Class SharedContext

java.lang.Object
com.illumon.iris.db.v2.sources.chunk.SharedContext
All Implemented Interfaces:
Context, ResettableContext, SafeCloseable, AutoCloseable

public class SharedContext
extends Object
implements ResettableContext

ResettableContext used as a holder for other ResettableContexts that may be shared across components.

This serves as a place to cache re-usable computations or resources, but must be reset() for every step of an operation (usually a chunk of ordered keys).

For example, ReadOnlyRedirectedColumnSources that share the same RedirectionIndex cache a chunk of redirections for the most recent chunk of ordered keys they have been handed.

It's important that "nested" usage follows the convention of creating a new instance and passing that instance to context creation methods. Said nested instance should be (or be attached to) an entry in the parent context, and reset/closed when said entry is. It should always be safe to skip nested SharedContext creation if all sources that may be using a given instance will be passed the same ordered keys.