clustertest

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockedCluster

type MockedCluster struct {
	MockedIsLeader               func() bool
	MockedLayout                 func() *cluster.Layout
	MockedGet                    func(key string) (*string, error)
	MockedGetPrefix              func(prefix string) (map[string]string, error)
	MockedGetRaw                 func(key string) (*mvccpb.KeyValue, error)
	MockedGetRawPrefix           func(prefix string) (map[string]*mvccpb.KeyValue, error)
	MockedGetWithOp              func(key string, ops ...cluster.ClientOp) (map[string]string, error)
	MockedPut                    func(key, value string) error
	MockedPutUnderLease          func(key, value string) error
	MockedPutAndDelete           func(map[string]*string) error
	MockedPutAndDeleteUnderLease func(map[string]*string) error
	MockedDelete                 func(key string) error
	MockedDeletePrefix           func(prefix string) error
	MockedSTM                    func(apply func(concurrency.STM) error) error
	MockedWatcher                func() (cluster.Watcher, error)
	MockedSyncer                 func(pullInterval time.Duration) (cluster.Syncer, error)
	MockedMutex                  func(name string) (cluster.Mutex, error)
	MockedCloseServer            func(wg *sync.WaitGroup)
	MockedStartServer            func() (chan struct{}, chan struct{}, error)
	MockedClose                  func(wg *sync.WaitGroup)
	MockedPurgeMember            func(member string) error
}

MockedCluster defines a mocked cluster

func NewMockedCluster

func NewMockedCluster() *MockedCluster

NewMockedCluster creates a new mocked cluster

func (*MockedCluster) Close

func (mc *MockedCluster) Close(wg *sync.WaitGroup)

Close implements interface function Close

func (*MockedCluster) CloseServer

func (mc *MockedCluster) CloseServer(wg *sync.WaitGroup)

CloseServer implements interface function CloseServer

func (*MockedCluster) Delete

func (mc *MockedCluster) Delete(key string) error

Delete implements interface function Delete

func (*MockedCluster) DeletePrefix

func (mc *MockedCluster) DeletePrefix(prefix string) error

DeletePrefix implements interface function DeletePrefix

func (*MockedCluster) Get

func (mc *MockedCluster) Get(key string) (*string, error)

Get implements interface function Get

func (*MockedCluster) GetPrefix

func (mc *MockedCluster) GetPrefix(prefix string) (map[string]string, error)

GetPrefix implements interface function GetPrefix

func (*MockedCluster) GetRaw

func (mc *MockedCluster) GetRaw(key string) (*mvccpb.KeyValue, error)

GetRaw implements interface function GetRaw

func (*MockedCluster) GetRawPrefix

func (mc *MockedCluster) GetRawPrefix(prefix string) (map[string]*mvccpb.KeyValue, error)

GetRawPrefix implements interface function GetRawPrefix

func (*MockedCluster) GetWithOp

func (mc *MockedCluster) GetWithOp(key string, ops ...cluster.ClientOp) (map[string]string, error)

GetWithOp implements interface function GetWithOp

func (*MockedCluster) IsLeader

func (mc *MockedCluster) IsLeader() bool

IsLeader implements interface function IsLeader

func (*MockedCluster) Layout

func (mc *MockedCluster) Layout() *cluster.Layout

Layout implements interface function Layout

func (*MockedCluster) Mutex

func (mc *MockedCluster) Mutex(name string) (cluster.Mutex, error)

Mutex implements interface function Mutex

func (*MockedCluster) PurgeMember

func (mc *MockedCluster) PurgeMember(member string) error

PurgeMember implements interface function PurgeMember

func (*MockedCluster) Put

func (mc *MockedCluster) Put(key, value string) error

Put implements interface function Put

func (*MockedCluster) PutAndDelete

func (mc *MockedCluster) PutAndDelete(m map[string]*string) error

PutAndDelete implements interface function PutAndDelete

func (*MockedCluster) PutAndDeleteUnderLease

func (mc *MockedCluster) PutAndDeleteUnderLease(m map[string]*string) error

PutAndDeleteUnderLease implements interface function PutAndDeleteUnderLease

func (*MockedCluster) PutUnderLease

func (mc *MockedCluster) PutUnderLease(key, value string) error

PutUnderLease implements interface function PutUnderLease

func (*MockedCluster) STM

func (mc *MockedCluster) STM(apply func(concurrency.STM) error) error

STM implements interface function STM

func (*MockedCluster) StartServer

func (mc *MockedCluster) StartServer() (chan struct{}, chan struct{}, error)

StartServer implements interface function StartServer

func (*MockedCluster) Syncer

func (mc *MockedCluster) Syncer(pullInterval time.Duration) (cluster.Syncer, error)

Syncer implements interface function Syncer

func (*MockedCluster) Watcher

func (mc *MockedCluster) Watcher() (cluster.Watcher, error)

Watcher implements interface function Watcher

type MockedSTM

type MockedSTM struct {
	// embed concurrency.STM for commit & reset
	concurrency.STM
	MockedGet func(key ...string) string
	MockedPut func(key, val string, opts ...clientv3.OpOption)
	MockedRev func(key string) int64
	MockedDel func(key string)
}

MockedSTM is a mocked cocurrency.STM

func (*MockedSTM) Del

func (stm *MockedSTM) Del(key string)

Del implements STM.Del

func (*MockedSTM) Get

func (stm *MockedSTM) Get(key ...string) string

Get implements STM.Get

func (*MockedSTM) Put

func (stm *MockedSTM) Put(key, val string, opts ...clientv3.OpOption)

Put implements STM.Put

func (*MockedSTM) Rev

func (stm *MockedSTM) Rev(key string) int64

Rev implements STM.Rev

type MockedSyncer

type MockedSyncer struct {
	MockedSync          func(string) (<-chan *string, error)
	MockedSyncRaw       func(string) (<-chan *mvccpb.KeyValue, error)
	MockedSyncPrefix    func(string) (<-chan map[string]string, error)
	MockedSyncRawPrefix func(string) (<-chan map[string]*mvccpb.KeyValue, error)
	MockedClose         func()
}

MockedSyncer is a mock for cluster.Syncer

func NewMockedSyncer

func NewMockedSyncer() *MockedSyncer

NewMockedSyncer return MockedSyncer

func (*MockedSyncer) Close

func (s *MockedSyncer) Close()

Close implements interface function Close

func (*MockedSyncer) Sync

func (s *MockedSyncer) Sync(key string) (<-chan *string, error)

Sync implements interface function Sync

func (*MockedSyncer) SyncPrefix

func (s *MockedSyncer) SyncPrefix(prefix string) (<-chan map[string]string, error)

SyncPrefix implements interface function SyncPrefix

func (*MockedSyncer) SyncRaw

func (s *MockedSyncer) SyncRaw(key string) (<-chan *mvccpb.KeyValue, error)

SyncRaw implements interface function SyncRaw

func (*MockedSyncer) SyncRawPrefix

func (s *MockedSyncer) SyncRawPrefix(prefix string) (<-chan map[string]*mvccpb.KeyValue, error)

SyncRawPrefix implements interface function SyncRawPrefix

type MockedWatcher

type MockedWatcher struct {
	MockedWatch          func(key string) (<-chan *string, error)
	MockedWatchPrefix    func(prefix string) (<-chan map[string]*string, error)
	MockedWatchRaw       func(key string) (<-chan *clientv3.Event, error)
	MockedWatchRawPrefix func(prefix string) (<-chan map[string]*clientv3.Event, error)
	MockedWatchWithOp    func(key string, ops ...cluster.ClientOp) (<-chan map[string]*string, error)
	MockedClose          func()
}

MockedWatcher defines a mocked watcher

func NewMockedWatcher

func NewMockedWatcher() *MockedWatcher

NewMockedWatcher return MockedWatcher

func (*MockedWatcher) Close

func (w *MockedWatcher) Close()

Close implements interface function Close

func (*MockedWatcher) Watch

func (w *MockedWatcher) Watch(key string) (<-chan *string, error)

Watch implements interface function Watch

func (*MockedWatcher) WatchPrefix

func (w *MockedWatcher) WatchPrefix(prefix string) (<-chan map[string]*string, error)

WatchPrefix implements interface function WatchPrefix

func (*MockedWatcher) WatchRaw

func (w *MockedWatcher) WatchRaw(key string) (<-chan *clientv3.Event, error)

WatchRaw implements interface function WatchRaw

func (*MockedWatcher) WatchRawPrefix

func (w *MockedWatcher) WatchRawPrefix(prefix string) (<-chan map[string]*clientv3.Event, error)

WatchRawPrefix implements interface function WatchRawPrefix

func (*MockedWatcher) WatchWithOp

func (w *MockedWatcher) WatchWithOp(key string, ops ...cluster.ClientOp) (<-chan map[string]*string, error)

WatchWithOp implements interface function WatchWithOp

Jump to

Keyboard shortcuts

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