[#577] Replace ObjInfo with ExtObjInfo in cache
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
parent
dc77ad4863
commit
245e64900d
2 changed files with 47 additions and 38 deletions
8
api/cache/objects.go
vendored
8
api/cache/objects.go
vendored
|
@ -39,13 +39,13 @@ func New(config *Config) *ObjectsCache {
|
|||
}
|
||||
|
||||
// GetObject returns a cached object info.
|
||||
func (o *ObjectsCache) GetObject(address oid.Address) *data.ObjectInfo {
|
||||
func (o *ObjectsCache) GetObject(address oid.Address) *data.ExtendedObjectInfo {
|
||||
entry, err := o.cache.Get(address)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
result, ok := entry.(*data.ObjectInfo)
|
||||
result, ok := entry.(*data.ExtendedObjectInfo)
|
||||
if !ok {
|
||||
o.logger.Warn("invalid cache entry type", zap.String("actual", fmt.Sprintf("%T", entry)),
|
||||
zap.String("expected", fmt.Sprintf("%T", result)))
|
||||
|
@ -56,8 +56,8 @@ func (o *ObjectsCache) GetObject(address oid.Address) *data.ObjectInfo {
|
|||
}
|
||||
|
||||
// PutObject puts an object info to cache.
|
||||
func (o *ObjectsCache) PutObject(obj *data.ObjectInfo) error {
|
||||
return o.cache.Set(obj.Address(), obj)
|
||||
func (o *ObjectsCache) PutObject(obj *data.ExtendedObjectInfo) error {
|
||||
return o.cache.Set(obj.ObjectInfo.Address(), obj)
|
||||
}
|
||||
|
||||
// Delete deletes an object from cache.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue