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 UUID
asUUID()
int
compareTo(@NotNull SegmentId that)
boolean
equals(Object object)
int
estimateMemoryUsage()
long
getCreationTime()
@NotNull GCGeneration
getGcGeneration()
Get the underlying segment's gc generation.long
getLeastSignificantBits()
long
getMostSignificantBits()
@NotNull Segment
getSegment()
Get the segment identified by this instance.int
hashCode()
boolean
isBulkSegmentId()
Checks whether this is a bulk segment identifier.boolean
isDataSegmentId()
Checks whether this is a data segment identifier.static boolean
isDataSegmentId(long lsb)
Checks whether this is a data segment identifier.void
reclaimed(@NotNull String gcInfo)
Notify this id about the reclamation of its segment (e.g.boolean
sameStore(@NotNull SegmentStore store)
Determine whether this instance belongs to the passedstore
String
toString()
-
-
-
Field Detail
-
NULL
public static final SegmentId NULL
Anull
segment 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:
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
@NotNull public @NotNull Segment 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
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 theSegmentNotFoundException
when 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:
true
iff 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:
compareTo
in interfaceComparable<SegmentId>
-
estimateMemoryUsage
public int estimateMemoryUsage()
-
-