aboutsummaryrefslogtreecommitdiffstats
path: root/examples/object_storage/storage.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-08-22 00:30:50 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-22 00:30:50 +0200
commit5b13c1a2e55cb442484d9c7b45389f422b110eec (patch)
tree9be0949cb354dfd6521aa84f4af9e5777c3a1cef /examples/object_storage/storage.go
parentf42d82364c5d159f65a48e720433ad2bc97f0b7f (diff)
downloadgo-git-5b13c1a2e55cb442484d9c7b45389f422b110eec.tar.gz
options renamed and some text fixes
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
+}