forked from TrueCloudLab/frostfs-http-gw
[#91] Add support namespaces
Signed-off-by: Roman Loginov <r.loginov@yadro.com>
This commit is contained in:
parent
dc8d0d4ab3
commit
a375af7d98
12 changed files with 236 additions and 37 deletions
10
internal/cache/buckets.go
vendored
10
internal/cache/buckets.go
vendored
|
@ -46,8 +46,8 @@ func NewBucketCache(config *Config) *BucketCache {
|
|||
}
|
||||
|
||||
// Get returns a cached object.
|
||||
func (o *BucketCache) Get(key string) *data.BucketInfo {
|
||||
entry, err := o.cache.Get(key)
|
||||
func (o *BucketCache) Get(ns, bktName string) *data.BucketInfo {
|
||||
entry, err := o.cache.Get(formKey(ns, bktName))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
@ -64,5 +64,9 @@ func (o *BucketCache) Get(key string) *data.BucketInfo {
|
|||
|
||||
// Put puts an object to cache.
|
||||
func (o *BucketCache) Put(bkt *data.BucketInfo) error {
|
||||
return o.cache.Set(bkt.Name, bkt)
|
||||
return o.cache.Set(formKey(bkt.Zone, bkt.Name), bkt)
|
||||
}
|
||||
|
||||
func formKey(ns, name string) string {
|
||||
return name + "." + ns
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue