public interface SegmentArchiveWriter
Caller will use the methods modifying the archive in the following order:
writeBinaryReferences(byte[])
writeGraph(byte[])
(optionally)close()
Before the close()
, all the non-modifying methods
(eg. readSegment(long, long)
, getLength()
} can be invoked at
any time. They should be thread safe.
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the archive.
|
boolean |
containsSegment(long msb,
long lsb)
Check if the segment exists.
|
void |
flush()
Flush all the data to the storage.
|
int |
getEntryCount()
Get the number of entries currently contained in the archive.
|
long |
getLength()
Get the current length of the archive.
|
@NotNull String |
getName()
Get the name of the archive.
|
boolean |
isCreated()
Check if the archive has been created (eg. something has been written).
|
@Nullable org.apache.jackrabbit.oak.commons.Buffer |
readSegment(long msb,
long lsb)
Read the segment.
|
void |
writeBinaryReferences(@NotNull byte[] data)
Write the binary references data.
|
void |
writeGraph(@NotNull byte[] data)
Write the graph data.
|
void |
writeSegment(long msb,
long lsb,
@NotNull byte[] data,
int offset,
int size,
int generation,
int fullGeneration,
boolean isCompacted)
Write the new segment to the archive.
|
@NotNull void writeSegment(long msb, long lsb, @NotNull @NotNull byte[] data, int offset, int size, int generation, int fullGeneration, boolean isCompacted) throws IOException
msb
- the most significant bits of the identifier of the segmentlsb
- the least significant bits of the identifier of the segmentdata
- the data.offset
- the start offset in the data.size
- the number of bytes to write.generation
- the segment generation, see SegmentArchiveEntry.getGeneration()
fullGeneration
- the segment full generation, see SegmentArchiveEntry.getFullGeneration()
isCompacted
- the segment compaction property, see SegmentArchiveEntry.isCompacted()
IOException
@Nullable @Nullable org.apache.jackrabbit.oak.commons.Buffer readSegment(long msb, long lsb) throws IOException
msb
- the most significant bits of the identifier of the segmentlsb
- the least significant bits of the identifier of the segmentIOException
boolean containsSegment(long msb, long lsb)
msb
- the most significant bits of the identifier of the segmentlsb
- the least significant bits of the identifier of the segmentvoid writeGraph(@NotNull @NotNull byte[] data) throws IOException
data
- serialized segment graph dataIOException
void writeBinaryReferences(@NotNull @NotNull byte[] data) throws IOException
data
- serialized binary references dataIOException
long getLength()
int getEntryCount()
void close() throws IOException
IOException
boolean isCreated()
void flush() throws IOException
writeSegment(long, long, byte[], int, int, int, int, boolean)
should be actually saved to the storage.IOException
@NotNull @NotNull String getName()
Copyright © 2012–2020 The Apache Software Foundation. All rights reserved.