containerdb

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

* Copyright 2020 ICON Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2020 ICON Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendKeys

func AppendKeys(key []byte, keys ...interface{}) []byte

func AppendRawKeys

func AppendRawKeys(key []byte, keys ...interface{}) []byte

func BigIntSafe added in v1.4.0

func BigIntSafe(v Value) *big.Int

func Int64Safe added in v1.4.0

func Int64Safe(v Value) int64

func SplitKeys

func SplitKeys(key []byte) ([][]byte, error)

func ToBytes

func ToBytes(v interface{}) []byte

Types

type ArrayDB

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

func NewArrayDB

func NewArrayDB(source interface{}, key KeyBuilder) *ArrayDB

func (*ArrayDB) Get

func (a *ArrayDB) Get(i int) Value

func (*ArrayDB) Pop

func (a *ArrayDB) Pop() Value

func (*ArrayDB) Put

func (a *ArrayDB) Put(v interface{}) error

func (*ArrayDB) Set

func (a *ArrayDB) Set(i int, v interface{}) error

func (*ArrayDB) Size

func (a *ArrayDB) Size() int

type BytesStore

type BytesStore interface {
	Bytes() []byte
	SetBytes([]byte) error
	Delete() error
}

type BytesStoreSnapshot

type BytesStoreSnapshot interface {
	GetValue(key []byte) ([]byte, error)
}
var EmptyBytesStoreSnapshot BytesStoreSnapshot = emptyBytesStoreSnapshot{}

func NewBytesStoreSnapshotFromRaw added in v0.9.10

func NewBytesStoreSnapshotFromRaw(s RawBytesStoreSnapshot) BytesStoreSnapshot

type BytesStoreState

type BytesStoreState interface {
	GetValue(key []byte) ([]byte, error)
	SetValue(key []byte, value []byte) ([]byte, error)
	DeleteValue(key []byte) ([]byte, error)
}
var EmptyBytesStoreState BytesStoreState = &snapshotStore{EmptyBytesStoreSnapshot}

func NewBytesStoreStateFromRaw added in v0.9.6

func NewBytesStoreStateFromRaw(s RawBytesStoreState) BytesStoreState

func NewBytesStoreStateWithSnapshot

func NewBytesStoreStateWithSnapshot(s BytesStoreSnapshot) BytesStoreState

type DictDB

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

func NewDictDB

func NewDictDB(source interface{}, depth int, key KeyBuilder) *DictDB

func (*DictDB) Delete

func (d *DictDB) Delete(kv ...interface{}) error

func (*DictDB) Get

func (d *DictDB) Get(keys ...interface{}) Value

func (*DictDB) GetDB

func (d *DictDB) GetDB(keys ...interface{}) *DictDB

func (*DictDB) Set

func (d *DictDB) Set(params ...interface{}) error

type KeyBuilder

type KeyBuilder interface {
	Append(keys ...interface{}) KeyBuilder
	Build() []byte
}

func NewHashKey added in v0.9.10

func NewHashKey(prefix []byte, keys ...interface{}) KeyBuilder

func ToKey

func ToKey(builderType KeyBuilderType, keys ...interface{}) KeyBuilder

type KeyBuilderType

type KeyBuilderType int
const (
	HashBuilder KeyBuilderType = iota
	PrefixedHashBuilder
	RLPBuilder
	RawBuilder
)

type ObjectStoreSnapshot

type ObjectStoreSnapshot interface {
	Get(key []byte) (trie.Object, error)
	ObjectToBytes(value trie.Object) []byte
}

type ObjectStoreState

type ObjectStoreState interface {
	Get(key []byte) (trie.Object, error)
	Set(key []byte, obj trie.Object) (trie.Object, error)
	Delete(key []byte) (trie.Object, error)
	ObjectToBytes(value trie.Object) []byte
	BytesToObject(value []byte) trie.Object
}

type RawBytesStoreSnapshot added in v0.9.10

type RawBytesStoreSnapshot interface {
	Get(key []byte) ([]byte, error)
}

type RawBytesStoreState added in v0.9.6

type RawBytesStoreState interface {
	Get(key []byte) ([]byte, error)
	Set(key []byte, value []byte) ([]byte, error)
	Delete(key []byte) ([]byte, error)
}

type StoreState

type StoreState interface {
	GetValue(key []byte) Value
	At(key []byte) WritableValue
}

func ToStoreState

func ToStoreState(store interface{}) StoreState

type Value

type Value interface {
	BigInt() *big.Int
	Int64() int64
	Uint64() uint64
	Address() module.Address
	Bytes() []byte
	String() string
	Bool() bool
	Object() trie.Object
}

func NewValue

func NewValue(vs ValueSnapshot) Value

type ValueSnapshot

type ValueSnapshot interface {
	Bytes() []byte
	Object() trie.Object
}

func NewValueSnapshotFromBytes

func NewValueSnapshotFromBytes(bs []byte) ValueSnapshot

type ValueState

type ValueState interface {
	ValueSnapshot
	SetBytes(value []byte) error
	SetObject(value trie.Object) error
	Delete() (ValueSnapshot, error)
}

type ValueStore

type ValueStore interface {
	GetValue(key []byte) ValueSnapshot
	At(key []byte) ValueState
}

type VarDB

type VarDB struct {
	WritableValue
}

func NewVarDB

func NewVarDB(source interface{}, key KeyBuilder) *VarDB

type WritableValue

type WritableValue interface {
	Value
	Delete() (Value, error)
	Set(interface{}) error
}

func NewWritableValue

func NewWritableValue(vs ValueState) WritableValue

Jump to

Keyboard shortcuts

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