forked from TrueCloudLab/frostfs-node
[#677] client: Refactor PrmAnnounceSpace/EndpointInfo/NetworkInfo usage
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
8a81af5a3b
commit
aa9f8dce3d
8 changed files with 24 additions and 20 deletions
|
@ -224,8 +224,8 @@ func SetEACL(ctx context.Context, prm SetEACLPrm) (res SetEACLRes, err error) {
|
|||
|
||||
// NetworkInfoPrm groups parameters of NetworkInfo operation.
|
||||
type NetworkInfoPrm struct {
|
||||
commonPrm
|
||||
client.PrmNetworkInfo
|
||||
Client *client.Client
|
||||
ClientParams client.PrmNetworkInfo
|
||||
}
|
||||
|
||||
// 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.
|
||||
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
|
||||
}
|
||||
|
||||
// NodeInfoPrm groups parameters of NodeInfo operation.
|
||||
type NodeInfoPrm struct {
|
||||
commonPrm
|
||||
client.PrmEndpointInfo
|
||||
Client *client.Client
|
||||
ClientParams client.PrmEndpointInfo
|
||||
}
|
||||
|
||||
// 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.
|
||||
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
|
||||
}
|
||||
|
|
|
@ -16,8 +16,9 @@ var getEpochCmd = &cobra.Command{
|
|||
p := key.GetOrGenerate(cmd)
|
||||
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
||||
|
||||
var prm internalclient.NetworkInfoPrm
|
||||
prm.SetClient(cli)
|
||||
prm := internalclient.NetworkInfoPrm{
|
||||
Client: cli,
|
||||
}
|
||||
|
||||
res, err := internalclient.NetworkInfo(cmd.Context(), prm)
|
||||
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
||||
|
|
|
@ -20,8 +20,9 @@ var netInfoCmd = &cobra.Command{
|
|||
p := key.GetOrGenerate(cmd)
|
||||
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
||||
|
||||
var prm internalclient.NetworkInfoPrm
|
||||
prm.SetClient(cli)
|
||||
prm := internalclient.NetworkInfoPrm{
|
||||
Client: cli,
|
||||
}
|
||||
|
||||
res, err := internalclient.NetworkInfo(cmd.Context(), prm)
|
||||
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
||||
|
|
|
@ -22,8 +22,9 @@ var nodeInfoCmd = &cobra.Command{
|
|||
p := key.GetOrGenerate(cmd)
|
||||
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
||||
|
||||
var prm internalclient.NodeInfoPrm
|
||||
prm.SetClient(cli)
|
||||
prm := internalclient.NodeInfoPrm{
|
||||
Client: cli,
|
||||
}
|
||||
|
||||
res, err := internalclient.NodeInfo(cmd.Context(), prm)
|
||||
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
||||
|
|
|
@ -91,8 +91,9 @@ func createSession(cmd *cobra.Command, _ []string) {
|
|||
//
|
||||
// Fills ID, lifetime and session key.
|
||||
func CreateSession(ctx context.Context, dst *session.Object, c *client.Client, lifetime uint64) error {
|
||||
var netInfoPrm internalclient.NetworkInfoPrm
|
||||
netInfoPrm.SetClient(c)
|
||||
netInfoPrm := internalclient.NetworkInfoPrm{
|
||||
Client: c,
|
||||
}
|
||||
|
||||
ni, err := internalclient.NetworkInfo(ctx, netInfoPrm)
|
||||
if err != nil {
|
||||
|
|
|
@ -383,9 +383,9 @@ func (r *remoteLoadAnnounceWriter) Put(a containerSDK.SizeEstimation) error {
|
|||
}
|
||||
|
||||
func (r *remoteLoadAnnounceWriter) Close(ctx context.Context) error {
|
||||
var cliPrm apiClient.PrmAnnounceSpace
|
||||
|
||||
cliPrm.SetValues(r.buf)
|
||||
cliPrm := apiClient.PrmAnnounceSpace{
|
||||
Announcements: r.buf,
|
||||
}
|
||||
|
||||
_, err := r.client.ContainerAnnounceUsedSpace(ctx, cliPrm)
|
||||
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-contract v0.0.0-20230627134746-36f3d39c406a
|
||||
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/tzhash v1.8.0
|
||||
github.com/cheggaaa/pb v1.0.29
|
||||
|
|
4
go.sum
4
go.sum
|
@ -44,8 +44,8 @@ git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSV
|
|||
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6 h1:aGQ6QaAnTerQ5Dq5b2/f9DUQtSqPkZZ/bkMx/HKuLCo=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6/go.mod h1:W8Nn08/l6aQ7UlIbpF7FsQou7TVpcRD1ZT1KG4TrFhE=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230904141422-5a471e5002a7 h1:fwEDv/1INboZGbfQDxlsdbZGvHNUL/73rQe4fG8G3DA=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230904141422-5a471e5002a7/go.mod h1:t1akKcUH7iBrFHX8rSXScYMP17k2kYQXMbZooiL5Juw=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230904165523-55a1f23e7170 h1:nOS6QWW8O4xDpL61TXe+NBpVXTB/fP4zy0lRh0eAWfI=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230904165523-55a1f23e7170/go.mod h1:t1akKcUH7iBrFHX8rSXScYMP17k2kYQXMbZooiL5Juw=
|
||||
git.frostfs.info/TrueCloudLab/hrw v1.2.1 h1:ccBRK21rFvY5R1WotI6LNoPlizk7qSvdfD8lNIRudVc=
|
||||
git.frostfs.info/TrueCloudLab/hrw v1.2.1/go.mod h1:C1Ygde2n843yTZEQ0FP69jYiuaYV0kriLvP4zm8JuvM=
|
||||
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA=
|
||||
|
|
Loading…
Reference in a new issue