gbr/disk_log/core
gbr/disk_log/core: Core implementation for Erlang’s disk_log wrapper.
This module handles the FFI (Foreign Function Interface) calls to Erlang’s
disk_log and provides the opaque types for logs and options.
It is not intended to be used directly by most applications. Use the
gbr/disk_log facade instead for a more idiomatic experience and to
enable pattern matching on public types.
Types
Data structure for reading chunks of terms from the log.
pub type ChunkData {
Eof
Chunk(continuation: Continuation, terms: List(BitArray))
}
Constructors
-
EofEnd of log file reached.
-
Chunk(continuation: Continuation, terms: List(BitArray))A chunk of log terms and the next continuation.
Opaque continuation used for reading chunks from the log.
pub type Continuation {
Continuation(dynamic.Dynamic)
}
Constructors
-
Continuation(dynamic.Dynamic)
Error type for disk log operations.
pub type DiskLogError {
DiskLogError(reason: String)
}
Constructors
-
DiskLogError(reason: String)A general error with a descriptive reason.
Opaque handle to a disk log process.
- name: Atom disk log instance.
https://www.erlang.org/doc/apps/kernel/disk_log.html
pub opaque type LogDisk
Possible formats for the log file data.
pub type LogFormat {
Internal
External
}
Constructors
-
InternalInternal Erlang binary format.
-
ExternalExternal raw binary format.
The access mode for the log file.
pub type LogMode {
ReadOnly
ReadWrite
}
Constructors
-
ReadOnlyOpen the log in read-only mode.
-
ReadWriteOpen the log in read-write mode.
Opaque configuration options for a disk log.
https://www.erlang.org/doc/apps/kernel/disk_log.html#open/1
pub opaque type LogOpts
Strategies for repairing a disk log.
pub type LogRepair {
Enable
Truncate
Disabled
}
Constructors
-
EnableAttempt to repair the log if corrupted.
-
TruncateTruncate the log if corruption is found.
-
DisabledDo not attempt repair.
Maximum allowed size for a disk log.
pub type LogSize {
Infinity
MaxBytes(Int)
WrapSize(max_bytes: Int, max_files: Int)
}
Constructors
-
InfinityNo size limit.
-
MaxBytes(Int)Limit by total bytes for a single file.
-
WrapSize(max_bytes: Int, max_files: Int)Limit by total bytes and total number of files for wrap logs.
Supported log types for the disk log module.
pub type LogType {
Halt
Wrap
Rotate
}
Constructors
-
HaltHalt logs write items to a single file.
-
WrapWrap logs use a sequence of files of limited size.
-
RotateRotate logs rotate and compress files (external format only).
A module, function, and arguments tuple for callback functions.
pub type MFA =
#(atom.Atom, atom.Atom, List(dynamic.Dynamic))
Values
pub fn alog(
log: LogDisk,
data: BitArray,
) -> Result(LogDisk, DiskLogError)
Log data asynchronously.
pub fn balog(
log: LogDisk,
data: BitArray,
) -> Result(LogDisk, DiskLogError)
Log binary data asynchronously.
pub fn block(
log: LogDisk,
queue: Bool,
) -> Result(LogDisk, DiskLogError)
Block a log process.
pub fn chunk(
log: LogDisk,
cont: Continuation,
) -> Result(ChunkData, DiskLogError)
Read a chunk of data from the log.
pub fn inc_wrap_file(
log: LogDisk,
) -> Result(LogDisk, DiskLogError)
Increment the wrap file counter.
pub fn log(
log: LogDisk,
data: BitArray,
) -> Result(LogDisk, DiskLogError)
Log data synchronously.
pub fn open(log: LogDisk) -> Result(LogDisk, DiskLogError)
Open a log with default options.
pub fn open_opts(
log: LogDisk,
opts: LogOpts,
) -> Result(LogDisk, DiskLogError)
Open a log with specific options.