etcd

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEtcdEmbedConfig

func NewEtcdEmbedConfig(ctx *Context) (*embed.Config, error)

Types

type Client

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

func (*Client) Close

func (c *Client) Close()

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)

func (*Client) GetBackupMeta

func (c *Client) GetBackupMeta(key polypb.BackupMetaKey) (polypb.BackupMetaSlice, error)

func (*Client) GetNodeMeta

func (c *Client) GetNodeMeta(key polypb.NodeMetaKey) ([]*polypb.NodeMeta, error)

func (*Client) Locker

func (c *Client) Locker(key string) sync.Locker

func (*Client) Put

func (c *Client) Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)

func (*Client) PutBackupMeta

func (c *Client) PutBackupMeta(key polypb.BackupMetaKey, meta *polypb.BackupMeta) error

func (*Client) PutNodeMeta

func (c *Client) PutNodeMeta(key polypb.NodeMetaKey, meta *polypb.NodeMeta) error

func (*Client) RemoveBackupMeta

func (c *Client) RemoveBackupMeta(key polypb.BackupMetaKey) error

func (*Client) RemoveNodeMeta

func (c *Client) RemoveNodeMeta(key polypb.NodeMetaKey) error

func (*Client) UpdateLSN

func (c *Client) UpdateLSN(key polypb.BackupMetaKey, lsn string) error

type ClientAPI

type ClientAPI interface {
	GetBackupMeta(key polypb.BackupMetaKey) (polypb.BackupMetaSlice, error)
	PutBackupMeta(key polypb.BackupMetaKey, meta *polypb.BackupMeta) error
	RemoveBackupMeta(key polypb.BackupMetaKey) error
	UpdateLSN(key polypb.BackupMetaKey, lsn string) error

	GetNodeMeta(key polypb.NodeMetaKey) ([]*polypb.NodeMeta, error)
	PutNodeMeta(key polypb.NodeMetaKey, meta *polypb.NodeMeta) error
	RemoveNodeMeta(key polypb.NodeMetaKey) error
	//Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)
	//Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)
	//Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)
	//Locker(key string) sync.Locker
	Close()
}

func NewClient

func NewClient(cfg clientv3.Config) (ClientAPI, error)

func NewTestClient

func NewTestClient(cli *clientv3.Client) (ClientAPI, error)

type Context

type Context struct {
	Host       string
	ClientPort string
	PeerPort   string
	DataDir    string
	JoinAddr   string
	NodeID     polypb.NodeID
}

func (*Context) AddMember

func (c *Context) AddMember(peerUrl string) (string, error)

type EtcdServer

type EtcdServer struct {
	Server *embed.Etcd

	ClientPort string
	// contains filtered or unexported fields
}

func NewEtcdServer

func NewEtcdServer(cfg *embed.Config) (*EtcdServer, error)

func (*EtcdServer) Close

func (e *EtcdServer) Close()

type FakeClient

type FakeClient struct {
}

Jump to

Keyboard shortcuts

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