aboutsummaryrefslogtreecommitdiffstats
path: root/examples/object_storage/storage.go
diff options
context:
space:
mode:
Diffstat (limited to 'examples/object_storage/storage.go')
-rw-r--r--examples/object_storage/storage.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/examples/object_storage/storage.go b/examples/object_storage/storage.go
index bb9ff29..c119adc 100644
--- a/examples/object_storage/storage.go
+++ b/examples/object_storage/storage.go
@@ -5,6 +5,7 @@ import (
"io"
"io/ioutil"
+ "gopkg.in/src-d/go-git.v4/config"
"gopkg.in/src-d/go-git.v4/core"
"github.com/aerospike/aerospike-client-go"
@@ -40,6 +41,10 @@ func (s *AerospikeStorage) ReferenceStorage() core.ReferenceStorage {
return s.rs
}
+func (s *AerospikeStorage) ConfigStorage() config.ConfigStorage {
+ return &ConfigStorage{}
+}
+
type AerospikeObjectStorage struct {
url string
client *aerospike.Client
@@ -227,3 +232,34 @@ func (s *AerospikeReferenceStorage) Iter() (core.ReferenceIter, error) {
return core.NewReferenceSliceIter(refs), nil
}
+
+type ConfigStorage struct {
+ RemotesConfig map[string]*config.RemoteConfig
+}
+
+func (c *ConfigStorage) Remote(name string) (*config.RemoteConfig, error) {
+ r, ok := c.RemotesConfig[name]
+ if ok {
+ return r, nil
+ }
+
+ return nil, config.ErrRemoteConfigNotFound
+}
+
+func (c *ConfigStorage) Remotes() ([]*config.RemoteConfig, error) {
+ var o []*config.RemoteConfig
+ for _, r := range c.RemotesConfig {
+ o = append(o, r)
+ }
+
+ return o, nil
+}
+func (c *ConfigStorage) SetRemote(r *config.RemoteConfig) error {
+ c.RemotesConfig[r.Name] = r
+ return nil
+}
+
+func (c *ConfigStorage) DeleteRemote(name string) error {
+ delete(c.RemotesConfig, name)
+ return nil
+}