public class FsLogSegment extends Object
| Modifier and Type | Field and Description |
|---|---|
static short |
END_OF_SEGMENT |
protected FileChannel |
fileChannel |
protected String |
fileName |
static short |
INSUFFICIENT_CAPACITY |
static short |
INVALID_ADDR |
static org.slf4j.Logger |
LOG |
protected MappedByteBuffer |
mappedBuffer |
protected org.agrona.concurrent.UnsafeBuffer |
metadataSection |
static short |
NO_DATA |
protected Rater |
rater |
protected short |
state |
static short |
STATE_ACTIVE |
static short |
STATE_FILLED |
| Constructor and Description |
|---|
FsLogSegment(String fileName) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allocate(int segmentId,
int segmentSize) |
int |
append(ByteBuffer block) |
void |
closeSegment() |
void |
delete() |
void |
flush() |
int |
getCapacity() |
String |
getFileName() |
int |
getSegmentId() |
int |
getSize() |
int |
getSizeVolatile() |
boolean |
isActive() |
boolean |
isConsistent() |
boolean |
isFilled() |
boolean |
openSegment(boolean create) |
int |
readBytes(ByteBuffer readBuffer,
int fileOffset)
Reads a sequence of bytes into the provided read buffer.
|
protected void |
setCapacity(int capacity) |
void |
setFilled() |
protected void |
setSegmentId(int segmentId) |
protected void |
setSizeOrdered(int tail) |
protected void |
setSizeVolatile(int tail) |
void |
truncateUncommittedData() |
public static final org.slf4j.Logger LOG
public static final short INVALID_ADDR
public static final short NO_DATA
public static final short END_OF_SEGMENT
public static final short INSUFFICIENT_CAPACITY
public static final short STATE_ACTIVE
public static final short STATE_FILLED
protected volatile short state
protected final String fileName
protected FileChannel fileChannel
protected org.agrona.concurrent.UnsafeBuffer metadataSection
protected MappedByteBuffer mappedBuffer
protected final Rater rater
public FsLogSegment(String fileName)
public boolean openSegment(boolean create)
public void closeSegment()
public void delete()
public String getFileName()
public int getSegmentId()
protected void setSegmentId(int segmentId)
public int getSize()
public int getSizeVolatile()
protected void setSizeOrdered(int tail)
protected void setSizeVolatile(int tail)
public int getCapacity()
protected void setCapacity(int capacity)
public boolean isFilled()
public boolean isActive()
public boolean allocate(int segmentId,
int segmentSize)
public int append(ByteBuffer block)
block - public void flush()
throws IOException
IOExceptionpublic int readBytes(ByteBuffer readBuffer, int fileOffset)
NO_DATA in case no data is available
END_OF_SEGMENT in case the end of the segment is reached
readBuffer - the buffer to read data intofileOffset - the offset in the file to read frompublic void setFilled()
public boolean isConsistent()
throws IOException
IOExceptionpublic void truncateUncommittedData()
throws IOException
IOExceptionCopyright © 2017–2018 camunda services GmbH. All rights reserved.