helpers

package
v2.2.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 18, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

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 CopyKeyspaces

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

CopyKeyspaces will create the keyspaces 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) 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) NewMasterParticipation

func (c *TeeConn) NewMasterParticipation(name, id string) (topo.MasterParticipation, error)

NewMasterParticipation is part of the topo.Conn interface.

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, topo.CancelFunc)

Watch is part of the topo.Conn interface

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 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 (*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