forked from TrueCloudLab/frostfs-node
[#1085] blobovnicza: allow to ignore errors during iteration
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
9c60ab893c
commit
e53ad2f468
2 changed files with 67 additions and 0 deletions
|
@ -84,6 +84,8 @@ type IteratePrm struct {
|
|||
withoutData bool
|
||||
|
||||
handler IterationHandler
|
||||
|
||||
ignoreErrors bool
|
||||
}
|
||||
|
||||
// DecodeAddresses sets flag to unmarshal object addresses.
|
||||
|
@ -101,6 +103,11 @@ func (x *IteratePrm) SetHandler(h IterationHandler) {
|
|||
x.handler = h
|
||||
}
|
||||
|
||||
// IgnoreErrors makes all errors to be ignored.
|
||||
func (x *IteratePrm) IgnoreErrors() {
|
||||
x.ignoreErrors = true
|
||||
}
|
||||
|
||||
// IterateRes groups resulting values of Iterate operation.
|
||||
type IterateRes struct {
|
||||
}
|
||||
|
@ -124,6 +131,9 @@ func (b *Blobovnicza) Iterate(prm IteratePrm) (*IterateRes, error) {
|
|||
}
|
||||
|
||||
if err := addressFromKey(elem.addr, k); err != nil {
|
||||
if prm.ignoreErrors {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("could not decode address key: %w", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue