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