Documentation ¶
Index ¶
- Variables
- func NewServer(zconn zk.Conn) topo.Impl
- func NewTestServer(t *testing.T, cells []string) topo.Server
- func TabletPathForAlias(alias *pb.TabletAlias) string
- type Server
- func (zkts *Server) Close()
- func (zkts *Server) CreateEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, ...) error
- func (zkts *Server) CreateKeyspace(ctx context.Context, keyspace string, value *pb.Keyspace) error
- func (zkts *Server) CreateShard(ctx context.Context, keyspace, shard string, value *pb.Shard) error
- func (zkts *Server) CreateTablet(ctx context.Context, tablet *pb.Tablet) error
- func (zkts *Server) DeleteEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, ...) error
- func (zkts *Server) DeleteKeyspace(ctx context.Context, keyspace string) error
- func (zkts *Server) DeleteKeyspaceReplication(ctx context.Context, cell, keyspace string) error
- func (zkts *Server) DeleteKeyspaceShards(ctx context.Context, keyspace string) error
- func (zkts *Server) DeleteShard(ctx context.Context, keyspace, shard string) error
- func (zkts *Server) DeleteShardReplication(ctx context.Context, cell, keyspace, shard string) error
- func (zkts *Server) DeleteSrvKeyspace(ctx context.Context, cell, keyspace string) error
- func (zkts *Server) DeleteSrvShard(ctx context.Context, cell, keyspace, shard string) error
- func (zkts *Server) DeleteTablet(ctx context.Context, alias *pb.TabletAlias) error
- func (zkts *Server) GetEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType) (*pb.EndPoints, int64, error)
- func (zkts *Server) GetKeyspace(ctx context.Context, keyspace string) (*pb.Keyspace, int64, error)
- func (zkts *Server) GetKeyspaces(ctx context.Context) ([]string, error)
- func (zkts *Server) GetKnownCells(ctx context.Context) ([]string, error)
- func (zkts *Server) GetShard(ctx context.Context, keyspace, shard string) (*pb.Shard, int64, error)
- func (zkts *Server) GetShardNames(ctx context.Context, keyspace string) ([]string, error)
- func (zkts *Server) GetShardReplication(ctx context.Context, cell, keyspace, shard string) (*topo.ShardReplicationInfo, error)
- func (zkts *Server) GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*topo.SrvKeyspace, error)
- func (zkts *Server) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error)
- func (zkts *Server) GetSrvShard(ctx context.Context, cell, keyspace, shard string) (*pb.SrvShard, error)
- func (zkts *Server) GetSrvTabletTypesPerShard(ctx context.Context, cell, keyspace, shard string) ([]pb.TabletType, error)
- func (zkts *Server) GetTablet(ctx context.Context, alias *pb.TabletAlias) (*pb.Tablet, int64, error)
- func (zkts *Server) GetTabletsByCell(ctx context.Context, cell string) ([]*pb.TabletAlias, error)
- func (zkts *Server) GetVSchema(ctx context.Context) (string, error)
- func (zkts *Server) GetZConn() zk.Conn
- func (zkts *Server) LockKeyspaceForAction(ctx context.Context, keyspace, contents string) (string, error)
- func (zkts *Server) LockShardForAction(ctx context.Context, keyspace, shard, contents string) (string, error)
- func (zkts *Server) LockSrvShardForAction(ctx context.Context, cell, keyspace, shard, contents string) (string, error)
- func (zkts *Server) PruneActionLogs(zkActionLogPath string, keepCount int) (prunedCount int, err error)
- func (zkts *Server) PurgeActions(zkActionPath string, canBePurged func(data string) bool) error
- func (zkts *Server) SaveVSchema(ctx context.Context, vschema string) error
- func (zkts *Server) UnlockKeyspaceForAction(ctx context.Context, keyspace, lockPath, results string) error
- func (zkts *Server) UnlockShardForAction(ctx context.Context, keyspace, shard, lockPath, results string) error
- func (zkts *Server) UnlockSrvShardForAction(ctx context.Context, cell, keyspace, shard, lockPath, results string) error
- func (zkts *Server) UpdateEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, ...) error
- func (zkts *Server) UpdateKeyspace(ctx context.Context, keyspace string, value *pb.Keyspace, ...) (int64, error)
- func (zkts *Server) UpdateShard(ctx context.Context, keyspace, shard string, value *pb.Shard, ...) (int64, error)
- func (zkts *Server) UpdateShardReplicationFields(ctx context.Context, cell, keyspace, shard string, ...) error
- func (zkts *Server) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, srvKeyspace *topo.SrvKeyspace) error
- func (zkts *Server) UpdateSrvShard(ctx context.Context, cell, keyspace, shard string, srvShard *pb.SrvShard) error
- func (zkts *Server) UpdateTablet(ctx context.Context, tablet *pb.Tablet, existingVersion int64) (int64, error)
- func (zkts *Server) UpdateTabletFields(ctx context.Context, tabletAlias *pb.TabletAlias, ...) (*pb.Tablet, error)
- func (zkts *Server) ValidateShard(ctx context.Context, keyspace, shard string) error
- func (zkts *Server) WatchSrvKeyspace(ctx context.Context, cell, keyspace string) (<-chan *topo.SrvKeyspace, chan<- struct{}, error)
- type TestServer
Constants ¶
This section is empty.
Variables ¶
var WatchSleepDuration = 30 * time.Second
WatchSleepDuration is how many seconds interval to poll for in case the directory that contains a file to watch doesn't exist, or a watch is broken. It is exported so individual test and main programs can change it.
Functions ¶
func NewServer ¶
NewServer can be used to create a custom Server (for tests for instance) but it cannot change the globally registered one.
func NewTestServer ¶
NewTestServer returns a new TestServer (with the required paths created)
func TabletPathForAlias ¶
func TabletPathForAlias(alias *pb.TabletAlias) string
TabletPathForAlias converts a tablet alias to the zk path
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the zookeeper topo.Server implementation.
func (*Server) CreateEndPoints ¶
func (zkts *Server) CreateEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, addrs *pb.EndPoints) error
CreateEndPoints is part of the topo.Server interface
func (*Server) CreateKeyspace ¶
CreateKeyspace is part of the topo.Server interface
func (*Server) CreateShard ¶
CreateShard is part of the topo.Server interface
func (*Server) CreateTablet ¶
CreateTablet is part of the topo.Server interface
func (*Server) DeleteEndPoints ¶
func (zkts *Server) DeleteEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, existingVersion int64) error
DeleteEndPoints is part of the topo.Server interface
func (*Server) DeleteKeyspace ¶
DeleteKeyspace is part of the topo.Server interface.
func (*Server) DeleteKeyspaceReplication ¶
DeleteKeyspaceReplication is part of the topo.Server interface
func (*Server) DeleteKeyspaceShards ¶
DeleteKeyspaceShards is part of the topo.Server interface
func (*Server) DeleteShard ¶
DeleteShard is part of the topo.Server interface
func (*Server) DeleteShardReplication ¶
DeleteShardReplication is part of the topo.Server interface
func (*Server) DeleteSrvKeyspace ¶
DeleteSrvKeyspace is part of the topo.Server interface
func (*Server) DeleteSrvShard ¶
DeleteSrvShard is part of the topo.Server interface
func (*Server) DeleteTablet ¶
DeleteTablet is part of the topo.Server interface
func (*Server) GetEndPoints ¶
func (zkts *Server) GetEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType) (*pb.EndPoints, int64, error)
GetEndPoints is part of the topo.Server interface
func (*Server) GetKeyspace ¶
GetKeyspace is part of the topo.Server interface
func (*Server) GetKeyspaces ¶
GetKeyspaces is part of the topo.Server interface
func (*Server) GetKnownCells ¶
GetKnownCells is part of the topo.Server interface
func (*Server) GetShardNames ¶
GetShardNames is part of the topo.Server interface
func (*Server) GetShardReplication ¶
func (zkts *Server) GetShardReplication(ctx context.Context, cell, keyspace, shard string) (*topo.ShardReplicationInfo, error)
GetShardReplication is part of the topo.Server interface
func (*Server) GetSrvKeyspace ¶
func (zkts *Server) GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*topo.SrvKeyspace, error)
GetSrvKeyspace is part of the topo.Server interface
func (*Server) GetSrvKeyspaceNames ¶
GetSrvKeyspaceNames is part of the topo.Server interface
func (*Server) GetSrvShard ¶
func (zkts *Server) GetSrvShard(ctx context.Context, cell, keyspace, shard string) (*pb.SrvShard, error)
GetSrvShard is part of the topo.Server interface
func (*Server) GetSrvTabletTypesPerShard ¶
func (zkts *Server) GetSrvTabletTypesPerShard(ctx context.Context, cell, keyspace, shard string) ([]pb.TabletType, error)
GetSrvTabletTypesPerShard is part of the topo.Server interface
func (*Server) GetTablet ¶
func (zkts *Server) GetTablet(ctx context.Context, alias *pb.TabletAlias) (*pb.Tablet, int64, error)
GetTablet is part of the topo.Server interface
func (*Server) GetTabletsByCell ¶
GetTabletsByCell is part of the topo.Server interface
func (*Server) GetVSchema ¶
GetVSchema fetches the JSON vschema from the topo.
func (*Server) LockKeyspaceForAction ¶
func (zkts *Server) LockKeyspaceForAction(ctx context.Context, keyspace, contents string) (string, error)
LockKeyspaceForAction is part of topo.Server interface
func (*Server) LockShardForAction ¶
func (zkts *Server) LockShardForAction(ctx context.Context, keyspace, shard, contents string) (string, error)
LockShardForAction is part of topo.Server interface
func (*Server) LockSrvShardForAction ¶
func (zkts *Server) LockSrvShardForAction(ctx context.Context, cell, keyspace, shard, contents string) (string, error)
LockSrvShardForAction is part of topo.Server interface
func (*Server) PruneActionLogs ¶
func (zkts *Server) PruneActionLogs(zkActionLogPath string, keepCount int) (prunedCount int, err error)
PruneActionLogs prunes old actionlog entries. Returns how many entries were purged (even if there was an error).
There is a chance some processes might still be waiting for action results, but it is very very small.
func (*Server) PurgeActions ¶
PurgeActions removes all queued actions, leaving the action node itself in place.
This inherently breaks the locking mechanism of the action queue, so this is a rare cleanup action, not a normal part of the flow.
This can be used for tablets, shards and keyspaces.
func (*Server) SaveVSchema ¶
SaveVSchema saves the JSON vschema into the topo.
func (*Server) UnlockKeyspaceForAction ¶
func (zkts *Server) UnlockKeyspaceForAction(ctx context.Context, keyspace, lockPath, results string) error
UnlockKeyspaceForAction is part of topo.Server interface
func (*Server) UnlockShardForAction ¶
func (zkts *Server) UnlockShardForAction(ctx context.Context, keyspace, shard, lockPath, results string) error
UnlockShardForAction is part of topo.Server interface
func (*Server) UnlockSrvShardForAction ¶
func (zkts *Server) UnlockSrvShardForAction(ctx context.Context, cell, keyspace, shard, lockPath, results string) error
UnlockSrvShardForAction is part of topo.Server interface
func (*Server) UpdateEndPoints ¶
func (zkts *Server) UpdateEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, addrs *pb.EndPoints, existingVersion int64) error
UpdateEndPoints is part of the topo.Server interface
func (*Server) UpdateKeyspace ¶
func (zkts *Server) UpdateKeyspace(ctx context.Context, keyspace string, value *pb.Keyspace, existingVersion int64) (int64, error)
UpdateKeyspace is part of the topo.Server interface
func (*Server) UpdateShard ¶
func (zkts *Server) UpdateShard(ctx context.Context, keyspace, shard string, value *pb.Shard, existingVersion int64) (int64, error)
UpdateShard is part of the topo.Server interface
func (*Server) UpdateShardReplicationFields ¶
func (zkts *Server) UpdateShardReplicationFields(ctx context.Context, cell, keyspace, shard string, update func(*pb.ShardReplication) error) error
UpdateShardReplicationFields is part of the topo.Server interface
func (*Server) UpdateSrvKeyspace ¶
func (zkts *Server) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, srvKeyspace *topo.SrvKeyspace) error
UpdateSrvKeyspace is part of the topo.Server interface
func (*Server) UpdateSrvShard ¶
func (zkts *Server) UpdateSrvShard(ctx context.Context, cell, keyspace, shard string, srvShard *pb.SrvShard) error
UpdateSrvShard is part of the topo.Server interface
func (*Server) UpdateTablet ¶
func (zkts *Server) UpdateTablet(ctx context.Context, tablet *pb.Tablet, existingVersion int64) (int64, error)
UpdateTablet is part of the topo.Server interface
func (*Server) UpdateTabletFields ¶
func (zkts *Server) UpdateTabletFields(ctx context.Context, tabletAlias *pb.TabletAlias, update func(*pb.Tablet) error) (*pb.Tablet, error)
UpdateTabletFields is part of the topo.Server interface
func (*Server) ValidateShard ¶
ValidateShard is part of the topo.Server interface
func (*Server) WatchSrvKeyspace ¶
func (zkts *Server) WatchSrvKeyspace(ctx context.Context, cell, keyspace string) (<-chan *topo.SrvKeyspace, chan<- struct{}, error)
WatchSrvKeyspace is part of the topo.Server interface
type TestServer ¶
type TestServer struct { topo.Impl HookLockSrvShardForAction func() // contains filtered or unexported fields }
TestServer is a proxy for a real implementation of topo.Server that provides hooks for testing.
func (*TestServer) GetKnownCells ¶
func (s *TestServer) GetKnownCells(ctx context.Context) ([]string, error)
GetKnownCells is part of topo.Server interface
func (*TestServer) LockSrvShardForAction ¶
func (s *TestServer) LockSrvShardForAction(ctx context.Context, cell, keyspace, shard, contents string) (string, error)
LockSrvShardForAction should override the function defined by the underlying topo.Server.