package reclog
import "golang.org/x/build/maintner/reclog"
Package reclog contains readers and writers for a record wrapper format used by maintner.
Index ¶
- func AppendRecordToFile(filename string, data []byte) error
- func ForeachFileRecord(path string, fn RecordCallback) error
- func ForeachRecord(r io.Reader, startOffset int64, fn RecordCallback) error
- func WriteRecord(w io.Writer, off int64, data []byte) error
- type RecordCallback
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.
func WriteRecord ¶
WriteRecord writes the record data to w, formatting the record wrapper with the given offset off. It is the caller's responsibility to pass the correct offset. Exactly one Write call will be made to w.
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.
Source Files ¶
reclog.go
- Version
- v0.0.0-20250421191922-3619c213cff3 (latest)
- Published
- Apr 21, 2025
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 2 months ago –
Tools for package owners.