forked from TrueCloudLab/frostfs-node
39c17253be
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
35 lines
510 B
Go
35 lines
510 B
Go
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
|
|
}
|
|
}
|