utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KARMEM_CAP = 1024
)

Variables

This section is empty.

Functions

func BlockHash2DBKey

func BlockHash2DBKey(hash common.Hash) []byte

func BlockHeight2DBKey

func BlockHeight2DBKey(height int64) []byte

func ByteAddressToHexString

func ByteAddressToHexString(address []byte) string

func DataAddressKey2DBKey

func DataAddressKey2DBKey(address, key []byte) []byte

func DeserializeBlock

func DeserializeBlock(byteBlockData []byte) (*common.Block, error)

func DeserializeBroadcastMessage

func DeserializeBroadcastMessage(byteTxData []byte) (*p2p.BroadcastMessage, error)

func DeserializeDataCommand

func DeserializeDataCommand(byteDataCommand []byte) (*common.DataCommand, error)

func DeserializeGeneralParams

func DeserializeGeneralParams(byteParamsData []byte) (*common.GeneralParams, error)

func DeserializeGenesisParams

func DeserializeGenesisParams(byteParamsData []byte) (*common.GenesisParams, error)

func DeserializeStatusMsg

func DeserializeStatusMsg(byteMsgData []byte) (*p2p.SyncStatusMsg, error)

func DeserializeTimeSyncMsg

func DeserializeTimeSyncMsg(byteTimeSyncMsg []byte) (*p2p.TimeSyncMsg, error)

func DeserializeTransaction

func DeserializeTransaction(byteTxData []byte) (*common.Transaction, error)

func KarmemBlock2Protobuf

func KarmemBlock2Protobuf(block *common.Block, full bool) *pb.Block

func KarmemTransaction2Protobuf

func KarmemTransaction2Protobuf(tx *common.Transaction) *pb.Transaction

func SerializeBlock

func SerializeBlock(block *common.Block) ([]byte, error)

func SerializeBlockHeader

func SerializeBlockHeader(header *common.BlockHeader) ([]byte, error)

func SerializeBroadcastMessage

func SerializeBroadcastMessage(msg *p2p.BroadcastMessage) ([]byte, error)

func SerializeDataCommand

func SerializeDataCommand(dc *common.DataCommand) ([]byte, error)

func SerializeGeneralParams

func SerializeGeneralParams(p *common.GeneralParams) ([]byte, error)

func SerializeGenesisParams

func SerializeGenesisParams(p *common.GenesisParams) ([]byte, error)

func SerializeStatusMsg

func SerializeStatusMsg(msg *p2p.SyncStatusMsg) ([]byte, error)

func SerializeTimeSyncMsg

func SerializeTimeSyncMsg(msg *p2p.TimeSyncMsg) ([]byte, error)

func SerializeTransaction

func SerializeTransaction(transaction *common.Transaction) ([]byte, error)

func TxHash2DBKey

func TxHash2DBKey(hash common.Hash) []byte

Types

type LevelDB

type LevelDB struct {
	// contains filtered or unexported fields
}

func NewLevelDB

func NewLevelDB(path string) (*LevelDB, error)

func (*LevelDB) BatchDelete

func (ld *LevelDB) BatchDelete(key [][]byte) error

func (*LevelDB) BatchInsert

func (ld *LevelDB) BatchInsert(key [][]byte, value [][]byte) error

func (*LevelDB) Get

func (ld *LevelDB) Get(key []byte) ([]byte, error)

func (*LevelDB) Insert

func (ld *LevelDB) Insert(key []byte, value []byte) error

func (*LevelDB) Remove

func (ld *LevelDB) Remove(key []byte) error

Jump to

Keyboard shortcuts

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