[#141] registry: Use Batch() for all methods
All checks were successful
DCO action / DCO (pull_request) Successful in 1m34s
Tests and linters / Tests (1.21) (pull_request) Successful in 2m42s
Tests and linters / Tests (1.22) (pull_request) Successful in 2m47s
Tests and linters / Lint (pull_request) Successful in 4m11s
Tests and linters / Tests with -race (pull_request) Successful in 4m41s
All checks were successful
DCO action / DCO (pull_request) Successful in 1m34s
Tests and linters / Tests (1.21) (pull_request) Successful in 2m42s
Tests and linters / Tests (1.22) (pull_request) Successful in 2m47s
Tests and linters / Lint (pull_request) Successful in 4m11s
Tests and linters / Tests with -race (pull_request) Successful in 4m41s
Refs #136 Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
de61aef66e
commit
4aaa50c8ed
1 changed files with 2 additions and 2 deletions
|
@ -75,7 +75,7 @@ func (o *ObjRegistry) AddObject(cid, oid, s3Bucket, s3Key, payloadHash string) e
|
|||
}
|
||||
|
||||
func (o *ObjRegistry) SetObjectStatus(id uint64, oldStatus, newStatus string) error {
|
||||
return o.boltDB.Update(func(tx *bbolt.Tx) error {
|
||||
return o.boltDB.Batch(func(tx *bbolt.Tx) error {
|
||||
oldB := tx.Bucket([]byte(oldStatus))
|
||||
if oldB == nil {
|
||||
return fmt.Errorf("bucket doesn't exist: '%s'", oldStatus)
|
||||
|
@ -110,7 +110,7 @@ func (o *ObjRegistry) SetObjectStatus(id uint64, oldStatus, newStatus string) er
|
|||
}
|
||||
|
||||
func (o *ObjRegistry) DeleteObject(id uint64) error {
|
||||
return o.boltDB.Update(func(tx *bbolt.Tx) error {
|
||||
return o.boltDB.Batch(func(tx *bbolt.Tx) error {
|
||||
return tx.ForEach(func(_ []byte, b *bbolt.Bucket) error {
|
||||
return b.Delete(encodeId(id))
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue