From ef95b28e3d721ded376cd6c383e5e59b61f05bc5 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Mon, 23 Dec 2019 08:42:57 +0000 Subject: [PATCH] add Write method to config source --- config/source/cli/cli.go | 5 +++++ config/source/env/env.go | 4 ++++ config/source/etcd/etcd.go | 4 ++++ config/source/file/file.go | 4 ++++ config/source/flag/flag.go | 4 ++++ config/source/memory/memory.go | 4 ++++ config/source/source.go | 1 + 7 files changed, 26 insertions(+) diff --git a/config/source/cli/cli.go b/config/source/cli/cli.go index 362ea79f..6d6a8fbb 100644 --- a/config/source/cli/cli.go +++ b/config/source/cli/cli.go @@ -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" } diff --git a/config/source/env/env.go b/config/source/env/env.go index 62dbf8b2..c971945c 100644 --- a/config/source/env/env.go +++ b/config/source/env/env.go @@ -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" } diff --git a/config/source/etcd/etcd.go b/config/source/etcd/etcd.go index 7c8edba9..9dc0c0c2 100644 --- a/config/source/etcd/etcd.go +++ b/config/source/etcd/etcd.go @@ -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...) diff --git a/config/source/file/file.go b/config/source/file/file.go index 8a4b720d..15b9b860 100644 --- a/config/source/file/file.go +++ b/config/source/file/file.go @@ -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 diff --git a/config/source/flag/flag.go b/config/source/flag/flag.go index 04483d5b..98ff4d91 100644 --- a/config/source/flag/flag.go +++ b/config/source/flag/flag.go @@ -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" } diff --git a/config/source/memory/memory.go b/config/source/memory/memory.go index 78e26d3f..e6a25d2a 100644 --- a/config/source/memory/memory.go +++ b/config/source/memory/memory.go @@ -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 diff --git a/config/source/source.go b/config/source/source.go index c6d961be..6d0605bc 100644 --- a/config/source/source.go +++ b/config/source/source.go @@ -15,6 +15,7 @@ var ( type Source interface { Read() (*ChangeSet, error) Watch() (Watcher, error) + Write(*ChangeSet) error String() string }