Documentation
¶
Overview ¶
Package pb provides native binary encoding for badger protobuf types. This implementation replaces protobuf with direct binary encoding for reduced dependencies and faster serialization.
Index ¶
- func Marshal(m Marshaler) ([]byte, error)
- func Size(m Sizer) int
- func Unmarshal(data []byte, m Unmarshaler) error
- type Checksum
- type Checksum_Algorithm
- type DataKey
- func (d *DataKey) GetCreatedAt() int64
- func (d *DataKey) GetData() []byte
- func (d *DataKey) GetIv() []byte
- func (d *DataKey) GetKeyId() uint64
- func (d *DataKey) Marshal() ([]byte, error)
- func (d *DataKey) Reset()
- func (d *DataKey) Size() int
- func (d *DataKey) String() string
- func (d *DataKey) Unmarshal(data []byte) error
- type EncryptionAlgo
- type KV
- func (k *KV) Clone() *KV
- func (k *KV) GetExpiresAt() uint64
- func (k *KV) GetKey() []byte
- func (k *KV) GetMeta() []byte
- func (k *KV) GetStreamDone() bool
- func (k *KV) GetStreamId() uint32
- func (k *KV) GetUserMeta() []byte
- func (k *KV) GetValue() []byte
- func (k *KV) GetVersion() uint64
- func (k *KV) Marshal() ([]byte, error)
- func (k *KV) MarshalToSizedBuffer(buf []byte) (int, error)
- func (k *KV) Reset()
- func (k *KV) Size() int
- func (k *KV) String() string
- func (k *KV) Unmarshal(data []byte) error
- type KVList
- type ManifestChange
- func (m *ManifestChange) GetCompression() uint32
- func (m *ManifestChange) GetEncryptionAlgo() EncryptionAlgo
- func (m *ManifestChange) GetId() uint64
- func (m *ManifestChange) GetKeyId() uint64
- func (m *ManifestChange) GetLevel() uint32
- func (m *ManifestChange) GetOp() ManifestChange_Operation
- func (m *ManifestChange) Marshal() ([]byte, error)
- func (m *ManifestChange) Reset()
- func (m *ManifestChange) Size() int
- func (m *ManifestChange) String() string
- func (m *ManifestChange) Unmarshal(data []byte) error
- type ManifestChangeSet
- type ManifestChange_Operation
- type MarshalOptions
- type Marshaler
- type Match
- type Sizer
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Unmarshal ¶
func Unmarshal(data []byte, m Unmarshaler) error
Unmarshal unmarshals bytes into an Unmarshaler.
Types ¶
type Checksum ¶
type Checksum struct {
Algo Checksum_Algorithm
Sum uint64
}
Checksum represents a checksum with algorithm.
func (*Checksum) GetAlgo ¶
func (c *Checksum) GetAlgo() Checksum_Algorithm
type Checksum_Algorithm ¶
type Checksum_Algorithm int32
Checksum_Algorithm defines checksum algorithm type.
const ( Checksum_CRC32C Checksum_Algorithm = 0 Checksum_XXHash64 Checksum_Algorithm = 1 )
type DataKey ¶
DataKey represents an encryption data key.
func (*DataKey) GetCreatedAt ¶
type EncryptionAlgo ¶
type EncryptionAlgo int32
EncryptionAlgo defines encryption algorithm type.
const (
EncryptionAlgo_aes EncryptionAlgo = 0
)
type KV ¶
type KV struct {
Key []byte
Value []byte
UserMeta []byte
Version uint64
ExpiresAt uint64
Meta []byte
StreamId uint32
StreamDone bool
}
KV represents a key-value pair.
func (*KV) GetExpiresAt ¶
func (*KV) GetStreamDone ¶
func (*KV) GetStreamId ¶
func (*KV) GetUserMeta ¶
func (*KV) GetVersion ¶
func (*KV) MarshalToSizedBuffer ¶
MarshalToSizedBuffer marshals KV to a pre-allocated buffer.
type KVList ¶
KVList represents a list of KV pairs.
func (*KVList) GetAllocRef ¶
type ManifestChange ¶
type ManifestChange struct {
Id uint64
Op ManifestChange_Operation
Level uint32
KeyId uint64
EncryptionAlgo EncryptionAlgo
Compression uint32
}
ManifestChange represents a change to the manifest.
func (*ManifestChange) GetCompression ¶
func (m *ManifestChange) GetCompression() uint32
func (*ManifestChange) GetEncryptionAlgo ¶
func (m *ManifestChange) GetEncryptionAlgo() EncryptionAlgo
func (*ManifestChange) GetId ¶
func (m *ManifestChange) GetId() uint64
func (*ManifestChange) GetKeyId ¶
func (m *ManifestChange) GetKeyId() uint64
func (*ManifestChange) GetLevel ¶
func (m *ManifestChange) GetLevel() uint32
func (*ManifestChange) GetOp ¶
func (m *ManifestChange) GetOp() ManifestChange_Operation
func (*ManifestChange) Marshal ¶
func (m *ManifestChange) Marshal() ([]byte, error)
Marshal encodes ManifestChange to binary format.
func (*ManifestChange) Reset ¶
func (m *ManifestChange) Reset()
func (*ManifestChange) Size ¶
func (m *ManifestChange) Size() int
Size returns the encoded size of ManifestChange. Format: [id:8][op:4][level:4][keyId:8][encryptionAlgo:4][compression:4]
func (*ManifestChange) String ¶
func (m *ManifestChange) String() string
func (*ManifestChange) Unmarshal ¶
func (m *ManifestChange) Unmarshal(data []byte) error
Unmarshal decodes ManifestChange from binary format.
type ManifestChangeSet ¶
type ManifestChangeSet struct {
Changes []*ManifestChange
}
ManifestChangeSet represents a set of manifest changes.
func (*ManifestChangeSet) GetChanges ¶
func (m *ManifestChangeSet) GetChanges() []*ManifestChange
func (*ManifestChangeSet) Marshal ¶
func (m *ManifestChangeSet) Marshal() ([]byte, error)
Marshal encodes ManifestChangeSet to binary format.
func (*ManifestChangeSet) Reset ¶
func (m *ManifestChangeSet) Reset()
func (*ManifestChangeSet) Size ¶
func (m *ManifestChangeSet) Size() int
Size returns the encoded size of ManifestChangeSet.
func (*ManifestChangeSet) String ¶
func (m *ManifestChangeSet) String() string
func (*ManifestChangeSet) Unmarshal ¶
func (m *ManifestChangeSet) Unmarshal(data []byte) error
Unmarshal decodes ManifestChangeSet from binary format.
type ManifestChange_Operation ¶
type ManifestChange_Operation int32
ManifestChange_Operation defines manifest change operations.
const ( ManifestChange_CREATE ManifestChange_Operation = 0 ManifestChange_DELETE ManifestChange_Operation = 1 )
type MarshalOptions ¶
type MarshalOptions struct{}
MarshalOptions provides options for marshaling (compatibility with protobuf API).
func (MarshalOptions) MarshalAppend ¶
func (MarshalOptions) MarshalAppend(b []byte, m Marshaler) ([]byte, error)
MarshalAppend appends the marshaled form to the provided buffer.
type Match ¶
Match represents a match pattern.
func (*Match) GetIgnoreBytes ¶
type Sizer ¶
type Sizer interface {
Size() int
}
Sizer is the interface for types that can report their encoded size.
type Unmarshaler ¶
Unmarshaler is the interface for types that can unmarshal themselves.