Documentation ¶
Index ¶
- func NewFakeTopoServer(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) 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) NewLeaderParticipation(string, string) (topo.LeaderParticipation, 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, topo.CancelFunc)
- type FakeFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFakeTopoServer ¶
func NewFakeTopoServer(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) NewLeaderParticipation ¶
NewLeaderParticipation implements the Conn interface
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