Package org.apache.druid.segment
Class WrappedSegmentReference
- java.lang.Object
-
- org.apache.druid.segment.WrappedSegmentReference
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ReferenceCountedObject,Segment,SegmentReference
public class WrappedSegmentReference extends Object implements SegmentReference
This class is used as a wrapper for other classes that just want to modify the storage adapter for a datasource. Examples include:UnnestDataSource,FilteredDataSource
-
-
Constructor Summary
Constructors Constructor Description WrappedSegmentReference(SegmentReference delegate, Function<StorageAdapter,StorageAdapter> storageAdapterWrapperFunction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Closeable>acquireReferences()This method is expected to increment a reference count and provide aCloseablethat decrements the reference count when closed.QueryableIndexasQueryableIndex()StorageAdapterasStorageAdapter()voidclose()org.joda.time.IntervalgetDataInterval()SegmentIdgetId()
-
-
-
Constructor Detail
-
WrappedSegmentReference
public WrappedSegmentReference(SegmentReference delegate, Function<StorageAdapter,StorageAdapter> storageAdapterWrapperFunction)
-
-
Method Detail
-
acquireReferences
public Optional<Closeable> acquireReferences()
Description copied from interface:ReferenceCountedObjectThis method is expected to increment a reference count and provide aCloseablethat decrements the reference count when closed. This is likely just a wrapper aroundReferenceCountingCloseableObject.incrementReferenceAndDecrementOnceCloseable(), but may also include any other associated references which should be incremented when this method is called, and decremented/released by the closeable. IMPORTANT NOTE: to fulfill the contract of this method, implementors must return a closeable to indicate that the reference can be acquired, even if there is nothing to close. Implementors should avoid allowing this method or theCloseableit creates to throw exceptions. For callers: if this method returns non-empty, IT MUST BE CLOSED, else reference counts can potentially leak.- Specified by:
acquireReferencesin interfaceReferenceCountedObject
-
getDataInterval
public org.joda.time.Interval getDataInterval()
- Specified by:
getDataIntervalin interfaceSegment
-
asQueryableIndex
@Nullable public QueryableIndex asQueryableIndex()
- Specified by:
asQueryableIndexin interfaceSegment
-
asStorageAdapter
public StorageAdapter asStorageAdapter()
- Specified by:
asStorageAdapterin interfaceSegment
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-