/** * Interface to support the aborting of a given server or client. * <p> * This is used primarily for ZooKeeper usage when we could get an unexpected * and fatal exception, requiring an abort. * <p> * Implemented by the Master, RegionServer, and TableServers (client). */ @InterfaceAudience.LimitedPrivate({HBaseInterfaceAudience.COPROC, HBaseInterfaceAudience.PHOENIX}) @InterfaceStability.Evolving public interface Abortable { /** * Abort the server or client. * @param why Why we're aborting. * @param e Throwable that caused abort. Can be null. */ void abort(String why, Throwable e); /** * Check if the server or client was aborted. * @return true if the server or client was aborted, false otherwise */ boolean isAborted(); }
/** * Driver for hbase mapreduce jobs. Select which to run by passing name of job * to this main. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.TOOLS) @InterfaceStability.Stable public class Driver { private static ProgramDriver pgd = new ProgramDriver(); @VisibleForTesting static void setProgramDriver(ProgramDriver pgd0) { pgd = pgd0; } /** * @param args * @throws Throwable */ public static void main(String[] args) throws Throwable { pgd.addClass(RowCounter.NAME, RowCounter.class, "Count rows in HBase table"); ProgramDriver.class.getMethod("driver", new Class[] { String[].class }) .invoke(pgd, new Object[] { args }); } }
/** * Encoder/Decoder for Cell. * * <p>Like {@link org.apache.hadoop.hbase.io.encoding.DataBlockEncoder} * only Cell-based rather than KeyValue version 1 based and without presuming * an hfile context. Intent is an Interface that will work for hfile and rpc. */ @InterfaceAudience.LimitedPrivate({HBaseInterfaceAudience.COPROC, HBaseInterfaceAudience.PHOENIX}) public interface Codec { // TODO: interfacing with {@link org.apache.hadoop.hbase.io.encoding.DataBlockEncoder} /** * Call flush when done. Some encoders may not put anything on the stream until flush is called. * On flush, let go of any resources used by the encoder. */ interface Encoder extends CellOutputStream {} /** * Implementations should implicitly clean up any resources allocated when the * Decoder/CellScanner runs off the end of the cell block. Do this rather than require the user * call close explicitly. */ interface Decoder extends CellScanner {}; Decoder getDecoder(InputStream is); Encoder getEncoder(OutputStream os); }
/** * Convenience class that is used to make RowProcessorEndpoint invocations. * For example usage, refer TestRowProcessorEndpoint * */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) @InterfaceStability.Evolving public class RowProcessorClient { public static <S extends Message, T extends Message> ProcessRequest getRowProcessorPB(RowProcessor<S,T> r) throws IOException { final ProcessRequest.Builder requestBuilder = ProcessRequest.newBuilder(); requestBuilder.setRowProcessorClassName(r.getClass().getName()); S s = r.getRequestData(); if (s != null) { requestBuilder.setRowProcessorInitializerMessageName(s.getClass().getName()); requestBuilder.setRowProcessorInitializerMessage(s.toByteString()); } return requestBuilder.build(); } }
/** * Coprocessors implement this interface to observe and mediate bulk load operations. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) @InterfaceStability.Evolving public interface BulkLoadObserver extends Coprocessor { /** * Called as part of SecureBulkLoadEndpoint.prepareBulkLoad() RPC call. * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @throws IOException */ void prePrepareBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx, PrepareBulkLoadRequest request) throws IOException; /** * Called as part of SecureBulkLoadEndpoint.cleanupBulkLoad() RPC call. * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @throws IOException */ void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx, CleanupBulkLoadRequest request) throws IOException; }
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG) public class NoCacheFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletResponse httpRes = (HttpServletResponse) res; httpRes.setHeader("Cache-Control", "no-cache"); long now = System.currentTimeMillis(); httpRes.addDateHeader("Expires", now); httpRes.addDateHeader("Date", now); httpRes.addHeader("Pragma", "no-cache"); chain.doFilter(req, res); } @Override public void destroy() { } }
/** * Abstraction that allows different modules in RegionServer to update/get * the favored nodes information for regions. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) @InterfaceStability.Evolving public interface FavoredNodesForRegion { /** * Used to update the favored nodes mapping when required. * @param encodedRegionName * @param favoredNodes */ void updateRegionFavoredNodesMapping(String encodedRegionName, List<ServerName> favoredNodes); /** * Get the favored nodes mapping for this region. Used when the HDFS create API * is invoked to pass in favored nodes hints for new region files. * @param encodedRegionName * @return array containing the favored nodes' InetSocketAddresses */ InetSocketAddress[] getFavoredNodesForRegion(String encodedRegionName); }
/** * Using this Interface one can mark a Cell as timestamp changeable. <br> * Note : Server side Cell implementations in write path must implement this. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) public interface SettableTimestamp { /** * Sets with the given timestamp. * @param ts */ void setTimestamp(long ts) throws IOException; /** * Sets with the given timestamp. * @param ts buffer containing the timestamp value * @param tsOffset offset to the new timestamp */ void setTimestamp(byte[] ts, int tsOffset) throws IOException; }
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG) public class ClickjackingPreventionFilter implements Filter { private FilterConfig filterConfig; @Override public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletResponse httpRes = (HttpServletResponse) res; httpRes.addHeader("X-Frame-Options", filterConfig.getInitParameter("xframeoptions")); chain.doFilter(req, res); } @Override public void destroy() { } }
/** * Implementers are Stoppable. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) @InterfaceStability.Evolving public interface Stoppable { /** * Stop this service. * @param why Why we're stopping. */ void stop(String why); /** * @return True if {@link #stop(String)} has been closed. */ boolean isStopped(); }
/** * A Filter for WAL entries before being sent over to replication. Multiple * filters might be chained together using {@link ChainWALEntryFilter}. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.REPLICATION) public interface WALEntryFilter { /** * Applies the filter, possibly returning a different Entry instance. * If null is returned, the entry will be skipped. * @param entry Entry to filter * @return a (possibly modified) Entry to use. Returning null or an entry with * no cells will cause the entry to be skipped for replication. */ public Entry filter(Entry entry); }
/** * A {@link RegionSplitPolicy} that disables region splits. * This should be used with care, since it will disable automatic sharding. * Most of the time, using {@link ConstantSizeRegionSplitPolicy} with a * large region size (10GB, etc) is safer. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG) public class DisabledRegionSplitPolicy extends RegionSplitPolicy { @Override protected boolean shouldSplit() { return false; } }
/** * A factory class that constructs an {@link org.apache.hadoop.hbase.ipc.RpcScheduler}. */ @InterfaceAudience.LimitedPrivate({HBaseInterfaceAudience.COPROC, HBaseInterfaceAudience.PHOENIX}) @InterfaceStability.Evolving public interface RpcSchedulerFactory { /** * Constructs a {@link org.apache.hadoop.hbase.ipc.RpcScheduler}. */ RpcScheduler create(Configuration conf, PriorityFunction priority, Abortable server); @Deprecated RpcScheduler create(Configuration conf, PriorityFunction priority); }
/** * A base class WALEntryFilter implementations. Protects against changes in the interface signature. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.REPLICATION) public abstract class BaseWALEntryFilter implements WALEntryFilter { }
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) @InterfaceStability.Evolving public interface MasterCoprocessorEnvironment extends CoprocessorEnvironment { /** @return reference to the HMaster services */ MasterServices getMasterServices(); }
/** * Coprocessor endpoints registered once per server and providing protobuf services should implement * this interface and return the {@link Service} instance via {@link #getService()}. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) @InterfaceStability.Evolving public interface SingletonCoprocessorService { Service getService(); }
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) @InterfaceStability.Evolving public interface RegionCoprocessorEnvironment extends CoprocessorEnvironment { /** @return the region associated with this coprocessor */ Region getRegion(); /** @return region information for the region this coprocessor is running on */ HRegionInfo getRegionInfo(); /** @return reference to the region server services */ RegionServerServices getRegionServerServices(); /** @return shared data between all instances of this coprocessor */ ConcurrentMap<String, Object> getSharedData(); }
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) @InterfaceStability.Evolving public interface WALCoprocessorEnvironment extends CoprocessorEnvironment { /** @return reference to the region server's WAL */ WAL getWAL(); }
/** * Coprocessor endpoints providing protobuf services should implement this * interface and return the {@link Service} instance via {@link #getService()}. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) @InterfaceStability.Evolving public interface CoprocessorService { Service getService(); }
/** * Using this Interface one can mark a Cell as Sequence stampable. <br> * Note : Make sure to make Cell implementation of this type in server side. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) public interface SettableSequenceId { /** * Sets with the given seqId. * @param seqId */ void setSequenceId(long seqId) throws IOException; }