MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / EncodeLogRecordPst

Function EncodeLogRecordPst

engine/data/log_record.go:82–88  ·  view source on GitHub ↗

EncodeLogRecordPst encodes the position information of a log record.

(pst *LogRecordPst)

Source from the content-addressed store, hash-verified

80
81// EncodeLogRecordPst encodes the position information of a log record.
82func EncodeLogRecordPst(pst *LogRecordPst) []byte {
83 buf := make([]byte, binary.MaxVarintLen16+binary.MaxVarintLen64)
84 var index = 0
85 index += binary.PutVarint(buf[index:], int64(pst.Fid)) // Encode file ID
86 index += binary.PutVarint(buf[index:], pst.Offset) // Encode offset
87 return buf[:index]
88}
89
90// DecodeLogRecordPst decodes the position information from a byte buffer.
91func DecodeLogRecordPst(buf []byte) *LogRecordPst {

Callers 2

PutMethod · 0.92
WriteHintRecordMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected