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)
- func CopyTablets(ctx context.Context, fromTS, toTS topo.Impl)
- type Tee
- func (tee *Tee) Close()
- func (tee *Tee) Create(ctx context.Context, cell, filePath string, contents []byte) (topo.Version, error)
- func (tee *Tee) CreateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace) error
- func (tee *Tee) CreateShard(ctx context.Context, keyspace, shard string, value *topodatapb.Shard) error
- func (tee *Tee) CreateTablet(ctx context.Context, tablet *topodatapb.Tablet) error
- func (tee *Tee) Delete(ctx context.Context, cell, filePath string, version topo.Version) 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) 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) DeleteTablet(ctx context.Context, alias *topodatapb.TabletAlias) error
- func (tee *Tee) Get(ctx context.Context, cell, filePath string) ([]byte, topo.Version, error)
- func (tee *Tee) GetKeyspace(ctx context.Context, keyspace string) (*topodatapb.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) (*topodatapb.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) (*topodatapb.SrvKeyspace, error)
- func (tee *Tee) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error)
- func (tee *Tee) GetSrvVSchema(ctx context.Context, cell string) (*vschemapb.SrvVSchema, error)
- func (tee *Tee) GetTablet(ctx context.Context, alias *topodatapb.TabletAlias) (*topodatapb.Tablet, int64, error)
- func (tee *Tee) GetTabletsByCell(ctx context.Context, cell string) ([]*topodatapb.TabletAlias, error)
- func (tee *Tee) GetVSchema(ctx context.Context, keyspace string) (*vschemapb.Keyspace, error)
- func (tee *Tee) ListDir(ctx context.Context, cell, dirPath string) ([]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) NewMasterParticipation(name, id string) (topo.MasterParticipation, error)
- func (tee *Tee) SaveVSchema(ctx context.Context, keyspace string, contents *vschemapb.Keyspace) 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) Update(ctx context.Context, cell, filePath string, contents []byte, ...) (topo.Version, error)
- func (tee *Tee) UpdateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace, ...) (newVersion int64, err error)
- func (tee *Tee) UpdateShard(ctx context.Context, keyspace, shard string, value *topodatapb.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, ...) error
- func (tee *Tee) UpdateSrvVSchema(ctx context.Context, cell string, srvVSchema *vschemapb.SrvVSchema) error
- func (tee *Tee) UpdateTablet(ctx context.Context, tablet *topodatapb.Tablet, existingVersion int64) (newVersion int64, err error)
- func (tee *Tee) ValidateShard(ctx context.Context, keyspace, shard string) error
- func (tee *Tee) Watch(ctx context.Context, cell, filePath string) (*topo.WatchData, <-chan *topo.WatchData, topo.CancelFunc)
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. We also create MasterParticipation from 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) Create ¶
func (tee *Tee) Create(ctx context.Context, cell, filePath string, contents []byte) (topo.Version, error)
Create is part of the topo.Backend interface.
func (*Tee) CreateKeyspace ¶
func (tee *Tee) CreateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace) error
CreateKeyspace is part of the topo.Server interface
func (*Tee) CreateShard ¶
func (tee *Tee) CreateShard(ctx context.Context, keyspace, shard string, value *topodatapb.Shard) error
CreateShard is part of the topo.Server interface
func (*Tee) CreateTablet ¶
CreateTablet 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) 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) DeleteTablet ¶
func (tee *Tee) DeleteTablet(ctx context.Context, alias *topodatapb.TabletAlias) error
DeleteTablet is part of the topo.Server interface
func (*Tee) GetKeyspace ¶
func (tee *Tee) GetKeyspace(ctx context.Context, keyspace string) (*topodatapb.Keyspace, int64, 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) GetShard ¶
func (tee *Tee) GetShard(ctx context.Context, keyspace, shard string) (*topodatapb.Shard, int64, error)
GetShard 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 ¶
func (tee *Tee) GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*topodatapb.SrvKeyspace, error)
GetSrvKeyspace is part of the topo.Server interface
func (*Tee) GetSrvKeyspaceNames ¶
GetSrvKeyspaceNames is part of the topo.Server interface
func (*Tee) GetSrvVSchema ¶
GetSrvVSchema is part of the topo.Server interface
func (*Tee) GetTablet ¶
func (tee *Tee) GetTablet(ctx context.Context, alias *topodatapb.TabletAlias) (*topodatapb.Tablet, int64, error)
GetTablet is part of the topo.Server interface
func (*Tee) GetTabletsByCell ¶
func (tee *Tee) GetTabletsByCell(ctx context.Context, cell string) ([]*topodatapb.TabletAlias, error)
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) NewMasterParticipation ¶
func (tee *Tee) NewMasterParticipation(name, id string) (topo.MasterParticipation, error)
NewMasterParticipation is part of the topo.Server interface
func (*Tee) SaveVSchema ¶
func (tee *Tee) SaveVSchema(ctx context.Context, keyspace string, contents *vschemapb.Keyspace) error
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) Update ¶
func (tee *Tee) Update(ctx context.Context, cell, filePath string, contents []byte, version topo.Version) (topo.Version, error)
Update is part of the topo.Backend interface.
func (*Tee) UpdateKeyspace ¶
func (tee *Tee) UpdateKeyspace(ctx context.Context, keyspace string, value *topodatapb.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 *topodatapb.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(*topodatapb.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 *topodatapb.SrvKeyspace) error
UpdateSrvKeyspace is part of the topo.Server interface
func (*Tee) UpdateSrvVSchema ¶
func (tee *Tee) UpdateSrvVSchema(ctx context.Context, cell string, srvVSchema *vschemapb.SrvVSchema) error
UpdateSrvVSchema is part of the topo.Server interface
func (*Tee) UpdateTablet ¶
func (tee *Tee) UpdateTablet(ctx context.Context, tablet *topodatapb.Tablet, existingVersion int64) (newVersion int64, err error)
UpdateTablet is part of the topo.Server interface
func (*Tee) ValidateShard ¶
ValidateShard is part of the topo.Server interface