Class RestrictedSegment
- All Implemented Interfaces:
Closeable,AutoCloseable,Segment
Segment wrapper with a Policy restriction that is automatically enforced.
The policy seamlessly governs queries on the wrapped segment, ensuring compliance for supported interfaces. For
example, as(Class) with CursorFactory returns a policy-enforced RestrictedCursorFactory.
Direct access to the policy or the underlying Segment (the delegate) is not allowed.
However, a backdoor is available via as(BypassRestrictedSegment.class), allowing access to
a BypassRestrictedSegment instance, which provides flexibility on policy enforcement.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TRequest an implementation of a particular interface.voidclose()org.joda.time.IntervalDeveloper friendly string suitable to use in internal error messages and provide some additional information about what kind of segment was involved in a problemgetId()Returns theSegmentIdof this segment, if it is backed by a real table, otherwise returns null.booleanvoidvalidateOrElseThrow(PolicyEnforcer policyEnforcer) Validates if the segment complies with the policy restrictions on tables.
-
Field Details
-
delegate
-
policy
-
-
Constructor Details
-
RestrictedSegment
-
-
Method Details
-
getId
Description copied from interface:SegmentReturns theSegmentIdof this segment, if it is backed by a real table, otherwise returns null. -
getDataInterval
public org.joda.time.Interval getDataInterval()- Specified by:
getDataIntervalin interfaceSegment
-
as
Description copied from interface:SegmentRequest an implementation of a particular interface.All implementations of this method should be able to provide a
CursorFactory. Other interfaces are only expected to be requested by callers that have specific knowledge of extra features provided by specific segment types. For example, an extension might provide a custom Segment type that can offer both CursorFactory and some new interface. That extension can also offer a Query that uses that new interface.Implementations which accept classes other than known built-in interfaces such as
CursorFactoryare limited to using those classes within the extension. This means that one extension cannot rely on the `Segment.as` behavior of another extension.- Specified by:
asin interfaceSegment- Type Parameters:
T- desired interface- Parameters:
clazz- desired interface- Returns:
- instance of clazz, or null if the interface is not supported by this segment, one of the following:
-
CursorFactory, to make cursors to run queries. Never null. -
QueryableIndex, index object, if this is a memory-mapped regular segment. -
IndexedTable, table object, if this is a joinable indexed table. -
TimeBoundaryInspector, inspector for min/max timestamps, if supported by this segment. -
PhysicalSegmentInspector, inspector for physical segment details, if supported by this segment. -
MaxIngestedEventTimeInspector, inspector forDataSourceMetadataResultValue.getMaxIngestedEventTime() -
TopNOptimizationInspector, inspector containing information for topN specific optimizations -
CloseableShapeshifter, stepping stone toRowsAndColumns. -
BypassRestrictedSegment, a policy-aware segment, converted from a policy-enforced segment.
-
-
validateOrElseThrow
Description copied from interface:SegmentValidates if the segment complies with the policy restrictions on tables.This should be called right before the segment is about to be processed by the query stack, and after
ExecutionVertex.createSegmentMapFunction(PolicyEnforcer).- Specified by:
validateOrElseThrowin interfaceSegment
-
isTombstone
public boolean isTombstone()- Specified by:
isTombstonein interfaceSegment
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getDebugString
Description copied from interface:SegmentDeveloper friendly string suitable to use in internal error messages and provide some additional information about what kind of segment was involved in a problem- Specified by:
getDebugStringin interfaceSegment
-