Class SegmentId
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.SegmentId
-
- All Implemented Interfaces:
Comparable<SegmentId>
public class SegmentId extends Object implements Comparable<SegmentId>
Segment identifier. There are two types of segments: data segments, and bulk segments. Data segments have a header and may reference other segments; bulk segments do not.
-
-
Constructor Summary
Constructors Constructor Description SegmentId(@NotNull SegmentStore store, long msb, long lsb)Create a new segment id without access tracking.SegmentId(@NotNull SegmentStore store, long msb, long lsb, @NotNull Runnable onAccess)Create a new segment id with access tracking.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description UUIDasUUID()intcompareTo(@NotNull SegmentId that)booleanequals(Object object)intestimateMemoryUsage()longgetCreationTime()@NotNull GCGenerationgetGcGeneration()Get the underlying segment's gc generation.longgetLeastSignificantBits()longgetMostSignificantBits()@NotNull SegmentgetSegment()Get the segment identified by this instance.inthashCode()booleanisBulkSegmentId()Checks whether this is a bulk segment identifier.booleanisDataSegmentId()Checks whether this is a data segment identifier.static booleanisDataSegmentId(long lsb)Checks whether this is a data segment identifier.voidreclaimed(@NotNull String gcInfo)Notify this id about the reclamation of its segment (e.g.booleansameStore(@NotNull SegmentStore store)Determine whether this instance belongs to the passedstoreStringtoString()
-
-
-
Field Detail
-
NULL
public static final SegmentId NULL
Anullsegment id not representing any segment.
-
-
Constructor Detail
-
SegmentId
public SegmentId(@NotNull @NotNull SegmentStore store, long msb, long lsb, @NotNull @NotNull Runnable onAccess)Create a new segment id with access tracking.- Parameters:
store- store this is belongs tomsb- most significant bits of this idlsb- least significant bits of this idonAccess- callback called whenever an underlying and locally memoised segment is accessed.
-
SegmentId
public SegmentId(@NotNull @NotNull SegmentStore store, long msb, long lsb)Create a new segment id without access tracking.- Parameters:
store- store this is belongs tomsb- most significant bits of this idlsb- least significant bits of this id
-
-
Method Detail
-
isDataSegmentId
public static boolean isDataSegmentId(long lsb)
Checks whether this is a data segment identifier.- Returns:
truefor a data segment,falseotherwise
-
isDataSegmentId
public boolean isDataSegmentId()
Checks whether this is a data segment identifier.- Returns:
truefor a data segment,falseotherwise
-
isBulkSegmentId
public boolean isBulkSegmentId()
Checks whether this is a bulk segment identifier.- Returns:
truefor a bulk segment,falseotherwise
-
getMostSignificantBits
public long getMostSignificantBits()
-
getLeastSignificantBits
public long getLeastSignificantBits()
-
getSegment
@NotNull public @NotNull Segment getSegment()
Get the segment identified by this instance. The segment is memoised in this instance'ssegmentfield.- Returns:
- the segment identified by this instance.
- See Also:
loaded(Segment),unloaded()
-
reclaimed
public void reclaimed(@NotNull @NotNull String gcInfo)Notify this id about the reclamation of its segment (e.g. by the garbage collector).- Parameters:
gcInfo- details about the reclamation. This information is logged along with theSegmentNotFoundExceptionwhen attempting to resolve the segment of this id.
-
sameStore
public boolean sameStore(@NotNull @NotNull SegmentStore store)Determine whether this instance belongs to the passedstore- Parameters:
store-- Returns:
trueiff this instance belongs tostore
-
getCreationTime
public long getCreationTime()
-
asUUID
public UUID asUUID()
- Returns:
- this segment id as UUID
-
getGcGeneration
@NotNull public @NotNull GCGeneration getGcGeneration()
Get the underlying segment's gc generation. Might cause the segment to get loaded if the generation info is missing- Returns:
- the segment's gc generation
-
compareTo
public int compareTo(@NotNull @NotNull SegmentId that)- Specified by:
compareToin interfaceComparable<SegmentId>
-
estimateMemoryUsage
public int estimateMemoryUsage()
-
-