watch - ActiveState ActiveGo 1.8
...

Package watch

import "github.com/hashicorp/consul/watch"
Overview
Index

Overview ▾

type HandlerFunc

HandlerFunc is used to handle new data

type HandlerFunc func(uint64, interface{})

type Plan

Plan is the parsed version of a watch specification. A watch provides the details of a query, which generates a view into the Consul data store. This view is watched for changes and a handler is invoked to take any appropriate actions.

type Plan struct {
    Datacenter string
    Token      string
    Type       string
    Exempt     map[string]interface{}

    Watcher   WatcherFunc
    Handler   HandlerFunc
    LogOutput io.Writer
    // contains filtered or unexported fields
}

func Parse

func Parse(params map[string]interface{}) (*Plan, error)

Parse takes a watch query and compiles it into a WatchPlan or an error

func ParseExempt

func ParseExempt(params map[string]interface{}, exempt []string) (*Plan, error)

ParseExempt takes a watch query and compiles it into a WatchPlan or an error Any exempt parameters are stored in the Exempt map

func (*Plan) Run

func (p *Plan) Run(address string) error

Run is used to run a watch plan

func (*Plan) Stop

func (p *Plan) Stop()

Stop is used to stop running the watch plan

type WatcherFunc

WatcherFunc is used to watch for a diff

type WatcherFunc func(*Plan) (uint64, interface{}, error)