helpers

package
v0.16.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareKeyspaces

func CompareKeyspaces(ctx context.Context, fromTS, toTS *topo.Server) error

CompareKeyspaces will compare the keyspaces in the destination topo.

func CompareRoutingRules

func CompareRoutingRules(ctx context.Context, fromTS, toTS *topo.Server) error

CompareRoutingRules will compare the routing rules in the destination topo.

func CompareShardReplications

func CompareShardReplications(ctx context.Context, fromTS, toTS *topo.Server) error

CompareShardReplications will compare the ShardReplication objects in the destination topo.

func CompareShards

func CompareShards(ctx context.Context, fromTS, toTS *topo.Server) error

CompareShards will compare the shards in the destination topo.

func CompareTablets

func CompareTablets(ctx context.Context, fromTS, toTS *topo.Server) error

CompareTablets will compare the tablets in the destination topo.

func CopyKeyspaces

func CopyKeyspaces(ctx context.Context, fromTS, toTS *topo.Server)

CopyKeyspaces will create the keyspaces in the destination topo.

func CopyRoutingRules

func CopyRoutingRules(ctx context.Context, fromTS, toTS *topo.Server)

CopyRoutingRules will create the routing rules in the destination topo.

func CopyShardReplications

func CopyShardReplications(ctx context.Context, fromTS, toTS *topo.Server)

CopyShardReplications will create the ShardReplication objects in the destination topo.

func CopyShards

func CopyShards(ctx context.Context, fromTS, toTS *topo.Server)

CopyShards will create the shards in the destination topo.

func CopyTablets

func CopyTablets(ctx context.Context, fromTS, toTS *topo.Server)

CopyTablets will create the tablets in the destination topo.

func NewTee

func NewTee(primary, secondary *topo.Server, reverseLockOrder bool) (*topo.Server, error)

NewTee returns a new topo.Server object. It uses a TeeFactory.

Types

type TeeConn

type TeeConn struct {
	// contains filtered or unexported fields
}

TeeConn implements the topo.Conn interface.

func (*TeeConn) Close

func (c *TeeConn) Close()

Close is part of 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) Delete

func (c *TeeConn) Delete(ctx context.Context, filePath string, version topo.Version) error

Delete is part of the topo.Conn interface.

func (*TeeConn) Get

func (c *TeeConn) Get(ctx context.Context, filePath string) ([]byte, topo.Version, error)

Get is part of the topo.Conn interface.

func (*TeeConn) List added in v0.13.0

func (c *TeeConn) List(ctx context.Context, filePathPrefix string) ([]topo.KVInfo, error)

List is part of the topo.Conn interface.

func (*TeeConn) ListDir

func (c *TeeConn) ListDir(ctx context.Context, dirPath string, full bool) ([]topo.DirEntry, error)

ListDir is part of the topo.Conn interface.

func (*TeeConn) Lock

func (c *TeeConn) Lock(ctx context.Context, dirPath, contents string) (topo.LockDescriptor, error)

Lock 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL