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

package topo

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

Package topo is the module responsible for interacting with the topology service. It uses one Conn connection to the global topo service (with possibly another one to a read-only version of the global topo service), and one to each cell topo service.

It contains the plug-in interfaces Conn, Factory and Version that topo implementations will use. We support Zookeeper, etcd, consul as real topo servers, and in-memory, tee as test and utility topo servers. Implementations are in sub-directories here.

In tests, we do not mock this package. Instead, we just use a memorytopo.

We also support copying data across topo servers (using helpers/copy.go and the topo2topo cmd binary), and writing to two topo servers at the same time (using helpers/tee.go). This is to facilitate migrations between topo servers.

There are two test sub-packages associated with this code: - test/ contains a test suite that is run against all of our implementations.

It just performs a bunch of common topo server activities (create, list,
delete various objects, ...). If a topo implementation passes all these
tests, it most likely will work as expected in a real deployment.

- topotests/ contains tests that use a memorytopo to test the code in this

package.

Index

Package Files

cell_info.go cells_aliases.go conn.go errors.go keyspace.go locks.go replication.go server.go shard.go srv_keyspace.go srv_vschema.go stats_conn.go tablet.go vschema.go wildcards.go workflow.go

Constants

const (
    NodeExists = ErrorCode(iota)
    NoNode
    NodeNotEmpty
    Timeout
    Interrupted
    BadVersion
    PartialResult
    NoUpdateNeeded
    NoImplementation
)

The following is the list of error codes.

const (
    // GlobalCell is the name of the global cell.  It is special
    // as it contains the global topology, and references the other cells.
    GlobalCell = "global"

    // GlobalReadOnlyCell is the name of the global read-only cell
    // connection cell name.
    GlobalReadOnlyCell = "global-read-only"
)
const (
    CellInfoFile         = "CellInfo"
    CellsAliasFile       = "CellsAlias"
    KeyspaceFile         = "Keyspace"
    ShardFile            = "Shard"
    VSchemaFile          = "VSchema"
    ShardReplicationFile = "ShardReplication"
    TabletFile           = "Tablet"
    SrvVSchemaFile       = "SrvVSchema"
    SrvKeyspaceFile      = "SrvKeyspace"
    RoutingRulesFile     = "RoutingRules"
)

Filenames for all object types.

const (
    CellsPath        = "cells"
    CellsAliasesPath = "cells_aliases"
    KeyspacesPath    = "keyspaces"
    ShardsPath       = "shards"
    TabletsPath      = "tablets"
)

Path for all object types.

Variables

var (

    // RemoteOperationTimeout is used for operations where we have to
    // call out to another process.
    // Used for RPC calls (including topo server calls)
    RemoteOperationTimeout = flag.Duration("remote_operation_timeout", 30*time.Second, "time to wait for a remote operation")
)

func CheckKeyspaceLocked Uses

func CheckKeyspaceLocked(ctx context.Context, keyspace string) error

CheckKeyspaceLocked can be called on a context to make sure we have the lock for a given keyspace.

func CheckShardLocked Uses

func CheckShardLocked(ctx context.Context, keyspace, shard string) error

CheckShardLocked can be called on a context to make sure we have the lock for a given shard.

func DeleteTabletReplicationData Uses

func DeleteTabletReplicationData(ctx context.Context, ts *Server, tablet *topodatapb.Tablet) error

DeleteTabletReplicationData deletes replication data.

func DirEntriesSortByName Uses

func DirEntriesSortByName(entries []DirEntry)

DirEntriesSortByName sorts a slice of DirEntry objects by Name.

func DirEntriesToStringArray Uses

func DirEntriesToStringArray(entries []DirEntry) []string

DirEntriesToStringArray is a helper method to extract the names from an []DirEntry

func FixShardReplication Uses

func FixShardReplication(ctx context.Context, ts *Server, logger logutil.Logger, cell, keyspace, shard string) error

FixShardReplication will fix the first problem it encounters within a ShardReplication object.

func GetAliasByCell Uses

func GetAliasByCell(ctx context.Context, ts *Server, cell string) string

GetAliasByCell returns the alias group this `cell` belongs to, if there's none, it returns the `cell` as alias.

func InCellList Uses

func InCellList(cell string, cells []string) bool

InCellList returns true if the cell list is empty, or if the passed cell is in the cell list.

func IsErrType Uses

func IsErrType(err error, code ErrorCode) bool

IsErrType returns true if the error has the specified ErrorCode.

func IsInServingGraph Uses

func IsInServingGraph(tt topodatapb.TabletType) bool

IsInServingGraph returns if a tablet appears in the serving graph

func IsRunningQueryService Uses

func IsRunningQueryService(tt topodatapb.TabletType) bool

IsRunningQueryService returns if a tablet is running the query service

func IsRunningUpdateStream Uses

func IsRunningUpdateStream(tt topodatapb.TabletType) bool

IsRunningUpdateStream returns if a tablet is running the update stream RPC service.

func IsShardUsingRangeBasedSharding Uses

func IsShardUsingRangeBasedSharding(shard string) bool

IsShardUsingRangeBasedSharding returns true if the shard name implies it is using range based sharding.

func IsSlaveType Uses

func IsSlaveType(tt topodatapb.TabletType) bool

IsSlaveType returns if this type should be connected to a master db and actively replicating? MASTER is not obviously (only support one level replication graph) BACKUP, RESTORE, DRAINED may or may not be, but we don't know for sure

func IsSubjectToLameduck Uses

func IsSubjectToLameduck(tt topodatapb.TabletType) bool

IsSubjectToLameduck returns if a tablet is subject to being lameduck. Lameduck is a transition period where we are still allowed to serve, but we tell the clients we are going away soon. Typically, a vttablet will still serve, but broadcast a non-serving state through its health check. then vtgate will ctahc that non-serving state, and stop sending queries.

Masters are not subject to lameduck, as we usually want to transition them as fast as possible.

Replica and rdonly will use lameduck when going from healthy to unhealhty (either because health check fails, or they're shutting down).

Other types are probably not serving user visible traffic, so they need to transition as fast as possible too.

func IsTrivialTypeChange Uses

func IsTrivialTypeChange(oldTabletType, newTabletType topodatapb.TabletType) bool

IsTrivialTypeChange returns if this db type be trivially reassigned without changes to the replication graph

func NewError Uses

func NewError(code ErrorCode, node string) error

NewError creates a new topo error.

func NewTablet Uses

func NewTablet(uid uint32, cell, host string) *topodatapb.Tablet

NewTablet create a new Tablet record with the given id, cell, and hostname.

func OrderAndCheckPartitions Uses

func OrderAndCheckPartitions(cell string, srvKeyspace *topodatapb.SrvKeyspace) error

OrderAndCheckPartitions will re-order the partition list, and check it's correct.

func RegisterFactory Uses

func RegisterFactory(name string, factory Factory)

RegisterFactory registers a Factory for an implementation for a Server. If an implementation with that name already exists, it log.Fatals out. Call this in the 'init' function in your topology implementation module.

func RemoveShardReplicationRecord Uses

func RemoveShardReplicationRecord(ctx context.Context, ts *Server, cell, keyspace, shard string, tabletAlias *topodatapb.TabletAlias) error

RemoveShardReplicationRecord is a low level function to remove an entry from the ShardReplication object.

func ShardIsServing Uses

func ShardIsServing(srvKeyspace *topodatapb.SrvKeyspace, shard *topodatapb.Shard) bool

ShardIsServing returns true if this shard is found in any of the partitions in the srvKeyspace

func TabletEquality Uses

func TabletEquality(left, right *topodatapb.Tablet) bool

TabletEquality returns true iff two Tablet are representing the same tablet process: same uid/cell, running on the same host / ports.

func UpdateShardReplicationRecord Uses

func UpdateShardReplicationRecord(ctx context.Context, ts *Server, keyspace, shard string, tabletAlias *topodatapb.TabletAlias) error

UpdateShardReplicationRecord is a low level function to add / update an entry to the ShardReplication object.

func UpdateTabletReplicationData Uses

func UpdateTabletReplicationData(ctx context.Context, ts *Server, tablet *topodatapb.Tablet) error

UpdateTabletReplicationData creates or updates the replication graph data for a tablet

func Validate Uses

func Validate(ctx context.Context, ts *Server, tabletAlias *topodatapb.TabletAlias) error

Validate makes sure a tablet is represented correctly in the topology server.

func ValidateShardName Uses

func ValidateShardName(shard string) (string, *topodatapb.KeyRange, error)

ValidateShardName takes a shard name and sanitizes it, and also returns the KeyRange.

type CancelFunc Uses

type CancelFunc func()

CancelFunc is returned by the Watch method.

type Conn Uses

type Conn interface {

    // ListDir returns the entries in a directory.  The returned
    // list should be sorted by entry.Name.
    // If there are no files under the provided path, returns ErrNoNode.
    // dirPath is a path relative to the root directory of the cell.
    // If full is set, we want all the fields in DirEntry to be filled in.
    // If full is not set, only Name will be used. This is intended for
    // implementations where getting more than the names is more expensive,
    // as in most cases only the names are needed.
    ListDir(ctx context.Context, dirPath string, full bool) ([]DirEntry, error)

    // Create creates the initial version of a file.
    // Returns ErrNodeExists if the file exists.
    // filePath is a path relative to the root directory of the cell.
    Create(ctx context.Context, filePath string, contents []byte) (Version, error)

    // Update updates the file with the provided filename with the
    // new content.
    // If version is nil, it is an unconditional update
    // (which is then the same as a Create is the file doesn't exist).
    // filePath is a path relative to the root directory of the cell.
    // It returns the new Version of the file after update.
    // Returns ErrBadVersion if the provided version is not current.
    Update(ctx context.Context, filePath string, contents []byte, version Version) (Version, error)

    // Get returns the content and version of a file.
    // filePath is a path relative to the root directory of the cell.
    // Can return ErrNoNode if the file doesn't exist.
    Get(ctx context.Context, filePath string) ([]byte, Version, error)

    // Delete deletes the provided file.
    // If version is nil, it is an unconditional delete.
    // If the last entry of a directory is deleted, using ListDir
    // on its parent directory should not return the directory.
    // For instance, when deleting /keyspaces/aaa/Keyspace, and if
    // there is no other file in /keyspaces/aaa, then aaa should not
    // appear any more when listing /keyspaces.
    // filePath is a path relative to the root directory of the cell.
    //
    // Delete will never be called on a directory.
    // Returns ErrNodeExists if the file doesn't exist.
    // Returns ErrBadVersion if the provided version is not current.
    Delete(ctx context.Context, filePath string, version Version) error

    // Lock takes a lock on the given directory.
    // It does not prevent any modification to any file in the topology.
    // It just prevents two concurrent processes (wherever they are)
    // to run concurrently. It is used for instance to make sure only
    // one reparent operation is running on a Shard at a given time.
    // dirPath is the directory associated with a resource, for instance
    // a Keyspace or a Shard. It is not a file location.
    // (this means the implementation can for instance create a
    // file in this directory to materialize the lock).
    // contents describes the lock holder and purpose, but has no other
    // meaning, so it can be used as a lock file contents, for instance.
    // Returns ErrNoNode if the directory doesn't exist (meaning
    //   there is no existing file under that directory).
    // Returns ErrTimeout if ctx expires.
    // Returns ErrInterrupted if ctx is canceled.
    Lock(ctx context.Context, dirPath, contents string) (LockDescriptor, error)

    // Watch starts watching a file in the provided cell.  It
    // returns the current value, a 'changes' channel to read the
    // changes from, and a 'cancel' function to call to stop the
    // watch.  If the initial read fails, or the file doesn't
    // exist, current.Err is set, and 'changes'/'cancel' are nil.
    // Otherwise current.Err is nil, and current.Contents /
    // current.Version are accurate. The provided context is only
    // used to setup the current watch, and not after Watch()
    // returns.
    //
    // To stop the watch, just call the returned 'cancel' function.
    // This will eventually result in a final WatchData result with Err =
    // ErrInterrupted. It should be safe to call the 'cancel' function
    // multiple times, or after the Watch already errored out.
    //
    // The 'changes' channel may return a record with Err != nil.
    // In that case, the channel will also be closed right after
    // that record.  In any case, 'changes' has to be drained of
    // all events, even when 'stop' is closed.
    //
    // Note the 'changes' channel can return twice the same
    // Version/Contents (for instance, if the watch is interrupted
    // and restarted within the Conn implementation).
    // Similarly, the 'changes' channel may skip versions / changes
    // (that is, if value goes [A, B, C, D, E, F], the watch may only
    // receive [A, B, F]). This should only happen for rapidly
    // changing values though. Usually, the initial value will come
    // back right away. And a stable value (that hasn't changed for
    // a while) should be seen shortly.
    //
    // The Watch call is not guaranteed to return exactly up to
    // date data right away. For instance, if a file is created
    // and saved, and then a watch is set on that file, it may
    // return ErrNoNode (as the underlying configuration service
    // may use asynchronous caches that are not up to date
    // yet). The only guarantee is that the watch data will
    // eventually converge. Vitess doesn't explicitly depend on the data
    // being correct quickly, as long as it eventually gets there.
    //
    // filePath is a path relative to the root directory of the cell.
    Watch(ctx context.Context, filePath string) (current *WatchData, changes <-chan *WatchData, cancel CancelFunc)

    // NewMasterParticipation creates a MasterParticipation
    // object, used to become the Master in an election for the
    // provided group name.  Id is the name of the local process,
    // passing in the hostname:port of the current process as id
    // is the common usage. Id must be unique for each process
    // calling this, for a given name. Calling this function does
    // not make the current process a candidate for the election.
    NewMasterParticipation(name, id string) (MasterParticipation, error)

    // Close closes the connection to the server.
    Close()
}

Conn defines the interface that must be implemented by topology plug-ins to be used with Vitess.

Zookeeper is a good example of an implementation, as defined in go/vt/topo/zk2topo.

This API is very generic, and key/value store oriented. We use regular paths for object names, and we can list all immediate children of a path. All paths sent through this API are relative paths, from the root directory of the cell.

The Conn objects are created by the Factory implementations.

type DirEntry Uses

type DirEntry struct {
    // Name is the name of the entry.
    // Always filled in.
    Name string

    // Type is the DirEntryType of the entry.
    // Only filled in if full is true.
    Type DirEntryType

    // Ephemeral is set if the directory / file only contains
    // data that was not set by the file API, like lock files
    // or master-election related files.
    // Only filled in if full is true.
    Ephemeral bool
}

DirEntry is an entry in a directory, as returned by ListDir.

type DirEntryType Uses

type DirEntryType int

DirEntryType is the type of an entry in a directory.

const (
    // TypeDirectory describes a directory.
    TypeDirectory DirEntryType = iota

    // TypeFile describes a file.
    TypeFile
)

type Error Uses

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

Error represents a topo error.

func (Error) Error Uses

func (e Error) Error() string

Error satisfies error.

type ErrorCode Uses

type ErrorCode int

ErrorCode is the error code for topo errors.

type Factory Uses

type Factory interface {
    // HasGlobalReadOnlyCell returns true if the global cell
    // has read-only replicas of the topology data. The global topology
    // is usually more expensive to read from / write to, as it is
    // replicated over many cells. Some topology services provide
    // more efficient way to read the data, like Observer servers
    // for Zookeeper. If this returns true, we will maintain
    // two connections for the global topology: the 'global' cell
    // for consistent reads and writes, and the 'global-read-only'
    // cell for reads only.
    HasGlobalReadOnlyCell(serverAddr, root string) bool

    // Create creates a topo.Conn object.
    Create(cell, serverAddr, root string) (Conn, error)
}

Factory is a factory interface to create Conn objects. Topo implementations will provide an implementation for this.

type KeyspaceInfo Uses

type KeyspaceInfo struct {
    *topodatapb.Keyspace
    // contains filtered or unexported fields
}

KeyspaceInfo is a meta struct that contains metadata to give the data more context and convenience. This is the main way we interact with a keyspace.

func (*KeyspaceInfo) CheckServedFromMigration Uses

func (ki *KeyspaceInfo) CheckServedFromMigration(tabletType topodatapb.TabletType, cells []string, keyspace string, remove bool) error

CheckServedFromMigration makes sure a requested migration is safe

func (*KeyspaceInfo) ComputeCellServedFrom Uses

func (ki *KeyspaceInfo) ComputeCellServedFrom(cell string) []*topodatapb.SrvKeyspace_ServedFrom

ComputeCellServedFrom returns the ServedFrom list for a cell

func (*KeyspaceInfo) GetServedFrom Uses

func (ki *KeyspaceInfo) GetServedFrom(tabletType topodatapb.TabletType) *topodatapb.Keyspace_ServedFrom

GetServedFrom returns a Keyspace_ServedFrom record if it exists.

func (*KeyspaceInfo) KeyspaceName Uses

func (ki *KeyspaceInfo) KeyspaceName() string

KeyspaceName returns the keyspace name

func (*KeyspaceInfo) UpdateServedFromMap Uses

func (ki *KeyspaceInfo) UpdateServedFromMap(tabletType topodatapb.TabletType, cells []string, keyspace string, remove bool, allCells []string) error

UpdateServedFromMap handles ServedFromMap. It can add or remove records, cells, ...

type KeyspaceShard Uses

type KeyspaceShard struct {
    Keyspace string
    Shard    string
}

KeyspaceShard is a type used by ResolveShardWildcard

type Lock Uses

type Lock struct {
    // Action and the following fields are set at construction time.
    Action   string
    HostName string
    UserName string
    Time     string

    // Status is the current status of the Lock.
    Status string
}

Lock describes a long-running lock on a keyspace or a shard. It needs to be public as we JSON-serialize it.

func (*Lock) ToJSON Uses

func (l *Lock) ToJSON() (string, error)

ToJSON returns a JSON representation of the object.

type LockDescriptor Uses

type LockDescriptor interface {
    // Check returns an error if the lock was lost.
    // Some topology implementations use a keep-alive mechanism, and
    // sometimes it fails. The users of the lock are responsible for
    // checking on it when convenient.
    Check(ctx context.Context) error

    // Unlock releases the lock.
    Unlock(ctx context.Context) error
}

LockDescriptor is an interface that describes a lock. It will be returned by Lock().

type MasterParticipation Uses

type MasterParticipation interface {
    // WaitForMastership makes the current process a candidate
    // for election, and waits until this process is the master.
    // After we become the master, we may lose mastership. In that case,
    // the returned context will be canceled. If Stop was called,
    // WaitForMastership will return nil, ErrInterrupted.
    WaitForMastership() (context.Context, error)

    // Stop is called when we don't want to participate in the
    // master election any more. Typically, that is when the
    // hosting process is terminating.  We will relinquish
    // mastership at that point, if we had it. Stop should
    // not return until everything has been done.
    // The MasterParticipation object should be discarded
    // after Stop has been called. Any call to WaitForMastership
    // after Stop() will return nil, ErrInterrupted.
    // If WaitForMastership() was running, it will return
    // nil, ErrInterrupted as soon as possible.
    Stop()

    // GetCurrentMasterID returns the current master id.
    // This may not work after Stop has been called.
    GetCurrentMasterID(ctx context.Context) (string, error)
}

MasterParticipation is the object returned by NewMasterParticipation. Sample usage:

mp := server.NewMasterParticipation("vtctld", "hostname:8080") job := NewJob() go func() {

for {
  ctx, err := mp.WaitForMastership()
  switch err {
  case nil:
    job.RunUntilContextDone(ctx)
  case topo.ErrInterrupted:
    return
  default:
    log.Errorf("Got error while waiting for master, will retry in 5s: %v", err)
    time.Sleep(5 * time.Second)
  }
}

}()

http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {

if job.Running() {
  job.WriteStatus(w, r)
} else {
  http.Redirect(w, r, mp.GetCurrentMasterID(context.Background()), http.StatusFound)
}

})

servenv.OnTermSync(func() {

mp.Stop()

})

type Server Uses

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

Server is the main topo.Server object. We support two ways of creating one: 1. From an implementation, server address, and root path.

This uses a plugin mechanism, and we have implementations for
etcd, zookeeper and consul.

2. Specific implementations may have higher level creation methods

(in which case they may provide a more complex Factory).
We support memorytopo (for tests and processes that only need an
in-memory server), and tee (a helper implementation to transition
between one server implementation and another).

func NewWithFactory Uses

func NewWithFactory(factory Factory, serverAddress, root string) (*Server, error)

NewWithFactory creates a new Server based on the given Factory. It also opens the global cell connection.

func Open Uses

func Open() *Server

Open returns a Server using the command line parameter flags for implementation, address and root. It log.Exits out if an error occurs.

func OpenServer Uses

func OpenServer(implementation, serverAddress, root string) (*Server, error)

OpenServer returns a Server using the provided implementation, address and root for the global server.

func (*Server) AddSrvKeyspacePartitions Uses

func (ts *Server) AddSrvKeyspacePartitions(ctx context.Context, keyspace string, shards []*ShardInfo, tabletType topodatapb.TabletType, cells []string) (err error)

AddSrvKeyspacePartitions adds partitions to srvKeyspace

func (*Server) Close Uses

func (ts *Server) Close()

Close will close all connections to underlying topo Server. It will nil all member variables, so any further access will panic.

func (*Server) ConnForCell Uses

func (ts *Server) ConnForCell(ctx context.Context, cell string) (Conn, error)

ConnForCell returns a Conn object for the given cell. It caches Conn objects from previously requested cells.

func (*Server) CreateCellInfo Uses

func (ts *Server) CreateCellInfo(ctx context.Context, cell string, ci *topodatapb.CellInfo) error

CreateCellInfo creates a new CellInfo with the provided content.

func (*Server) CreateCellsAlias Uses

func (ts *Server) CreateCellsAlias(ctx context.Context, alias string, cellsAlias *topodatapb.CellsAlias) error

CreateCellsAlias creates a new CellInfo with the provided content.

func (*Server) CreateKeyspace Uses

func (ts *Server) CreateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace) error

CreateKeyspace wraps the underlying Conn.Create and dispatches the event.

func (*Server) CreateShard Uses

func (ts *Server) CreateShard(ctx context.Context, keyspace, shard string) (err error)

CreateShard creates a new shard and tries to fill in the right information. This will lock the Keyspace, as we may be looking at other shard servedTypes. Using GetOrCreateShard is probably a better idea for most use cases.

func (*Server) CreateTablet Uses

func (ts *Server) CreateTablet(ctx context.Context, tablet *topodatapb.Tablet) error

CreateTablet creates a new tablet and all associated paths for the replication graph.

func (*Server) CreateWorkflow Uses

func (ts *Server) CreateWorkflow(ctx context.Context, w *workflowpb.Workflow) (*WorkflowInfo, error)

CreateWorkflow creates the given workflow, and returns the initial WorkflowInfo.

func (*Server) DeleteCellInfo Uses

func (ts *Server) DeleteCellInfo(ctx context.Context, cell string) error

DeleteCellInfo deletes the specified CellInfo. We first make sure no Shard record points to the cell.

func (*Server) DeleteCellsAlias Uses

func (ts *Server) DeleteCellsAlias(ctx context.Context, alias string) error

DeleteCellsAlias deletes the specified CellsAlias

func (*Server) DeleteKeyspace Uses

func (ts *Server) DeleteKeyspace(ctx context.Context, keyspace string) error

DeleteKeyspace wraps the underlying Conn.Delete and dispatches the event.

func (*Server) DeleteKeyspaceReplication Uses

func (ts *Server) DeleteKeyspaceReplication(ctx context.Context, cell, keyspace string) error

DeleteKeyspaceReplication deletes all the ShardReplication objects for a cell/keyspace.

func (*Server) DeleteShard Uses

func (ts *Server) DeleteShard(ctx context.Context, keyspace, shard string) error

DeleteShard wraps the underlying conn.Delete and dispatches the event.

func (*Server) DeleteShardReplication Uses

func (ts *Server) DeleteShardReplication(ctx context.Context, cell, keyspace, shard string) error

DeleteShardReplication deletes a ShardReplication object.

func (*Server) DeleteSrvKeyspace Uses

func (ts *Server) DeleteSrvKeyspace(ctx context.Context, cell, keyspace string) error

DeleteSrvKeyspace deletes a SrvKeyspace.

func (*Server) DeleteSrvKeyspacePartitions Uses

func (ts *Server) DeleteSrvKeyspacePartitions(ctx context.Context, keyspace string, shards []*ShardInfo, tabletType topodatapb.TabletType, cells []string) (err error)

DeleteSrvKeyspacePartitions deletes shards from srvKeyspace partitions

func (*Server) DeleteSrvVSchema Uses

func (ts *Server) DeleteSrvVSchema(ctx context.Context, cell string) error

DeleteSrvVSchema deletes the SrvVSchema file for a cell.

func (*Server) DeleteTablet Uses

func (ts *Server) DeleteTablet(ctx context.Context, tabletAlias *topodatapb.TabletAlias) error

DeleteTablet wraps the underlying conn.Delete and dispatches the event.

func (*Server) DeleteWorkflow Uses

func (ts *Server) DeleteWorkflow(ctx context.Context, wi *WorkflowInfo) error

DeleteWorkflow deletes the specified workflow. After this, the WorkflowInfo object should not be used any more.

func (*Server) FindAllShardsInKeyspace Uses

func (ts *Server) FindAllShardsInKeyspace(ctx context.Context, keyspace string) (map[string]*ShardInfo, error)

FindAllShardsInKeyspace reads and returns all the existing shards in a keyspace. It doesn't take any lock.

func (*Server) FindAllTabletAliasesInShard Uses

func (ts *Server) FindAllTabletAliasesInShard(ctx context.Context, keyspace, shard string) ([]*topodatapb.TabletAlias, error)

FindAllTabletAliasesInShard uses the replication graph to find all the tablet aliases in the given shard.

It can return ErrPartialResult if some cells were not fetched, in which case the result only contains the cells that were fetched.

The tablet aliases are sorted by cell, then by UID.

func (*Server) FindAllTabletAliasesInShardByCell Uses

func (ts *Server) FindAllTabletAliasesInShardByCell(ctx context.Context, keyspace, shard string, cells []string) ([]*topodatapb.TabletAlias, error)

FindAllTabletAliasesInShardByCell uses the replication graph to find all the tablet aliases in the given shard.

It can return ErrPartialResult if some cells were not fetched, in which case the result only contains the cells that were fetched.

The tablet aliases are sorted by cell, then by UID.

func (*Server) GetCellInfo Uses

func (ts *Server) GetCellInfo(ctx context.Context, cell string, strongRead bool) (*topodatapb.CellInfo, error)

GetCellInfo reads a CellInfo from the global Conn.

func (*Server) GetCellInfoNames Uses

func (ts *Server) GetCellInfoNames(ctx context.Context) ([]string, error)

GetCellInfoNames returns the names of the existing cells. They are sorted by name.

func (*Server) GetCellsAliases Uses

func (ts *Server) GetCellsAliases(ctx context.Context, strongRead bool) (ret map[string]*topodatapb.CellsAlias, err error)

GetCellsAliases returns the names of the existing cells. They are sorted by name.

func (*Server) GetKeyspace Uses

func (ts *Server) GetKeyspace(ctx context.Context, keyspace string) (*KeyspaceInfo, error)

GetKeyspace reads the given keyspace and returns it

func (*Server) GetKeyspaces Uses

func (ts *Server) GetKeyspaces(ctx context.Context) ([]string, error)

GetKeyspaces returns the list of keyspaces in the topology.

func (*Server) GetKnownCells Uses

func (ts *Server) GetKnownCells(ctx context.Context) ([]string, error)

GetKnownCells returns the list of known cells. For now, it just lists the 'cells' directory in the global topology server. TODO(alainjobart) once the cell map is migrated to this generic package, we can do better than this.

func (*Server) GetOnlyShard Uses

func (ts *Server) GetOnlyShard(ctx context.Context, keyspace string) (*ShardInfo, error)

GetOnlyShard returns the single ShardInfo of an unsharded keyspace.

func (*Server) GetOrCreateShard Uses

func (ts *Server) GetOrCreateShard(ctx context.Context, keyspace, shard string) (si *ShardInfo, err error)

GetOrCreateShard will return the shard object, or create one if it doesn't already exist. Note the shard creation is protected by a keyspace Lock.

func (*Server) GetRoutingRules Uses

func (ts *Server) GetRoutingRules(ctx context.Context) (*vschemapb.RoutingRules, error)

GetRoutingRules fetches the routing rules from the topo.

func (*Server) GetShard Uses

func (ts *Server) GetShard(ctx context.Context, keyspace, shard string) (*ShardInfo, error)

GetShard is a high level function to read shard data. It generates trace spans.

func (*Server) GetShardNames Uses

func (ts *Server) GetShardNames(ctx context.Context, keyspace string) ([]string, error)

GetShardNames returns the list of shards in a keyspace.

func (*Server) GetShardReplication Uses

func (ts *Server) GetShardReplication(ctx context.Context, cell, keyspace, shard string) (*ShardReplicationInfo, error)

GetShardReplication returns the ShardReplicationInfo object.

func (*Server) GetShardServingCells Uses

func (ts *Server) GetShardServingCells(ctx context.Context, si *ShardInfo) (servingCells []string, err error)

GetShardServingCells returns cells where this shard is serving

func (*Server) GetShardServingTypes Uses

func (ts *Server) GetShardServingTypes(ctx context.Context, si *ShardInfo) (servingTypes []topodatapb.TabletType, err error)

GetShardServingTypes returns served types for given shard across all cells

func (*Server) GetSrvKeyspace Uses

func (ts *Server) GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*topodatapb.SrvKeyspace, error)

GetSrvKeyspace returns the SrvKeyspace for a cell/keyspace.

func (*Server) GetSrvKeyspaceAllCells Uses

func (ts *Server) GetSrvKeyspaceAllCells(ctx context.Context, keyspace string) ([]*topodatapb.SrvKeyspace, error)

GetSrvKeyspaceAllCells returns the SrvKeyspace for all cells

func (*Server) GetSrvKeyspaceNames Uses

func (ts *Server) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error)

GetSrvKeyspaceNames returns the SrvKeyspace objects for a cell.

func (*Server) GetSrvVSchema Uses

func (ts *Server) GetSrvVSchema(ctx context.Context, cell string) (*vschemapb.SrvVSchema, error)

GetSrvVSchema returns the SrvVSchema for a cell.

func (*Server) GetTablet Uses

func (ts *Server) GetTablet(ctx context.Context, alias *topodatapb.TabletAlias) (*TabletInfo, error)

GetTablet is a high level function to read tablet data. It generates trace spans.

func (*Server) GetTabletMap Uses

func (ts *Server) GetTabletMap(ctx context.Context, tabletAliases []*topodatapb.TabletAlias) (map[string]*TabletInfo, error)

GetTabletMap tries to read all the tablets in the provided list, and returns them all in a map. If error is ErrPartialResult, the results in the dictionary are incomplete, meaning some tablets couldn't be read. The map is indexed by topoproto.TabletAliasString(tablet alias).

func (*Server) GetTabletMapForShard Uses

func (ts *Server) GetTabletMapForShard(ctx context.Context, keyspace, shard string) (map[string]*TabletInfo, error)

GetTabletMapForShard returns the tablets for a shard. It can return ErrPartialResult if it couldn't read all the cells, or all the individual tablets, in which case the map is valid, but partial. The map is indexed by topoproto.TabletAliasString(tablet alias).

func (*Server) GetTabletMapForShardByCell Uses

func (ts *Server) GetTabletMapForShardByCell(ctx context.Context, keyspace, shard string, cells []string) (map[string]*TabletInfo, error)

GetTabletMapForShardByCell returns the tablets for a shard. It can return ErrPartialResult if it couldn't read all the cells, or all the individual tablets, in which case the map is valid, but partial. The map is indexed by topoproto.TabletAliasString(tablet alias).

func (*Server) GetTabletsByCell Uses

func (ts *Server) GetTabletsByCell(ctx context.Context, cell string) ([]*topodatapb.TabletAlias, error)

GetTabletsByCell returns all the tablets in a cell. It returns ErrNode if the cell doesn't exist. It returns (nil, nil) if the cell exists, but there are no tablets.

func (*Server) GetVSchema Uses

func (ts *Server) GetVSchema(ctx context.Context, keyspace string) (*vschemapb.Keyspace, error)

GetVSchema fetches the vschema from the topo.

func (*Server) GetWorkflow Uses

func (ts *Server) GetWorkflow(ctx context.Context, uuid string) (*WorkflowInfo, error)

GetWorkflow reads a workflow from the global cell.

func (*Server) GetWorkflowNames Uses

func (ts *Server) GetWorkflowNames(ctx context.Context) ([]string, error)

GetWorkflowNames returns the names of the existing workflows. They are sorted by uuid.

func (*Server) LockKeyspace Uses

func (ts *Server) LockKeyspace(ctx context.Context, keyspace, action string) (context.Context, func(*error), error)

LockKeyspace will lock the keyspace, and return: - a context with a locksInfo structure for future reference. - an unlock method - an error if anything failed.

We lock a keyspace for the following operations to be guaranteed exclusive operation: * changing a keyspace sharding info fields (is this one necessary?) * changing a keyspace 'ServedFrom' field (is this one necessary?) * resharding operations:

* horizontal resharding: includes changing the shard's 'ServedType',
  as well as the associated horizontal resharding operations.
* vertical resharding: includes changing the keyspace 'ServedFrom'
  field, as well as the associated vertical resharding operations.
* 'vtctl SetShardIsMasterServing' emergency operations
* 'vtctl SetShardTabletControl' emergency operations
* 'vtctl SourceShardAdd' and 'vtctl SourceShardDelete' emergency operations

* keyspace-wide schema changes

func (*Server) LockShard Uses

func (ts *Server) LockShard(ctx context.Context, keyspace, shard, action string) (context.Context, func(*error), error)

LockShard will lock the shard, and return: - a context with a locksInfo structure for future reference. - an unlock method - an error if anything failed.

We are currently only using this method to lock actions that would impact each-other. Most changes of the Shard object are done by UpdateShardFields, which is not locking the shard object. The current list of actions that lock a shard are: * all Vitess-controlled re-parenting operations:

* InitShardMaster
* PlannedReparentShard
* EmergencyReparentShard

* operations that we don't want to conflict with re-parenting:

* DeleteTablet when it's the shard's current master

func (*Server) MigrateServedType Uses

func (ts *Server) MigrateServedType(ctx context.Context, keyspace string, shardsToAdd, shardsToRemove []*ShardInfo, tabletType topodatapb.TabletType, cells []string) (err error)

MigrateServedType removes/adds shards from srvKeyspace when migrating a served type.

func (*Server) ResolveKeyspaceWildcard Uses

func (ts *Server) ResolveKeyspaceWildcard(ctx context.Context, param string) ([]string, error)

ResolveKeyspaceWildcard will resolve keyspace wildcards. - If the param is not a wildcard, it will just be returned (if the keyspace

doesn't exist, it is still returned).

- If the param is a wildcard, it will get all keyspaces and returns

the ones which match the wildcard (which may be an empty list).

func (*Server) ResolveShardWildcard Uses

func (ts *Server) ResolveShardWildcard(ctx context.Context, param string) ([]KeyspaceShard, error)

ResolveShardWildcard will resolve shard wildcards. Both keyspace and shard names can use wildcard. Errors talking to the topology server are returned. ErrNoNode is ignored if it's the result of resolving a wildcard. Examples: - */* returns all keyspace/shard pairs, or empty list if none. - user/* returns all shards in user keyspace (or error if user keyspace

doesn't exist)

- us*/* returns all shards in all keyspaces that start with 'us'. If no such

keyspace exists, list is empty (it is not an error).

func (*Server) ResolveWildcards Uses

func (ts *Server) ResolveWildcards(ctx context.Context, cell string, paths []string) ([]string, error)

ResolveWildcards resolves paths like: /keyspaces/*/Keyspace into real existing paths

If you send paths that don't contain any wildcard and don't exist, this function will return an empty array.

func (*Server) SaveRoutingRules Uses

func (ts *Server) SaveRoutingRules(ctx context.Context, routingRules *vschemapb.RoutingRules) error

SaveRoutingRules saves the routing rules into the topo.

func (*Server) SaveVSchema Uses

func (ts *Server) SaveVSchema(ctx context.Context, keyspace string, vschema *vschemapb.Keyspace) error

SaveVSchema first validates the VSchema, then saves it. If the VSchema is empty, just remove it.

func (*Server) SaveWorkflow Uses

func (ts *Server) SaveWorkflow(ctx context.Context, wi *WorkflowInfo) error

SaveWorkflow saves the WorkflowInfo object. If the version is not good any more, ErrBadVersion is returned.

func (*Server) UpdateCellInfoFields Uses

func (ts *Server) UpdateCellInfoFields(ctx context.Context, cell string, update func(*topodatapb.CellInfo) error) error

UpdateCellInfoFields is a high level helper method to read a CellInfo object, update its fields, and then write it back. If the write fails due to a version mismatch, it will re-read the record and retry the update. If the update method returns ErrNoUpdateNeeded, nothing is written, and nil is returned.

func (*Server) UpdateCellsAlias Uses

func (ts *Server) UpdateCellsAlias(ctx context.Context, alias string, update func(*topodatapb.CellsAlias) error) error

UpdateCellsAlias updates cells for a given alias

func (*Server) UpdateDisableQueryService Uses

func (ts *Server) UpdateDisableQueryService(ctx context.Context, keyspace string, shards []*ShardInfo, tabletType topodatapb.TabletType, cells []string, disableQueryService bool) (err error)

UpdateDisableQueryService will make sure the disableQueryService is set appropriately in tablet controls in srvKeyspace.

func (*Server) UpdateKeyspace Uses

func (ts *Server) UpdateKeyspace(ctx context.Context, ki *KeyspaceInfo) error

UpdateKeyspace updates the keyspace data. It checks the keyspace is locked.

func (*Server) UpdateShardFields Uses

func (ts *Server) UpdateShardFields(ctx context.Context, keyspace, shard string, update func(*ShardInfo) error) (*ShardInfo, error)

UpdateShardFields is a high level helper to read a shard record, call an update function on it, and then write it back. If the write fails due to a version mismatch, it will re-read the record and retry the update. If the update succeeds, it returns the updated ShardInfo. If the update method returns ErrNoUpdateNeeded, nothing is written, and nil,nil is returned.

Note the callback method takes a ShardInfo, so it can get the keyspace and shard from it, or use all the ShardInfo methods.

func (*Server) UpdateShardReplicationFields Uses

func (ts *Server) UpdateShardReplicationFields(ctx context.Context, cell, keyspace, shard string, update func(*topodatapb.ShardReplication) error) error

UpdateShardReplicationFields updates the fields inside a topo.ShardReplication object.

func (*Server) UpdateSrvKeyspace Uses

func (ts *Server) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, srvKeyspace *topodatapb.SrvKeyspace) error

UpdateSrvKeyspace saves a new SrvKeyspace. It is a blind write.

func (*Server) UpdateSrvVSchema Uses

func (ts *Server) UpdateSrvVSchema(ctx context.Context, cell string, srvVSchema *vschemapb.SrvVSchema) error

UpdateSrvVSchema updates the SrvVSchema file for a cell.

func (*Server) UpdateTablet Uses

func (ts *Server) UpdateTablet(ctx context.Context, ti *TabletInfo) error

UpdateTablet updates the tablet data only - not associated replication paths. It also uses a span, and sends the event.

func (*Server) UpdateTabletFields Uses

func (ts *Server) UpdateTabletFields(ctx context.Context, alias *topodatapb.TabletAlias, update func(*topodatapb.Tablet) error) (*topodatapb.Tablet, error)

UpdateTabletFields is a high level helper to read a tablet record, call an update function on it, and then write it back. If the write fails due to a version mismatch, it will re-read the record and retry the update. If the update succeeds, it returns the updated tablet. If the update method returns ErrNoUpdateNeeded, nothing is written, and nil,nil is returned.

func (*Server) WatchSrvKeyspace Uses

func (ts *Server) WatchSrvKeyspace(ctx context.Context, cell, keyspace string) (*WatchSrvKeyspaceData, <-chan *WatchSrvKeyspaceData, CancelFunc)

WatchSrvKeyspace will set a watch on the SrvKeyspace object. It has the same contract as Conn.Watch, but it also unpacks the contents into a SrvKeyspace object.

func (*Server) WatchSrvVSchema Uses

func (ts *Server) WatchSrvVSchema(ctx context.Context, cell string) (*WatchSrvVSchemaData, <-chan *WatchSrvVSchemaData, CancelFunc)

WatchSrvVSchema will set a watch on the SrvVSchema object. It has the same contract as Conn.Watch, but it also unpacks the contents into a SrvVSchema object.

type ShardInfo Uses

type ShardInfo struct {
    *topodatapb.Shard
    // contains filtered or unexported fields
}

ShardInfo is a meta struct that contains metadata to give the data more context and convenience. This is the main way we interact with a shard.

func NewShardInfo Uses

func NewShardInfo(keyspace, shard string, value *topodatapb.Shard, version Version) *ShardInfo

NewShardInfo returns a ShardInfo basing on shard with the keyspace / shard. This function should be only used by Server implementations.

func (*ShardInfo) GetServedType Uses

func (si *ShardInfo) GetServedType(tabletType topodatapb.TabletType) *topodatapb.Shard_ServedType

GetServedType returns the Shard_ServedType for a TabletType, or nil

func (*ShardInfo) GetTabletControl Uses

func (si *ShardInfo) GetTabletControl(tabletType topodatapb.TabletType) *topodatapb.Shard_TabletControl

GetTabletControl returns the Shard_TabletControl for the given tablet type, or nil if it is not in the map.

func (*ShardInfo) HasMaster Uses

func (si *ShardInfo) HasMaster() bool

HasMaster returns true if the Shard has an assigned Master.

func (*ShardInfo) Keyspace Uses

func (si *ShardInfo) Keyspace() string

Keyspace returns the keyspace a shard belongs to.

func (*ShardInfo) ShardName Uses

func (si *ShardInfo) ShardName() string

ShardName returns the shard name for a shard.

func (*ShardInfo) UpdateSourceBlacklistedTables Uses

func (si *ShardInfo) UpdateSourceBlacklistedTables(ctx context.Context, tabletType topodatapb.TabletType, cells []string, remove bool, tables []string) error

UpdateSourceBlacklistedTables will add or remove the listed tables in the shard record's TabletControl structures. Note we don't support a lot of the corner cases: - only support one table list per shard. If we encounter a different

table list that the provided one, we error out.

- we don't support DisableQueryService at the same time as BlacklistedTables,

because it's not used in the same context (vertical vs horizontal sharding)

This function should be called while holding the keyspace lock.

func (*ShardInfo) Version Uses

func (si *ShardInfo) Version() Version

Version returns the shard version from last time it was read or updated.

type ShardReplicationInfo Uses

type ShardReplicationInfo struct {
    *topodatapb.ShardReplication
    // contains filtered or unexported fields
}

ShardReplicationInfo is the companion structure for ShardReplication.

func NewShardReplicationInfo Uses

func NewShardReplicationInfo(sr *topodatapb.ShardReplication, cell, keyspace, shard string) *ShardReplicationInfo

NewShardReplicationInfo is for topo.Server implementations to create the structure

func (*ShardReplicationInfo) Cell Uses

func (sri *ShardReplicationInfo) Cell() string

Cell returns the cell for a ShardReplicationInfo

func (*ShardReplicationInfo) GetShardReplicationNode Uses

func (sri *ShardReplicationInfo) GetShardReplicationNode(tabletAlias *topodatapb.TabletAlias) (*topodatapb.ShardReplication_Node, error)

GetShardReplicationNode finds a node for a given tablet.

func (*ShardReplicationInfo) Keyspace Uses

func (sri *ShardReplicationInfo) Keyspace() string

Keyspace returns the keyspace for a ShardReplicationInfo

func (*ShardReplicationInfo) Shard Uses

func (sri *ShardReplicationInfo) Shard() string

Shard returns the shard for a ShardReplicationInfo

type StatsConn Uses

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

The StatsConn is a wrapper for a Conn that emits stats for every operation

func NewStatsConn Uses

func NewStatsConn(cell string, conn Conn) *StatsConn

NewStatsConn returns a StatsConn

func (*StatsConn) Close Uses

func (st *StatsConn) Close()

Close is part of the Conn interface

func (*StatsConn) Create Uses

func (st *StatsConn) Create(ctx context.Context, filePath string, contents []byte) (Version, error)

Create is part of the Conn interface

func (*StatsConn) Delete Uses

func (st *StatsConn) Delete(ctx context.Context, filePath string, version Version) error

Delete is part of the Conn interface

func (*StatsConn) Get Uses

func (st *StatsConn) Get(ctx context.Context, filePath string) ([]byte, Version, error)

Get is part of the Conn interface

func (*StatsConn) ListDir Uses

func (st *StatsConn) ListDir(ctx context.Context, dirPath string, full bool) ([]DirEntry, error)

ListDir is part of the Conn interface

func (*StatsConn) Lock Uses

func (st *StatsConn) Lock(ctx context.Context, dirPath, contents string) (LockDescriptor, error)

Lock is part of the Conn interface

func (*StatsConn) NewMasterParticipation Uses

func (st *StatsConn) NewMasterParticipation(name, id string) (MasterParticipation, error)

NewMasterParticipation is part of the Conn interface

func (*StatsConn) Update Uses

func (st *StatsConn) Update(ctx context.Context, filePath string, contents []byte, version Version) (Version, error)

Update is part of the Conn interface

func (*StatsConn) Watch Uses

func (st *StatsConn) Watch(ctx context.Context, filePath string) (current *WatchData, changes <-chan *WatchData, cancel CancelFunc)

Watch is part of the Conn interface

type TabletInfo Uses

type TabletInfo struct {
    *topodatapb.Tablet
    // contains filtered or unexported fields
}

TabletInfo is the container for a Tablet, read from the topology server.

func NewTabletInfo Uses

func NewTabletInfo(tablet *topodatapb.Tablet, version Version) *TabletInfo

NewTabletInfo returns a TabletInfo basing on tablet with the version set. This function should be only used by Server implementations.

func (*TabletInfo) Addr Uses

func (ti *TabletInfo) Addr() string

Addr returns hostname:vt port.

func (*TabletInfo) AliasString Uses

func (ti *TabletInfo) AliasString() string

AliasString returns the string representation of the tablet alias

func (*TabletInfo) DbName Uses

func (ti *TabletInfo) DbName() string

DbName is usually implied by keyspace. Having the shard information in the database name complicates mysql replication.

func (*TabletInfo) IsInServingGraph Uses

func (ti *TabletInfo) IsInServingGraph() bool

IsInServingGraph returns if this tablet is in the serving graph

func (*TabletInfo) IsSlaveType Uses

func (ti *TabletInfo) IsSlaveType() bool

IsSlaveType returns if this tablet's type is a slave

func (*TabletInfo) MysqlAddr Uses

func (ti *TabletInfo) MysqlAddr() string

MysqlAddr returns hostname:mysql port.

func (*TabletInfo) String Uses

func (ti *TabletInfo) String() string

String returns a string describing the tablet.

func (*TabletInfo) Version Uses

func (ti *TabletInfo) Version() Version

Version returns the version of this tablet from last time it was read or updated.

type Version Uses

type Version interface {
    // String returns a text representation of the version.
    String() string
}

Version is an interface that describes a file version.

type WatchData Uses

type WatchData struct {
    // Contents has the bytes that were stored by Create
    // or Update.
    Contents []byte

    // Version contains an opaque representation of the Version
    // of that file.
    Version Version

    // Err is set the same way for both the 'current' value
    // returned by Watch, or the values read on the 'changes'
    // channel. It can be:
    // - nil, then Contents and Version are set.
    // - ErrNoNode if the file doesn't exist.
    // - ErrInterrupted if 'cancel' was called.
    // - any other platform-specific error.
    Err error
}

WatchData is the structure returned by the Watch() API. It can contain: a) an error in Err if the call failed (or if the watch was terminated). b) the current or new version of the data.

type WatchSrvKeyspaceData Uses

type WatchSrvKeyspaceData struct {
    Value *topodatapb.SrvKeyspace
    Err   error
}

WatchSrvKeyspaceData is returned / streamed by WatchSrvKeyspace. The WatchSrvKeyspace API guarantees exactly one of Value or Err will be set.

type WatchSrvVSchemaData Uses

type WatchSrvVSchemaData struct {
    Value *vschemapb.SrvVSchema
    Err   error
}

WatchSrvVSchemaData is returned / streamed by WatchSrvVSchema. The WatchSrvVSchema API guarantees exactly one of Value or Err will be set.

type WorkflowInfo Uses

type WorkflowInfo struct {
    *workflowpb.Workflow
    // contains filtered or unexported fields
}

WorkflowInfo is a meta struct that contains the version of a Workflow.

Directories

PathSynopsis
consultopoPackage consultopo implements topo.Server with consul as the backend.
etcd2topoPackage etcd2topo implements topo.Server with etcd as the backend.
eventsPackage events defines the structures used for events relating directly to individual topology elements, like keyspaces, shards, and tablets.
helpersPackage helpers contains a few utility classes to handle topo.Server objects, and transitions from one topo implementation to another.
memorytopoPackage memorytopo contains an implementation of the topo.Factory / topo.Conn interfaces based on an in-memory tree of data.
testPackage test contains utilities to test topo.Conn implementations.
topoprotoPackage topoproto contains utility functions to deal with the proto3 structures defined in proto/topodata.
topotestsPackage topotests contains all the unit tests for the topo.Server code that is based on topo.Conn.
zk2topo

Package topo imports 32 packages (graph) and is imported by 65 packages. Updated 2019-06-05. Refresh now. Tools for package owners.