Interface SegmentStore
-
- All Known Implementing Classes:
AbstractFileStore
,FileStore
,MemoryStore
,ReadOnlyFileStore
public interface SegmentStore
The backend storage interface used by the segment node store.
-
-
Field Summary
Fields Modifier and Type Field Description static SegmentStore
EMPTY_STORE
A store that is always empty and that cannot be written to.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
containsSegment(SegmentId id)
Checks whether the identified segment exists in this store.@NotNull Segment
readSegment(SegmentId segmentId)
Reads the identified segment from this store.void
writeSegment(SegmentId id, byte[] bytes, int offset, int length)
Writes the given segment to the segment store.
-
-
-
Field Detail
-
EMPTY_STORE
static final SegmentStore EMPTY_STORE
A store that is always empty and that cannot be written to.
-
-
Method Detail
-
containsSegment
boolean containsSegment(SegmentId id)
Checks whether the identified segment exists in this store.- Parameters:
id
- segment identifier- Returns:
true
if the segment exists,false
otherwise
-
readSegment
@NotNull @NotNull Segment readSegment(SegmentId segmentId)
Reads the identified segment from this store.- Parameters:
segmentId
- segment identifier- Returns:
- identified segment, or a
SegmentNotFoundException
thrown if not found
-
writeSegment
void writeSegment(SegmentId id, byte[] bytes, int offset, int length) throws IOException
Writes the given segment to the segment store.- Parameters:
id
- segment identifierbytes
- byte buffer that contains the raw contents of the segmentoffset
- start offset within the byte bufferlength
- length of the segment- Throws:
IOException
-
-