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
|
@ -188,7 +188,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.FrostFSNodeCantFlushObjectToBlobstor,
|
||||
addr.EncodeToString(), err)
|
||||
}
|
||||
return err
|
||||
|
@ -200,7 +200,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.FrostFSNodeCantUpdateObjectStorageID,
|
||||
addr.EncodeToString(), err)
|
||||
}
|
||||
return err
|
||||
|
@ -230,7 +230,7 @@ func (c *cache) flush(ctx context.Context, ignoreErrors bool) error {
|
|||
for it.Rewind(); it.Valid(); it.Next() {
|
||||
if got, want := int(it.Item().KeySize()), len(key); got != want {
|
||||
err := fmt.Errorf("invalid db key len: got %d, want %d", got, want)
|
||||
c.reportFlushError("can't decode object address from the DB", hex.EncodeToString(it.Item().Key()), metaerr.Wrap(err))
|
||||
c.reportFlushError(logs.FrostFSNodeCantDecodeObjectAddressFromDB, hex.EncodeToString(it.Item().Key()), metaerr.Wrap(err))
|
||||
if ignoreErrors {
|
||||
continue
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ func (c *cache) flush(ctx context.Context, ignoreErrors bool) error {
|
|||
var obj objectSDK.Object
|
||||
if err := obj.Unmarshal(data); err != nil {
|
||||
copy(key[:], it.Item().Key())
|
||||
c.reportFlushError("can't unmarshal an object from the DB", key.address().EncodeToString(), metaerr.Wrap(err))
|
||||
c.reportFlushError(logs.FrostFSNodeCantUnmarshalObjectFromDB, key.address().EncodeToString(), metaerr.Wrap(err))
|
||||
if ignoreErrors {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue