Class SegmentId
java.lang.Object
org.apache.jackrabbit.oak.segment.SegmentId
- All Implemented Interfaces:
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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSegmentId
(@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
Modifier and TypeMethodDescriptionasUUID()
int
boolean
int
long
@NotNull GCGeneration
Get the underlying segment's gc generation.long
long
@NotNull Segment
Get the segment identified by this instance.int
hashCode()
boolean
Checks whether this is a bulk segment identifier.boolean
Checks whether this is a data segment identifier.static boolean
isDataSegmentId
(long lsb) Checks whether this is a data segment identifier.void
Notify this id about the reclamation of its segment (e.g.boolean
sameStore
(@NotNull SegmentStore store) Determine whether this instance belongs to the passedstore
toString()
-
Field Details
-
NULL
Anull
segment id not representing any segment.
-
-
Constructor Details
-
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
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 Details
-
isDataSegmentId
public static boolean isDataSegmentId(long lsb) Checks whether this is a data segment identifier.- Returns:
true
for a data segment,false
otherwise
-
isDataSegmentId
public boolean isDataSegmentId()Checks whether this is a data segment identifier.- Returns:
true
for a data segment,false
otherwise
-
isBulkSegmentId
public boolean isBulkSegmentId()Checks whether this is a bulk segment identifier.- Returns:
true
for a bulk segment,false
otherwise
-
getMostSignificantBits
public long getMostSignificantBits() -
getLeastSignificantBits
public long getLeastSignificantBits() -
getSegment
Get the segment identified by this instance. The segment is memoised in this instance'ssegment
field.- Returns:
- the segment identified by this instance.
- See Also:
-
loaded(Segment)
unloaded()
-
reclaimed
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 theSegmentNotFoundException
when attempting to resolve the segment of this id.
-
sameStore
Determine whether this instance belongs to the passedstore
- Parameters:
store
-- Returns:
true
iff this instance belongs tostore
-
getCreationTime
public long getCreationTime() -
asUUID
- Returns:
- this segment id as UUID
-
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
- Specified by:
compareTo
in interfaceComparable<SegmentId>
-
toString
-
equals
-
hashCode
public int hashCode() -
estimateMemoryUsage
public int estimateMemoryUsage()
-