helpers

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

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

Go to latest
Published: Apr 6, 2017 License: BSD-3-Clause Imports: 8 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.Impl)

CopyKeyspaces will create the keyspaces in the destination topo.

func CopyShardReplications

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

CopyShardReplications will create the ShardReplication objects in the destination topo.

func CopyShards

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

CopyShards will create the shards in the destination topo.

func CopyTablets

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

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

func NewTee(primary, secondary topo.Impl, reverseLockOrder bool) *Tee

NewTee returns a new topo.Impl object

func (*Tee) Close

func (tee *Tee) Close()

Close is part of the topo.Server interface

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

func (tee *Tee) CreateTablet(ctx context.Context, tablet *topodatapb.Tablet) error

CreateTablet is part of the topo.Server interface

func (*Tee) Delete

func (tee *Tee) Delete(ctx context.Context, cell, filePath string, version topo.Version) error

Delete is part of the topo.Backend interface.

func (*Tee) DeleteKeyspace

func (tee *Tee) DeleteKeyspace(ctx context.Context, keyspace string) error

DeleteKeyspace is part of the topo.Server interface

func (*Tee) DeleteKeyspaceReplication

func (tee *Tee) DeleteKeyspaceReplication(ctx context.Context, cell, keyspace string) error

DeleteKeyspaceReplication is part of the topo.Server interface

func (*Tee) DeleteShard

func (tee *Tee) DeleteShard(ctx context.Context, keyspace, shard string) error

DeleteShard is part of the topo.Server interface

func (*Tee) DeleteShardReplication

func (tee *Tee) DeleteShardReplication(ctx context.Context, cell, keyspace, shard string) error

DeleteShardReplication is part of the topo.Server interface

func (*Tee) DeleteSrvKeyspace

func (tee *Tee) DeleteSrvKeyspace(ctx context.Context, cell, keyspace string) error

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) Get

func (tee *Tee) Get(ctx context.Context, cell, filePath string) ([]byte, topo.Version, error)

Get is part of the topo.Backend 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

func (tee *Tee) GetKeyspaces(ctx context.Context) ([]string, error)

GetKeyspaces is part of the topo.Server interface

func (*Tee) GetKnownCells

func (tee *Tee) GetKnownCells(ctx context.Context) ([]string, error)

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

func (tee *Tee) GetShardNames(ctx context.Context, keyspace string) ([]string, error)

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

func (tee *Tee) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error)

GetSrvKeyspaceNames is part of the topo.Server interface

func (*Tee) GetSrvVSchema

func (tee *Tee) GetSrvVSchema(ctx context.Context, cell string) (*vschemapb.SrvVSchema, error)

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

func (tee *Tee) GetVSchema(ctx context.Context, keyspace string) (*vschemapb.Keyspace, error)

GetVSchema is part of the topo.Server interface

func (*Tee) ListDir

func (tee *Tee) ListDir(ctx context.Context, cell, dirPath string) ([]string, error)

ListDir is part of the topo.Backend 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) Watch

func (tee *Tee) Watch(ctx context.Context, cell, filePath string) (*topo.WatchData, <-chan *topo.WatchData, topo.CancelFunc)

Watch is part of the topo.Backend interface

Jump to

Keyboard shortcuts

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