add Write method to config source

This commit is contained in:
Asim Aslam 2019-12-23 08:42:57 +00:00
parent 1781542964
commit ef95b28e3d
7 changed files with 26 additions and 0 deletions

View File

@ -78,6 +78,11 @@ func (c *cliSource) Watch() (source.Watcher, error) {
return source.NewNoopWatcher()
}
// Write is unsupported
func (c *cliSource) Write(cs *source.ChangeSet) error {
return nil
}
func (c *cliSource) String() string {
return "cli"
}

View File

@ -105,6 +105,10 @@ func (e *env) Watch() (source.Watcher, error) {
return newWatcher()
}
func (e *env) Write(cs *source.ChangeSet) error {
return nil
}
func (e *env) String() string {
return "env"
}

View File

@ -76,6 +76,10 @@ func (c *etcd) Watch() (source.Watcher, error) {
return newWatcher(c.prefix, c.stripPrefix, c.client.Watcher, cs, c.opts)
}
func (c *etcd) Write(cs *source.ChangeSet) error {
return nil
}
func NewSource(opts ...source.Option) source.Source {
options := source.NewOptions(opts...)

View File

@ -54,6 +54,10 @@ func (f *file) Watch() (source.Watcher, error) {
return newWatcher(f)
}
func (f *file) Write(cs *source.ChangeSet) error {
return nil
}
func NewSource(opts ...source.Option) source.Source {
options := source.NewOptions(opts...)
path := DefaultPath

View File

@ -77,6 +77,10 @@ func (fs *flagsrc) Watch() (source.Watcher, error) {
return source.NewNoopWatcher()
}
func (fs *flagsrc) Write(cs *source.ChangeSet) error {
return nil
}
func (fs *flagsrc) String() string {
return "flag"
}

View File

@ -41,6 +41,10 @@ func (s *memory) Watch() (source.Watcher, error) {
return w, nil
}
func (m *memory) Write(cs *source.ChangeSet) error {
return nil
}
// Update allows manual updates of the config data.
func (s *memory) Update(c *source.ChangeSet) {
// don't process nil

View File

@ -15,6 +15,7 @@ var (
type Source interface {
Read() (*ChangeSet, error)
Watch() (Watcher, error)
Write(*ChangeSet) error
String() string
}