Skip to content

Commit

Permalink
javadoc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cecemei committed Jan 10, 2025
1 parent 0443967 commit 530fcba
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
import javax.annotation.Nullable;

/**
* A factory class for creating {@code Cursor} instances with strict adherence to {@link Policy} restrictions.
* A factory class for creating {@code Cursor} instances with strict adherence to {@link Policy} restrictions. Created
* by {@link RestrictedSegment#asCursorFactory()}, and applies policies transparently.
* <p>
* The {@code CursorFactory} simplifies the process of initializing and retrieving {@code Cursor} objects while ensuring
* that any cursor created complies with the {@link Policy} restrictions.
* <p>
* Policy Enforcement in {@link #makeCursorHolder}:
* Policy enforcement in {@link #makeCursorHolder}:
* <ul>
* <li>Row-level restrictions are enforced by adding filters to {@link CursorBuildSpec}, which is then passed to
* delegate for execution. This ensures that only relevant data are accessible by the client.
Expand Down
28 changes: 14 additions & 14 deletions processing/src/main/java/org/apache/druid/segment/Segment.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,31 @@ default StorageAdapter asStorageAdapter()

/**
* Request an implementation of a particular interface.
*
* <p>
* If the passed-in interface is {@link QueryableIndex} or {@link CursorFactory}, then this method behaves
* identically to {@link #asQueryableIndex()} or {@link #asCursorFactory()}. 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
* StorageAdapter and some new interface. That extension can also offer a Query that uses that new interface.
*
* <p>
* Implementations which accept classes other than {@link QueryableIndex} or {@link CursorFactory} are limited
* to using those classes within the extension. This means that one extension cannot rely on the `Segment.as`
* behavior of another extension.
*
* @param clazz desired interface
* @param <T> desired interface
*
* @return instance of clazz, or null if the interface is not supported by this segment
*
* @see CursorFactory to make cursors to run queries. Never null.
* @see QueryableIndex index object, if this is a memory-mapped regular segment.
* @see IndexedTable table object, if this is a joinable indexed table.
* @see TimeBoundaryInspector inspector for min/max timestamps, if supported by this segment.
* @see PhysicalSegmentInspector inspector for physical segment details, if supported by this segment.
* @see MaxIngestedEventTimeInspector inspector for {@link DataSourceMetadataResultValue#getMaxIngestedEventTime()}
* @see TopNOptimizationInspector inspector containing information for topN specific optimizations
* @see CloseableShapeshifter stepping stone to {@link org.apache.druid.query.rowsandcols.RowsAndColumns}.
*
* @return instance of clazz, or null if the interface is not supported by this segment, one of the following:
* <ul>
* <li> {@link CursorFactory}, to make cursors to run queries. Never null.</li>
* <li> {@link QueryableIndex}, index object, if this is a memory-mapped regular segment.
* <li> {@link IndexedTable}, table object, if this is a joinable indexed table.
* <li> {@link TimeBoundaryInspector}, inspector for min/max timestamps, if supported by this segment.
* <li> {@link PhysicalSegmentInspector}, inspector for physical segment details, if supported by this segment.
* <li> {@link MaxIngestedEventTimeInspector}, inspector for {@link DataSourceMetadataResultValue#getMaxIngestedEventTime()}
* <li> {@link TopNOptimizationInspector}, inspector containing information for topN specific optimizations
* <li> {@link CloseableShapeshifter}, stepping stone to {@link org.apache.druid.query.rowsandcols.RowsAndColumns}.
* <li> {@link BypassRestrictedSegment}, a policy-aware segment, converted from a policy-enforced segment.
* </ul>
*/
@SuppressWarnings({"unused", "unchecked"})
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ public String getErrorMessage()
}
}

/**
* Returns a map of table and {@link Policy} restriction on the table. Empty value means the table doesn't have any
* restriction.
*/
public Map<String, Optional<Policy>> getPolicyMap()
{
return policyRestrictions;
Expand Down

0 comments on commit 530fcba

Please sign in to comment.