Documentation ¶
Overview ¶
Package reclog contains readers and writers for a record wrapper format used by maintner.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendRecordToFile ¶
AppendRecordToFile opens the named filename for append (creating it if necessary) and adds the provided data record to the end. The caller is responsible for file locking.
func ForeachFileRecord ¶
func ForeachFileRecord(path string, fn RecordCallback) error
ForeachFileRecord calls fn for each record in the named file. Calls to fn are made serially. If fn returns an error, iteration ends and that error is returned.
func ForeachRecord ¶
func ForeachRecord(r io.Reader, startOffset int64, fn RecordCallback) error
ForeachRecord calls fn for each record in r. Calls to fn are made serially. If fn returns an error, iteration ends and that error is returned. The startOffset is where in the file r represents. It should be 0 if reading from the beginning of a file.
Types ¶
type RecordCallback ¶
RecordCallback is the callback signature accepted by ForeachFileRecord and ForeachRecord, which read the mutation log format used by DiskMutationLogger.
Offset is the offset in the logical of physical file. hdr and bytes are only valid until the function returns and must not be retained.
hdr is the record header, in the form "REC@c765c9a+1d3=" (REC@ <hex offset> + <hex len(rec)> + '=').
rec is the proto3 binary marshalled representation of *maintpb.Mutation.
If the callback returns an error, iteration stops.