Documentation / @andrew_l/binlog / Binlog
Class: Binlog ​
TypeScript implementation of binlog system Adapted from https://github.com/vk-com/kphp-kdb/blob/master/binlog/kdb-binlog-common.c
Constructors ​
Constructor ​
new Binlog(
options):Binlog
Parameters ​
options ​
Returns ​
Binlog
Accessors ​
currentFileIndex ​
Get Signature ​
get currentFileIndex():
number
Get the current binlog file index
Returns ​
number
currentFileName ​
Get Signature ​
get currentFileName():
string
Get current binlog file name
Returns ​
string
directory ​
Get Signature ​
get directory():
string
Get current binlog directory
Returns ​
string
Methods ​
close() ​
close():
Promise<void>
Close the current binlog file
Returns ​
Promise<void>
init() ​
init():
Promise<void>
Initialize the binlog system, ensuring directory exists and pick most recent binlog file
Returns ​
Promise<void>
Promise resolving to true if successful, false otherwise
open() ​
open():
Promise<void>
Open the binlog for writing
Returns ​
Promise<void>
readEntries() ​
readEntries<
TData>(filename,unsafe?):Promise<BinlogEntry<TData>[]>
Read and parse all entries from a binlog file
Type Parameters ​
TData ​
TData = Buffer<ArrayBufferLike>
Parameters ​
filename ​
string
Binlog file to read
unsafe? ​
boolean
Ignore broken binlog records otherwise throws error
Returns ​
Promise<BinlogEntry<TData>[]>
Array of parsed entries
rotate() ​
rotate():
Promise<void>
Rotate the binlog file
Returns ​
Promise<void>
write() ​
write(
opcode,data):Promise<void>
Write a binlog entry
Parameters ​
opcode ​
number
Operation code
data ​
unknown
Data to write
Returns ​
Promise<void>
Promise resolving to true if successful, false otherwise