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 aCloseable
that decrements the reference count when closed.QueryableIndex
asQueryableIndex()
StorageAdapter
asStorageAdapter()
void
close()
org.joda.time.Interval
getDataInterval()
SegmentId
getId()
-
-
-
Constructor Detail
-
WrappedSegmentReference
public WrappedSegmentReference(SegmentReference delegate, Function<StorageAdapter,StorageAdapter> storageAdapterWrapperFunction)
-
-
Method Detail
-
acquireReferences
public Optional<Closeable> acquireReferences()
Description copied from interface:ReferenceCountedObject
This method is expected to increment a reference count and provide aCloseable
that 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 theCloseable
it creates to throw exceptions. For callers: if this method returns non-empty, IT MUST BE CLOSED, else reference counts can potentially leak.- Specified by:
acquireReferences
in interfaceReferenceCountedObject
-
getDataInterval
public org.joda.time.Interval getDataInterval()
- Specified by:
getDataInterval
in interfaceSegment
-
asQueryableIndex
@Nullable public QueryableIndex asQueryableIndex()
- Specified by:
asQueryableIndex
in interfaceSegment
-
asStorageAdapter
public StorageAdapter asStorageAdapter()
- Specified by:
asStorageAdapter
in interfaceSegment
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-