aboutsummaryrefslogtreecommitdiffstats
path: root/storage/transactional/config.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2019-02-02 10:14:24 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2019-02-02 10:14:24 +0100
commit96317743391ac87aeb07d292469e212671628437 (patch)
tree990bbe4a11241f2ac3a5f4a71d514884b9c2b962 /storage/transactional/config.go
parent12dc3ef13e5c783b9e304aa8b6a2f7097880ab87 (diff)
downloadgo-git-96317743391ac87aeb07d292469e212671628437.tar.gz
storage: transactional, package documentation
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
Diffstat (limited to 'storage/transactional/config.go')
-rw-r--r--storage/transactional/config.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/storage/transactional/config.go b/storage/transactional/config.go
index fec1f28..4d8efe1 100644
--- a/storage/transactional/config.go
+++ b/storage/transactional/config.go
@@ -2,6 +2,7 @@ package transactional
import "gopkg.in/src-d/go-git.v4/config"
+// ConfigStorage implements the storer.ConfigStorage for the transactional package.
type ConfigStorage struct {
config.ConfigStorer
temporal config.ConfigStorer
@@ -9,10 +10,13 @@ type ConfigStorage struct {
set bool
}
+// NewConfigStorage returns a new ConfigStorer based on a base storer and a
+// temporal storer.
func NewConfigStorage(s, temporal config.ConfigStorer) *ConfigStorage {
return &ConfigStorage{ConfigStorer: s, temporal: temporal}
}
+// SetConfig honors the storer.ConfigStorer interface.
func (c *ConfigStorage) SetConfig(cfg *config.Config) error {
if err := c.temporal.SetConfig(cfg); err != nil {
return err
@@ -22,6 +26,7 @@ func (c *ConfigStorage) SetConfig(cfg *config.Config) error {
return nil
}
+// Config honors the storer.ConfigStorer interface.
func (c *ConfigStorage) Config() (*config.Config, error) {
if !c.set {
return c.ConfigStorer.Config()
@@ -30,6 +35,7 @@ func (c *ConfigStorage) Config() (*config.Config, error) {
return c.temporal.Config()
}
+// Commit it copies the config from the temporal storage into the base storage.
func (c *ConfigStorage) Commit() error {
if !c.set {
return nil