lock

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOCK_TYPE_NONE uint8 = iota
	LOCK_TYPE_READ
	LOCK_TYPE_WRITE
)
View Source
const (
	// This order equals a priority of operation
	OP_TYPE_READ uint8 = iota + 1
	OP_TYPE_WRITE
)
View Source
const (
	MainStorePrefix uint8 = iota
	TxStorePrefix
	LockStorePrefix
)
View Source
const OP_NUM uint8 = 2

Variables

This section is empty.

Functions

func IsConflictLock

func IsConflictLock(require, current uint8) bool

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func RegisterOPCodec

func RegisterOPCodec(cdc *codec.Codec)

Types

type OP

type OP interface {
	cross.OP

	Key() []byte
	Type() uint8
	ApplyTo(sdk.KVStore)
}

type OPManager

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

func NewOPManager

func NewOPManager() *OPManager

func (*OPManager) AddOP

func (m *OPManager) AddOP(op OP)

func (*OPManager) COPs

func (m *OPManager) COPs() cross.OPs

func (*OPManager) GetLastChange

func (m *OPManager) GetLastChange(key []byte) (WriteOP, bool)

func (*OPManager) OPs

func (m *OPManager) OPs() OPs

type OPs

type OPs []OP

func OptimizeOPs

func OptimizeOPs(ops OPs) OPs

type Read

type Read struct {
	K []byte
}

func (Read) ApplyTo

func (r Read) ApplyTo(sdk.KVStore)

func (Read) Equal

func (r Read) Equal(cop cross.OP) bool

func (Read) Key

func (r Read) Key() []byte

func (Read) String

func (r Read) String() string

func (Read) Type

func (r Read) Type() uint8

type ReadOP

type ReadOP interface {
	OP
}

type Store

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

func NewStore

func NewStore(kvs sdk.KVStore) Store

func (Store) Commit

func (s Store) Commit(id []byte) error

func (Store) CommitImmediately

func (s Store) CommitImmediately() error

func (Store) Delete

func (s Store) Delete(key []byte)

func (Store) Discard

func (s Store) Discard(id []byte) error

func (Store) Get

func (s Store) Get(key []byte) []byte

func (Store) Has

func (s Store) Has(key []byte) bool

func (Store) OPs

func (s Store) OPs() cross.OPs

func (Store) Precommit

func (s Store) Precommit(id []byte) error

func (Store) Set

func (s Store) Set(key, value []byte)

type Write

type Write struct {
	K []byte
	V []byte
}

func (Write) ApplyTo

func (w Write) ApplyTo(kvs sdk.KVStore)

func (Write) Equal

func (w Write) Equal(cop cross.OP) bool

func (Write) Key

func (w Write) Key() []byte

func (Write) String

func (w Write) String() string

func (Write) Type

func (w Write) Type() uint8

func (Write) Value

func (w Write) Value() []byte

type WriteOP

type WriteOP interface {
	OP
	Value() []byte
}

Jump to

Keyboard shortcuts

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