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
-
Constructor Summary
ConstructorDescriptionPagingContextHolder
(int chunkCapacity, @Nullable SharedContext sharedContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Release any resources associated with this context.int
Get 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 theSharedContext
this holder was created with.void
setInnerContext
(@Nullable Context newInnerContext) Set the inner context object for use by the current region.boolean
Returns 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:
supportsUnboundedFill
in interfaceChunkSource.FillContext
- Returns:
- if this context has a limited capacity
- ImplNote:
- This implementation always returns
true
, as thePageStore
fill implementation follows an append pattern over multiplepages
when 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.Updater
to use- Returns:
- The result of
updater
-
close
public void close()Description copied from interface:Context
Release any resources associated with this context. The context should not be used afterwards.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceContext
- Specified by:
close
in interfaceSafeCloseable
-