forked from TrueCloudLab/frostfs-s3-gw
[#260] Use namespace as domain when resolve bucket
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
a61ff3b8cb
commit
055cc6a22a
16 changed files with 159 additions and 46 deletions
11
api/cache/buckets.go
vendored
11
api/cache/buckets.go
vendored
|
@ -39,7 +39,8 @@ func NewBucketCache(config *Config) *BucketCache {
|
|||
}
|
||||
|
||||
// Get returns a cached object.
|
||||
func (o *BucketCache) Get(key string) *data.BucketInfo {
|
||||
func (o *BucketCache) Get(ns, bktName string) *data.BucketInfo {
|
||||
key := ns + "/" + bktName
|
||||
entry, err := o.cache.Get(key)
|
||||
if err != nil {
|
||||
return nil
|
||||
|
@ -56,11 +57,11 @@ 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)
|
||||
func (o *BucketCache) Put(ns string, bkt *data.BucketInfo) error {
|
||||
return o.cache.Set(ns+"/"+bkt.Name, bkt)
|
||||
}
|
||||
|
||||
// Delete deletes an object from cache.
|
||||
func (o *BucketCache) Delete(key string) bool {
|
||||
return o.cache.Remove(key)
|
||||
func (o *BucketCache) Delete(ns, bktName string) bool {
|
||||
return o.cache.Remove(ns + "/" + bktName)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue