state

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountPath = "/accounts/"

	DeploymentPath         = "/deployments/"
	DeploymentSequencePath = "/deployments-seq/"

	DeploymentGroupPath = "/deployment-groups/"
	ProviderPath        = "/providers/"
	OrderPath           = "/orders/"
	FulfillmentPath     = "/fulfillment-orders/"
	LeasePath           = "/lease/"

	MaxRangeLimit = math.MaxInt64

	AddressSize = 32 // XXX: check
)

Variables

This section is empty.

Functions

func DeploymentAddress

func DeploymentAddress(account []byte, nonce uint64) []byte

func LoadState

func LoadState(db DB, gen *types.Genesis) (CommitState, CacheState, error)

func MaxAddress

func MaxAddress() []byte

func MinAddress

func MinAddress() []byte

func NonceAddress

func NonceAddress(account []byte, nonce uint64) []byte

func ProviderAddress

func ProviderAddress(account []byte, nonce uint64) []byte

Types

type AccountAdapter

type AccountAdapter interface {
	Save(account *types.Account) error
	Get(base.Bytes) (*types.Account, error)
	KeyFor(base.Bytes) base.Bytes
}

func NewAccountAdapter

func NewAccountAdapter(state State) AccountAdapter

type CacheState added in v0.0.9

type CacheState interface {
	State
	Write() error
}

func NewCache added in v0.0.9

func NewCache(db DB) CacheState

type CommitState added in v0.0.9

type CommitState interface {
	Version() int64
	Hash() []byte
	Commit() ([]byte, int64, error)
	Get(key []byte) []byte
	GetRange([]byte, []byte, int) ([][]byte, [][]byte, error)
	Set(key, val []byte)
	Remove(key []byte)

	Account() AccountAdapter
	Deployment() DeploymentAdapter
	Provider() ProviderAdapter
	Order() OrderAdapter
	DeploymentGroup() DeploymentGroupAdapter
	Fulfillment() FulfillmentAdapter
	Lease() LeaseAdapter
}

func NewState

func NewState(db DB) CommitState

type DB

type DB interface {
	DBReader
	Commit() ([]byte, int64, error)
	Set(key, val []byte)
	Remove(key []byte)
}

func LoadDB

func LoadDB(pathname string) (DB, error)

func NewMemDB

func NewMemDB() DB

type DBReader

type DBReader interface {
	IsEmpty() bool
	Version() int64
	Hash() []byte
	Get(key []byte) []byte
	GetRange([]byte, []byte, int) ([][]byte, [][]byte, error)
}

type DeploymentAdapter

type DeploymentAdapter interface {
	Save(deployment *types.Deployment) error
	Get(base.Bytes) (*types.Deployment, error)
	GetMaxRange() (*types.Deployments, error)
	KeyFor(base.Bytes) base.Bytes
	SequenceFor(base.Bytes) Sequence
}

func NewDeploymentAdapter

func NewDeploymentAdapter(state State) DeploymentAdapter

type DeploymentGroupAdapter

type DeploymentGroupAdapter interface {
	Save(*types.DeploymentGroup) error
	Get(id types.DeploymentGroupID) (*types.DeploymentGroup, error)
	All() ([]*types.DeploymentGroup, error)
	ForDeployment(addr base.Bytes) ([]*types.DeploymentGroup, error)
}

func NewDeploymentGroupAdapter

func NewDeploymentGroupAdapter(state State) DeploymentGroupAdapter

type FulfillmentAdapter

type FulfillmentAdapter interface {
	Save(*types.Fulfillment) error
	Get(id types.FulfillmentID) (*types.Fulfillment, error)
	ForDeployment(base.Bytes) ([]*types.Fulfillment, error)
	ForGroup(types.DeploymentGroupID) ([]*types.Fulfillment, error)
	ForOrder(types.OrderID) ([]*types.Fulfillment, error)
	All() ([]*types.Fulfillment, error)
}

func NewFulfillmentAdapter

func NewFulfillmentAdapter(state State) FulfillmentAdapter

type LeaseAdapter

type LeaseAdapter interface {
	Save(*types.Lease) error
	Get(types.LeaseID) (*types.Lease, error)
	ForDeployment(deployment base.Bytes) ([]*types.Lease, error)
	All() ([]*types.Lease, error)
}

func NewLeaseAdapter

func NewLeaseAdapter(state State) LeaseAdapter

type OrderAdapter

type OrderAdapter interface {
	Save(*types.Order) error
	Get(types.OrderID) (*types.Order, error)
	ForDeployment(base.Bytes) ([]*types.Order, error)
	ForGroup(types.DeploymentGroupID) ([]*types.Order, error)
	All() ([]*types.Order, error)
}

func NewOrderAdapter

func NewOrderAdapter(state State) OrderAdapter

type ProviderAdapter

type ProviderAdapter interface {
	Save(provider *types.Provider) error
	Get(base.Bytes) (*types.Provider, error)
	GetMaxRange() (*types.Providers, error)
	GetRange(base.Bytes, base.Bytes, int) ([][]byte, *types.Providers, error)
	KeyFor(base.Bytes) base.Bytes
}

func NewProviderAdapter

func NewProviderAdapter(state State) ProviderAdapter

type Sequence

type Sequence interface {
	Current() uint64
	Advance() uint64
	Next() uint64
}

func NewSequence

func NewSequence(state State, path []byte) Sequence

type State

type State interface {
	Get(key []byte) []byte
	Set(key, val []byte)
	Remove(key []byte)
	GetRange([]byte, []byte, int) ([][]byte, [][]byte, error)
	Version() int64

	Account() AccountAdapter
	Deployment() DeploymentAdapter
	Provider() ProviderAdapter
	Order() OrderAdapter
	DeploymentGroup() DeploymentGroupAdapter
	Fulfillment() FulfillmentAdapter
	Lease() LeaseAdapter
}

Jump to

Keyboard shortcuts

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