forked from TrueCloudLab/frostfs-node
[#38] service/object: Implement simplified object Head service
Implement Head service w/o linking object processing and restoration from split-chain. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
21fc85540a
commit
05f3963975
9 changed files with 487 additions and 0 deletions
27
pkg/services/object/head/util.go
Normal file
27
pkg/services/object/head/util.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package headsvc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
|
||||
)
|
||||
|
||||
type onceHeaderWriter struct {
|
||||
once *sync.Once
|
||||
|
||||
traverser *placement.Traverser
|
||||
|
||||
resp *Response
|
||||
|
||||
cancel context.CancelFunc
|
||||
}
|
||||
|
||||
func (w *onceHeaderWriter) write(hdr *object.Object) {
|
||||
w.once.Do(func() {
|
||||
w.resp.hdr = hdr
|
||||
w.traverser.SubmitSuccess()
|
||||
w.cancel()
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue