skipper: github.com/zalando/skipper/eskipfile Index | Examples | Files

package eskipfile

import "github.com/zalando/skipper/eskipfile"

Package eskipfile implements the DataClient interface for reading the skipper route definitions from an eskip formatted file.

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

The package provides two implementations: one without file watch (legacy version) and one with file watch. When running the skipper command, the one with watch is used.

Code:

// open file with a routing table:
dataClient := eskipfile.Watch("/some/path/to/routing-table.eskip")
defer dataClient.Close()

// create a routing object:
rt := routing.New(routing.Options{
    DataClients: []routing.DataClient{dataClient},
})
defer rt.Close()

// create an http.Handler:
p := proxy.New(rt, proxy.OptionsNone)
defer p.Close()

Index

Examples

Package Files

doc.go file.go watch.go

type Client Uses

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

Client contains the route definitions from an eskip file, not implementing file watch. Use the Open function to create instances of it.

func Open Uses

func Open(path string) (*Client, error)

Opens an eskip file and parses it, returning a DataClient implementation. If reading or parsing the file fails, returns an error. This implementation doesn't provide file watch.

func (Client) LoadAll Uses

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

LoadAll returns the parsed route definitions found in the file.

func (Client) LoadAndParseAll Uses

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

func (Client) LoadUpdate Uses

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

LoadUpdate: noop. The current implementation doesn't support watching the eskip file for changes.

type WatchClient Uses

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

WatchClient implements a route configuration client with file watching. Use the Watch function to initialize instances of it.

func Watch Uses

func Watch(name string) *WatchClient

Watch creates a route configuration client with file watching. Watch doesn't follow file system nodes, it always reads from the file identified by the initially provided file name.

func (*WatchClient) Close Uses

func (c *WatchClient) Close()

Close stops watching the configured file and providing updates.

func (*WatchClient) LoadAll Uses

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

LoadAll returns the parsed route definitions found in the file.

func (*WatchClient) LoadUpdate Uses

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

LoadUpdate returns differential updates when a watched file has changed.

Package eskipfile imports 4 packages (graph) and is imported by 9 packages. Updated 2019-09-24. Refresh now. Tools for package owners.