summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/wiggin77/cfg/source.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2023-08-05 20:43:19 +0200
committerGitHub <noreply@github.com>2023-08-05 20:43:19 +0200
commit56e7bd01ca09ad52b0c4f48f146a20a4f1b78696 (patch)
treeb1355645342667209263cbd355dc0b4254f1e8fe /vendor/github.com/wiggin77/cfg/source.go
parent9459495484d6e06a3d46de64fccd8d06f7ccc72c (diff)
downloadmatterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.gz
matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.bz2
matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.zip
Update dependencies and remove old matterclient lib (#2067)HEADmaster
Diffstat (limited to 'vendor/github.com/wiggin77/cfg/source.go')
-rw-r--r--vendor/github.com/wiggin77/cfg/source.go58
1 files changed, 0 insertions, 58 deletions
diff --git a/vendor/github.com/wiggin77/cfg/source.go b/vendor/github.com/wiggin77/cfg/source.go
deleted file mode 100644
index 09083e97..00000000
--- a/vendor/github.com/wiggin77/cfg/source.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package cfg
-
-import (
- "sync"
- "time"
-)
-
-// Source is the interface required for any source of name/value pairs.
-type Source interface {
-
- // GetProps fetches all the properties from a source and returns
- // them as a map.
- GetProps() (map[string]string, error)
-}
-
-// SourceMonitored is the interface required for any config source that is
-// monitored for changes.
-type SourceMonitored interface {
- Source
-
- // GetLastModified returns the time of the latest modification to any
- // property value within the source. If a source does not support
- // modifying properties at runtime then the zero value for `Time`
- // should be returned to ensure reload events are not generated.
- GetLastModified() (time.Time, error)
-
- // GetMonitorFreq returns the frequency as a `time.Duration` between
- // checks for changes to this config source.
- //
- // Returning zero (or less) will temporarily suspend calls to `GetLastModified`
- // and `GetMonitorFreq` will be called every 10 seconds until resumed, after which
- // `GetMontitorFreq` will be called at a frequency roughly equal to the `time.Duration`
- // returned.
- GetMonitorFreq() time.Duration
-}
-
-// AbstractSourceMonitor can be embedded in a custom `Source` to provide the
-// basic plumbing for monitor frequency.
-type AbstractSourceMonitor struct {
- mutex sync.RWMutex
- freq time.Duration
-}
-
-// GetMonitorFreq returns the frequency as a `time.Duration` between
-// checks for changes to this config source.
-func (asm *AbstractSourceMonitor) GetMonitorFreq() (freq time.Duration) {
- asm.mutex.RLock()
- freq = asm.freq
- asm.mutex.RUnlock()
- return
-}
-
-// SetMonitorFreq sets the frequency between checks for changes to this config source.
-func (asm *AbstractSourceMonitor) SetMonitorFreq(freq time.Duration) {
- asm.mutex.Lock()
- asm.freq = freq
- asm.mutex.Unlock()
-}