Documentation ¶
Overview ¶
Package helpers contains a few utility classes to handle topo.Server objects, and transitions from one topo implementation to another.
Package helpers contains a few utility classes to handle topo.Server objects, and transitions from one topo implementation to another.
Index ¶
- func CompareKeyspaces(ctx context.Context, fromTS, toTS *topo.Server) error
- func CompareRoutingRules(ctx context.Context, fromTS, toTS *topo.Server) error
- func CompareShardReplications(ctx context.Context, fromTS, toTS *topo.Server) error
- func CompareShards(ctx context.Context, fromTS, toTS *topo.Server) error
- func CompareTablets(ctx context.Context, fromTS, toTS *topo.Server) error
- func CopyKeyspaces(ctx context.Context, fromTS, toTS *topo.Server) error
- func CopyRoutingRules(ctx context.Context, fromTS, toTS *topo.Server) error
- func CopyShardReplications(ctx context.Context, fromTS, toTS *topo.Server) error
- func CopyShards(ctx context.Context, fromTS, toTS *topo.Server) error
- func CopyTablets(ctx context.Context, fromTS, toTS *topo.Server) error
- func NewTee(primary, secondary *topo.Server, reverseLockOrder bool) (*topo.Server, error)
- type TeeConn
- func (c *TeeConn) Close()
- func (c *TeeConn) Create(ctx context.Context, filePath string, contents []byte) (topo.Version, error)
- func (c *TeeConn) Delete(ctx context.Context, filePath string, version topo.Version) error
- func (c *TeeConn) Get(ctx context.Context, filePath string) ([]byte, topo.Version, error)
- func (c *TeeConn) List(ctx context.Context, filePathPrefix string) ([]topo.KVInfo, error)
- func (c *TeeConn) ListDir(ctx context.Context, dirPath string, full bool) ([]topo.DirEntry, error)
- func (c *TeeConn) Lock(ctx context.Context, dirPath, contents string) (topo.LockDescriptor, error)
- func (c *TeeConn) NewLeaderParticipation(name, id string) (topo.LeaderParticipation, error)
- func (c *TeeConn) TryLock(ctx context.Context, dirPath, contents string) (topo.LockDescriptor, error)
- func (c *TeeConn) Update(ctx context.Context, filePath string, contents []byte, version topo.Version) (topo.Version, error)
- func (c *TeeConn) Watch(ctx context.Context, filePath string) (*topo.WatchData, <-chan *topo.WatchData, error)
- func (c *TeeConn) WatchRecursive(ctx context.Context, path string) ([]*topo.WatchDataRecursive, <-chan *topo.WatchDataRecursive, error)
- type TeeFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareKeyspaces ¶
CompareKeyspaces will compare the keyspaces in the destination topo.
func CompareRoutingRules ¶
CompareRoutingRules will compare the routing rules in the destination topo.
func CompareShardReplications ¶
CompareShardReplications will compare the ShardReplication objects in the destination topo.
func CompareShards ¶
CompareShards will compare the shards in the destination topo.
func CompareTablets ¶
CompareTablets will compare the tablets in the destination topo.
func CopyKeyspaces ¶
CopyKeyspaces will create the keyspaces in the destination topo.
func CopyRoutingRules ¶
CopyRoutingRules will create the routing rules 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 TeeConn ¶
type TeeConn struct {
// contains filtered or unexported fields
}
TeeConn implements the topo.Conn interface.
func (*TeeConn) Create ¶
func (c *TeeConn) Create(ctx context.Context, filePath string, contents []byte) (topo.Version, error)
Create is part of the topo.Conn interface.
func (*TeeConn) NewLeaderParticipation ¶ added in v0.13.0
func (c *TeeConn) NewLeaderParticipation(name, id string) (topo.LeaderParticipation, error)
NewLeaderParticipation is part of the topo.Conn interface.
func (*TeeConn) TryLock ¶ added in v0.16.0
func (c *TeeConn) TryLock(ctx context.Context, dirPath, contents string) (topo.LockDescriptor, error)
TryLock is part of the topo.Conn interface. Its implementation is same as Lock
func (*TeeConn) Update ¶
func (c *TeeConn) Update(ctx context.Context, filePath string, contents []byte, version topo.Version) (topo.Version, error)
Update is part of the topo.Conn interface.
func (*TeeConn) Watch ¶
func (c *TeeConn) Watch(ctx context.Context, filePath string) (*topo.WatchData, <-chan *topo.WatchData, error)
Watch is part of the topo.Conn interface
func (*TeeConn) WatchRecursive ¶ added in v0.15.0
func (c *TeeConn) WatchRecursive(ctx context.Context, path string) ([]*topo.WatchDataRecursive, <-chan *topo.WatchDataRecursive, error)
type TeeFactory ¶
type TeeFactory struct {
// contains filtered or unexported fields
}
TeeFactory is an implementation of topo.Factory 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 LeaderParticipation 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 (*TeeFactory) Create ¶
func (f *TeeFactory) Create(cell, serverAddr, root string) (topo.Conn, error)
Create is part of the topo.Factory interface.
func (*TeeFactory) HasGlobalReadOnlyCell ¶
func (f *TeeFactory) HasGlobalReadOnlyCell(serverAddr, root string) bool
HasGlobalReadOnlyCell is part of the topo.Factory interface.