Documentation ¶
Index ¶
- Variables
- func EnsureDelete(z ZkConnSupported, path string) error
- type MemoryZkServer
- type ZkConn
- func (z *ZkConn) Children(path string) ([]string, *zk.Stat, error)
- func (z *ZkConn) ChildrenW(path string) ([]string, *zk.Stat, <-chan zk.Event, error)
- func (z *ZkConn) Close()
- func (z *ZkConn) Create(path string, data []byte, flags int32, acl []zk.ACL) (string, error)
- func (z *ZkConn) Delete(path string, version int32) error
- func (z *ZkConn) Exists(path string) (bool, *zk.Stat, error)
- func (z *ZkConn) ExistsW(path string) (bool, *zk.Stat, <-chan zk.Event, error)
- func (z *ZkConn) Get(path string) ([]byte, *zk.Stat, error)
- func (z *ZkConn) GetW(path string) ([]byte, *zk.Stat, <-chan zk.Event, error)
- func (z *ZkConn) Set(path string, data []byte, version int32) (*zk.Stat, error)
- type ZkConnSupported
Constants ¶
This section is empty.
Variables ¶
var DefaultLogger = log.Logger(log.DefaultLogger.CreateChild())
DefaultLogger is used by zktest if no logger is set
var ErrDeleteFailed = errors.New("delete eventually failed")
ErrDeleteFailed is retured when EnsureDelete() is unable to ensure the delete
var ErrDeleteOnRoot = errors.New("cannot delete on root path")
ErrDeleteOnRoot is returned when EnsureDelete is called with a root path
Functions ¶
func EnsureDelete ¶
func EnsureDelete(z ZkConnSupported, path string) error
EnsureDelete will ensure that path is deleted from zk, trying up to three times before eventually failing with an error
Types ¶
type MemoryZkServer ¶
type MemoryZkServer struct { sfxtest.ErrChecker GlobalChan chan zk.Event Logger log.Logger ChanTimeout time.Duration // contains filtered or unexported fields }
MemoryZkServer can be used in the place of a zk.Conn() to unit test zk connections
func (*MemoryZkServer) Conn ¶
func (z *MemoryZkServer) Conn() (ZkConnSupported, <-chan zk.Event, error)
Conn satisfies the ZkConnector interface for zkplus so we can easily pass the memory zk server into a builder
func (*MemoryZkServer) Connect ¶
func (z *MemoryZkServer) Connect() (*ZkConn, <-chan zk.Event, error)
Connect to this server
func (*MemoryZkServer) Pretty ¶
func (z *MemoryZkServer) Pretty() string
Pretty returns a pretty print of the zk structure
type ZkConn ¶
type ZkConn struct { Logger log.Logger sfxtest.ErrChecker // contains filtered or unexported fields }
ZkConn is the connection type returned from a MemoryZkConn that simulates a zk connection
func (*ZkConn) Close ¶
func (z *ZkConn) Close()
Close sends disconnected to all waiting events and deregisteres this conn with the parent server
type ZkConnSupported ¶
type ZkConnSupported interface { // Exists returns true if the path exists Exists(path string) (bool, *zk.Stat, error) ExistsW(path string) (bool, *zk.Stat, <-chan zk.Event, error) Get(path string) ([]byte, *zk.Stat, error) GetW(path string) ([]byte, *zk.Stat, <-chan zk.Event, error) Children(path string) ([]string, *zk.Stat, error) ChildrenW(path string) ([]string, *zk.Stat, <-chan zk.Event, error) Delete(path string, version int32) error Create(path string, data []byte, flags int32, acl []zk.ACL) (string, error) Set(path string, data []byte, version int32) (*zk.Stat, error) Close() }
ZkConnSupported is the interface of zk.Conn we currently support