marshaller

package
v1.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DeletePrefixEntryProtoTag = 0x12
View Source
const KVEntryKeyProtoTag = 0x0a
View Source
const KVEntryProtoTag = 0x0a
View Source
const KVEntryValueProtoTag = 0x12

Variables

This section is empty.

Functions

This section is empty.

Types

type Binary

type Binary struct{}

func (*Binary) Marshal

func (k *Binary) Marshal(data *StoreData) ([]byte, error)

TODO: does not support delimted

func (*Binary) Unmarshal

func (k *Binary) Unmarshal(in []byte) (*StoreData, uint64, error)

type Marshaller

type Marshaller interface {
	Unmarshal(in []byte) (*StoreData, uint64, error)
	Marshal(data *StoreData) ([]byte, error)
}

func Default

func Default() Marshaller

type Proto

type Proto struct{}

func (*Proto) Marshal

func (p *Proto) Marshal(data *StoreData) ([]byte, error)

func (*Proto) Unmarshal

func (p *Proto) Unmarshal(in []byte) (*StoreData, uint64, error)

type ProtoingFast

type ProtoingFast struct{}

ProtoingFast is a custom proto marshaller, that will marshal and unmarshall the storeData into a predefined proto struct (see below). The motivation here is that we want to write a proto message, making it readable by other tool with the appropriate message, but want to gain the marshal performance of a custom binary library

message StoreData {
	map<string, bytes> kv = 1;
	repeated string delete_prefixes = 2;
}

func (*ProtoingFast) Marshal

func (p *ProtoingFast) Marshal(data *StoreData) ([]byte, error)

func (*ProtoingFast) Unmarshal

func (p *ProtoingFast) Unmarshal(in []byte) (*StoreData, uint64, error)

type StoreData

type StoreData struct {
	Kv             map[string][]byte
	DeletePrefixes []string
}

type VTproto

type VTproto struct{}

func (*VTproto) Marshal

func (p *VTproto) Marshal(data *StoreData) ([]byte, error)

func (*VTproto) Unmarshal

func (p *VTproto) Unmarshal(in []byte) (*StoreData, uint64, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL