Line data Source code
1 : // Copyright 2024 The LevelDB-Go and Pebble Authors. All rights reserved. Use 2 : // of this source code is governed by a BSD-style license that can be found in 3 : // the LICENSE file. 4 : 5 : package batchrepr 6 : 7 : import "encoding/binary" 8 : 9 : // SetSeqNum mutates the provided batch representation, storing the provided 10 : // sequence number in its header. The provided byte slice must already be at 11 : // least HeaderLen bytes long or else SetSeqNum will panic. 12 2 : func SetSeqNum(repr []byte, seqNum uint64) { 13 2 : binary.LittleEndian.PutUint64(repr[:countOffset], seqNum) 14 2 : } 15 : 16 : // SetCount mutates the provided batch representation, storing the provided 17 : // count in its header. The provided byte slice must already be at least 18 : // HeaderLen bytes long or else SetCount will panic. 19 2 : func SetCount(repr []byte, count uint32) { 20 2 : binary.LittleEndian.PutUint32(repr[countOffset:HeaderLen], count) 21 2 : }