forked from TrueCloudLab/frostfs-node
[#57] services/object: Combine common service parameters
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
8cddbe58a6
commit
39c17253be
24 changed files with 109 additions and 61 deletions
35
pkg/services/object/util/prm.go
Normal file
35
pkg/services/object/util/prm.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/session"
|
||||
)
|
||||
|
||||
type CommonPrm struct {
|
||||
local bool
|
||||
}
|
||||
|
||||
func (p *CommonPrm) WithLocalOnly(v bool) *CommonPrm {
|
||||
if p != nil {
|
||||
p.local = v
|
||||
}
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (p *CommonPrm) LocalOnly() bool {
|
||||
if p != nil {
|
||||
return p.local
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func CommonPrmFromV2(req interface {
|
||||
GetMetaHeader() *session.RequestMetaHeader
|
||||
}) *CommonPrm {
|
||||
meta := req.GetMetaHeader()
|
||||
|
||||
return &CommonPrm{
|
||||
local: meta.GetTTL() <= 1, // FIXME: use constant
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue