public class StreamLogFiles extends Object implements StreamLog, StreamLogWithRankedAddressSpace
Created by maithem on 10/28/16.
Modifier and Type | Class and Description |
---|---|
static class |
StreamLogFiles.Checksum |
Modifier and Type | Field and Description |
---|---|
static int |
METADATA_SIZE |
static int |
RECORDS_PER_LOG_FILE |
static int |
VERSION |
Constructor and Description |
---|
StreamLogFiles(ServerContext serverContext,
boolean noVerify)
Returns a file-based stream log object.
|
Modifier and Type | Method and Description |
---|---|
void |
append(List<LogData> range)
Append a range of consecutive entries ordered by their addresses.
|
void |
append(long address,
LogData entry)
Append an entry to the stream log.
|
void |
close()
Close the stream log.
|
void |
compact()
Remove all trimmed addresses from the StreamLog.
|
TailsResponse |
getAllTails()
Get global and all stream tails.
|
long |
getLogTail()
Get the global log tail.
|
StreamsAddressResponse |
getStreamsAddressSpace()
Get the address space for every stream.
|
TailsResponse |
getTails(List<UUID> streams)
Get the global tail and stream tails.
|
long |
getTrimMark()
Get the first untrimmed address in the address space.
|
void |
prefixTrim(long address)
Prefix trim the global log.
|
LogData |
read(long address)
Given an address, read the corresponding stream entry.
|
void |
reset()
TODO(Maithem) remove this method.
|
void |
sync(boolean force)
Sync the stream log file to secondary storage.
|
static void |
writeHeader(FileChannel fileChannel,
int version,
boolean verify)
Write the header for a Corfu log file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
assertAppendPermittedUnsafe
getOverwriteCauseForAddress
public static final int METADATA_SIZE
public static final int VERSION
public static final int RECORDS_PER_LOG_FILE
public StreamLogFiles(ServerContext serverContext, boolean noVerify)
serverContext
- Context object that provides server state such as epoch,
segment and start addressnoVerify
- Disable checksum if truepublic static void writeHeader(FileChannel fileChannel, int version, boolean verify) throws IOException
fileChannel
- The file channel to use.version
- The version number to append to the header.verify
- Checksum verify flagIOException
- I/O exceptionpublic long getLogTail()
StreamLog
getLogTail
in interface StreamLog
public TailsResponse getTails(List<UUID> streams)
StreamLog
public StreamsAddressResponse getStreamsAddressSpace()
StreamLog
getStreamsAddressSpace
in interface StreamLog
public TailsResponse getAllTails()
StreamLog
getAllTails
in interface StreamLog
public void prefixTrim(long address)
StreamLog
prefixTrim
in interface StreamLog
address
- address to trim the log up topublic void sync(boolean force) throws IOException
StreamLog
sync
in interface StreamLog
force
- force data to secondary storage if trueIOException
public void compact()
StreamLog
public long getTrimMark()
StreamLog
getTrimMark
in interface StreamLog
public void append(List<LogData> range)
StreamLog
public void append(long address, LogData entry)
StreamLog
public LogData read(long address)
StreamLog
public void close()
StreamLog
public void reset()
Resets the Stream log. Clears all data and resets the handlers. Usage: To heal a recovering node, we require to wipe off existing data.
Copyright © 2019 CorfuDB. All rights reserved.