public class SegmentTarWriter extends java.lang.Object implements SegmentArchiveWriter
Constructor and Description |
---|
SegmentTarWriter(java.io.File file,
FileStoreMonitor monitor,
IOMonitor ioMonitor) |
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.
|
java.lang.String |
getName()
Get the name of the archive.
|
boolean |
isCreated()
Check if the archive has been created (eg.
|
Buffer |
readSegment(long msb,
long lsb)
Read the segment.
|
void |
writeBinaryReferences(byte[] data)
Write the binary references data.
|
void |
writeGraph(byte[] data)
Write the graph data.
|
void |
writeSegment(long msb,
long lsb,
byte[] data,
int offset,
int size,
int generation,
int fullGeneration,
boolean compacted)
Write the new segment to the archive.
|
public SegmentTarWriter(java.io.File file, FileStoreMonitor monitor, IOMonitor ioMonitor)
public void writeSegment(long msb, long lsb, byte[] data, int offset, int size, int generation, int fullGeneration, boolean compacted) throws java.io.IOException
SegmentArchiveWriter
writeSegment
in interface SegmentArchiveWriter
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()
compacted
- the segment compaction property, see SegmentArchiveEntry.isCompacted()
java.io.IOException
public Buffer readSegment(long msb, long lsb) throws java.io.IOException
SegmentArchiveWriter
readSegment
in interface SegmentArchiveWriter
msb
- the most significant bits of the identifier of the segmentlsb
- the least significant bits of the identifier of the segmentjava.io.IOException
public boolean containsSegment(long msb, long lsb)
SegmentArchiveWriter
containsSegment
in interface SegmentArchiveWriter
msb
- the most significant bits of the identifier of the segmentlsb
- the least significant bits of the identifier of the segmentpublic void writeGraph(byte[] data) throws java.io.IOException
SegmentArchiveWriter
writeGraph
in interface SegmentArchiveWriter
data
- serialized segment graph datajava.io.IOException
public void writeBinaryReferences(byte[] data) throws java.io.IOException
SegmentArchiveWriter
writeBinaryReferences
in interface SegmentArchiveWriter
data
- serialized binary references datajava.io.IOException
public long getLength()
SegmentArchiveWriter
getLength
in interface SegmentArchiveWriter
public int getEntryCount()
SegmentArchiveWriter
getEntryCount
in interface SegmentArchiveWriter
public void close() throws java.io.IOException
SegmentArchiveWriter
close
in interface SegmentArchiveWriter
java.io.IOException
public boolean isCreated()
SegmentArchiveWriter
isCreated
in interface SegmentArchiveWriter
public void flush() throws java.io.IOException
SegmentArchiveWriter
SegmentArchiveWriter.writeSegment(long, long, byte[], int, int, int, int, boolean)
should be actually saved to the storage.flush
in interface SegmentArchiveWriter
java.io.IOException
public java.lang.String getName()
SegmentArchiveWriter
getName
in interface SegmentArchiveWriter
Copyright © 2012–2022 The Apache Software Foundation. All rights reserved.