store

package
v0.0.0-...-19c2005 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMemoryDBSchema

func CreateMemoryDBSchema(tableSchemas map[string]*memdb.TableSchema) *memdb.DBSchema

Types

type MemoryDB

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

func NewMemoryDB

func NewMemoryDB(name string, tableSchemas map[string]*memdb.TableSchema) *MemoryDB

func (*MemoryDB) FindOne

func (m *MemoryDB) FindOne(tableName string, key, data string) (interface{}, error)

func (*MemoryDB) InsertMany

func (m *MemoryDB) InsertMany(tableName string, data []interface{}) error

func (*MemoryDB) InsertOne

func (m *MemoryDB) InsertOne(tableName string, data interface{}) error

func (*MemoryDB) SaveSnapShot

func (m *MemoryDB) SaveSnapShot()

type Query

type Query interface {
	FindOne(params ...interface{}) (Record, interface{}, error)
}

type Record

type Record struct {
	SType     StorageType
	RType     StorageElementsType
	ID        string
	Data      []byte
	Immutable bool
	CreatedOn time.Time
	UpdatedOn time.Time
	DeletedOn time.Time
	Ref       *RecordIndex
}

type RecordIndex

type RecordIndex struct {
	ID         string
	HasKeys    []string
	BucketName string
	Order      int32
}

type Storage

type Storage interface {
	CreateNew(ctx context.Context, params ...interface{}) (Store, error)
	GetStore(context.Context) Store
}

type StorageElementsType

type StorageElementsType int
const (
	BLOCK StorageElementsType = iota
	BLOCKHEADER
	TRANSACTION
	QUEUEITEM
	PRIVWALLET
	CONTENT
	CONTRACT
	KEY
	PEER
	ACCOUNT
	EPHEMERAL_DATA
	CHAIN_UPGRADE
	RECEIPTS
	MERKLEROOT
	HASH
	MEDIA
	HTML
	SCRIPT
	EXCHANGEDATA
	BANKDATA
	JSON
	BYTES
	PROTO
)

type StorageType

type StorageType int
const (
	MEMORY StorageType = iota
	LEVELDB
	BADGER
	VAULT
	QUEUE
)

type Store

type Store interface {
	InitDB(StorageType) Storage
	GetInstance(context.Context) Storage
}

Jump to

Keyboard shortcuts

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