state

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLOCKS_STOR_DIR          = "blocks_storage"
	BLOCKS_STOR_KEYVAL_DIR   = "blocks_storage_keyvalue"
	ACCOUNTS_STOR_GLOBAL_DIR = "accounts_stor_global"
	ACCOUNTS_STOR_ADDR_DIR   = "accounts_stor_addr"
	ACCOUNTS_STOR_ASSET_DIR  = "accounts_stor_assets"
)
View Source
const (
	GENESIS_SIGNATURE = "FSH8eAAzZNqnG8xgTZtz5xuLqXySsXgAjmFEC25hXMbEufiGjqWPnGCZFt6gLiVLJny16ipxRNAkkzjjhqTjBE2"
)

Variables

View Source
var ErrNotFound = errors.New("Not found")

Functions

This section is empty.

Types

type Account

type Account interface {
	Data() []proto.DataEntry
	AssetBalance(*proto.OptionalAsset) uint64
	Address() proto.Address
}

type BlockStorageParams

type BlockStorageParams struct {
	OffsetLen, HeaderOffsetLen int
}

func DefaultBlockStorageParams

func DefaultBlockStorageParams() BlockStorageParams

type MockAccount

type MockAccount struct {
	Assets       map[string]uint64
	DataEntries  []proto.DataEntry
	AddressField proto.Address
}

func (*MockAccount) Address

func (a *MockAccount) Address() proto.Address

func (*MockAccount) AssetBalance

func (a *MockAccount) AssetBalance(p *proto.OptionalAsset) uint64

func (*MockAccount) Data

func (a *MockAccount) Data() []proto.DataEntry

type MockState

type MockState struct {
	TransactionsByID       map[string]proto.Transaction
	TransactionsHeightByID map[string]uint64
	Accounts               map[string]Account // recipient to account
}

func (MockState) Account

func (a MockState) Account(r proto.Recipient) Account

func (MockState) TransactionByID

func (a MockState) TransactionByID(b []byte) (proto.Transaction, error)

func (MockState) TransactionHeightByID

func (a MockState) TransactionHeightByID(b []byte) (uint64, error)

type State

type State interface {
	TransactionByID([]byte) (proto.Transaction, error)
	TransactionHeightByID([]byte) (uint64, error)
	Account(proto.Recipient) Account
}

type StateManager

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

func NewStateManager

func NewStateManager(dataDir string, params BlockStorageParams) (*StateManager, error)

func (*StateManager) AcceptAndVerifyBlockBinary

func (s *StateManager) AcceptAndVerifyBlockBinary(data []byte, initialisation bool) error

func (*StateManager) AccountBalance

func (s *StateManager) AccountBalance(addr proto.Address, asset []byte) (uint64, error)

func (*StateManager) BlockIDToHeight

func (s *StateManager) BlockIDToHeight(blockID crypto.Signature) (uint64, error)

func (*StateManager) Close

func (s *StateManager) Close() error

func (*StateManager) GetBlock

func (s *StateManager) GetBlock(blockID crypto.Signature) (*proto.Block, error)

func (*StateManager) GetBlockByHeight

func (s *StateManager) GetBlockByHeight(height uint64) (*proto.Block, error)

func (*StateManager) Height

func (s *StateManager) Height() (uint64, error)

func (*StateManager) HeightToBlockID

func (s *StateManager) HeightToBlockID(height uint64) (crypto.Signature, error)

func (*StateManager) RollbackTo

func (s *StateManager) RollbackTo(removalEdge crypto.Signature) error

func (*StateManager) RollbackToHeight

func (s *StateManager) RollbackToHeight(height uint64) error

func (*StateManager) WavesAddressesNumber

func (s *StateManager) WavesAddressesNumber() (uint64, error)

Jump to

Keyboard shortcuts

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