Interface SegmentStore
-
- All Known Implementing Classes:
AbstractFileStore,FileStore,MemoryStore,ReadOnlyFileStore
public interface SegmentStoreThe backend storage interface used by the segment node store.
-
-
Field Summary
Fields Modifier and Type Field Description static SegmentStoreEMPTY_STOREA store that is always empty and that cannot be written to.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancontainsSegment(SegmentId id)Checks whether the identified segment exists in this store.@NotNull SegmentreadSegment(SegmentId segmentId)Reads the identified segment from this store.voidwriteSegment(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:
trueif the segment exists,falseotherwise
-
readSegment
@NotNull @NotNull Segment readSegment(SegmentId segmentId)
Reads the identified segment from this store.- Parameters:
segmentId- segment identifier- Returns:
- identified segment, or a
SegmentNotFoundExceptionthrown 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
-
-