Some checks failed
DCO action / DCO (pull_request) Successful in 1m30s
Vulncheck / Vulncheck (pull_request) Successful in 3m41s
Build / Build Components (1.21) (pull_request) Successful in 4m17s
Build / Build Components (1.20) (pull_request) Successful in 4m30s
Tests and linters / Lint (pull_request) Successful in 6m37s
Tests and linters / Staticcheck (pull_request) Successful in 6m17s
Tests and linters / Tests (1.21) (pull_request) Successful in 8m51s
Tests and linters / Tests (1.20) (pull_request) Successful in 9m10s
Tests and linters / Tests with -race (pull_request) Successful in 9m1s
Tests and linters / gopls check (pull_request) Failing after 15m55s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
92 lines
1.9 KiB
Go
92 lines
1.9 KiB
Go
package internal
|
|
|
|
import (
|
|
"io"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/sdk/bearer"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/sdk/client"
|
|
cid "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/sdk/container/id"
|
|
oid "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/sdk/object/id"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/sdk/session"
|
|
)
|
|
|
|
// here are small structures with public setters to share between parameter structures
|
|
|
|
type commonPrm struct {
|
|
cli *client.Client
|
|
}
|
|
|
|
// SetClient sets the base client for FrostFS API communication.
|
|
func (x *commonPrm) SetClient(cli *client.Client) {
|
|
x.cli = cli
|
|
}
|
|
|
|
type containerIDPrm struct {
|
|
cnrID cid.ID
|
|
}
|
|
|
|
// SetContainerID sets the container identifier.
|
|
func (x *containerIDPrm) SetContainerID(id cid.ID) {
|
|
x.cnrID = id
|
|
}
|
|
|
|
type bearerTokenPrm struct {
|
|
bearerToken *bearer.Token
|
|
}
|
|
|
|
// SetBearerToken sets the bearer token to be attached to the request.
|
|
func (x *bearerTokenPrm) SetBearerToken(tok *bearer.Token) {
|
|
x.bearerToken = tok
|
|
}
|
|
|
|
type objectAddressPrm struct {
|
|
objAddr oid.Address
|
|
}
|
|
|
|
func (x *objectAddressPrm) SetAddress(addr oid.Address) {
|
|
x.objAddr = addr
|
|
}
|
|
|
|
type rawPrm struct {
|
|
raw bool
|
|
}
|
|
|
|
// SetRawFlag sets flag of raw request.
|
|
func (x *rawPrm) SetRawFlag(raw bool) {
|
|
x.raw = raw
|
|
}
|
|
|
|
type payloadWriterPrm struct {
|
|
wrt io.Writer
|
|
}
|
|
|
|
// SetPayloadWriter sets the writer of the object payload.
|
|
func (x *payloadWriterPrm) SetPayloadWriter(wrt io.Writer) {
|
|
x.wrt = wrt
|
|
}
|
|
|
|
type commonObjectPrm struct {
|
|
commonPrm
|
|
bearerTokenPrm
|
|
|
|
sessionToken *session.Object
|
|
|
|
local bool
|
|
|
|
xHeaders []string
|
|
}
|
|
|
|
// SetTTL sets request TTL value.
|
|
func (x *commonObjectPrm) SetTTL(ttl uint32) {
|
|
x.local = ttl < 2
|
|
}
|
|
|
|
// SetXHeaders sets request X-Headers.
|
|
func (x *commonObjectPrm) SetXHeaders(hs []string) {
|
|
x.xHeaders = hs
|
|
}
|
|
|
|
// SetSessionToken sets the token of the session within which the request should be sent.
|
|
func (x *commonObjectPrm) SetSessionToken(tok *session.Object) {
|
|
x.sessionToken = tok
|
|
}
|