etcd

package
v0.0.0-...-d766383 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type Client

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

func Connect

func Connect(c *Config) (*Client, error)

func ConnectWithLazy

func ConnectWithLazy(lazypaths ...string) (*Client, error)

func NewClient

func NewClient(c *Config) (*Client, error)

func (*Client) Close

func (p *Client) Close() error

func (*Client) Del

func (p *Client) Del(key string) error

func (*Client) Exist

func (p *Client) Exist(key string) (bool, error)

func (*Client) Get

func (p *Client) Get(key string) ([]byte, error)

func (*Client) GetJson

func (p *Client) GetJson(key string, j interface{}) error

func (*Client) GetPb

func (p *Client) GetPb(key string, j proto.Message) error

func (*Client) GetWithVersion

func (p *Client) GetWithVersion(key string) ([]byte, int64, error)

func (*Client) ListPrefix

func (p *Client) ListPrefix(key string) ([]string, error)

func (*Client) Prefix

func (p *Client) Prefix(key string) (map[string][]byte, error)

func (*Client) Set

func (p *Client) Set(key string, val interface{}) error

func (*Client) SetEx

func (p *Client) SetEx(key string, val interface{}, timeout time.Duration) error

func (*Client) SetPb

func (p *Client) SetPb(key string, val proto.Message) error

func (*Client) SetPbVersion

func (p *Client) SetPbVersion(key string, val proto.Message, version int64) (bool, error)

func (*Client) SetWithLock

func (p *Client) SetWithLock(key string, val interface{}) error

func (*Client) SetWithVersion

func (p *Client) SetWithVersion(key string, val interface{}, version int64) (bool, error)

func (*Client) Watch

func (p *Client) Watch(key string, logic func(event *Event))

func (*Client) WatchPrefix

func (p *Client) WatchPrefix(key string, logic func(event *Event))

func (*Client) WhenLocked

func (p *Client) WhenLocked(key string, logic func(client *Client, key string) error) error

type Config

type Config struct {
	Address []string `` /* 147-byte string literal not displayed */

	Username string `json:"username,omitempty" yaml:"username,omitempty" toml:"username,omitempty"`
	Password string `json:"password,omitempty" yaml:"password,omitempty" toml:"password,omitempty"`
}

type Event

type Event struct {
	Key     string
	Type    EventType
	Value   []byte
	Version int64
}

type EventType

type EventType uint8
const (
	Changed EventType = iota + 1
	Deleted
)

func (EventType) String

func (e EventType) String() string

type Mutex

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

func NewMutex

func NewMutex(cli *Client, key string) *Mutex

func (*Mutex) Lock

func (p *Mutex) Lock() error

func (*Mutex) LockWithTimeout

func (p *Mutex) LockWithTimeout(timeout time.Duration) error

func (*Mutex) TryLock

func (p *Mutex) TryLock() error

func (*Mutex) Unlock

func (p *Mutex) Unlock() error

func (*Mutex) WhenLocked

func (p *Mutex) WhenLocked(logic func() error) error

Jump to

Keyboard shortcuts

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