Documentation ¶
Index ¶
- type Client
- type MockZK
- func (mzk *MockZK) Children(path string) ([]string, *zk.Stat, error)
- func (mzk *MockZK) ChildrenW(path string) ([]string, *zk.Stat, <-chan zk.Event, error)
- func (mzk *MockZK) Create(path string, data []byte, flags int32, acl []zk.ACL) (string, error)
- func (mzk *MockZK) Delete(path string, version int32) error
- func (mzk *MockZK) Exists(path string) (bool, *zk.Stat, error)
- func (mzk *MockZK) Get(path string) ([]byte, *zk.Stat, error)
- func (mzk *MockZK) GetW(path string) ([]byte, *zk.Stat, <-chan zk.Event, error)
- func (mzk *MockZK) Set(path string, data []byte, version int32) (*zk.Stat, error)
- type PathTargeter
- type PathTargeterConfig
- type Pool
- type PoolConfig
- type Targeter
- type TargeterConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { Children(path string) ([]string, *zk.Stat, error) ChildrenW(string) ([]string, *zk.Stat, <-chan zk.Event, error) Create(path string, data []byte, flags int32, acl []zk.ACL) (string, error) Delete(path string, version int32) error Exists(path string) (bool, *zk.Stat, error) Get(path string) ([]byte, *zk.Stat, error) GetW(string) ([]byte, *zk.Stat, <-chan zk.Event, error) Set(path string, data []byte, version int32) (*zk.Stat, error) }
Client in a interface that wraps zookeeper client methods.
type MockZK ¶
type MockZK struct { Args [][]interface{} ChildrenFn func(path string) ([]string, *zk.Stat, error) ChildrenwFn func(path string) ([]string, *zk.Stat, <-chan zk.Event, error) CreateFn func(path string, data []byte, flags int32, acl []zk.ACL) (string, error) DeleteFn func(path string, version int32) error ExistsFn func(path string) (bool, *zk.Stat, error) GetFn func(path string) ([]byte, *zk.Stat, error) GetwFn func(path string) ([]byte, *zk.Stat, <-chan zk.Event, error) SetFn func(path string, data []byte, version int32) (*zk.Stat, error) }
MockZK implements the zookeeper interface with overwritable implementation functions so that tests can supply their own behaviour. It is public so that it can be reused among other packages.
func NewMockZK ¶
func NewMockZK() *MockZK
NewMockZK returns a MockZK that has default implementations for all overridable functions.
func (*MockZK) ChildrenW ¶
ChildrenW returns the files contained at a given path plus a channel that will contain a zk.Event when a change occurs at that path.
func (*MockZK) Create ¶
Create puts data into zookeeper into a path when a key did not previously exists at that path.
func (*MockZK) Exists ¶
Exists returns true when a path exists; it also returns a zk.Stats which may be needed for future calls to operate on that same path.
type PathTargeter ¶
type PathTargeter struct {
// contains filtered or unexported fields
}
PathTargeter represents an object that connects to Zookeeper and queries a zk path for Vulcan scrape configurations for a specific zk path.
func NewPathTargeter ¶
func NewPathTargeter(config *PathTargeterConfig) *PathTargeter
NewPathTargeter creates a new instance of PathTargeter.
func (*PathTargeter) Jobs ¶
func (pt *PathTargeter) Jobs() <-chan []scraper.Job
Jobs implements scraper.JobWatcher interface. Returns a channel that feeds available jobs.
type PathTargeterConfig ¶
PathTargeterConfig represents the configuration of a PathTargeter.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool uses zookeeper as a backend to register a scraper's existence and watches zookeeper for changes in the list of active scrapers.
func NewPool ¶
func NewPool(config *PoolConfig) (*Pool, error)
NewPool returns a new instance of Pool.
type PoolConfig ¶
PoolConfig represents the configuration of a Pool object.
type Targeter ¶
type Targeter struct {
// contains filtered or unexported fields
}
Targeter uses zookeeper as a backend for configuring jobs that vulcan should scrape. The targeter watches the zookeeper path to react to new/changed/removed child nodes and their corresponding nodes.
func NewTargeter ¶
func NewTargeter(config *TargeterConfig) (*Targeter, error)
NewTargeter returns a new instance of Targeter.
type TargeterConfig ¶
TargeterConfig represents the configuration of a Targeter.