Documentation ¶
Index ¶
- Constants
- func TabletPathForAlias(alias *topodatapb.TabletAlias) string
- type Server
- func (zkts *Server) Close()
- func (zkts *Server) Create(ctx context.Context, cell, filePath string, contents []byte) (topo.Version, error)
- func (zkts *Server) CreateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace) error
- func (zkts *Server) CreateShard(ctx context.Context, keyspace, shard string, value *topodatapb.Shard) error
- func (zkts *Server) CreateTablet(ctx context.Context, tablet *topodatapb.Tablet) error
- func (zkts *Server) Delete(ctx context.Context, cell, filePath string, version topo.Version) 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) 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) DeleteTablet(ctx context.Context, alias *topodatapb.TabletAlias) error
- func (zkts *Server) Get(ctx context.Context, cell, filePath string) ([]byte, topo.Version, error)
- func (zkts *Server) GetKeyspace(ctx context.Context, keyspace string) (*topodatapb.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) (*topodatapb.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) (*topodatapb.SrvKeyspace, error)
- func (zkts *Server) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error)
- func (zkts *Server) GetSrvVSchema(ctx context.Context, cell string) (*vschemapb.SrvVSchema, error)
- func (zkts *Server) GetTablet(ctx context.Context, alias *topodatapb.TabletAlias) (*topodatapb.Tablet, int64, error)
- func (zkts *Server) GetTabletsByCell(ctx context.Context, cell string) ([]*topodatapb.TabletAlias, error)
- func (zkts *Server) GetVSchema(ctx context.Context, keyspace string) (*vschemapb.Keyspace, error)
- func (zkts *Server) GetZConn() zk.Conn
- func (zkts *Server) ListDir(ctx context.Context, cell, dirPath string) ([]string, error)
- 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) NewMasterParticipation(name, id string) (topo.MasterParticipation, error)
- func (zkts *Server) PruneActionLogs(zkActionLogPath string, keepCount int) (prunedCount int, err error)
- func (zkts *Server) PurgeActions(zkActionPath string, canBePurged func(data []byte) bool) error
- func (zkts *Server) SaveVSchema(ctx context.Context, keyspace string, vschema *vschemapb.Keyspace) 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) Update(ctx context.Context, cell, filePath string, contents []byte, ...) (topo.Version, error)
- func (zkts *Server) UpdateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace, ...) (int64, error)
- func (zkts *Server) UpdateShard(ctx context.Context, keyspace, shard string, value *topodatapb.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, ...) error
- func (zkts *Server) UpdateSrvVSchema(ctx context.Context, cell string, srvVSchema *vschemapb.SrvVSchema) error
- func (zkts *Server) UpdateTablet(ctx context.Context, tablet *topodatapb.Tablet, existingVersion int64) (int64, error)
- func (zkts *Server) Watch(ctx context.Context, cell, filePath string) (*topo.WatchData, <-chan *topo.WatchData, topo.CancelFunc)
- type ZKVersion
- type ZkExplorer
Constants ¶
const ( // GlobalElectionPath is the path used to store global // information for master participation in ZK. Exported for tests. GlobalElectionPath = "/zk/global/vt/election" )
const ( // GlobalKeyspacesPath is the path used to store global // information in ZK. Exported for tests. GlobalKeyspacesPath = "/zk/global/vt/keyspaces" )
Variables ¶
This section is empty.
Functions ¶
func TabletPathForAlias ¶
func TabletPathForAlias(alias *topodatapb.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.Impl implementation.
func (*Server) Create ¶
func (zkts *Server) Create(ctx context.Context, cell, filePath string, contents []byte) (topo.Version, error)
Create is part of the topo.Backend interface.
func (*Server) CreateKeyspace ¶
func (zkts *Server) CreateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace) error
CreateKeyspace is part of the topo.Server interface
func (*Server) CreateShard ¶
func (zkts *Server) CreateShard(ctx context.Context, keyspace, shard string, value *topodatapb.Shard) error
CreateShard is part of the topo.Server interface
func (*Server) CreateTablet ¶
CreateTablet 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) 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) DeleteTablet ¶
func (zkts *Server) DeleteTablet(ctx context.Context, alias *topodatapb.TabletAlias) error
DeleteTablet is part of the topo.Server interface
func (*Server) GetKeyspace ¶
func (zkts *Server) GetKeyspace(ctx context.Context, keyspace string) (*topodatapb.Keyspace, int64, error)
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) GetShard ¶
func (zkts *Server) GetShard(ctx context.Context, keyspace, shard string) (*topodatapb.Shard, int64, error)
GetShard 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) (*topodatapb.SrvKeyspace, error)
GetSrvKeyspace is part of the topo.Server interface
func (*Server) GetSrvKeyspaceNames ¶
GetSrvKeyspaceNames is part of the topo.Server interface
func (*Server) GetSrvVSchema ¶
GetSrvVSchema is part of the topo.Server interface
func (*Server) GetTablet ¶
func (zkts *Server) GetTablet(ctx context.Context, alias *topodatapb.TabletAlias) (*topodatapb.Tablet, int64, error)
GetTablet is part of the topo.Server interface
func (*Server) GetTabletsByCell ¶
func (zkts *Server) GetTabletsByCell(ctx context.Context, cell string) ([]*topodatapb.TabletAlias, error)
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) NewMasterParticipation ¶
func (zkts *Server) NewMasterParticipation(name, id string) (topo.MasterParticipation, error)
NewMasterParticipation is part of the 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 ¶
func (zkts *Server) SaveVSchema(ctx context.Context, keyspace string, vschema *vschemapb.Keyspace) error
SaveVSchema saves the 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) Update ¶
func (zkts *Server) Update(ctx context.Context, cell, filePath string, contents []byte, version topo.Version) (topo.Version, error)
Update is part of the topo.Backend interface.
func (*Server) UpdateKeyspace ¶
func (zkts *Server) UpdateKeyspace(ctx context.Context, keyspace string, value *topodatapb.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 *topodatapb.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(*topodatapb.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 *topodatapb.SrvKeyspace) error
UpdateSrvKeyspace is part of the topo.Server interface
func (*Server) UpdateSrvVSchema ¶
func (zkts *Server) UpdateSrvVSchema(ctx context.Context, cell string, srvVSchema *vschemapb.SrvVSchema) error
UpdateSrvVSchema is part of the topo.Server interface
func (*Server) UpdateTablet ¶
func (zkts *Server) UpdateTablet(ctx context.Context, tablet *topodatapb.Tablet, existingVersion int64) (int64, error)
UpdateTablet is part of the topo.Server interface
type ZKVersion ¶
type ZKVersion int32
ZKVersion is zookeeper's idea of a version. It implements topo.Version. We use the native zookeeper.Stat.Version type, int32.
type ZkExplorer ¶
type ZkExplorer struct {
// contains filtered or unexported fields
}
ZkExplorer implements explorer.Explorer
func NewZkExplorer ¶
func NewZkExplorer(zconn zk.Conn) *ZkExplorer
NewZkExplorer returns an Explorer implementation for Zookeeper
func (ZkExplorer) HandlePath ¶
HandlePath is part of the Explorer interface