Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
set name in lower level place
Browse files Browse the repository at this point in the history
  • Loading branch information
galthaus committed Feb 10, 2019
1 parent 5042ab6 commit f14b07d
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ type Store interface {
Closed() bool
// Type is the type of Store this is.
Type() string
// Name is the type of Store this is.
// Name is the name of Store this is.
Name() string
}

Expand Down
6 changes: 6 additions & 0 deletions consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ func (b *Consul) Load(key string, val interface{}) error {
if ro, ok := val.(ReadOnlySetter); ok {
ro.SetReadOnly(b.ReadOnly())
}
if bb, ok := val.(BundleSetter); ok {
n := b.Name()
if n != "" {
bb.SetBundle(n)
}
}
return nil
}

Expand Down
6 changes: 6 additions & 0 deletions directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ func (f *Directory) Load(key string, val interface{}) error {
if ro, ok := val.(ReadOnlySetter); ok {
ro.SetReadOnly(f.ReadOnly())
}
if bb, ok := val.(BundleSetter); ok {
n := f.Name()
if n != "" {
bb.SetBundle(n)
}
}
return nil
}

Expand Down
6 changes: 6 additions & 0 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ func (f *File) Load(key string, val interface{}) error {
if ro, ok := val.(ReadOnlySetter); ok {
ro.SetReadOnly(f.ReadOnly())
}
if bb, ok := val.(BundleSetter); ok {
n := f.Name()
if n != "" {
bb.SetBundle(n)
}
}
return nil
}
return os.ErrNotExist
Expand Down
6 changes: 0 additions & 6 deletions keySaver.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,6 @@ func load(s Store, k KeySaver, key string, runhook bool) (bool, error) {
if err != nil {
return false, err
}
if b, ok := k.(BundleSetter); ok {
n := s.Name()
if n != "" {
b.SetBundle(n)
}
}
if h, ok := k.(LoadHooker); runhook && ok {
return true, h.OnLoad()
}
Expand Down
6 changes: 6 additions & 0 deletions local.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ func (b *Bolt) Load(key string, val interface{}) error {
if ro, ok := val.(ReadOnlySetter); ok {
ro.SetReadOnly(b.ReadOnly())
}
if bb, ok := val.(BundleSetter); ok {
n := b.Name()
if n != "" {
bb.SetBundle(n)
}
}
return nil
}

Expand Down
6 changes: 6 additions & 0 deletions memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ func (m *Memory) Load(key string, val interface{}) error {
if ro, ok := val.(ReadOnlySetter); ok {
ro.SetReadOnly(m.ReadOnly())
}
if bb, ok := val.(BundleSetter); ok {
n := m.Name()
if n != "" {
bb.SetBundle(n)
}
}
return nil
}

Expand Down

0 comments on commit f14b07d

Please sign in to comment.