kv

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 18 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFileExist

func IsFileExist(path string) bool

func PrintHostAddress

func PrintHostAddress(ha host.Host)

Types

type CRDTKeyValueDB

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

func NewCRDTKeyValueDB

func NewCRDTKeyValueDB(ctx context.Context, c Config) (*CRDTKeyValueDB, error)

func (*CRDTKeyValueDB) Batch

func (c *CRDTKeyValueDB) Batch(ctx context.Context) (datastore.Batch, error)

func (*CRDTKeyValueDB) Close

func (c *CRDTKeyValueDB) Close()

func (*CRDTKeyValueDB) Connect

func (c *CRDTKeyValueDB) Connect(addr string) error

func (*CRDTKeyValueDB) DB

func (c *CRDTKeyValueDB) DB() *badger2.DB

func (*CRDTKeyValueDB) Delete

func (c *CRDTKeyValueDB) Delete(ctx context.Context, key []byte) error

func (*CRDTKeyValueDB) Get

func (c *CRDTKeyValueDB) Get(ctx context.Context, key []byte) ([]byte, error)

func (*CRDTKeyValueDB) Has

func (c *CRDTKeyValueDB) Has(ctx context.Context, key []byte) (bool, error)

func (*CRDTKeyValueDB) MarshalPrivateKey

func (c *CRDTKeyValueDB) MarshalPrivateKey() ([]byte, error)

func (*CRDTKeyValueDB) Put

func (c *CRDTKeyValueDB) Put(ctx context.Context, key, value []byte) error

func (*CRDTKeyValueDB) Query

func (*CRDTKeyValueDB) Repair

func (c *CRDTKeyValueDB) Repair() error

func (*CRDTKeyValueDB) Store

func (c *CRDTKeyValueDB) Store() ds.Datastore

type Config

type Config struct {
	NodeServiceName     string               // Service Discovery Identification
	DataStorePath       string               // Data storage path
	DataSyncChannel     string               // Pubsub data synchronization channel
	NetDiscoveryChannel string               // Node discovery channel
	PubSubHandleType    p2p.PubSubHandleType // PubSub Handle Type - "gossip/flood"
	PrivateKey          []byte               // As the private key
	Namespace           string
	ListenPort          string
	Logger              logging.StandardLogger
	PutHook             func(k ds.Key, v []byte) // Peer node data synchronization hook
	DeleteHook          func(k ds.Key)           // Peer node data synchronization hook
}

Jump to

Keyboard shortcuts

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