etcd

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultEnabled defines a state for default config
	DefaultEnabled = false

	// DefaultRegistryURL defines the default contact point
	DefaultRegistryURL = "http://127.0.0.1:4001"

	//DefaultUseDNSDiscovery defines if dns discovery should be used by default
	DefaultUseDNSDiscovery = false

	//DefaultDiscoveryDomain represents a domain name to resolve the SRV record from.
	DefaultDiscoveryDomain = "example.com"

	// DefaultCA defines a default location for the ca cert.
	DefaultCA = ""

	// DefaultSourceFolder defines a safe default for job sources
	DefaultSourceFolder = "/cron/Jobs"

	// DefaultJSONSingleDepth let's you use a flat directory structure inside etcd
	// instead of the file based one (could be a bit faster and less heavy on your network)
	DefaultJSONSingleDepth = true
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled            bool     `toml:"enabled"`
	RegistryURL        []string `toml:"registry-url"`
	UseDNSDiscovery    bool     `toml:"discovery-enabled"`
	DiscoveryDomain    string   `toml:"discovery-domain"`
	CACert             string   `toml:"connect-ca-cert"`
	SourceFolder       string   `toml:"source-folder"`
	UseJSONSingleDepth bool     `toml:"json-single-depth"`
}

Config represents a configuration for a HTTP service.

func NewConfig

func NewConfig() Config

NewConfig returns a new Config with default settings.

type Connection

type Connection struct {
	Config Config
	KAPI   client.KeysAPI
}

Connection defines a wrapper for the actual etcd connection

func NewConnection

func NewConnection(config Config) *Connection

NewConnection creates a new etcd connection

func (*Connection) Connect

func (c *Connection) Connect() error

Connect connects the etcd target

func (*Connection) ReadAll

func (c *Connection) ReadAll(tasks *[]provider.Task) error

ReadAll reads all cronjobs inside a directory

func (*Connection) ReadTask

func (c *Connection) ReadTask(key string, t *provider.Task) error

ReadTask reads a task from etcd

func (*Connection) WatchTasks

func (c *Connection) WatchTasks(cb func(t *provider.Task))

WatchTasks looks for new keys inside etcd

func (*Connection) WriteTask

func (c *Connection) WriteTask(t *provider.Task) error

WriteTask persists a task inside etcd

type SourceProvider

type SourceProvider struct {
	Config     Config
	Connection *Connection
	TaskFlow   chan provider.Task
	QuitChan   chan bool
}

SourceProvider creates a new src provider

func NewSourceProvider

func NewSourceProvider(config Config) *SourceProvider

NewSourceProvider creates a new src provider

func (SourceProvider) OnTaskUpdate

func (p SourceProvider) OnTaskUpdate(fn func(*provider.Task) error)

OnTaskUpdate runs when a task gets updated

func (*SourceProvider) Read

func (p *SourceProvider) Read() error

Read reads from FS

func (SourceProvider) Stop

func (p SourceProvider) Stop() error

Stop quits reading tasks

func (SourceProvider) String added in v0.7.0

func (p SourceProvider) String() string

String returns the Providers identity

func (SourceProvider) TaskDone

func (p SourceProvider) TaskDone(t *provider.Task) error

TaskDone will be executed when a task is done

func (SourceProvider) TaskError

func (p SourceProvider) TaskError(t *provider.Task, err error) error

TaskError will be called when an error occured

func (SourceProvider) TaskStarted

func (p SourceProvider) TaskStarted(t *provider.Task) error

TaskStarted will be executed when a task is started

Jump to

Keyboard shortcuts

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