sd

package
v0.0.0-...-0f28e9b Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyAlreadyExists  = fmt.Errorf("ErrKeyAlreadyExists")
	ErrEtcdLeaseNotFound = fmt.Errorf("ErrEtcdLeaseNotFound")
)

Functions

This section is empty.

Types

type Etcd

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

func NewEtcd

func NewEtcd(config *EtcdConfig) *Etcd

func (*Etcd) Close

func (e *Etcd) Close() error

func (*Etcd) DelKey

func (e *Etcd) DelKey(ctx context.Context, key string) error

func (*Etcd) Get

func (e *Etcd) Get(ctx context.Context, key string) (value []byte, err error)

func (*Etcd) GetWithPrefixKey

func (e *Etcd) GetWithPrefixKey(ctx context.Context, prefix string) ([]string, []string, error)

func (*Etcd) GrantLease

func (e *Etcd) GrantLease(ttl int64) (clientv3.LeaseID, error)

func (*Etcd) InsertKV

func (e *Etcd) InsertKV(ctx context.Context, key, val string, leaseID clientv3.LeaseID) error

func (*Etcd) InsertKVNoExisted

func (e *Etcd) InsertKVNoExisted(ctx context.Context, key, val string, leaseID clientv3.LeaseID) error

func (*Etcd) KeepaliveWithTTL

func (e *Etcd) KeepaliveWithTTL(ctx context.Context, key, value string, ttl int64) error

func (*Etcd) RenewLease

func (e *Etcd) RenewLease(ctx context.Context, id clientv3.LeaseID) error

func (*Etcd) RevokeLease

func (e *Etcd) RevokeLease(id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error)

func (*Etcd) TryLockWithTTL

func (e *Etcd) TryLockWithTTL(key string, ttl int64) error

func (*Etcd) WatchWithPrefix

func (e *Etcd) WatchWithPrefix(key string, cb func(*clientv3.Event) error) error

type EtcdConfig

type EtcdConfig struct {
	Uri     string `yaml:"uri"`
	Timeout int    `json:"timeout" yaml:"timeout" `
}

Jump to

Keyboard shortcuts

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