Help us shape the future of Go! Take the 2026 Go Developer Survey

etcddb

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Ctx = context.TODO()

Functions

func NewDB

func NewDB(url string) (database.Storage, error)

Types

type EtcDBatch

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

func (*EtcDBatch) Delete

func (b *EtcDBatch) Delete(key []byte) (err error)

func (*EtcDBatch) Put

func (b *EtcDBatch) Put(key []byte, value []byte) (err error)

func (*EtcDBatch) Write

func (b *EtcDBatch) Write() (err error)

type EtcDStorage

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

func (*EtcDStorage) Close

func (s *EtcDStorage) Close() error

Close finishes etcd connect

func (*EtcDStorage) CompactDB

func (s *EtcDStorage) CompactDB() error

CompactDB does nothing for etcd

func (*EtcDStorage) CreateBatch

func (s *EtcDStorage) CreateBatch() database.Batch

CreateBatch creates a Batch object

func (*EtcDStorage) CreateTemporary

func (s *EtcDStorage) CreateTemporary() (database.Storage, error)

CreateTemporary creates new DB of the same type in temp dir

func (*EtcDStorage) Delete

func (s *EtcDStorage) Delete(key []byte) (err error)

Delete removes key from etcd

func (*EtcDStorage) Drop

func (s *EtcDStorage) Drop() error

Drop removes only temporary DBs with etcd (i.e. remove all prefixed keys)

func (*EtcDStorage) FetchByPrefix

func (s *EtcDStorage) FetchByPrefix(prefix []byte) [][]byte

FetchByPrefix returns all values with keys that start with prefix

func (*EtcDStorage) Get

func (s *EtcDStorage) Get(key []byte) (value []byte, err error)

Get key value from etcd

func (*EtcDStorage) HasPrefix

func (s *EtcDStorage) HasPrefix(prefix []byte) bool

HasPrefix checks whether it can find any key with given prefix and returns true if one exists

func (*EtcDStorage) KeysByPrefix

func (s *EtcDStorage) KeysByPrefix(prefix []byte) [][]byte

KeysByPrefix returns all keys that start with prefix

func (*EtcDStorage) Open

func (s *EtcDStorage) Open() error

Reopen tries to open (re-open) the database

func (*EtcDStorage) OpenTransaction

func (s *EtcDStorage) OpenTransaction() (database.Transaction, error)

OpenTransaction creates new transaction.

func (*EtcDStorage) ProcessByPrefix

func (s *EtcDStorage) ProcessByPrefix(prefix []byte, proc database.StorageProcessor) error

ProcessByPrefix iterates through all entries where key starts with prefix and calls StorageProcessor on key value pair

func (*EtcDStorage) Put

func (s *EtcDStorage) Put(key []byte, value []byte) (err error)

Put saves key to etcd, if key has the same value in DB already, it is not saved

type WriteOptions

type WriteOptions struct {
	NoWriteMerge bool
	Sync         bool
}

Jump to

Keyboard shortcuts

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