Documentation ¶
Index ¶
- func AppendLongData(input []byte, data []byte) []byte
- func AppendShortData(input []byte, data []byte) []byte
- func AppendUint16(input []byte, value uint16) []byte
- func AppendUint32(input []byte, value uint32) []byte
- func AppendUint64(input []byte, value uint64) []byte
- func AppendUint8(input []byte, value uint8) []byte
- func IsBitSet(b []byte, idx int) (bool, error)
- func KeyPartFixture(typ uint16, val string) ledger.KeyPart
- func LightPayload(key uint16, value uint16) *ledger.Payload
- func LightPayload8(key uint8, value uint8) *ledger.Payload
- func MaxUint16(a, b uint16) uint16
- func OneBytePath(inp uint8) ledger.Path
- func QueryFixture() *ledger.Query
- func RandomPaths(n int, byteSize int) []ledger.Path
- func RandomPathsRandLen(maxN int, byteSize int) []ledger.Path
- func RandomPayload(minByteSize int, maxByteSize int) *ledger.Payload
- func RandomPayloads(n int, minByteSize int, maxByteSize int) []*ledger.Payload
- func RandomUniqueKeys(n, m, minByteSize, maxByteSize int) []ledger.Key
- func RandomUniqueKeysRandomN(maxN, m, minByteSize, maxByteSize int) []ledger.Key
- func RandomValues(n int, minByteSize, maxByteSize int) []ledger.Value
- func ReadFromBuffer(reader io.Reader, length int) ([]byte, error)
- func ReadLongData(input []byte) (data []byte, rest []byte, err error)
- func ReadLongDataFromReader(reader io.Reader) ([]byte, error)
- func ReadShortData(input []byte) (data []byte, rest []byte, err error)
- func ReadShortDataFromReader(reader io.Reader) ([]byte, error)
- func ReadSlice(input []byte, size int) (value []byte, rest []byte, err error)
- func ReadUint16(input []byte) (value uint16, rest []byte, err error)
- func ReadUint32(input []byte) (value uint32, rest []byte, err error)
- func ReadUint64(input []byte) (value uint64, rest []byte, err error)
- func ReadUint8(input []byte) (value uint8, rest []byte, err error)
- func RootHashFixture() ledger.RootHash
- func SetBit(b []byte, i int) error
- func SplitByPath(paths []ledger.Path, payloads []ledger.Payload, bitIndex int) ([]ledger.Path, []ledger.Payload, []ledger.Path, []ledger.Payload, error)
- func SplitSortedPaths(paths []ledger.Path, bitIndex int) ([]ledger.Path, []ledger.Path, error)
- func SplitTrieProofsByPath(paths []ledger.Path, proofs []*ledger.TrieProof, bitIndex int) ([]ledger.Path, []*ledger.TrieProof, []ledger.Path, []*ledger.TrieProof, error)
- func TrieBatchProofFixture() (*ledger.TrieBatchProof, ledger.State)
- func TrieProofFixture() (*ledger.TrieProof, ledger.State)
- func TwoBytesPath(inp uint16) ledger.Path
- func Uint16ToBinary(integer uint16) []byte
- func Uint64ToBinary(integer uint64) []byte
- func UpdateFixture() *ledger.Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendLongData ¶
AppendLongData appends data shorter than 32MB
func AppendShortData ¶
AppendShortData appends data shorter than 16kB
func AppendUint16 ¶
AppendUint16 appends the value bytes to the input slice (big endian)
func AppendUint32 ¶
AppendUint32 appends the value bytes to the input slice (big endian)
func AppendUint64 ¶
AppendUint64 appends the value bytes to the input slice (big endian)
func AppendUint8 ¶
AppendUint8 appends the value byte to the input slice
func IsBitSet ¶
IsBitSet returns if the bit at index `idx` in the byte array `b` is set to 1 (big endian) TODO: remove error return to improve performance
func KeyPartFixture ¶
KeyPartFixture returns a key part fixture
func LightPayload ¶
LightPayload returns a payload with 2 byte key and 2 byte value
func LightPayload8 ¶
LightPayload8 returns a payload with 1 byte key and 1 byte value
func OneBytePath ¶
OneBytePath returns a path (1 byte) given a uint8
func RandomPaths ¶
RandomPaths generates n random (no repetition) fixed sized (byteSize) paths
func RandomPathsRandLen ¶
RandomPathsRandLen generate m random paths (size: byteSize), the number of paths, m, is also randomly selected from the range [1, maxN]
func RandomPayload ¶
RandomPayload returns a random payload
func RandomPayloads ¶
RandomPayloads returns n random payloads
func RandomUniqueKeys ¶
RandomUniqueKeys generates n random keys (each with m random key parts)
func RandomUniqueKeysRandomN ¶
RandomUniqueKeysRandomN generate n (0<n<maxN) random keys (each m random key part),
func RandomValues ¶
RandomValues returns n random values with variable sizes (minByteSize <= size < maxByteSize)
func ReadFromBuffer ¶
ReadFromBuffer reads 'length' bytes from the input
func ReadLongData ¶
ReadLongData read data shorter than 32MB and return the rest of bytes
func ReadLongDataFromReader ¶
ReadLongDataFromReader reads data shorter than 16kB from reader
func ReadShortData ¶
ReadShortData read data shorter than 16kB and return the rest of bytes
func ReadShortDataFromReader ¶
ReadShortDataFromReader reads data shorter than 16kB from reader
func ReadUint16 ¶
ReadUint16 reads a uint16 from the input and returns the rest
func ReadUint32 ¶
ReadUint32 reads a uint32 from the input and returns the rest
func ReadUint64 ¶
ReadUint64 reads a uint64 from the input and returns the rest
func RootHashFixture ¶
RootHashFixture returns a root hash fixture
func SetBit ¶
SetBit sets the bit at position i in the byte array b to 1 TODO: remove error return to improve performance
func SplitByPath ¶
func SplitByPath(paths []ledger.Path, payloads []ledger.Payload, bitIndex int) ([]ledger.Path, []ledger.Payload, []ledger.Path, []ledger.Payload, error)
SplitByPath splits an slice of payloads based on the value of bit (bitIndex) of paths TODO: remove error return
func SplitSortedPaths ¶
SplitSortedPaths splits a set of ordered paths based on the value of bit (bitIndex)
func SplitTrieProofsByPath ¶
func SplitTrieProofsByPath(paths []ledger.Path, proofs []*ledger.TrieProof, bitIndex int) ([]ledger.Path, []*ledger.TrieProof, []ledger.Path, []*ledger.TrieProof, error)
SplitTrieProofsByPath splits a set of unordered path and proof pairs based on the value of bit (bitIndex) of path
func TrieBatchProofFixture ¶
func TrieBatchProofFixture() (*ledger.TrieBatchProof, ledger.State)
TrieBatchProofFixture returns a trie batch proof fixture
func TrieProofFixture ¶
TrieProofFixture returns a trie proof fixture
func TwoBytesPath ¶
TwoBytesPath returns a path (2 bytes) given a uint16
func Uint16ToBinary ¶
Uint16ToBinary converst a uint16 to a byte slice (big endian)
func Uint64ToBinary ¶
Uint64ToBinary converst a uint64 to a byte slice (big endian)
Types ¶
This section is empty.