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(fromTS, toTS topo.Server)
- func CopyShardReplications(fromTS, toTS topo.Server)
- func CopyShards(fromTS, toTS topo.Server, deleteKeyspaceShards bool)
- func CopyTablets(fromTS, toTS topo.Server)
- type Tee
- func (tee *Tee) Close()
- func (tee *Tee) CreateKeyspace(keyspace string, value *topo.Keyspace) error
- func (tee *Tee) CreateShard(keyspace, shard string, value *topo.Shard) error
- func (tee *Tee) CreateTablet(tablet *topo.Tablet) error
- func (tee *Tee) DeleteEndPoints(cell, keyspace, shard string, tabletType topo.TabletType) error
- func (tee *Tee) DeleteKeyspaceShards(keyspace string) error
- func (tee *Tee) DeleteShard(keyspace, shard string) error
- func (tee *Tee) DeleteShardReplication(cell, keyspace, shard string) error
- func (tee *Tee) DeleteSrvShard(cell, keyspace, shard string) error
- func (tee *Tee) DeleteTablet(alias topo.TabletAlias) error
- func (tee *Tee) GetEndPoints(cell, keyspace, shard string, tabletType topo.TabletType) (*topo.EndPoints, error)
- func (tee *Tee) GetKeyspace(keyspace string) (*topo.KeyspaceInfo, error)
- func (tee *Tee) GetKeyspaces() ([]string, error)
- func (tee *Tee) GetKnownCells() ([]string, error)
- func (tee *Tee) GetShard(keyspace, shard string) (*topo.ShardInfo, error)
- func (tee *Tee) GetShardNames(keyspace string) ([]string, error)
- func (tee *Tee) GetShardReplication(cell, keyspace, shard string) (*topo.ShardReplicationInfo, error)
- func (tee *Tee) GetSrvKeyspace(cell, keyspace string) (*topo.SrvKeyspace, error)
- func (tee *Tee) GetSrvKeyspaceNames(cell string) ([]string, error)
- func (tee *Tee) GetSrvShard(cell, keyspace, shard string) (*topo.SrvShard, error)
- func (tee *Tee) GetSrvTabletTypesPerShard(cell, keyspace, shard string) ([]topo.TabletType, error)
- func (tee *Tee) GetTablet(alias topo.TabletAlias) (*topo.TabletInfo, error)
- func (tee *Tee) GetTabletsByCell(cell string) ([]topo.TabletAlias, 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) UnlockKeyspaceForAction(keyspace, lockPath, results string) error
- func (tee *Tee) UnlockShardForAction(keyspace, shard, lockPath, results string) error
- func (tee *Tee) UnlockSrvShardForAction(cell, keyspace, shard, lockPath, results string) error
- func (tee *Tee) UpdateEndPoints(cell, keyspace, shard string, tabletType topo.TabletType, ...) error
- func (tee *Tee) UpdateKeyspace(ki *topo.KeyspaceInfo, existingVersion int64) (newVersion int64, err error)
- func (tee *Tee) UpdateShard(si *topo.ShardInfo, existingVersion int64) (newVersion int64, err error)
- func (tee *Tee) UpdateShardReplicationFields(cell, keyspace, shard string, update func(*topo.ShardReplication) error) error
- func (tee *Tee) UpdateSrvKeyspace(cell, keyspace string, srvKeyspace *topo.SrvKeyspace) error
- func (tee *Tee) UpdateSrvShard(cell, keyspace, shard string, srvShard *topo.SrvShard) error
- func (tee *Tee) UpdateTablet(tablet *topo.TabletInfo, existingVersion int64) (newVersion int64, err error)
- func (tee *Tee) UpdateTabletEndpoint(cell, keyspace, shard string, tabletType topo.TabletType, addr *topo.EndPoint) error
- func (tee *Tee) UpdateTabletFields(tabletAlias topo.TabletAlias, update func(*topo.Tablet) error) error
- func (tee *Tee) ValidateShard(keyspace, shard string) error
- func (tee *Tee) WatchEndPoints(cell, keyspace, shard string, tabletType topo.TabletType) (<-chan *topo.EndPoints, 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
func CopyTablets ¶
CopyTablets will create the tablets 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) 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(cell, keyspace, shard string, tabletType topo.TabletType) error
DeleteEndPoints 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) DeleteSrvShard ¶
DeleteSrvShard is part of the topo.Server interface
func (*Tee) DeleteTablet ¶
func (tee *Tee) DeleteTablet(alias topo.TabletAlias) error
DeleteTablet is part of the topo.Server interface
func (*Tee) GetEndPoints ¶
func (tee *Tee) GetEndPoints(cell, keyspace, shard string, tabletType topo.TabletType) (*topo.EndPoints, error)
GetEndPoints is part of the topo.Server interface
func (*Tee) GetKeyspace ¶
func (tee *Tee) GetKeyspace(keyspace string) (*topo.KeyspaceInfo, error)
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(cell, keyspace, shard string) (*topo.ShardReplicationInfo, error)
GetShardReplication is part of the topo.Server interface
func (*Tee) GetSrvKeyspace ¶
func (tee *Tee) GetSrvKeyspace(cell, keyspace string) (*topo.SrvKeyspace, error)
GetSrvKeyspace is part of the topo.Server interface
func (*Tee) GetSrvKeyspaceNames ¶
GetSrvKeyspaceNames is part of the topo.Server interface
func (*Tee) GetSrvShard ¶
GetSrvShard is part of the topo.Server interface
func (*Tee) GetSrvTabletTypesPerShard ¶
func (tee *Tee) GetSrvTabletTypesPerShard(cell, keyspace, shard string) ([]topo.TabletType, error)
GetSrvTabletTypesPerShard is part of the topo.Server interface
func (*Tee) GetTablet ¶
func (tee *Tee) GetTablet(alias topo.TabletAlias) (*topo.TabletInfo, error)
GetTablet is part of the topo.Server interface
func (*Tee) GetTabletsByCell ¶
func (tee *Tee) GetTabletsByCell(cell string) ([]topo.TabletAlias, error)
GetTabletsByCell 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) UnlockKeyspaceForAction ¶
UnlockKeyspaceForAction is part of the topo.Server interface
func (*Tee) UnlockShardForAction ¶
UnlockShardForAction is part of the topo.Server interface
func (*Tee) UnlockSrvShardForAction ¶
UnlockSrvShardForAction is part of the topo.Server interface
func (*Tee) UpdateEndPoints ¶
func (tee *Tee) UpdateEndPoints(cell, keyspace, shard string, tabletType topo.TabletType, addrs *topo.EndPoints) error
UpdateEndPoints is part of the topo.Server interface
func (*Tee) UpdateKeyspace ¶
func (tee *Tee) UpdateKeyspace(ki *topo.KeyspaceInfo, existingVersion int64) (newVersion int64, err error)
UpdateKeyspace is part of the topo.Server interface
func (*Tee) UpdateShard ¶
func (tee *Tee) UpdateShard(si *topo.ShardInfo, existingVersion int64) (newVersion int64, err error)
UpdateShard is part of the topo.Server interface
func (*Tee) UpdateShardReplicationFields ¶
func (tee *Tee) UpdateShardReplicationFields(cell, keyspace, shard string, update func(*topo.ShardReplication) error) error
UpdateShardReplicationFields is part of the topo.Server interface
func (*Tee) UpdateSrvKeyspace ¶
func (tee *Tee) UpdateSrvKeyspace(cell, keyspace string, srvKeyspace *topo.SrvKeyspace) error
UpdateSrvKeyspace is part of the topo.Server interface
func (*Tee) UpdateSrvShard ¶
UpdateSrvShard is part of the topo.Server interface
func (*Tee) UpdateTablet ¶
func (tee *Tee) UpdateTablet(tablet *topo.TabletInfo, existingVersion int64) (newVersion int64, err error)
UpdateTablet is part of the topo.Server interface
func (*Tee) UpdateTabletEndpoint ¶
func (tee *Tee) UpdateTabletEndpoint(cell, keyspace, shard string, tabletType topo.TabletType, addr *topo.EndPoint) error
UpdateTabletEndpoint is part of the topo.Server interface
func (*Tee) UpdateTabletFields ¶
func (tee *Tee) UpdateTabletFields(tabletAlias topo.TabletAlias, update func(*topo.Tablet) error) error
UpdateTabletFields is part of the topo.Server interface
func (*Tee) ValidateShard ¶
ValidateShard is part of the topo.Server interface
func (*Tee) WatchEndPoints ¶
func (tee *Tee) WatchEndPoints(cell, keyspace, shard string, tabletType topo.TabletType) (<-chan *topo.EndPoints, chan<- struct{}, error)
WatchEndPoints is part of the topo.Server interface. We only watch for changes on the primary.