[#677] client: Refactor PrmAnnounceSpace/EndpointInfo/NetworkInfo usage
All checks were successful
Vulncheck / Vulncheck (pull_request) Successful in 1m28s
DCO action / DCO (pull_request) Successful in 2m25s
Build / Build Components (1.21) (pull_request) Successful in 4m14s
Tests and linters / Staticcheck (pull_request) Successful in 4m24s
Tests and linters / Tests (1.21) (pull_request) Successful in 4m34s
Tests and linters / Lint (pull_request) Successful in 5m28s
Tests and linters / Tests (1.20) (pull_request) Successful in 7m46s
Tests and linters / Tests with -race (pull_request) Successful in 8m10s
Build / Build Components (1.20) (pull_request) Successful in 9m1s
All checks were successful
Vulncheck / Vulncheck (pull_request) Successful in 1m28s
DCO action / DCO (pull_request) Successful in 2m25s
Build / Build Components (1.21) (pull_request) Successful in 4m14s
Tests and linters / Staticcheck (pull_request) Successful in 4m24s
Tests and linters / Tests (1.21) (pull_request) Successful in 4m34s
Tests and linters / Lint (pull_request) Successful in 5m28s
Tests and linters / Tests (1.20) (pull_request) Successful in 7m46s
Tests and linters / Tests with -race (pull_request) Successful in 8m10s
Build / Build Components (1.20) (pull_request) Successful in 9m1s
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
8a81af5a3b
commit
aa9f8dce3d
8 changed files with 22 additions and 18 deletions
|
@ -224,8 +224,8 @@ func SetEACL(ctx context.Context, prm SetEACLPrm) (res SetEACLRes, err error) {
|
||||||
|
|
||||||
// NetworkInfoPrm groups parameters of NetworkInfo operation.
|
// NetworkInfoPrm groups parameters of NetworkInfo operation.
|
||||||
type NetworkInfoPrm struct {
|
type NetworkInfoPrm struct {
|
||||||
commonPrm
|
Client *client.Client
|
||||||
client.PrmNetworkInfo
|
ClientParams client.PrmNetworkInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkInfoRes groups the resulting values of NetworkInfo operation.
|
// NetworkInfoRes groups the resulting values of NetworkInfo operation.
|
||||||
|
@ -242,15 +242,15 @@ func (x NetworkInfoRes) NetworkInfo() netmap.NetworkInfo {
|
||||||
//
|
//
|
||||||
// Returns any error which prevented the operation from completing correctly in error return.
|
// Returns any error which prevented the operation from completing correctly in error return.
|
||||||
func NetworkInfo(ctx context.Context, prm NetworkInfoPrm) (res NetworkInfoRes, err error) {
|
func NetworkInfo(ctx context.Context, prm NetworkInfoPrm) (res NetworkInfoRes, err error) {
|
||||||
res.cliRes, err = prm.cli.NetworkInfo(ctx, prm.PrmNetworkInfo)
|
res.cliRes, err = prm.Client.NetworkInfo(ctx, prm.ClientParams)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeInfoPrm groups parameters of NodeInfo operation.
|
// NodeInfoPrm groups parameters of NodeInfo operation.
|
||||||
type NodeInfoPrm struct {
|
type NodeInfoPrm struct {
|
||||||
commonPrm
|
Client *client.Client
|
||||||
client.PrmEndpointInfo
|
ClientParams client.PrmEndpointInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeInfoRes groups the resulting values of NodeInfo operation.
|
// NodeInfoRes groups the resulting values of NodeInfo operation.
|
||||||
|
@ -272,7 +272,7 @@ func (x NodeInfoRes) LatestVersion() version.Version {
|
||||||
//
|
//
|
||||||
// Returns any error which prevented the operation from completing correctly in error return.
|
// Returns any error which prevented the operation from completing correctly in error return.
|
||||||
func NodeInfo(ctx context.Context, prm NodeInfoPrm) (res NodeInfoRes, err error) {
|
func NodeInfo(ctx context.Context, prm NodeInfoPrm) (res NodeInfoRes, err error) {
|
||||||
res.cliRes, err = prm.cli.EndpointInfo(ctx, prm.PrmEndpointInfo)
|
res.cliRes, err = prm.Client.EndpointInfo(ctx, prm.ClientParams)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,9 @@ var getEpochCmd = &cobra.Command{
|
||||||
p := key.GetOrGenerate(cmd)
|
p := key.GetOrGenerate(cmd)
|
||||||
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
||||||
|
|
||||||
var prm internalclient.NetworkInfoPrm
|
prm := internalclient.NetworkInfoPrm{
|
||||||
prm.SetClient(cli)
|
Client: cli,
|
||||||
|
}
|
||||||
|
|
||||||
res, err := internalclient.NetworkInfo(cmd.Context(), prm)
|
res, err := internalclient.NetworkInfo(cmd.Context(), prm)
|
||||||
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
||||||
|
|
|
@ -20,8 +20,9 @@ var netInfoCmd = &cobra.Command{
|
||||||
p := key.GetOrGenerate(cmd)
|
p := key.GetOrGenerate(cmd)
|
||||||
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
||||||
|
|
||||||
var prm internalclient.NetworkInfoPrm
|
prm := internalclient.NetworkInfoPrm{
|
||||||
prm.SetClient(cli)
|
Client: cli,
|
||||||
|
}
|
||||||
|
|
||||||
res, err := internalclient.NetworkInfo(cmd.Context(), prm)
|
res, err := internalclient.NetworkInfo(cmd.Context(), prm)
|
||||||
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
||||||
|
|
|
@ -22,8 +22,9 @@ var nodeInfoCmd = &cobra.Command{
|
||||||
p := key.GetOrGenerate(cmd)
|
p := key.GetOrGenerate(cmd)
|
||||||
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
||||||
|
|
||||||
var prm internalclient.NodeInfoPrm
|
prm := internalclient.NodeInfoPrm{
|
||||||
prm.SetClient(cli)
|
Client: cli,
|
||||||
|
}
|
||||||
|
|
||||||
res, err := internalclient.NodeInfo(cmd.Context(), prm)
|
res, err := internalclient.NodeInfo(cmd.Context(), prm)
|
||||||
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
||||||
|
|
|
@ -91,8 +91,9 @@ func createSession(cmd *cobra.Command, _ []string) {
|
||||||
//
|
//
|
||||||
// Fills ID, lifetime and session key.
|
// Fills ID, lifetime and session key.
|
||||||
func CreateSession(ctx context.Context, dst *session.Object, c *client.Client, lifetime uint64) error {
|
func CreateSession(ctx context.Context, dst *session.Object, c *client.Client, lifetime uint64) error {
|
||||||
var netInfoPrm internalclient.NetworkInfoPrm
|
netInfoPrm := internalclient.NetworkInfoPrm{
|
||||||
netInfoPrm.SetClient(c)
|
Client: c,
|
||||||
|
}
|
||||||
|
|
||||||
ni, err := internalclient.NetworkInfo(ctx, netInfoPrm)
|
ni, err := internalclient.NetworkInfo(ctx, netInfoPrm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -383,9 +383,9 @@ func (r *remoteLoadAnnounceWriter) Put(a containerSDK.SizeEstimation) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *remoteLoadAnnounceWriter) Close(ctx context.Context) error {
|
func (r *remoteLoadAnnounceWriter) Close(ctx context.Context) error {
|
||||||
var cliPrm apiClient.PrmAnnounceSpace
|
cliPrm := apiClient.PrmAnnounceSpace{
|
||||||
|
Announcements: r.buf,
|
||||||
cliPrm.SetValues(r.buf)
|
}
|
||||||
|
|
||||||
_, err := r.client.ContainerAnnounceUsedSpace(ctx, cliPrm)
|
_, err := r.client.ContainerAnnounceUsedSpace(ctx, cliPrm)
|
||||||
return err
|
return err
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -6,7 +6,7 @@ require (
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230802075510-964c3edb3f44
|
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230802075510-964c3edb3f44
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230627134746-36f3d39c406a
|
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230627134746-36f3d39c406a
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6
|
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230904141422-5a471e5002a7
|
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230904165523-55a1f23e7170
|
||||||
git.frostfs.info/TrueCloudLab/hrw v1.2.1
|
git.frostfs.info/TrueCloudLab/hrw v1.2.1
|
||||||
git.frostfs.info/TrueCloudLab/tzhash v1.8.0
|
git.frostfs.info/TrueCloudLab/tzhash v1.8.0
|
||||||
github.com/cheggaaa/pb v1.0.29
|
github.com/cheggaaa/pb v1.0.29
|
||||||
|
|
BIN
go.sum
BIN
go.sum
Binary file not shown.
Loading…
Reference in a new issue