chains

package
v0.0.0-...-e30b66f Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LAST_POLL_BLOCK_NUM = "LAST_POLL_BLOCK_NUM_%s_%d"

	LAST_VOTE_QUEUE_ID = "LAST_VOTE_QUEUE_ID_%s_%d"

	LAST_SIGN_QUEUE_ID = "LAST_SIGN_QUEUE_ID_%s_%d"

	LAST_EXECUTE_QUEUE_ID = "LAST_EXECUTE_QUEUE_ID_%s_%d"

	LAST_BATCHVOTES_QUEUE_ID = "LAST_BATCHVOTES_QUEUE_ID_%s_%d"
)
View Source
var (
	DESTINATION_PROPOSAL_MSG = "DESTINATION_PROPOSAL_MSG_%d"

	COLLECTOR_SIGN_REQ = "COLLECTOR_SIGN_REQ_%d"

	DESTINATION_EXECUTE_MSG = "DESTINATION_EXECUTE_MSG_%d"

	DESTINATION_BATCH_VOTES_MSG = "DESTINATION_BATCH_VOTES_MSG_%d"
)

Functions

func NewLevelDB

func NewLevelDB(file string, cache int, handles int) (*leveldb.DB, error)

Types

type ChainDB

type ChainDB struct {
	Properties       *Properties
	Msg              *queue.PrefixQueue
	CollectorChainId uint8
	// contains filtered or unexported fields
}

func NewChainDB

func NewChainDB(dataDir string, cache int, handles int) (*ChainDB, error)

func (*ChainDB) AddBatchVotesMsg

func (c *ChainDB) AddBatchVotesMsg(votes types.ProposalSignatures) error

func (*ChainDB) AddExecuteMsg

func (c *ChainDB) AddExecuteMsg(transfer types.TransferMsg) error

func (*ChainDB) AddProposalMsg

func (c *ChainDB) AddProposalMsg(transfer types.TransferMsg) error

func (*ChainDB) AddSignReq

func (c *ChainDB) AddSignReq(transfer types.TransferMsg) error

func (*ChainDB) GetBatchVotesById

func (c *ChainDB) GetBatchVotesById(chainId uint8, id uint64) (*types.ProposalSignatures, error)

func (*ChainDB) GetExecuteMsgById

func (c *ChainDB) GetExecuteMsgById(chainId uint8, id uint64) (*types.TransferMsg, error)

func (*ChainDB) GetLastBatchVotesId

func (c *ChainDB) GetLastBatchVotesId(chainId uint8, account string) (uint64, error)

func (*ChainDB) GetLastExecuteId

func (c *ChainDB) GetLastExecuteId(chainId uint8, account string) (uint64, error)

func (*ChainDB) GetLastSignId

func (c *ChainDB) GetLastSignId(chainId uint8, account string) (uint64, error)

func (*ChainDB) GetLastVoteId

func (c *ChainDB) GetLastVoteId(chainId uint8, account string) (uint64, error)

func (*ChainDB) GetNextPollBlockNum

func (c *ChainDB) GetNextPollBlockNum(chainId uint8, account string) (uint64, error)

func (*ChainDB) GetProposalMsgById

func (c *ChainDB) GetProposalMsgById(chainId uint8, id uint64) (*types.TransferMsg, error)

func (*ChainDB) GetSignReqById

func (c *ChainDB) GetSignReqById(id uint64) (*types.TransferMsg, error)

func (*ChainDB) UpdateLastBatchVotesId

func (c *ChainDB) UpdateLastBatchVotesId(chainId uint8, account string, blockNumber uint64) error

func (*ChainDB) UpdateLastExecuteId

func (c *ChainDB) UpdateLastExecuteId(chainId uint8, account string, blockNumber uint64) error

func (*ChainDB) UpdateLastSignId

func (c *ChainDB) UpdateLastSignId(chainId uint8, account string, blockNumber uint64) error

func (*ChainDB) UpdateLastVoteId

func (c *ChainDB) UpdateLastVoteId(chainId uint8, account string, blockNumber uint64) error

func (*ChainDB) UpdateNextPollBlockNum

func (c *ChainDB) UpdateNextPollBlockNum(chainId uint8, account string, blockNumber uint64) error

type Properties

type Properties struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Properties) Delete

func (p *Properties) Delete(key []byte) error

Delete deletes the key from the queue and database

func (*Properties) Get

func (p *Properties) Get(key []byte) ([]byte, error)

Get returns the given key if it's present.

func (*Properties) Has

func (p *Properties) Has(key []byte) (bool, error)

func (*Properties) Put

func (p *Properties) Put(key []byte, value []byte) error

Put puts the given key / value to the queue

type StorageSize

type StorageSize float64

func (StorageSize) String

func (s StorageSize) String() string

String implements the stringer interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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