summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/wiggin77/cfg/srcmap.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/srcmap.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/srcmap.go')
-rw-r--r--vendor/github.com/wiggin77/cfg/srcmap.go78
1 files changed, 0 insertions, 78 deletions
diff --git a/vendor/github.com/wiggin77/cfg/srcmap.go b/vendor/github.com/wiggin77/cfg/srcmap.go
deleted file mode 100644
index 321db27a..00000000
--- a/vendor/github.com/wiggin77/cfg/srcmap.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package cfg
-
-import (
- "time"
-)
-
-// SrcMap is a configuration `Source` backed by a simple map.
-type SrcMap struct {
- AbstractSourceMonitor
- m map[string]string
- lm time.Time
-}
-
-// NewSrcMap creates an empty `SrcMap`.
-func NewSrcMap() *SrcMap {
- sm := &SrcMap{}
- sm.m = make(map[string]string)
- sm.lm = time.Now()
- sm.freq = time.Minute
- return sm
-}
-
-// NewSrcMapFromMap creates a `SrcMap` containing a copy of the
-// specified map.
-func NewSrcMapFromMap(mapIn map[string]string) *SrcMap {
- sm := NewSrcMap()
- sm.PutAll(mapIn)
- return sm
-}
-
-// Put inserts or updates a value in the `SrcMap`.
-func (sm *SrcMap) Put(key string, val string) {
- sm.mutex.Lock()
- sm.m[key] = val
- sm.lm = time.Now()
- sm.mutex.Unlock()
-}
-
-// PutAll inserts a copy of `mapIn` into the `SrcMap`
-func (sm *SrcMap) PutAll(mapIn map[string]string) {
- sm.mutex.Lock()
- defer sm.mutex.Unlock()
-
- for k, v := range mapIn {
- sm.m[k] = v
- }
- sm.lm = time.Now()
-}
-
-// GetProps fetches all the properties from a source and returns
-// them as a map.
-func (sm *SrcMap) GetProps() (m map[string]string, err error) {
- sm.mutex.RLock()
- m = sm.m
- sm.mutex.RUnlock()
- return
-}
-
-// 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.
-func (sm *SrcMap) GetLastModified() (last time.Time, err error) {
- sm.mutex.RLock()
- last = sm.lm
- sm.mutex.RUnlock()
- return
-}
-
-// GetMonitorFreq returns the frequency as a `time.Duration` between
-// checks for changes to this config source. Defaults to 1 minute
-// unless changed with `SetMonitorFreq`.
-func (sm *SrcMap) GetMonitorFreq() (freq time.Duration) {
- sm.mutex.RLock()
- freq = sm.freq
- sm.mutex.RUnlock()
- return
-}