forked from TrueCloudLab/frostfs-node
[#162] core: Move literals to constants
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
a5f51add25
commit
21800e9fcc
8 changed files with 33 additions and 17 deletions
|
@ -194,7 +194,7 @@ func (c *cache) flushFSTree(ctx context.Context, ignoreErrors bool) error {
|
|||
|
||||
data, err := f()
|
||||
if err != nil {
|
||||
c.reportFlushError("can't read a file", sAddr, metaerr.Wrap(err))
|
||||
c.reportFlushError(logs.FSTreeCantReadFile, sAddr, metaerr.Wrap(err))
|
||||
if ignoreErrors {
|
||||
return nil
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ func (c *cache) flushFSTree(ctx context.Context, ignoreErrors bool) error {
|
|||
var obj objectSDK.Object
|
||||
err = obj.Unmarshal(data)
|
||||
if err != nil {
|
||||
c.reportFlushError("can't unmarshal an object", sAddr, metaerr.Wrap(err))
|
||||
c.reportFlushError(logs.FSTreeCantUnmarshalObject, sAddr, metaerr.Wrap(err))
|
||||
if ignoreErrors {
|
||||
return nil
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ func (c *cache) flushObject(ctx context.Context, obj *objectSDK.Object, data []b
|
|||
if err != nil {
|
||||
if !errors.Is(err, common.ErrNoSpace) && !errors.Is(err, common.ErrReadOnly) &&
|
||||
!errors.Is(err, blobstor.ErrNoPlaceFound) {
|
||||
c.reportFlushError("can't flush an object to blobstor",
|
||||
c.reportFlushError(logs.FSTreeCantFushObjectBlobstor,
|
||||
addr.EncodeToString(), err)
|
||||
}
|
||||
return err
|
||||
|
@ -280,7 +280,7 @@ func (c *cache) flushObject(ctx context.Context, obj *objectSDK.Object, data []b
|
|||
|
||||
_, err = c.metabase.UpdateStorageID(updPrm)
|
||||
if err != nil {
|
||||
c.reportFlushError("can't update object storage ID",
|
||||
c.reportFlushError(logs.FSTreeCantUpdateID,
|
||||
addr.EncodeToString(), err)
|
||||
}
|
||||
return err
|
||||
|
@ -315,7 +315,7 @@ func (c *cache) flush(ctx context.Context, ignoreErrors bool) error {
|
|||
for k, data := cs.Seek(nil); k != nil; k, data = cs.Next() {
|
||||
sa := string(k)
|
||||
if err := addr.DecodeString(sa); err != nil {
|
||||
c.reportFlushError("can't decode object address from the DB", sa, metaerr.Wrap(err))
|
||||
c.reportFlushError(logs.FSTreeCantDecodeDBObjectAddress, sa, metaerr.Wrap(err))
|
||||
if ignoreErrors {
|
||||
continue
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ func (c *cache) flush(ctx context.Context, ignoreErrors bool) error {
|
|||
|
||||
var obj objectSDK.Object
|
||||
if err := obj.Unmarshal(data); err != nil {
|
||||
c.reportFlushError("can't unmarshal an object from the DB", sa, metaerr.Wrap(err))
|
||||
c.reportFlushError(logs.FSTreeCantDecodeDBObjectAddress, sa, metaerr.Wrap(err))
|
||||
if ignoreErrors {
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue