util

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2014 License: MPL-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency interface {
	Fetch(*api.Client, *api.QueryOptions) (interface{}, *api.QueryMeta, error)
	HashCode() string
	Key() string
	Display() string
}

Dependency is an interface

type FileDependency

type FileDependency struct {
	// contains filtered or unexported fields
}

func ParseFileDependency

func ParseFileDependency(s string) (*FileDependency, error)

func (*FileDependency) Display

func (d *FileDependency) Display() string

func (*FileDependency) Fetch

func (d *FileDependency) Fetch(client *api.Client, options *api.QueryOptions) (interface{}, *api.QueryMeta, error)

func (*FileDependency) HashCode

func (d *FileDependency) HashCode() string

func (*FileDependency) Key

func (d *FileDependency) Key() string

type KeyDependency

type KeyDependency struct {
	Path       string
	DataCenter string
	// contains filtered or unexported fields
}

KeyDependency is the representation of a requested key dependency from inside a template.

func ParseKeyDependency

func ParseKeyDependency(s string) (*KeyDependency, error)

ParseKeyDependency parses a string of the format a(/b(/c...))

func (*KeyDependency) Display

func (d *KeyDependency) Display() string

func (*KeyDependency) Fetch

func (d *KeyDependency) Fetch(client *api.Client, options *api.QueryOptions) (interface{}, *api.QueryMeta, error)

Fetch queries the Consul API defined by the given client and returns string of the value to Path.

func (*KeyDependency) HashCode

func (d *KeyDependency) HashCode() string

func (*KeyDependency) Key

func (d *KeyDependency) Key() string

type KeyPair

type KeyPair struct {
	Path  string
	Key   string
	Value string
}

KeyPair is a simple Key-Value pair

type KeyPrefixDependency

type KeyPrefixDependency struct {
	Prefix     string
	DataCenter string
	// contains filtered or unexported fields
}

KeyPrefixDependency is the representation of a requested key dependency from inside a template.

func ParseKeyPrefixDependency

func ParseKeyPrefixDependency(s string) (*KeyPrefixDependency, error)

ParseKeyDependency parses a string of the format a(/b(/c...))

func (*KeyPrefixDependency) Display

func (d *KeyPrefixDependency) Display() string

func (*KeyPrefixDependency) Fetch

func (d *KeyPrefixDependency) Fetch(client *api.Client, options *api.QueryOptions) (interface{}, *api.QueryMeta, error)

Fetch queries the Consul API defined by the given client and returns a slice of KeyPair objects

func (*KeyPrefixDependency) HashCode

func (d *KeyPrefixDependency) HashCode() string

func (*KeyPrefixDependency) Key

func (d *KeyPrefixDependency) Key() string

type Service

type Service struct {
	Node    string
	Address string
	ID      string
	Name    string
	Tags    []string
	Port    uint64
}

Service is a service entry in Consul

type ServiceDependency

type ServiceDependency struct {
	Name       string
	Tag        string
	DataCenter string
	Port       uint64
	// contains filtered or unexported fields
}

ServiceDependency is the representation of a requested service dependency from inside a template.

func ParseServiceDependency

func ParseServiceDependency(s string) (*ServiceDependency, error)

ParseServiceDependency parses a string of the format service(.tag(@datacenter(:port)))

func (*ServiceDependency) Display

func (d *ServiceDependency) Display() string

func (*ServiceDependency) Fetch

func (d *ServiceDependency) Fetch(client *api.Client, options *api.QueryOptions) (interface{}, *api.QueryMeta, error)

Fetch queries the Consul API defined by the given client and returns a slice of Service objects.

func (*ServiceDependency) HashCode

func (d *ServiceDependency) HashCode() string

func (*ServiceDependency) Key

func (d *ServiceDependency) Key() string

type ServiceList

type ServiceList []*Service

ServiceList is a sortable slice of Service

func (ServiceList) Len

func (s ServiceList) Len() int

func (ServiceList) Less

func (s ServiceList) Less(i, j int) bool

func (ServiceList) Swap

func (s ServiceList) Swap(i, j int)

type Wait

type Wait struct {
	// Min and Max are the minimum and maximum time, respectively, to wait for
	// data changes before rendering a new template to disk.
	Min, Max time.Duration
}

Wait is the Min/Max duration used by the Watcher

func ParseWait

func ParseWait(s string) (*Wait, error)

ParseWait parses a string of the format `minimum(:maximum)` into a Wait struct.

type WatchData

type WatchData struct {
	Dependency Dependency
	Data       interface{}
	// contains filtered or unexported fields
}

func NewWatchData

func NewWatchData(dependency Dependency) (*WatchData, error)

func (*WatchData) Display

func (wd *WatchData) Display() string

type Watcher

type Watcher struct {
	// DataCh is the chan where new WatchData will be published
	DataCh chan *WatchData

	// ErrCh is the chan where any errors will be published
	ErrCh chan error

	// FinishCh is the chan where the watcher reports it is "done"
	FinishCh chan struct{}
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(client *api.Client, dependencies []Dependency) (*Watcher, error)

func (*Watcher) Stop

func (w *Watcher) Stop()

func (*Watcher) Watch

func (w *Watcher) Watch(once bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL