build: golang.org/x/build/maintner/reclog Index | Files

package reclog

import "golang.org/x/build/maintner/reclog"

Package reclog contains readers and writers for a record wrapper format used by maintner.

Index

Package Files

reclog.go

func AppendRecordToFile Uses

func AppendRecordToFile(filename string, data []byte) error

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 Uses

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 Uses

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 be 0 if reading from the beginning of a file.

func WriteRecord Uses

func WriteRecord(w io.Writer, off int64, data []byte) error

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.

type RecordCallback Uses

type RecordCallback func(off int64, hdr, rec []byte) error

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.

Package reclog imports 6 packages (graph) and is imported by 4 packages. Updated 2017-08-19. Refresh now. Tools for package owners.