go-vitess.v1: gopkg.in/src-d/go-vitess.v1/vt/topo/etcd2topo Index | Files

package etcd2topo

import "gopkg.in/src-d/go-vitess.v1/vt/topo/etcd2topo"

Package etcd2topo implements topo.Server with etcd as the backend.

We expect the following behavior from the etcd client library:

- Get and Delete return ErrorCodeKeyNotFound if the node doesn't exist.
- Create returns ErrorCodeNodeExist if the node already exists.
- Intermediate directories are always created automatically if necessary.
- Set returns ErrorCodeKeyNotFound if the node doesn't exist already.
- It returns ErrorCodeTestFailed if the provided version index doesn't match.

We follow these conventions within this package:

- Call convertError(err) on any errors returned from the etcd client library.
  Functions defined in this package can be assumed to have already converted
  errors as necessary.

Index

Package Files

config.go directory.go election.go error.go file.go lock.go server.go version.go watch.go

Variables

var (
    // ErrBadResponse is returned from this package if the response from the etcd
    // server does not contain the data that the API promises. The etcd client
    // unmarshals JSON from the server into a Response struct that uses pointers,
    // so we need to check for nil pointers, or else a misbehaving etcd could
    // cause us to panic.
    ErrBadResponse = errors.New("etcd request returned success, but response is missing required data")
)

Errors specific to this package.

func VersionFromInt Uses

func VersionFromInt(version int64) topo.Version

VersionFromInt is used by old-style functions to create a proper Version: if version is -1, returns nil. Otherwise returns the EtcdVersion object.

type EtcdVersion Uses

type EtcdVersion int64

EtcdVersion is etcd's idea of a version. It implements topo.Version. We use the native etcd version type, int64.

func (EtcdVersion) String Uses

func (v EtcdVersion) String() string

String is part of the topo.Version interface.

type Factory Uses

type Factory struct{}

Factory is the consul topo.Factory implementation.

func (Factory) Create Uses

func (f Factory) Create(cell, serverAddr, root string) (topo.Conn, error)

Create is part of the topo.Factory interface.

func (Factory) HasGlobalReadOnlyCell Uses

func (f Factory) HasGlobalReadOnlyCell(serverAddr, root string) bool

HasGlobalReadOnlyCell is part of the topo.Factory interface.

type Server Uses

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

Server is the implementation of topo.Server for etcd.

func NewServer Uses

func NewServer(serverAddr, root string) (*Server, error)

NewServer returns a new etcdtopo.Server.

func (*Server) Close Uses

func (s *Server) Close()

Close implements topo.Server.Close. It will nil out the global and cells fields, so any attempt to re-use this server will panic.

func (*Server) Create Uses

func (s *Server) Create(ctx context.Context, filePath string, contents []byte) (topo.Version, error)

Create is part of the topo.Conn interface.

func (*Server) Delete Uses

func (s *Server) Delete(ctx context.Context, filePath string, version topo.Version) error

Delete is part of the topo.Conn interface.

func (*Server) Get Uses

func (s *Server) Get(ctx context.Context, filePath string) ([]byte, topo.Version, error)

Get is part of the topo.Conn interface.

func (*Server) ListDir Uses

func (s *Server) ListDir(ctx context.Context, dirPath string, full bool) ([]topo.DirEntry, error)

ListDir is part of the topo.Conn interface.

func (*Server) Lock Uses

func (s *Server) Lock(ctx context.Context, dirPath, contents string) (topo.LockDescriptor, error)

Lock is part of the topo.Conn interface.

func (*Server) NewMasterParticipation Uses

func (s *Server) NewMasterParticipation(name, id string) (topo.MasterParticipation, error)

NewMasterParticipation is part of the topo.Server interface

func (*Server) Update Uses

func (s *Server) Update(ctx context.Context, filePath string, contents []byte, version topo.Version) (topo.Version, error)

Update is part of the topo.Conn interface.

func (*Server) Watch Uses

func (s *Server) Watch(ctx context.Context, filePath string) (*topo.WatchData, <-chan *topo.WatchData, topo.CancelFunc)

Watch is part of the topo.Conn interface.

Package etcd2topo imports 16 packages (graph) and is imported by 2 packages. Updated 2019-06-13. Refresh now. Tools for package owners.