Documentation ¶
Overview ¶
Package helpers contains a few utility classes to handle topo.Server objects, and transitions from one topo implementation to another.
Index ¶
- func CopyKeyspaces(ctx context.Context, fromTS, toTS topo.Impl)
- func CopyShardReplications(ctx context.Context, fromTS, toTS topo.Impl)
- func CopyShards(ctx context.Context, fromTS, toTS topo.Impl, deleteKeyspaceShards bool)
- func CopyTablets(ctx context.Context, fromTS, toTS topo.Impl)
- type Tee
- func (tee *Tee) Close()
- func (tee *Tee) CreateEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, ...) error
- func (tee *Tee) CreateKeyspace(ctx context.Context, keyspace string, value *pb.Keyspace) error
- func (tee *Tee) CreateShard(ctx context.Context, keyspace, shard string, value *pb.Shard) error
- func (tee *Tee) CreateTablet(ctx context.Context, tablet *pb.Tablet) error
- func (tee *Tee) DeleteEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, ...) error
- func (tee *Tee) DeleteKeyspace(ctx context.Context, keyspace string) error
- func (tee *Tee) DeleteKeyspaceReplication(ctx context.Context, cell, keyspace string) error
- func (tee *Tee) DeleteKeyspaceShards(ctx context.Context, keyspace string) error
- func (tee *Tee) DeleteShard(ctx context.Context, keyspace, shard string) error
- func (tee *Tee) DeleteShardReplication(ctx context.Context, cell, keyspace, shard string) error
- func (tee *Tee) DeleteSrvKeyspace(ctx context.Context, cell, keyspace string) error
- func (tee *Tee) DeleteSrvShard(ctx context.Context, cell, keyspace, shard string) error
- func (tee *Tee) DeleteTablet(ctx context.Context, alias *pb.TabletAlias) error
- func (tee *Tee) GetEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType) (*pb.EndPoints, int64, error)
- func (tee *Tee) GetKeyspace(ctx context.Context, keyspace string) (*pb.Keyspace, int64, error)
- func (tee *Tee) GetKeyspaces(ctx context.Context) ([]string, error)
- func (tee *Tee) GetKnownCells(ctx context.Context) ([]string, error)
- func (tee *Tee) GetShard(ctx context.Context, keyspace, shard string) (*pb.Shard, int64, error)
- func (tee *Tee) GetShardNames(ctx context.Context, keyspace string) ([]string, error)
- func (tee *Tee) GetShardReplication(ctx context.Context, cell, keyspace, shard string) (*topo.ShardReplicationInfo, error)
- func (tee *Tee) GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*pb.SrvKeyspace, error)
- func (tee *Tee) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error)
- func (tee *Tee) GetSrvShard(ctx context.Context, cell, keyspace, shard string) (*pb.SrvShard, error)
- func (tee *Tee) GetSrvTabletTypesPerShard(ctx context.Context, cell, keyspace, shard string) ([]pb.TabletType, error)
- func (tee *Tee) GetTablet(ctx context.Context, alias *pb.TabletAlias) (*pb.Tablet, int64, error)
- func (tee *Tee) GetTabletsByCell(ctx context.Context, cell string) ([]*pb.TabletAlias, error)
- func (tee *Tee) GetVSchema(ctx context.Context) (string, error)
- func (tee *Tee) LockKeyspaceForAction(ctx context.Context, keyspace, contents string) (string, error)
- func (tee *Tee) LockShardForAction(ctx context.Context, keyspace, shard, contents string) (string, error)
- func (tee *Tee) LockSrvShardForAction(ctx context.Context, cell, keyspace, shard, contents string) (string, error)
- func (tee *Tee) SaveVSchema(ctx context.Context, contents string) error
- func (tee *Tee) UnlockKeyspaceForAction(ctx context.Context, keyspace, lockPath, results string) error
- func (tee *Tee) UnlockShardForAction(ctx context.Context, keyspace, shard, lockPath, results string) error
- func (tee *Tee) UnlockSrvShardForAction(ctx context.Context, cell, keyspace, shard, lockPath, results string) error
- func (tee *Tee) UpdateEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, ...) error
- func (tee *Tee) UpdateKeyspace(ctx context.Context, keyspace string, value *pb.Keyspace, ...) (newVersion int64, err error)
- func (tee *Tee) UpdateShard(ctx context.Context, keyspace, shard string, value *pb.Shard, ...) (newVersion int64, err error)
- func (tee *Tee) UpdateShardReplicationFields(ctx context.Context, cell, keyspace, shard string, ...) error
- func (tee *Tee) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, srvKeyspace *pb.SrvKeyspace) error
- func (tee *Tee) UpdateSrvShard(ctx context.Context, cell, keyspace, shard string, srvShard *pb.SrvShard) error
- func (tee *Tee) UpdateTablet(ctx context.Context, tablet *pb.Tablet, existingVersion int64) (newVersion int64, err error)
- func (tee *Tee) UpdateTabletFields(ctx context.Context, tabletAlias *pb.TabletAlias, ...) (*pb.Tablet, error)
- func (tee *Tee) ValidateShard(ctx context.Context, keyspace, shard string) error
- func (tee *Tee) WatchSrvKeyspace(ctx context.Context, cell, keyspace string) (<-chan *pb.SrvKeyspace, chan<- struct{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyKeyspaces ¶
CopyKeyspaces will create the keyspaces in the destination topo
func CopyShardReplications ¶
CopyShardReplications will create the ShardReplication objects in the destination topo
func CopyShards ¶
CopyShards will create the shards in the destination topo
Types ¶
type Tee ¶
type Tee struct {
// contains filtered or unexported fields
}
Tee is an implementation of topo.Server that uses a primary underlying topo.Server for all changes, but also duplicates the changes to a secondary topo.Server. It also locks both topo servers when needed. It is meant to be used during transitions from one topo.Server to another.
- primary: we read everything from it, and write to it - secondary: we write to it as well, but we usually don't fail. - we lock primary/secondary if reverseLockOrder is False, or secondary/primary if reverseLockOrder is True.
func (*Tee) CreateEndPoints ¶
func (tee *Tee) CreateEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, addrs *pb.EndPoints) error
CreateEndPoints is part of the topo.Server interface
func (*Tee) CreateKeyspace ¶
CreateKeyspace is part of the topo.Server interface
func (*Tee) CreateShard ¶
CreateShard is part of the topo.Server interface
func (*Tee) CreateTablet ¶
CreateTablet is part of the topo.Server interface
func (*Tee) DeleteEndPoints ¶
func (tee *Tee) DeleteEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, existingVersion int64) error
DeleteEndPoints is part of the topo.Server interface
func (*Tee) DeleteKeyspace ¶
DeleteKeyspace is part of the topo.Server interface
func (*Tee) DeleteKeyspaceReplication ¶
DeleteKeyspaceReplication is part of the topo.Server interface
func (*Tee) DeleteKeyspaceShards ¶
DeleteKeyspaceShards is part of the topo.Server interface
func (*Tee) DeleteShard ¶
DeleteShard is part of the topo.Server interface
func (*Tee) DeleteShardReplication ¶
DeleteShardReplication is part of the topo.Server interface
func (*Tee) DeleteSrvKeyspace ¶
DeleteSrvKeyspace is part of the topo.Server interface
func (*Tee) DeleteSrvShard ¶
DeleteSrvShard is part of the topo.Server interface
func (*Tee) DeleteTablet ¶
DeleteTablet is part of the topo.Server interface
func (*Tee) GetEndPoints ¶
func (tee *Tee) GetEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType) (*pb.EndPoints, int64, error)
GetEndPoints is part of the topo.Server interface
func (*Tee) GetKeyspace ¶
GetKeyspace is part of the topo.Server interface
func (*Tee) GetKeyspaces ¶
GetKeyspaces is part of the topo.Server interface
func (*Tee) GetKnownCells ¶
GetKnownCells is part of the topo.Server interface
func (*Tee) GetShardNames ¶
GetShardNames is part of the topo.Server interface
func (*Tee) GetShardReplication ¶
func (tee *Tee) GetShardReplication(ctx context.Context, cell, keyspace, shard string) (*topo.ShardReplicationInfo, error)
GetShardReplication is part of the topo.Server interface
func (*Tee) GetSrvKeyspace ¶
GetSrvKeyspace is part of the topo.Server interface
func (*Tee) GetSrvKeyspaceNames ¶
GetSrvKeyspaceNames is part of the topo.Server interface
func (*Tee) GetSrvShard ¶
func (tee *Tee) GetSrvShard(ctx context.Context, cell, keyspace, shard string) (*pb.SrvShard, error)
GetSrvShard is part of the topo.Server interface
func (*Tee) GetSrvTabletTypesPerShard ¶
func (tee *Tee) GetSrvTabletTypesPerShard(ctx context.Context, cell, keyspace, shard string) ([]pb.TabletType, error)
GetSrvTabletTypesPerShard is part of the topo.Server interface
func (*Tee) GetTabletsByCell ¶
GetTabletsByCell is part of the topo.Server interface
func (*Tee) GetVSchema ¶
GetVSchema is part of the topo.Server interface
func (*Tee) LockKeyspaceForAction ¶
func (tee *Tee) LockKeyspaceForAction(ctx context.Context, keyspace, contents string) (string, error)
LockKeyspaceForAction is part of the topo.Server interface
func (*Tee) LockShardForAction ¶
func (tee *Tee) LockShardForAction(ctx context.Context, keyspace, shard, contents string) (string, error)
LockShardForAction is part of the topo.Server interface
func (*Tee) LockSrvShardForAction ¶
func (tee *Tee) LockSrvShardForAction(ctx context.Context, cell, keyspace, shard, contents string) (string, error)
LockSrvShardForAction is part of the topo.Server interface
func (*Tee) SaveVSchema ¶
SaveVSchema is part of the topo.Server interface
func (*Tee) UnlockKeyspaceForAction ¶
func (tee *Tee) UnlockKeyspaceForAction(ctx context.Context, keyspace, lockPath, results string) error
UnlockKeyspaceForAction is part of the topo.Server interface
func (*Tee) UnlockShardForAction ¶
func (tee *Tee) UnlockShardForAction(ctx context.Context, keyspace, shard, lockPath, results string) error
UnlockShardForAction is part of the topo.Server interface
func (*Tee) UnlockSrvShardForAction ¶
func (tee *Tee) UnlockSrvShardForAction(ctx context.Context, cell, keyspace, shard, lockPath, results string) error
UnlockSrvShardForAction is part of the topo.Server interface
func (*Tee) UpdateEndPoints ¶
func (tee *Tee) 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 (*Tee) UpdateKeyspace ¶
func (tee *Tee) UpdateKeyspace(ctx context.Context, keyspace string, value *pb.Keyspace, existingVersion int64) (newVersion int64, err error)
UpdateKeyspace is part of the topo.Server interface
func (*Tee) UpdateShard ¶
func (tee *Tee) UpdateShard(ctx context.Context, keyspace, shard string, value *pb.Shard, existingVersion int64) (newVersion int64, err error)
UpdateShard is part of the topo.Server interface
func (*Tee) UpdateShardReplicationFields ¶
func (tee *Tee) UpdateShardReplicationFields(ctx context.Context, cell, keyspace, shard string, update func(*pb.ShardReplication) error) error
UpdateShardReplicationFields is part of the topo.Server interface
func (*Tee) UpdateSrvKeyspace ¶
func (tee *Tee) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, srvKeyspace *pb.SrvKeyspace) error
UpdateSrvKeyspace is part of the topo.Server interface
func (*Tee) UpdateSrvShard ¶
func (tee *Tee) UpdateSrvShard(ctx context.Context, cell, keyspace, shard string, srvShard *pb.SrvShard) error
UpdateSrvShard is part of the topo.Server interface
func (*Tee) UpdateTablet ¶
func (tee *Tee) UpdateTablet(ctx context.Context, tablet *pb.Tablet, existingVersion int64) (newVersion int64, err error)
UpdateTablet is part of the topo.Server interface
func (*Tee) UpdateTabletFields ¶
func (tee *Tee) UpdateTabletFields(ctx context.Context, tabletAlias *pb.TabletAlias, update func(*pb.Tablet) error) (*pb.Tablet, error)
UpdateTabletFields is part of the topo.Server interface
func (*Tee) ValidateShard ¶
ValidateShard is part of the topo.Server interface
func (*Tee) WatchSrvKeyspace ¶
func (tee *Tee) WatchSrvKeyspace(ctx context.Context, cell, keyspace string) (<-chan *pb.SrvKeyspace, chan<- struct{}, error)
WatchSrvKeyspace is part of the topo.Server interface. We only watch for changes on the primary.