Documentation ¶
Index ¶
- Constants
- func ChildrenRecursive(ctx context.Context, zconn Conn, zkPath string) ([]string, error)
- func CreateRecursive(ctx context.Context, conn Conn, zkPath string, value []byte, flags int32, ...) (pathCreated string, err error)
- func DeleteRecursive(ctx context.Context, zconn Conn, zkPath string, version int32) error
- func ResolveWildcards(ctx context.Context, zconn Conn, zkPaths []string) ([]string, error)
- func Time(i int64) time.Time
- func ZkTime(t time.Time) int64
- type Conn
- type Server
- func (zs *Server) Close()
- func (zs *Server) Create(ctx context.Context, cell, filePath string, contents []byte) (topo.Version, error)
- func (zs *Server) CreateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace) error
- func (zs *Server) CreateShard(ctx context.Context, keyspace, shard string, value *topodatapb.Shard) error
- func (zs *Server) CreateTablet(ctx context.Context, tablet *topodatapb.Tablet) error
- func (zs *Server) Delete(ctx context.Context, cell, filePath string, version topo.Version) error
- func (zs *Server) DeleteKeyspace(ctx context.Context, keyspace string) error
- func (zs *Server) DeleteKeyspaceReplication(ctx context.Context, cell, keyspace string) error
- func (zs *Server) DeleteShard(ctx context.Context, keyspace, shard string) error
- func (zs *Server) DeleteShardReplication(ctx context.Context, cell, keyspace, shard string) error
- func (zs *Server) DeleteSrvKeyspace(ctx context.Context, cell, keyspace string) error
- func (zs *Server) DeleteTablet(ctx context.Context, alias *topodatapb.TabletAlias) error
- func (zs *Server) Get(ctx context.Context, cell, filePath string) ([]byte, topo.Version, error)
- func (zs *Server) GetKeyspace(ctx context.Context, keyspace string) (*topodatapb.Keyspace, int64, error)
- func (zs *Server) GetKeyspaces(ctx context.Context) ([]string, error)
- func (zs *Server) GetKnownCells(ctx context.Context) ([]string, error)
- func (zs *Server) GetShard(ctx context.Context, keyspace, shard string) (*topodatapb.Shard, int64, error)
- func (zs *Server) GetShardNames(ctx context.Context, keyspace string) ([]string, error)
- func (zs *Server) GetShardReplication(ctx context.Context, cell, keyspace, shard string) (*topo.ShardReplicationInfo, error)
- func (zs *Server) GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*topodatapb.SrvKeyspace, error)
- func (zs *Server) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error)
- func (zs *Server) GetSrvVSchema(ctx context.Context, cell string) (*vschemapb.SrvVSchema, error)
- func (zs *Server) GetTablet(ctx context.Context, alias *topodatapb.TabletAlias) (*topodatapb.Tablet, int64, error)
- func (zs *Server) GetTabletsByCell(ctx context.Context, cell string) ([]*topodatapb.TabletAlias, error)
- func (zs *Server) GetVSchema(ctx context.Context, keyspace string) (*vschemapb.Keyspace, error)
- func (zs *Server) ListDir(ctx context.Context, cell, dirPath string) ([]string, error)
- func (zs *Server) LockKeyspaceForAction(ctx context.Context, keyspace, contents string) (string, error)
- func (zs *Server) LockShardForAction(ctx context.Context, keyspace, shard, contents string) (string, error)
- func (zs *Server) NewMasterParticipation(name, id string) (topo.MasterParticipation, error)
- func (zs *Server) SaveVSchema(ctx context.Context, keyspace string, vschema *vschemapb.Keyspace) error
- func (zs *Server) UnlockKeyspaceForAction(ctx context.Context, keyspace, lockPath, results string) error
- func (zs *Server) UnlockShardForAction(ctx context.Context, keyspace, shard, lockPath, results string) error
- func (zs *Server) Update(ctx context.Context, cell, filePath string, contents []byte, ...) (topo.Version, error)
- func (zs *Server) UpdateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace, ...) (int64, error)
- func (zs *Server) UpdateShard(ctx context.Context, keyspace, shard string, value *topodatapb.Shard, ...) (int64, error)
- func (zs *Server) UpdateShardReplicationFields(ctx context.Context, cell, keyspace, shard string, ...) error
- func (zs *Server) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, ...) error
- func (zs *Server) UpdateSrvVSchema(ctx context.Context, cell string, srvVSchema *vschemapb.SrvVSchema) error
- func (zs *Server) UpdateTablet(ctx context.Context, tablet *topodatapb.Tablet, existingVersion int64) (int64, error)
- func (zs *Server) Watch(ctx context.Context, cell, filePath string) (*topo.WatchData, <-chan *topo.WatchData, topo.CancelFunc)
- type ZKVersion
Constants ¶
const ( // PermDirectory are default permissions for a node. PermDirectory = zk.PermAdmin | zk.PermCreate | zk.PermDelete | zk.PermRead | zk.PermWrite // PermFile allows a zk node to emulate file behavior by // disallowing child nodes. PermFile = zk.PermAdmin | zk.PermRead | zk.PermWrite )
Variables ¶
This section is empty.
Functions ¶
func ChildrenRecursive ¶
ChildrenRecursive returns the relative path of all the children of the provided node.
func CreateRecursive ¶
func CreateRecursive(ctx context.Context, conn Conn, zkPath string, value []byte, flags int32, aclv []zk.ACL, maxCreationDepth int) (pathCreated string, err error)
CreateRecursive is a helper function on top of Create. It will create a path and any pieces required, think mkdir -p. Intermediate znodes are always created empty.
func DeleteRecursive ¶
DeleteRecursive will delete all children of the given path.
func ResolveWildcards ¶
ResolveWildcards resolves paths like: /zk/nyc/vt/tablets/*/action /zk/global/vt/keyspaces/*/shards/*/action /zk/*/vt/tablets/*/action 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.
Types ¶
type Conn ¶
type Conn interface { Get(ctx context.Context, path string) (data []byte, stat *zk.Stat, err error) GetW(ctx context.Context, path string) (data []byte, stat *zk.Stat, watch <-chan zk.Event, err error) Children(ctx context.Context, path string) (children []string, stat *zk.Stat, err error) ChildrenW(ctx context.Context, path string) (children []string, stat *zk.Stat, watch <-chan zk.Event, err error) Exists(ctx context.Context, path string) (exists bool, stat *zk.Stat, err error) ExistsW(ctx context.Context, path string) (exists bool, stat *zk.Stat, watch <-chan zk.Event, err error) Create(ctx context.Context, path string, value []byte, flags int32, aclv []zk.ACL) (pathCreated string, err error) Set(ctx context.Context, path string, value []byte, version int32) (stat *zk.Stat, err error) Delete(ctx context.Context, path string, version int32) (err error) GetACL(ctx context.Context, path string) ([]zk.ACL, *zk.Stat, error) SetACL(ctx context.Context, path string, aclv []zk.ACL, version int32) error Close() error }
Conn is really close to the Zookeeper library connection interface. So refer to the Zookeeper docs for the conventions used here (for instance, using -1 as version to specify any version)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the zookeeper topo.Impl implementation.
func (*Server) Create ¶
func (zs *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 (zs *Server) CreateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace) error
CreateKeyspace is part of the topo.Server interface
func (*Server) CreateShard ¶
func (zs *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 (zs *Server) DeleteTablet(ctx context.Context, alias *topodatapb.TabletAlias) error
DeleteTablet is part of the topo.Server interface
func (*Server) GetKeyspace ¶
func (zs *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 (zs *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 (zs *Server) GetShardReplication(ctx context.Context, cell, keyspace, shard string) (*topo.ShardReplicationInfo, error)
GetShardReplication is part of the topo.Server interface
func (*Server) GetSrvKeyspace ¶
func (zs *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 (zs *Server) GetTablet(ctx context.Context, alias *topodatapb.TabletAlias) (*topodatapb.Tablet, int64, error)
GetTablet is part of the topo.Server interface
func (*Server) GetTabletsByCell ¶
func (zs *Server) GetTabletsByCell(ctx context.Context, cell string) ([]*topodatapb.TabletAlias, error)
GetTabletsByCell is part of the topo.Server interface
func (*Server) GetVSchema ¶
GetVSchema fetches the vschema from the topo.
func (*Server) LockKeyspaceForAction ¶
func (zs *Server) LockKeyspaceForAction(ctx context.Context, keyspace, contents string) (string, error)
LockKeyspaceForAction is part of topo.Server interface
func (*Server) LockShardForAction ¶
func (zs *Server) LockShardForAction(ctx context.Context, keyspace, shard, contents string) (string, error)
LockShardForAction is part of topo.Server interface
func (*Server) NewMasterParticipation ¶
func (zs *Server) NewMasterParticipation(name, id string) (topo.MasterParticipation, error)
NewMasterParticipation is part of the topo.Server interface. We use the full path: <root path>/election/<name>
func (*Server) SaveVSchema ¶
func (zs *Server) SaveVSchema(ctx context.Context, keyspace string, vschema *vschemapb.Keyspace) error
SaveVSchema saves the vschema into the topo.
func (*Server) UnlockKeyspaceForAction ¶
func (zs *Server) UnlockKeyspaceForAction(ctx context.Context, keyspace, lockPath, results string) error
UnlockKeyspaceForAction is part of topo.Server interface
func (*Server) UnlockShardForAction ¶
func (zs *Server) UnlockShardForAction(ctx context.Context, keyspace, shard, lockPath, results string) error
UnlockShardForAction is part of topo.Server interface
func (*Server) Update ¶
func (zs *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 (zs *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 (zs *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 (zs *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 (zs *Server) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, srvKeyspace *topodatapb.SrvKeyspace) error
UpdateSrvKeyspace is part of the topo.Server interface.
func (*Server) UpdateSrvVSchema ¶
func (zs *Server) UpdateSrvVSchema(ctx context.Context, cell string, srvVSchema *vschemapb.SrvVSchema) error
UpdateSrvVSchema is part of the topo.Server interface
func (*Server) UpdateTablet ¶
func (zs *Server) UpdateTablet(ctx context.Context, tablet *topodatapb.Tablet, existingVersion int64) (int64, error)
UpdateTablet is part of the topo.Server interface