marshal

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TimestampByteLength length of time after marshall
	TimestampByteLength = 4
	// BlockNumberMarshallLength length of block number after marshall
	BlockNumberMarshallLength = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteMarshaller

type ByteMarshaller struct {
}

ByteMarshaller marshal data using byte array

func (ByteMarshaller) MarshallAddressKey

func (bm ByteMarshaller) MarshallAddressKey(index *types.AddressIndex) []byte

MarshallAddressKey create LevelDB key

func (ByteMarshaller) MarshallAddressKeyPrefix

func (bm ByteMarshaller) MarshallAddressKeyPrefix(address string) []byte

MarshallAddressKeyPrefix marshall the address which is key prefix of address db

func (ByteMarshaller) MarshallAddressKeyPrefix2

func (bm ByteMarshaller) MarshallAddressKeyPrefix2(address string, tm *big.Int) []byte

MarshallAddressKeyPrefix2 marshall the address and time which is key prefix of address db

func (ByteMarshaller) MarshallAddressKeyPrefix3

func (bm ByteMarshaller) MarshallAddressKeyPrefix3(address string, tm time.Time) []byte

MarshallAddressKeyPrefix3 same to MarshallAddressKeyPrefix2

func (ByteMarshaller) MarshallAddressKeyStr

func (bm ByteMarshaller) MarshallAddressKeyStr(address string, time *big.Int, sequence uint8) []byte

MarshallAddressKeyStr create LevelDB key

func (ByteMarshaller) MarshallAddressValue

func (bm ByteMarshaller) MarshallAddressValue(index *types.AddressIndex) []byte

MarshallAddressValue create LevelDB value

func (ByteMarshaller) MarshallBatchKey

func (bm ByteMarshaller) MarshallBatchKey(from *big.Int, to *big.Int, step byte, createdAt *big.Int) []byte

MarshallBatchKey marshall key of batch status database

func (ByteMarshaller) MarshallBatchKeyFrom

func (bm ByteMarshaller) MarshallBatchKeyFrom(from *big.Int) []byte

MarshallBatchKeyFrom marshall From in batch DB

func (ByteMarshaller) MarshallBatchValue

func (bm ByteMarshaller) MarshallBatchValue(updatedAt *big.Int, currentBlock *big.Int) []byte

MarshallBatchValue value of key-value init batch status database

func (ByteMarshaller) MarshallBlockKey

func (bm ByteMarshaller) MarshallBlockKey(blockNumber string) []byte

MarshallBlockKey marshall key of block DB

func (ByteMarshaller) MarshallBlockValue

func (bm ByteMarshaller) MarshallBlockValue(blockIndex *types.BlockIndex) []byte

MarshallBlockValue marshall a blockIndex to []byte so that we store it as value in Block db

func (ByteMarshaller) UnmarshallAddressKey

func (bm ByteMarshaller) UnmarshallAddressKey(key []byte) (string, *big.Int)

UnmarshallAddressKey LevelDB key to address_time

func (ByteMarshaller) UnmarshallAddressValue

func (bm ByteMarshaller) UnmarshallAddressValue(value []byte) types.AddressIndex

UnmarshallAddressValue LevelDB value to txhash_Value_Time

func (ByteMarshaller) UnmarshallBatchKey

func (bm ByteMarshaller) UnmarshallBatchKey(key []byte) types.BatchStatus

UnmarshallBatchKey unmarshall key of batch status database

func (ByteMarshaller) UnmarshallBatchValue

func (bm ByteMarshaller) UnmarshallBatchValue(value []byte) types.BatchStatus

UnmarshallBatchValue unmarshal value of key-value init batch status database

func (ByteMarshaller) UnmarshallBlockKey

func (bm ByteMarshaller) UnmarshallBlockKey(key []byte) *big.Int

UnmarshallBlockKey unmarshall key of block DB

func (ByteMarshaller) UnmarshallBlockValue

func (bm ByteMarshaller) UnmarshallBlockValue(value []byte) types.BlockIndex

UnmarshallBlockValue unmarshall a byte array into array of address, this is for Block db

type Marshaller

type Marshaller interface {
	MarshallBatchValue(updatedAt *big.Int, currentBlock *big.Int) []byte
	UnmarshallBatchValue(value []byte) types.BatchStatus
	MarshallBatchKey(from *big.Int, to *big.Int, step byte, createdAt *big.Int) []byte
	MarshallBatchKeyFrom(from *big.Int) []byte
	UnmarshallBatchKey(value []byte) types.BatchStatus
	MarshallBlockValue(blockIndex *types.BlockIndex) []byte
	UnmarshallBlockValue(value []byte) types.BlockIndex
	MarshallBlockKey(blockNumber string) []byte
	UnmarshallBlockKey(key []byte) *big.Int
	MarshallAddressKey(index *types.AddressIndex) []byte
	MarshallAddressKeyPrefix(address string) []byte
	MarshallAddressKeyPrefix2(address string, time *big.Int) []byte
	MarshallAddressKeyPrefix3(address string, tm time.Time) []byte
	MarshallAddressKeyStr(address string, time *big.Int, sequence uint8) []byte
	MarshallAddressValue(index *types.AddressIndex) []byte
	UnmarshallAddressKey(key []byte) (string, *big.Int)
	UnmarshallAddressValue(value []byte) types.AddressIndex
}

Marshaller the interface to convert business objects to/from byte

type StringMarshaller

type StringMarshaller struct {
}

StringMarshaller initial marshaller impl

func (StringMarshaller) MarshallAddressKey

func (sm StringMarshaller) MarshallAddressKey(index *types.AddressIndex) []byte

MarshallAddressKey create LevelDB key

func (StringMarshaller) MarshallAddressKeyStr

func (sm StringMarshaller) MarshallAddressKeyStr(address string, blockNumber string) []byte

MarshallAddressKeyStr create LevelDB key

func (StringMarshaller) MarshallAddressValue

func (sm StringMarshaller) MarshallAddressValue(index *types.AddressIndex) []byte

MarshallAddressValue create LevelDB value

func (StringMarshaller) MarshallBlockDBValue

func (sm StringMarshaller) MarshallBlockDBValue(blockIndex *types.BlockIndex) []byte

MarshallBlockDBValue marshall a blockIndex to []byte so that we store it as value in Block db

func (StringMarshaller) UnmarshallAddressKey

func (sm StringMarshaller) UnmarshallAddressKey(key []byte) (string, *big.Int)

UnmarshallAddressKey LevelDB key to address_blockNumber

func (StringMarshaller) UnmarshallAddressValue

func (sm StringMarshaller) UnmarshallAddressValue(value []byte) types.AddressIndex

UnmarshallAddressValue LevelDB value to txhash_Value_Time

func (StringMarshaller) UnmarshallBlockDBValue

func (sm StringMarshaller) UnmarshallBlockDBValue(value []byte) []string

UnmarshallBlockDBValue unmarshall a byte array into array of address, this is for Block db

Jump to

Keyboard shortcuts

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