[#451] Handle lock objects using tree service

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-05-26 16:11:14 +03:00 committed by Alex Vanin
parent bc000f1bc4
commit dd534e8738
23 changed files with 488 additions and 520 deletions

20
api/cache/system.go vendored
View file

@ -56,6 +56,21 @@ func (o *SystemCache) GetObject(key string) *data.ObjectInfo {
return result
}
// GetLockInfo returns a cached object.
func (o *SystemCache) GetLockInfo(key string) *data.LockInfo {
entry, err := o.cache.Get(key)
if err != nil {
return nil
}
result, ok := entry.(*data.LockInfo)
if !ok {
return nil
}
return result
}
func (o *SystemCache) GetCORS(key string) *data.CORSConfiguration {
entry, err := o.cache.Get(key)
if err != nil {
@ -124,6 +139,11 @@ func (o *SystemCache) PutObject(key string, obj *data.ObjectInfo) error {
return o.cache.Set(key, obj)
}
// PutLockInfo puts an object to cache.
func (o *SystemCache) PutLockInfo(key string, lockInfo *data.LockInfo) error {
return o.cache.Set(key, lockInfo)
}
func (o *SystemCache) PutCORS(key string, obj *data.CORSConfiguration) error {
return o.cache.Set(key, obj)
}