Package source is the interface for sources



    This section is empty.


    View Source
    var (
    	// ErrWatcherStopped is returned when source watcher has been stopped
    	ErrWatcherStopped = errors.New("watcher stopped")


    This section is empty.


    type ChangeSet

    type ChangeSet struct {
    	Data      []byte
    	Checksum  string
    	Format    string
    	Source    string
    	Timestamp time.Time

      ChangeSet represents a set of changes from a source

      func (*ChangeSet) Sum

      func (c *ChangeSet) Sum() string

        Sum returns the md5 checksum of the ChangeSet data

        type Option

        type Option func(o *Options)

        func WithClient

        func WithClient(c client.Client) Option

          WithClient sets the source client

          func WithEncoder

          func WithEncoder(e encoder.Encoder) Option

            WithEncoder sets the source encoder

            type Options

            type Options struct {
            	// Encoder
            	Encoder encoder.Encoder
            	// for alternative data
            	Context context.Context
            	// Client to use for RPC
            	Client client.Client

            func NewOptions

            func NewOptions(opts ...Option) Options

            type Source

            type Source interface {
            	Read() (*ChangeSet, error)
            	Write(*ChangeSet) error
            	Watch() (Watcher, error)
            	String() string

              Source is the source from which config is loaded

              type Watcher

              type Watcher interface {
              	Next() (*ChangeSet, error)
              	Stop() error

                Watcher watches a source for changes

                func NewNoopWatcher

                func NewNoopWatcher() (Watcher, error)

                  NewNoopWatcher returns a watcher that blocks on Next() until Stop() is called.


                  Path Synopsis
                  Package file is a file source.
                  Package file is a file source.
                  Package memory is a memory source
                  Package memory is a memory source