Package io.deephaven.engine.page
Class PagingContextHolder
java.lang.Object
io.deephaven.engine.page.PagingContextHolder
- All Implemented Interfaces:
ChunkSource.FillContext,Context,SafeCloseable,AutoCloseable
ChunkSource.FillContext implementation for use by PagingChunkSource implementations. This is
basically a re-usable box around an inner context object, filled with whatever the most recently used
Page chose to store.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionPagingContextHolder(int chunkCapacity, @Nullable SharedContext sharedContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Release any resources associated with this context.intGet the chunk capacity this holder was created with.<T extends Context>
TGet the inner context value set bysetInnerContext(Context)and cast it to the templated type.Get theSharedContextthis holder was created with.voidsetInnerContext(@Nullable Context newInnerContext) Set the inner context object for use by the current region.booleanReturns true if this Context contains internal state that limits its capacity to the originally requested capacity.<T extends Context>
TupdateInnerContext(@NotNull PagingContextHolder.Updater updater) Update the inner context value using the provided updater.
-
Constructor Details
-
Method Details
-
supportsUnboundedFill
public boolean supportsUnboundedFill()Returns true if this Context contains internal state that limits its capacity to the originally requested capacity. If false is returned, then fillChunk operations may be arbitrarily large.- Specified by:
supportsUnboundedFillin interfaceChunkSource.FillContext- Returns:
- if this context has a limited capacity
- ImplNote:
- This implementation always returns
true, as thePageStorefill implementation follows an append pattern over multiplepageswhen necessary, and all known inner context implementations trivially support unbounded fill. We thus make this a requirement for future inner context implementations, either naturally or via a slicing/looping pattern.
-
getChunkCapacity
public int getChunkCapacity()Get the chunk capacity this holder was created with.- Returns:
- The chunk capacity
-
getInnerContext
Get the inner context value set bysetInnerContext(Context)and cast it to the templated type.- Type Parameters:
T- The desired result type- Returns:
- The inner context value
-
setInnerContext
Set the inner context object for use by the current region. The previous inner context will beclosed.- Parameters:
newInnerContext- The new context object
-
updateInnerContext
public <T extends Context> T updateInnerContext(@NotNull @NotNull PagingContextHolder.Updater updater) Update the inner context value using the provided updater.- Type Parameters:
T- The desired result type- Parameters:
updater- ThePagingContextHolder.Updaterto use- Returns:
- The result of
updater
-
close
public void close()Description copied from interface:ContextRelease any resources associated with this context. The context should not be used afterwards.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceContext- Specified by:
closein interfaceSafeCloseable
-