/** * Initialize a new HBaseFijiTableAnnotator for the given table. * * @param table the table served by this ColumnAnnotator. */ public HBaseFijiTableAnnotator( final HBaseFijiTable table ) { mTable = (HBaseFijiTable) table.retain(); mState = new AtomicReference<State>(State.OPEN); }
/** * Constructor for this AtomicFijiPutter. * * @param table The HBaseFijiTable to which this writer writes. * @throws IOException in case of an error. */ public HBaseAtomicFijiPutter(HBaseFijiTable table) throws IOException { mTable = table; mHTable = mTable.openHTableConnection(); mLayoutConsumerRegistration = mTable.registerLayoutConsumer(new InnerLayoutUpdater()); Preconditions.checkState(mWriterLayoutCapsule != null, "AtomicFijiPutter for table: %s failed to initialize.", mTable.getURI()); // Retain the table only when everything succeeds. table.retain(); final State oldState = mState.getAndSet(State.OPEN); Preconditions.checkState(oldState == State.UNINITIALIZED, "Cannot open AtomicFijiPutter instance in state %s.", oldState); }
/** * Creates a non-buffered fiji table writer that sends modifications directly to Fiji. * * @param table A fiji table. * @throws IOException on I/O error. */ public HBaseFijiTableWriter(HBaseFijiTable table) throws IOException { mTable = table; mLayoutConsumerRegistration = mTable.registerLayoutConsumer(new InnerLayoutUpdater()); Preconditions.checkState(mWriterLayoutCapsule != null, "FijiTableWriter for table: %s failed to initialize.", mTable.getURI()); mHTable = table.openHTableConnection(); SchemaPlatformBridge.get().setAutoFlush(mHTable, true); // Retain the table only when everything succeeds. mTable.retain(); final State oldState = mState.getAndSet(State.OPEN); Preconditions.checkState(oldState == State.UNINITIALIZED, "Cannot open FijiTableWriter instance in state %s.", oldState); }
/** * Open a table reader whose behavior is customized by overriding CellSpecs. * * @param table Fiji table from which this reader will read. * @param cellSpecOverrides specifications of overriding read behaviors. * @throws IOException in case of an error opening the reader. */ private HBaseFijiTableReader( final HBaseFijiTable table, final Map<FijiColumnName, CellSpec> cellSpecOverrides ) throws IOException { mTable = table; mCellSpecOverrides = cellSpecOverrides; mOnDecoderCacheMiss = FijiTableReaderBuilder.DEFAULT_CACHE_MISS; mOverrides = null; mAlternatives = null; mLayoutConsumerRegistration = mTable.registerLayoutConsumer(new InnerLayoutUpdater()); Preconditions.checkState(mReaderLayoutCapsule != null, "FijiTableReader for table: %s failed to initialize.", mTable.getURI()); // Retain the table only when everything succeeds. mTable.retain(); final State oldState = mState.getAndSet(State.OPEN); Preconditions.checkState(oldState == State.UNINITIALIZED, "Cannot open FijiTableReader instance in state %s.", oldState); ResourceTracker.get().registerResource(this); }
/** * Initializes a qualifier pager. * * @param entityId The entityId of the row. * @param dataRequest The requested data. * @param table The Fiji table that this row belongs to. * @param family Iterate through the qualifiers from this map-type family. * @throws FijiColumnPagingNotEnabledException If paging is not enabled for the specified family. */ public HBaseQualifierPager( EntityId entityId, FijiDataRequest dataRequest, HBaseFijiTable table, FijiColumnName family) throws FijiColumnPagingNotEnabledException { Preconditions.checkArgument(!family.isFullyQualified(), "Must use HBaseQualifierPager on a map-type family, but got '{}'.", family); mFamily = family; mDataRequest = dataRequest; mColumnRequest = mDataRequest.getColumn(family.getFamily(), null); if (!mColumnRequest.isPagingEnabled()) { throw new FijiColumnPagingNotEnabledException( String.format("Paging is not enabled for column [%s].", family)); } mEntityId = entityId; mTable = table; mHasNext = true; // there might be no page to read, but we don't know until we issue an RPC // Only retain the table if everything else ran fine: mTable.retain(); }
mTable.retain(); final State oldState = mState.getAndSet(State.OPEN); Preconditions.checkState(oldState == State.UNINITIALIZED,
/** * Creates a buffered fiji table writer that stores modifications to be sent on command * or when the buffer overflows. * * @param table A fiji table. * @throws FijiTableNotFoundException in case of an invalid table parameter * @throws IOException in case of IO errors. */ public HBaseFijiBufferedWriter(HBaseFijiTable table) throws IOException { mTable = table; try { mHTable = mTable.openHTableConnection(); } catch (TableNotFoundException e) { throw new FijiTableNotFoundException(table.getURI()); } mLayoutConsumerRegistration = mTable.registerLayoutConsumer(new InnerLayoutUpdater()); Preconditions.checkState(mWriterLayoutCapsule != null, "HBaseFijiBufferedWriter for table: %s failed to initialize.", mTable.getURI()); SchemaPlatformBridge.get().setAutoFlush(mHTable, false); // Retain the table only after everything else succeeded: mTable.retain(); synchronized (mInternalLock) { Preconditions.checkState(mState == State.UNINITIALIZED, "Cannot open HBaseFijiBufferedWriter instance in state %s.", mState); mState = State.OPEN; } ResourceTracker.get().registerResource(this); }
mTable.retain(); ResourceTracker.get().registerResource(this);