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

package consultopo

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

Package consultopo implements topo.Server with consul as the backend.

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 consul server does not contain the data
    // that the API promises. The consul 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
    // consul could cause us to panic.
    ErrBadResponse = errors.New("consul 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 ConsulVersion object.

type ClientAuthCred Uses

type ClientAuthCred struct {
    // ACLToken when provided, the client will use this token when making requests to the Consul server.
    ACLToken string `json:"acl_token,omitempty"`
}

ClientAuthCred credential to use for consul clusters

type ConsulVersion Uses

type ConsulVersion uint64

ConsulVersion is consul's idea of a version. It implements topo.Version. We use the native consul version type, uint64.

func (ConsulVersion) String Uses

func (v ConsulVersion) 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 consul.

func NewServer Uses

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

NewServer returns a new consultopo.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 consultopo imports 15 packages (graph) and is imported by 2 packages. Updated 2019-07-16. Refresh now. Tools for package owners.