Documentation ¶
Index ¶
- func NewFakeTopoServer(ctx context.Context, factory *FakeFactory) *topo.Server
- type FakeConn
- func (f *FakeConn) AddGetError(shouldErr bool)
- func (f *FakeConn) AddUpdateError(shouldErr bool, writePersists bool)
- func (f *FakeConn) Close()
- func (f *FakeConn) Create(ctx context.Context, filePath string, contents []byte) (topo.Version, error)
- func (f *FakeConn) Delete(ctx context.Context, filePath string, version topo.Version) error
- func (f *FakeConn) Get(ctx context.Context, filePath string) ([]byte, topo.Version, error)
- func (f *FakeConn) GetVersion(ctx context.Context, filePath string, version int64) ([]byte, error)
- func (f *FakeConn) List(ctx context.Context, filePathPrefix string) ([]topo.KVInfo, error)
- func (f *FakeConn) ListDir(ctx context.Context, dirPath string, full bool) ([]topo.DirEntry, error)
- func (f *FakeConn) Lock(ctx context.Context, dirPath, contents string) (topo.LockDescriptor, error)
- func (f *FakeConn) LockName(ctx context.Context, dirPath, contents string) (topo.LockDescriptor, error)
- func (f *FakeConn) LockWithTTL(ctx context.Context, dirPath, contents string, _ time.Duration) (topo.LockDescriptor, error)
- func (f *FakeConn) NewLeaderParticipation(string, string) (topo.LeaderParticipation, error)
- func (f *FakeConn) TryLock(ctx context.Context, dirPath, contents string) (topo.LockDescriptor, error)
- func (f *FakeConn) Update(ctx context.Context, filePath string, contents []byte, version topo.Version) (topo.Version, error)
- func (f *FakeConn) Watch(ctx context.Context, filePath string) (*topo.WatchData, <-chan *topo.WatchData, error)
- func (f *FakeConn) WatchRecursive(ctx context.Context, path string) ([]*topo.WatchDataRecursive, <-chan *topo.WatchDataRecursive, error)
- type FakeFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFakeTopoServer ¶
func NewFakeTopoServer(ctx context.Context, factory *FakeFactory) *topo.Server
NewFakeTopoServer creates a new fake topo server
Types ¶
type FakeConn ¶
type FakeConn struct {
// contains filtered or unexported fields
}
FakeConn implements the Conn interface. It is used only for testing
func (*FakeConn) AddGetError ¶
AddGetError is used to add a get error to the fake connection
func (*FakeConn) AddUpdateError ¶
AddUpdateError is used to add an update error to the fake connection
func (*FakeConn) Create ¶
func (f *FakeConn) Create(ctx context.Context, filePath string, contents []byte) (topo.Version, error)
Create implements the Conn interface
func (*FakeConn) GetVersion ¶ added in v0.20.0
GetVersion is part of topo.Conn interface.
func (*FakeConn) LockName ¶ added in v0.21.0
func (f *FakeConn) LockName(ctx context.Context, dirPath, contents string) (topo.LockDescriptor, error)
LockName implements the Conn interface.
func (*FakeConn) LockWithTTL ¶ added in v0.21.0
func (f *FakeConn) LockWithTTL(ctx context.Context, dirPath, contents string, _ time.Duration) (topo.LockDescriptor, error)
LockWithTTL implements the Conn interface.
func (*FakeConn) NewLeaderParticipation ¶
NewLeaderParticipation implements the Conn interface
func (*FakeConn) TryLock ¶ added in v0.16.0
func (f *FakeConn) 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 (*FakeConn) Update ¶
func (f *FakeConn) Update(ctx context.Context, filePath string, contents []byte, version topo.Version) (topo.Version, error)
Update implements the Conn interface
func (*FakeConn) Watch ¶
func (f *FakeConn) Watch(ctx context.Context, filePath string) (*topo.WatchData, <-chan *topo.WatchData, error)
Watch implements the Conn interface
func (*FakeConn) WatchRecursive ¶ added in v0.15.0
func (f *FakeConn) WatchRecursive(ctx context.Context, path string) ([]*topo.WatchDataRecursive, <-chan *topo.WatchDataRecursive, error)
type FakeFactory ¶
type FakeFactory struct {
// contains filtered or unexported fields
}
FakeFactory implements the Factory interface. This is supposed to be used only for testing
func NewFakeTopoFactory ¶
func NewFakeTopoFactory() *FakeFactory
NewFakeTopoFactory creates a new fake topo factory
func (*FakeFactory) AddCell ¶
func (f *FakeFactory) AddCell(cell string) *FakeConn
AddCell is used to add a cell to the factory. It returns the fake connection created. This connection can then be used to set get and update errors
func (*FakeFactory) Create ¶
func (f *FakeFactory) Create(cell, serverAddr, root string) (topo.Conn, error)
Create implements the Factory interface It creates a fake connection which is supposed to be used only for testing
func (*FakeFactory) HasGlobalReadOnlyCell ¶
func (f *FakeFactory) HasGlobalReadOnlyCell(serverAddr, root string) bool
HasGlobalReadOnlyCell implements the Factory interface