Documentation

Overview

    Package etcd implements a DataClient for reading the skipper route definitions from an etcd service.

    (See the DataClient interface in the skipper/routing package.)

    etcd is a generic, distributed configuration service: https://github.com/coreos/etcd. The route definitions are stored under individual keys as eskip route expressions. When loaded from etcd, the routes will get the etcd key as id.

    In addition to the DataClient implementation, type Client provides methods to Upsert and Delete routes.

    Example
    Output:
    
    

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type Client

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

      A Client is used to load the whole set of routes and the updates from an etcd store.

      func New

      func New(o Options) (*Client, error)

        Creates a new Client with the provided options.

        func (*Client) Delete

        func (c *Client) Delete(id string) error

          Deletes a route from etcd.

          func (*Client) DeleteAllIf

          func (c *Client) DeleteAllIf(routes []*eskip.Route, cond eskip.RoutePredicate) error

          func (*Client) LoadAll

          func (c *Client) LoadAll() ([]*eskip.Route, error)

            Returns all the route definitions currently stored in etcd.

            func (*Client) LoadAndParseAll

            func (c *Client) LoadAndParseAll() ([]*eskip.RouteInfo, error)

              Returns all the route definitions currently stored in etcd, or the parsing error in case of failure.

              func (*Client) LoadUpdate

              func (c *Client) LoadUpdate() ([]*eskip.Route, []string, error)

                Returns the updates (upserts and deletes) since the last initial request or update.

                It uses etcd's watch functionality that results in blocking this call until the next change is detected in etcd or reaches the configured hard timeout.

                func (*Client) Upsert

                func (c *Client) Upsert(r *eskip.Route) error

                  Inserts or updates a route in etcd.

                  func (*Client) UpsertAll

                  func (c *Client) UpsertAll(routes []*eskip.Route) error

                  type Options

                  type Options struct {
                  
                  	// A slice of etcd endpoint addresses.
                  	// (Schema and host.)
                  	Endpoints []string
                  
                  	// Etcd path to a directory where the
                  	// Skipper related settings are stored.
                  	Prefix string
                  
                  	// A timeout value for etcd long-polling.
                  	// The default timeout is 1 second.
                  	Timeout time.Duration
                  
                  	// Skip TLS certificate check.
                  	Insecure bool
                  
                  	// Optional OAuth-Token
                  	OAuthToken string
                  
                  	// Optional username for basic auth
                  	Username string
                  
                  	// Optional password for basic auth
                  	Password string
                  }

                    Initialization options.

                    Source Files

                    Directories

                    Path Synopsis
                    Package etcdtest implements an easy startup script to start a local etcd instance for testing purpose.
                    Package etcdtest implements an easy startup script to start a local etcd instance for testing purpose.