aboutsummaryrefslogtreecommitdiffstats
path: root/repository
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-09-26 23:00:27 +0200
committerMichael Muré <batolettre@gmail.com>2020-09-29 20:42:21 +0200
commitc68be32df499fd06c2c0cc906f719586da9ee3f3 (patch)
tree4ad6cdae95c93ce9f1860a32a8428f95e15a5074 /repository
parent9408f1eb0e99cddee1a7e1739bd786de543c30e7 (diff)
downloadgit-bug-c68be32df499fd06c2c0cc906f719586da9ee3f3.tar.gz
repo: split Config into 2 smaller interfaces
Diffstat (limited to 'repository')
-rw-r--r--repository/config.go23
1 files changed, 15 insertions, 8 deletions
diff --git a/repository/config.go b/repository/config.go
index 2133b169..70d51f11 100644
--- a/repository/config.go
+++ b/repository/config.go
@@ -13,15 +13,11 @@ var (
// Config represent the common function interacting with the repository config storage
type Config interface {
- // Store writes a single key/value pair in the config
- StoreString(key, value string) error
-
- // Store writes a key and timestamp value to the config
- StoreTimestamp(key string, value time.Time) error
-
- // Store writes a key and boolean value to the config
- StoreBool(key string, value bool) error
+ ConfigRead
+ ConfigWrite
+}
+type ConfigRead interface {
// ReadAll reads all key/value pair matching the key prefix
ReadAll(keyPrefix string) (map[string]string, error)
@@ -39,6 +35,17 @@ type Config interface {
// Return ErrNoConfigEntry or ErrMultipleConfigEntry if
// there is zero or more than one entry for this key
ReadTimestamp(key string) (time.Time, error)
+}
+
+type ConfigWrite interface {
+ // Store writes a single key/value pair in the config
+ StoreString(key, value string) error
+
+ // Store writes a key and timestamp value to the config
+ StoreTimestamp(key string, value time.Time) error
+
+ // Store writes a key and boolean value to the config
+ StoreBool(key string, value bool) error
// RemoveAll removes all key/value pair matching the key prefix
RemoveAll(keyPrefix string) error