state

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2018 License: Apache-2.0 Imports: 13 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
)

Variables

This section is empty.

Functions

func DeploymentAddress

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

func DeploymentGroupID

func DeploymentGroupID(daddr []byte, gseq uint64) []byte

{deployment-address}{group-sequence-id}

func FulfillmentID

func FulfillmentID(daddr []byte, gseq uint64, oseq uint64, paddr []byte) []byte

{deployment-address}{group-sequence-id}{order-sequence-id}{provider-address}

AKA: OrderID(daddr,gseq,oseq) + provider-address

func GetMaxEndRange64

func GetMaxEndRange64() base.Bytes

func GetMinStartRange

func GetMinStartRange() base.Bytes

func IDForLease

func IDForLease(obj *types.Lease) []byte

func LeaseID

func LeaseID(daddr []byte, gseq uint64, oseq uint64, paddr []byte) []byte

{deployment-address}{group-sequence-id}{order-sequence-id}{provider-address}

AKA: FulfillmentID(daddr,gseq,oseq)

func MaxAddress

func MaxAddress() []byte

func MinAddress

func MinAddress() []byte

func NonceAddress

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

func OrderID

func OrderID(daddr []byte, gseq uint64, oseq uint64) []byte

{deployment-address}{group-sequence-id}{order-sequence-id}

AKA: DeploymentGroupID(daddr,gseq) + oseq

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(db DB) AccountAdapter

type DB

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

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
	GetWithProof(key []byte) ([]byte, iavl.KeyProof, error)
	GetRangeWithProof([]byte, []byte, int) ([][]byte, [][]byte, iavl.KeyRangeProof, error)
}

type DeploymentAdapter

type DeploymentAdapter interface {
	Save(deployment *types.Deployment) error
	Get(base.Bytes) (*types.Deployment, error)
	GetMaxRange() (*types.Deployments, error)
	GetRangeWithProof(base.Bytes, base.Bytes, int) ([][]byte, *types.Deployments, iavl.KeyRangeProof, error)
	KeyFor(base.Bytes) base.Bytes
	SequenceFor(base.Bytes) Sequence
}

func NewDeploymentAdapter

func NewDeploymentAdapter(db DB) DeploymentAdapter

type DeploymentGroupAdapter

type DeploymentGroupAdapter interface {
	Save(*types.DeploymentGroup) error
	Get(addr base.Bytes, seq uint64) (*types.DeploymentGroup, error)
	GetByKey(addr base.Bytes) (*types.DeploymentGroup, error)
	ForDeployment(addr base.Bytes) ([]*types.DeploymentGroup, error)
	KeyFor(base.Bytes) base.Bytes
}

func NewDeploymentGroupAdapter

func NewDeploymentGroupAdapter(db DB) DeploymentGroupAdapter

type FulfillmentAdapter

type FulfillmentAdapter interface {
	Save(*types.Fulfillment) error
	Get(daddr base.Bytes, group uint64, order uint64, paddr base.Bytes) (*types.Fulfillment, error)
	GetByKey(address base.Bytes) (*types.Fulfillment, error)
	ForGroup(*types.DeploymentGroup) ([]*types.Fulfillment, error)
	ForOrder(*types.Order) ([]*types.Fulfillment, error)
	IDFor(*types.Fulfillment) []byte
	KeyFor(id []byte) []byte
}

func NewFulfillmentAdapter

func NewFulfillmentAdapter(db DB) FulfillmentAdapter

type LeaseAdapter

type LeaseAdapter interface {
	Save(*types.Lease) error
	Get(daddr base.Bytes, group uint64, order uint64, paddr base.Bytes) (*types.Lease, error)
	GetByKey(address base.Bytes) (*types.Lease, error)
	IDFor(obj *types.Lease) []byte
	KeyFor(id []byte) []byte
	All() ([]*types.Lease, error)
}

func NewLeaseAdapter

func NewLeaseAdapter(db DB) LeaseAdapter

type OrderAdapter

type OrderAdapter interface {
	Save(*types.Order) error
	GetByKey(base.Bytes) (*types.Order, error)
	Get(addr base.Bytes, group uint64, order uint64) (*types.Order, error)
	ForGroup(*types.DeploymentGroup) ([]*types.Order, error)
	All() ([]*types.Order, error)
	KeyFor(base.Bytes) base.Bytes
}

func NewOrderAdapter

func NewOrderAdapter(db DB) OrderAdapter

type ProviderAdapter

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

func NewProviderAdapter

func NewProviderAdapter(db DB) ProviderAdapter

type Sequence

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

func NewSequence

func NewSequence(db DB, path []byte) Sequence

type State

type State interface {
	Version() int64
	Hash() []byte
	Commit() ([]byte, int64, error)

	DB() DBReader

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

func LoadState

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

func NewState

func NewState(db DB) State

Jump to

Keyboard shortcuts

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