multinode: old drpc api returned

drpc api with old names added to prevent breaking
backwards compatibility.

Change-Id: I1b8a41f2c1e0bd11ac83c86f0b1bfbfc1f07378f
This commit is contained in:
Qweder93 2021-06-16 19:46:25 +03:00 committed by Nikolai Siedov
parent 8a6efa1f58
commit b9d7874dc2
7 changed files with 1806 additions and 171 deletions

View File

@ -114,7 +114,7 @@ func (service *Service) ListInfos(ctx context.Context) (_ []NodeInfo, err error)
nodeClient := multinodepb.NewDRPCNodeClient(conn)
storageClient := multinodepb.NewDRPCStorageClient(conn)
bandwidthClient := multinodepb.NewDRPCBandwidthClient(conn)
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,
@ -197,7 +197,7 @@ func (service *Service) ListInfosSatellite(ctx context.Context, satelliteID stor
}()
nodeClient := multinodepb.NewDRPCNodeClient(conn)
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,

View File

@ -73,7 +73,7 @@ func (service *Service) EarnedSatellite(ctx context.Context) (earned []Satellite
}
var listSatellites storj.NodeIDList
var listNodesEarnedPerSatellite []multinodepb.EarnedSatelliteResponse
var listNodesEarnedPerSatellite []multinodepb.EarnedPerSatelliteResponse
for _, node := range storageNodes {
earnedPerSatellite, err := service.earnedSatellite(ctx, node)
@ -217,12 +217,12 @@ func (service *Service) summarySatellite(ctx context.Context, node nodes.Node, s
err = errs.Combine(err, conn.Close())
}()
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,
}
response, err := payoutClient.SummarySatellite(ctx, &multinodepb.SummarySatelliteRequest{Header: header, SatelliteId: satelliteID})
response, err := payoutClient.SatelliteSummary(ctx, &multinodepb.SatelliteSummaryRequest{Header: header, SatelliteId: satelliteID})
if err != nil {
return &multinodepb.PayoutInfo{}, Error.Wrap(err)
}
@ -244,12 +244,12 @@ func (service *Service) summarySatellitePeriod(ctx context.Context, node nodes.N
err = errs.Combine(err, conn.Close())
}()
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,
}
response, err := payoutClient.SummarySatellitePeriod(ctx, &multinodepb.SummarySatellitePeriodRequest{Header: header, SatelliteId: satelliteID, Period: period})
response, err := payoutClient.SatellitePeriodSummary(ctx, &multinodepb.SatellitePeriodSummaryRequest{Header: header, SatelliteId: satelliteID, Period: period})
if err != nil {
return &multinodepb.PayoutInfo{}, Error.Wrap(err)
}
@ -271,12 +271,12 @@ func (service *Service) summaryPeriod(ctx context.Context, node nodes.Node, peri
err = errs.Combine(err, conn.Close())
}()
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,
}
response, err := payoutClient.SummaryPeriod(ctx, &multinodepb.SummaryPeriodRequest{Header: header, Period: period})
response, err := payoutClient.AllSatellitesPeriodSummary(ctx, &multinodepb.AllSatellitesPeriodSummaryRequest{Header: header, Period: period})
if err != nil {
return &multinodepb.PayoutInfo{}, Error.Wrap(err)
}
@ -298,12 +298,12 @@ func (service *Service) summary(ctx context.Context, node nodes.Node) (info *mul
err = errs.Combine(err, conn.Close())
}()
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,
}
response, err := payoutClient.Summary(ctx, &multinodepb.SummaryRequest{Header: header})
response, err := payoutClient.AllSatellitesSummary(ctx, &multinodepb.AllSatellitesSummaryRequest{Header: header})
if err != nil {
return &multinodepb.PayoutInfo{}, Error.Wrap(err)
}
@ -476,12 +476,12 @@ func (service *Service) nodeExpectations(ctx context.Context, node nodes.Node) (
err = errs.Combine(err, conn.Close())
}()
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,
}
estimated, err := payoutClient.EstimatedPayout(ctx, &multinodepb.EstimatedPayoutRequest{Header: header})
estimated, err := payoutClient.EstimatedPayoutTotal(ctx, &multinodepb.EstimatedPayoutTotalRequest{Header: header})
if err != nil {
return Expectations{}, Error.Wrap(err)
}
@ -508,7 +508,7 @@ func (service *Service) earned(ctx context.Context, node nodes.Node) (_ int64, e
err = errs.Combine(err, conn.Close())
}()
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,
}
@ -522,27 +522,27 @@ func (service *Service) earned(ctx context.Context, node nodes.Node) (_ int64, e
}
// earnedSatellite returns earned split by satellites.
func (service *Service) earnedSatellite(ctx context.Context, node nodes.Node) (_ multinodepb.EarnedSatelliteResponse, err error) {
func (service *Service) earnedSatellite(ctx context.Context, node nodes.Node) (_ multinodepb.EarnedPerSatelliteResponse, err error) {
conn, err := service.dialer.DialNodeURL(ctx, storj.NodeURL{
ID: node.ID,
Address: node.PublicAddress,
})
if err != nil {
return multinodepb.EarnedSatelliteResponse{}, Error.Wrap(err)
return multinodepb.EarnedPerSatelliteResponse{}, Error.Wrap(err)
}
defer func() {
err = errs.Combine(err, conn.Close())
}()
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,
}
response, err := payoutClient.EarnedSatellite(ctx, &multinodepb.EarnedSatelliteRequest{Header: header})
response, err := payoutClient.EarnedPerSatellite(ctx, &multinodepb.EarnedPerSatelliteRequest{Header: header})
if err != nil {
return multinodepb.EarnedSatelliteResponse{}, Error.Wrap(err)
return multinodepb.EarnedPerSatelliteResponse{}, Error.Wrap(err)
}
return *response, nil
@ -569,12 +569,12 @@ func (service *Service) PaystubSatellitePeriod(ctx context.Context, period strin
err = errs.Combine(err, conn.Close())
}()
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,
}
response, err := payoutClient.PaystubSatellitePeriod(ctx, &multinodepb.PaystubSatellitePeriodRequest{
response, err := payoutClient.SatellitePeriodPaystub(ctx, &multinodepb.SatellitePeriodPaystubRequest{
Header: header,
SatelliteId: satelliteID,
Period: period,
@ -620,12 +620,12 @@ func (service *Service) PaystubPeriod(ctx context.Context, period string, nodeID
err = errs.Combine(err, conn.Close())
}()
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,
}
response, err := payoutClient.PaystubPeriod(ctx, &multinodepb.PaystubPeriodRequest{
response, err := payoutClient.PeriodPaystub(ctx, &multinodepb.PeriodPaystubRequest{
Header: header,
Period: period,
})
@ -670,12 +670,12 @@ func (service *Service) PaystubSatellite(ctx context.Context, nodeID, satelliteI
err = errs.Combine(err, conn.Close())
}()
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,
}
response, err := payoutClient.PaystubSatellite(ctx, &multinodepb.PaystubSatelliteRequest{
response, err := payoutClient.SatellitePaystub(ctx, &multinodepb.SatellitePaystubRequest{
Header: header,
SatelliteId: satelliteID,
})
@ -720,7 +720,7 @@ func (service *Service) Paystub(ctx context.Context, nodeID storj.NodeID) (_ Pay
err = errs.Combine(err, conn.Close())
}()
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
header := &multinodepb.RequestHeader{
ApiKey: node.APISecret,
}

File diff suppressed because it is too large Load Diff

View File

@ -397,3 +397,99 @@ message HeldAmountHistoryResponse {
repeated HeldAmountHistory history = 1;
}
service Payout {
rpc AllSatellitesSummary(AllSatellitesSummaryRequest) returns (AllSatellitesSummaryResponse);
rpc AllSatellitesPeriodSummary(AllSatellitesPeriodSummaryRequest) returns (AllSatellitesPeriodSummaryResponse);
rpc SatelliteSummary(SatelliteSummaryRequest) returns (SatelliteSummaryResponse);
rpc SatellitePeriodSummary(SatellitePeriodSummaryRequest) returns (SatellitePeriodSummaryResponse);
rpc Earned(EarnedRequest) returns (EarnedResponse);
rpc EarnedPerSatellite(EarnedPerSatelliteRequest) returns (EarnedPerSatelliteResponse);
rpc EstimatedPayoutSatellite(EstimatedPayoutSatelliteRequest) returns (EstimatedPayoutSatelliteResponse);
rpc EstimatedPayoutTotal(EstimatedPayoutTotalRequest) returns (EstimatedPayoutTotalResponse);
rpc Undistributed(UndistributedRequest) returns (UndistributedResponse);
rpc SatellitePaystub(SatellitePaystubRequest) returns (SatellitePaystubResponse);
rpc Paystub(PaystubRequest) returns (PaystubResponse);
rpc PeriodPaystub(PeriodPaystubRequest) returns (PeriodPaystubResponse);
rpc SatellitePeriodPaystub(SatellitePeriodPaystubRequest) returns (SatellitePeriodPaystubResponse);
}
message EstimatedPayoutTotalRequest {
RequestHeader header = 1;
}
message EstimatedPayoutTotalResponse {
int64 estimated_earnings = 1;
}
message AllSatellitesSummaryRequest {
RequestHeader header = 1;
}
message AllSatellitesSummaryResponse {
PayoutInfo payout_info = 1;
}
message AllSatellitesPeriodSummaryRequest {
RequestHeader header = 1;
string period = 2;
}
message AllSatellitesPeriodSummaryResponse {
PayoutInfo payout_info = 1;
}
message SatelliteSummaryRequest {
RequestHeader header = 1;
bytes satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
}
message SatelliteSummaryResponse {
PayoutInfo payout_info = 1;
}
message SatellitePeriodSummaryRequest {
RequestHeader header = 1;
bytes satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
string period = 3;
}
message SatellitePeriodSummaryResponse {
PayoutInfo payout_info = 1;
}
message EarnedPerSatelliteRequest {
RequestHeader header = 1;
}
message EarnedPerSatelliteResponse {
repeated EarnedSatellite earned_satellite = 1;
}
message SatellitePaystubRequest {
RequestHeader header = 1;
bytes satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
}
message SatellitePaystubResponse {
Paystub paystub = 1;
}
message PeriodPaystubRequest {
RequestHeader header = 1;
string period = 2;
}
message PeriodPaystubResponse {
Paystub paystub = 1;
}
message SatellitePeriodPaystubRequest {
RequestHeader header = 1;
bytes satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
string period = 3;
}
message SatellitePeriodPaystubResponse {
Paystub paystub = 1;
}

View File

@ -1418,3 +1418,558 @@ func (x *drpcPayouts_HeldAmountHistoryStream) SendAndClose(m *HeldAmountHistoryR
}
return x.CloseSend()
}
type DRPCPayoutClient interface {
DRPCConn() drpc.Conn
AllSatellitesSummary(ctx context.Context, in *AllSatellitesSummaryRequest) (*AllSatellitesSummaryResponse, error)
AllSatellitesPeriodSummary(ctx context.Context, in *AllSatellitesPeriodSummaryRequest) (*AllSatellitesPeriodSummaryResponse, error)
SatelliteSummary(ctx context.Context, in *SatelliteSummaryRequest) (*SatelliteSummaryResponse, error)
SatellitePeriodSummary(ctx context.Context, in *SatellitePeriodSummaryRequest) (*SatellitePeriodSummaryResponse, error)
Earned(ctx context.Context, in *EarnedRequest) (*EarnedResponse, error)
EarnedPerSatellite(ctx context.Context, in *EarnedPerSatelliteRequest) (*EarnedPerSatelliteResponse, error)
EstimatedPayoutSatellite(ctx context.Context, in *EstimatedPayoutSatelliteRequest) (*EstimatedPayoutSatelliteResponse, error)
EstimatedPayoutTotal(ctx context.Context, in *EstimatedPayoutTotalRequest) (*EstimatedPayoutTotalResponse, error)
Undistributed(ctx context.Context, in *UndistributedRequest) (*UndistributedResponse, error)
SatellitePaystub(ctx context.Context, in *SatellitePaystubRequest) (*SatellitePaystubResponse, error)
Paystub(ctx context.Context, in *PaystubRequest) (*PaystubResponse, error)
PeriodPaystub(ctx context.Context, in *PeriodPaystubRequest) (*PeriodPaystubResponse, error)
SatellitePeriodPaystub(ctx context.Context, in *SatellitePeriodPaystubRequest) (*SatellitePeriodPaystubResponse, error)
}
type drpcPayoutClient struct {
cc drpc.Conn
}
func NewDRPCPayoutClient(cc drpc.Conn) DRPCPayoutClient {
return &drpcPayoutClient{cc}
}
func (c *drpcPayoutClient) DRPCConn() drpc.Conn { return c.cc }
func (c *drpcPayoutClient) AllSatellitesSummary(ctx context.Context, in *AllSatellitesSummaryRequest) (*AllSatellitesSummaryResponse, error) {
out := new(AllSatellitesSummaryResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/AllSatellitesSummary", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPayoutClient) AllSatellitesPeriodSummary(ctx context.Context, in *AllSatellitesPeriodSummaryRequest) (*AllSatellitesPeriodSummaryResponse, error) {
out := new(AllSatellitesPeriodSummaryResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/AllSatellitesPeriodSummary", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPayoutClient) SatelliteSummary(ctx context.Context, in *SatelliteSummaryRequest) (*SatelliteSummaryResponse, error) {
out := new(SatelliteSummaryResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/SatelliteSummary", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPayoutClient) SatellitePeriodSummary(ctx context.Context, in *SatellitePeriodSummaryRequest) (*SatellitePeriodSummaryResponse, error) {
out := new(SatellitePeriodSummaryResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/SatellitePeriodSummary", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPayoutClient) Earned(ctx context.Context, in *EarnedRequest) (*EarnedResponse, error) {
out := new(EarnedResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/Earned", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPayoutClient) EarnedPerSatellite(ctx context.Context, in *EarnedPerSatelliteRequest) (*EarnedPerSatelliteResponse, error) {
out := new(EarnedPerSatelliteResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/EarnedPerSatellite", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPayoutClient) EstimatedPayoutSatellite(ctx context.Context, in *EstimatedPayoutSatelliteRequest) (*EstimatedPayoutSatelliteResponse, error) {
out := new(EstimatedPayoutSatelliteResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/EstimatedPayoutSatellite", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPayoutClient) EstimatedPayoutTotal(ctx context.Context, in *EstimatedPayoutTotalRequest) (*EstimatedPayoutTotalResponse, error) {
out := new(EstimatedPayoutTotalResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/EstimatedPayoutTotal", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPayoutClient) Undistributed(ctx context.Context, in *UndistributedRequest) (*UndistributedResponse, error) {
out := new(UndistributedResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/Undistributed", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPayoutClient) SatellitePaystub(ctx context.Context, in *SatellitePaystubRequest) (*SatellitePaystubResponse, error) {
out := new(SatellitePaystubResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/SatellitePaystub", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPayoutClient) Paystub(ctx context.Context, in *PaystubRequest) (*PaystubResponse, error) {
out := new(PaystubResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/Paystub", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPayoutClient) PeriodPaystub(ctx context.Context, in *PeriodPaystubRequest) (*PeriodPaystubResponse, error) {
out := new(PeriodPaystubResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/PeriodPaystub", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPayoutClient) SatellitePeriodPaystub(ctx context.Context, in *SatellitePeriodPaystubRequest) (*SatellitePeriodPaystubResponse, error) {
out := new(SatellitePeriodPaystubResponse)
err := c.cc.Invoke(ctx, "/multinode.Payout/SatellitePeriodPaystub", drpcEncoding_File_multinode_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
type DRPCPayoutServer interface {
AllSatellitesSummary(context.Context, *AllSatellitesSummaryRequest) (*AllSatellitesSummaryResponse, error)
AllSatellitesPeriodSummary(context.Context, *AllSatellitesPeriodSummaryRequest) (*AllSatellitesPeriodSummaryResponse, error)
SatelliteSummary(context.Context, *SatelliteSummaryRequest) (*SatelliteSummaryResponse, error)
SatellitePeriodSummary(context.Context, *SatellitePeriodSummaryRequest) (*SatellitePeriodSummaryResponse, error)
Earned(context.Context, *EarnedRequest) (*EarnedResponse, error)
EarnedPerSatellite(context.Context, *EarnedPerSatelliteRequest) (*EarnedPerSatelliteResponse, error)
EstimatedPayoutSatellite(context.Context, *EstimatedPayoutSatelliteRequest) (*EstimatedPayoutSatelliteResponse, error)
EstimatedPayoutTotal(context.Context, *EstimatedPayoutTotalRequest) (*EstimatedPayoutTotalResponse, error)
Undistributed(context.Context, *UndistributedRequest) (*UndistributedResponse, error)
SatellitePaystub(context.Context, *SatellitePaystubRequest) (*SatellitePaystubResponse, error)
Paystub(context.Context, *PaystubRequest) (*PaystubResponse, error)
PeriodPaystub(context.Context, *PeriodPaystubRequest) (*PeriodPaystubResponse, error)
SatellitePeriodPaystub(context.Context, *SatellitePeriodPaystubRequest) (*SatellitePeriodPaystubResponse, error)
}
type DRPCPayoutUnimplementedServer struct{}
func (s *DRPCPayoutUnimplementedServer) AllSatellitesSummary(context.Context, *AllSatellitesSummaryRequest) (*AllSatellitesSummaryResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
func (s *DRPCPayoutUnimplementedServer) AllSatellitesPeriodSummary(context.Context, *AllSatellitesPeriodSummaryRequest) (*AllSatellitesPeriodSummaryResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
func (s *DRPCPayoutUnimplementedServer) SatelliteSummary(context.Context, *SatelliteSummaryRequest) (*SatelliteSummaryResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
func (s *DRPCPayoutUnimplementedServer) SatellitePeriodSummary(context.Context, *SatellitePeriodSummaryRequest) (*SatellitePeriodSummaryResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
func (s *DRPCPayoutUnimplementedServer) Earned(context.Context, *EarnedRequest) (*EarnedResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
func (s *DRPCPayoutUnimplementedServer) EarnedPerSatellite(context.Context, *EarnedPerSatelliteRequest) (*EarnedPerSatelliteResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
func (s *DRPCPayoutUnimplementedServer) EstimatedPayoutSatellite(context.Context, *EstimatedPayoutSatelliteRequest) (*EstimatedPayoutSatelliteResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
func (s *DRPCPayoutUnimplementedServer) EstimatedPayoutTotal(context.Context, *EstimatedPayoutTotalRequest) (*EstimatedPayoutTotalResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
func (s *DRPCPayoutUnimplementedServer) Undistributed(context.Context, *UndistributedRequest) (*UndistributedResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
func (s *DRPCPayoutUnimplementedServer) SatellitePaystub(context.Context, *SatellitePaystubRequest) (*SatellitePaystubResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
func (s *DRPCPayoutUnimplementedServer) Paystub(context.Context, *PaystubRequest) (*PaystubResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
func (s *DRPCPayoutUnimplementedServer) PeriodPaystub(context.Context, *PeriodPaystubRequest) (*PeriodPaystubResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
func (s *DRPCPayoutUnimplementedServer) SatellitePeriodPaystub(context.Context, *SatellitePeriodPaystubRequest) (*SatellitePeriodPaystubResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
}
type DRPCPayoutDescription struct{}
func (DRPCPayoutDescription) NumMethods() int { return 13 }
func (DRPCPayoutDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
switch n {
case 0:
return "/multinode.Payout/AllSatellitesSummary", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
AllSatellitesSummary(
ctx,
in1.(*AllSatellitesSummaryRequest),
)
}, DRPCPayoutServer.AllSatellitesSummary, true
case 1:
return "/multinode.Payout/AllSatellitesPeriodSummary", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
AllSatellitesPeriodSummary(
ctx,
in1.(*AllSatellitesPeriodSummaryRequest),
)
}, DRPCPayoutServer.AllSatellitesPeriodSummary, true
case 2:
return "/multinode.Payout/SatelliteSummary", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
SatelliteSummary(
ctx,
in1.(*SatelliteSummaryRequest),
)
}, DRPCPayoutServer.SatelliteSummary, true
case 3:
return "/multinode.Payout/SatellitePeriodSummary", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
SatellitePeriodSummary(
ctx,
in1.(*SatellitePeriodSummaryRequest),
)
}, DRPCPayoutServer.SatellitePeriodSummary, true
case 4:
return "/multinode.Payout/Earned", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
Earned(
ctx,
in1.(*EarnedRequest),
)
}, DRPCPayoutServer.Earned, true
case 5:
return "/multinode.Payout/EarnedPerSatellite", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
EarnedPerSatellite(
ctx,
in1.(*EarnedPerSatelliteRequest),
)
}, DRPCPayoutServer.EarnedPerSatellite, true
case 6:
return "/multinode.Payout/EstimatedPayoutSatellite", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
EstimatedPayoutSatellite(
ctx,
in1.(*EstimatedPayoutSatelliteRequest),
)
}, DRPCPayoutServer.EstimatedPayoutSatellite, true
case 7:
return "/multinode.Payout/EstimatedPayoutTotal", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
EstimatedPayoutTotal(
ctx,
in1.(*EstimatedPayoutTotalRequest),
)
}, DRPCPayoutServer.EstimatedPayoutTotal, true
case 8:
return "/multinode.Payout/Undistributed", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
Undistributed(
ctx,
in1.(*UndistributedRequest),
)
}, DRPCPayoutServer.Undistributed, true
case 9:
return "/multinode.Payout/SatellitePaystub", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
SatellitePaystub(
ctx,
in1.(*SatellitePaystubRequest),
)
}, DRPCPayoutServer.SatellitePaystub, true
case 10:
return "/multinode.Payout/Paystub", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
Paystub(
ctx,
in1.(*PaystubRequest),
)
}, DRPCPayoutServer.Paystub, true
case 11:
return "/multinode.Payout/PeriodPaystub", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
PeriodPaystub(
ctx,
in1.(*PeriodPaystubRequest),
)
}, DRPCPayoutServer.PeriodPaystub, true
case 12:
return "/multinode.Payout/SatellitePeriodPaystub", drpcEncoding_File_multinode_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPayoutServer).
SatellitePeriodPaystub(
ctx,
in1.(*SatellitePeriodPaystubRequest),
)
}, DRPCPayoutServer.SatellitePeriodPaystub, true
default:
return "", nil, nil, nil, false
}
}
func DRPCRegisterPayout(mux drpc.Mux, impl DRPCPayoutServer) error {
return mux.Register(impl, DRPCPayoutDescription{})
}
type DRPCPayout_AllSatellitesSummaryStream interface {
drpc.Stream
SendAndClose(*AllSatellitesSummaryResponse) error
}
type drpcPayout_AllSatellitesSummaryStream struct {
drpc.Stream
}
func (x *drpcPayout_AllSatellitesSummaryStream) SendAndClose(m *AllSatellitesSummaryResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPayout_AllSatellitesPeriodSummaryStream interface {
drpc.Stream
SendAndClose(*AllSatellitesPeriodSummaryResponse) error
}
type drpcPayout_AllSatellitesPeriodSummaryStream struct {
drpc.Stream
}
func (x *drpcPayout_AllSatellitesPeriodSummaryStream) SendAndClose(m *AllSatellitesPeriodSummaryResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPayout_SatelliteSummaryStream interface {
drpc.Stream
SendAndClose(*SatelliteSummaryResponse) error
}
type drpcPayout_SatelliteSummaryStream struct {
drpc.Stream
}
func (x *drpcPayout_SatelliteSummaryStream) SendAndClose(m *SatelliteSummaryResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPayout_SatellitePeriodSummaryStream interface {
drpc.Stream
SendAndClose(*SatellitePeriodSummaryResponse) error
}
type drpcPayout_SatellitePeriodSummaryStream struct {
drpc.Stream
}
func (x *drpcPayout_SatellitePeriodSummaryStream) SendAndClose(m *SatellitePeriodSummaryResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPayout_EarnedStream interface {
drpc.Stream
SendAndClose(*EarnedResponse) error
}
type drpcPayout_EarnedStream struct {
drpc.Stream
}
func (x *drpcPayout_EarnedStream) SendAndClose(m *EarnedResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPayout_EarnedPerSatelliteStream interface {
drpc.Stream
SendAndClose(*EarnedPerSatelliteResponse) error
}
type drpcPayout_EarnedPerSatelliteStream struct {
drpc.Stream
}
func (x *drpcPayout_EarnedPerSatelliteStream) SendAndClose(m *EarnedPerSatelliteResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPayout_EstimatedPayoutSatelliteStream interface {
drpc.Stream
SendAndClose(*EstimatedPayoutSatelliteResponse) error
}
type drpcPayout_EstimatedPayoutSatelliteStream struct {
drpc.Stream
}
func (x *drpcPayout_EstimatedPayoutSatelliteStream) SendAndClose(m *EstimatedPayoutSatelliteResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPayout_EstimatedPayoutTotalStream interface {
drpc.Stream
SendAndClose(*EstimatedPayoutTotalResponse) error
}
type drpcPayout_EstimatedPayoutTotalStream struct {
drpc.Stream
}
func (x *drpcPayout_EstimatedPayoutTotalStream) SendAndClose(m *EstimatedPayoutTotalResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPayout_UndistributedStream interface {
drpc.Stream
SendAndClose(*UndistributedResponse) error
}
type drpcPayout_UndistributedStream struct {
drpc.Stream
}
func (x *drpcPayout_UndistributedStream) SendAndClose(m *UndistributedResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPayout_SatellitePaystubStream interface {
drpc.Stream
SendAndClose(*SatellitePaystubResponse) error
}
type drpcPayout_SatellitePaystubStream struct {
drpc.Stream
}
func (x *drpcPayout_SatellitePaystubStream) SendAndClose(m *SatellitePaystubResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPayout_PaystubStream interface {
drpc.Stream
SendAndClose(*PaystubResponse) error
}
type drpcPayout_PaystubStream struct {
drpc.Stream
}
func (x *drpcPayout_PaystubStream) SendAndClose(m *PaystubResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPayout_PeriodPaystubStream interface {
drpc.Stream
SendAndClose(*PeriodPaystubResponse) error
}
type drpcPayout_PeriodPaystubStream struct {
drpc.Stream
}
func (x *drpcPayout_PeriodPaystubStream) SendAndClose(m *PeriodPaystubResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPayout_SatellitePeriodPaystubStream interface {
drpc.Stream
SendAndClose(*SatellitePeriodPaystubResponse) error
}
type drpcPayout_SatellitePeriodPaystubStream struct {
drpc.Stream
}
func (x *drpcPayout_SatellitePeriodPaystubStream) SendAndClose(m *SatellitePeriodPaystubResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
return err
}
return x.CloseSend()
}

View File

@ -16,12 +16,14 @@ import (
"storj.io/storj/storagenode/payouts/estimatedpayouts"
)
var _ multinodepb.DRPCPayoutServer = (*PayoutEndpoint)(nil)
var _ multinodepb.DRPCPayoutsServer = (*PayoutEndpoint)(nil)
// PayoutEndpoint implements multinode payouts endpoint.
//
// architecture: Endpoint
type PayoutEndpoint struct {
multinodepb.DRPCPayoutUnimplementedServer
multinodepb.DRPCPayoutsUnimplementedServer
log *zap.Logger
@ -69,6 +71,7 @@ func (payout *PayoutEndpoint) EarnedSatellite(ctx context.Context, req *multinod
}
var resp multinodepb.EarnedSatelliteResponse
satelliteIDs, err := payout.db.GetPayingSatellitesIDs(ctx)
if err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Internal, err)
@ -130,6 +133,7 @@ func (payout *PayoutEndpoint) Summary(ctx context.Context, req *multinodepb.Summ
}
var totalPaid, totalHeld int64
satelliteIDs, err := payout.db.GetPayingSatellitesIDs(ctx)
if err != nil {
return &multinodepb.SummaryResponse{}, rpcstatus.Wrap(rpcstatus.Internal, err)
@ -157,6 +161,7 @@ func (payout *PayoutEndpoint) SummaryPeriod(ctx context.Context, req *multinodep
}
var totalPaid, totalHeld int64
satelliteIDs, err := payout.db.GetPayingSatellitesIDs(ctx)
if err != nil {
return &multinodepb.SummaryPeriodResponse{}, rpcstatus.Wrap(rpcstatus.Internal, err)
@ -314,8 +319,8 @@ func (payout *PayoutEndpoint) PaystubPeriod(ctx context.Context, req *multinodep
}}, nil
}
// PaystubPeriodSatellite returns summed amounts of all values from paystubs from all satellites for specific period.
func (payout *PayoutEndpoint) PaystubPeriodSatellite(ctx context.Context, req *multinodepb.PaystubSatellitePeriodRequest) (_ *multinodepb.PaystubSatellitePeriodResponse, err error) {
// PaystubSatellitePeriod returns summed amounts of all values from paystubs from all satellites for specific period.
func (payout *PayoutEndpoint) PaystubSatellitePeriod(ctx context.Context, req *multinodepb.PaystubSatellitePeriodRequest) (_ *multinodepb.PaystubSatellitePeriodResponse, err error) {
defer mon.Task()(&ctx)(&err)
if err = authenticate(ctx, payout.apiKeys, req.GetHeader()); err != nil {
@ -376,3 +381,225 @@ func (payout *PayoutEndpoint) HeldAmountHistory(ctx context.Context, req *multin
return resp, nil
}
// PeriodPaystub returns summed amounts of all values from paystubs from all satellites for specific period.
func (payout *PayoutEndpoint) PeriodPaystub(ctx context.Context, req *multinodepb.PeriodPaystubRequest) (_ *multinodepb.PeriodPaystubResponse, err error) {
defer mon.Task()(&ctx)(&err)
if err = authenticate(ctx, payout.apiKeys, req.GetHeader()); err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
}
paystub, err := payout.db.GetPeriodPaystubs(ctx, req.Period)
if err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Internal, err)
}
return &multinodepb.PeriodPaystubResponse{Paystub: &multinodepb.Paystub{
UsageAtRest: paystub.UsageAtRest,
UsageGet: paystub.UsageGet,
UsageGetRepair: paystub.UsageGetRepair,
UsageGetAudit: paystub.UsageGetAudit,
CompAtRest: paystub.CompAtRest,
CompGet: paystub.CompGet,
CompGetRepair: paystub.CompGetRepair,
CompGetAudit: paystub.CompGetAudit,
Held: paystub.Held,
Paid: paystub.Paid,
Distributed: paystub.Distributed,
Disposed: paystub.Disposed,
}}, nil
}
// EarnedPerSatellite returns total earned amount per satellite.
func (payout *PayoutEndpoint) EarnedPerSatellite(ctx context.Context, req *multinodepb.EarnedPerSatelliteRequest) (_ *multinodepb.EarnedPerSatelliteResponse, err error) {
defer mon.Task()(&ctx)(&err)
if err = authenticate(ctx, payout.apiKeys, req.GetHeader()); err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
}
var resp multinodepb.EarnedPerSatelliteResponse
satelliteIDs, err := payout.db.GetPayingSatellitesIDs(ctx)
if err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Internal, err)
}
for _, id := range satelliteIDs {
earned, err := payout.db.GetEarnedAtSatellite(ctx, id)
if err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Internal, err)
}
resp.EarnedSatellite = append(resp.EarnedSatellite, &multinodepb.EarnedSatellite{
Total: earned,
SatelliteId: id,
})
}
return &resp, nil
}
// EstimatedPayoutTotal returns estimated earnings for current month from all satellites.
func (payout *PayoutEndpoint) EstimatedPayoutTotal(ctx context.Context, req *multinodepb.EstimatedPayoutTotalRequest) (_ *multinodepb.EstimatedPayoutTotalResponse, err error) {
defer mon.Task()(&ctx)(&err)
if err = authenticate(ctx, payout.apiKeys, req.GetHeader()); err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
}
estimated, err := payout.estimatedPayouts.GetAllSatellitesEstimatedPayout(ctx, time.Now())
if err != nil {
return &multinodepb.EstimatedPayoutTotalResponse{}, rpcstatus.Wrap(rpcstatus.Internal, err)
}
return &multinodepb.EstimatedPayoutTotalResponse{EstimatedEarnings: estimated.CurrentMonthExpectations}, nil
}
// AllSatellitesSummary returns all satellites all time payout summary.
func (payout *PayoutEndpoint) AllSatellitesSummary(ctx context.Context, req *multinodepb.AllSatellitesSummaryRequest) (_ *multinodepb.AllSatellitesSummaryResponse, err error) {
defer mon.Task()(&ctx)(&err)
if err = authenticate(ctx, payout.apiKeys, req.GetHeader()); err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
}
var totalPaid, totalHeld int64
satelliteIDs, err := payout.db.GetPayingSatellitesIDs(ctx)
if err != nil {
return &multinodepb.AllSatellitesSummaryResponse{}, rpcstatus.Wrap(rpcstatus.Internal, err)
}
for _, id := range satelliteIDs {
paid, held, err := payout.db.GetSatelliteSummary(ctx, id)
if err != nil {
return &multinodepb.AllSatellitesSummaryResponse{}, rpcstatus.Wrap(rpcstatus.Internal, err)
}
totalHeld += held
totalPaid += paid
}
return &multinodepb.AllSatellitesSummaryResponse{PayoutInfo: &multinodepb.PayoutInfo{Paid: totalPaid, Held: totalHeld}}, nil
}
// AllSatellitesPeriodSummary returns all satellites period payout summary.
func (payout *PayoutEndpoint) AllSatellitesPeriodSummary(ctx context.Context, req *multinodepb.AllSatellitesPeriodSummaryRequest) (_ *multinodepb.AllSatellitesPeriodSummaryResponse, err error) {
defer mon.Task()(&ctx)(&err)
if err = authenticate(ctx, payout.apiKeys, req.GetHeader()); err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
}
var totalPaid, totalHeld int64
satelliteIDs, err := payout.db.GetPayingSatellitesIDs(ctx)
if err != nil {
return &multinodepb.AllSatellitesPeriodSummaryResponse{}, rpcstatus.Wrap(rpcstatus.Internal, err)
}
for _, id := range satelliteIDs {
paid, held, err := payout.db.GetSatellitePeriodSummary(ctx, id, req.Period)
if err != nil {
return &multinodepb.AllSatellitesPeriodSummaryResponse{}, rpcstatus.Wrap(rpcstatus.Internal, err)
}
totalHeld += held
totalPaid += paid
}
return &multinodepb.AllSatellitesPeriodSummaryResponse{PayoutInfo: &multinodepb.PayoutInfo{Held: totalHeld, Paid: totalPaid}}, nil
}
// SatelliteSummary returns satellite all time payout summary.
func (payout *PayoutEndpoint) SatelliteSummary(ctx context.Context, req *multinodepb.SatelliteSummaryRequest) (_ *multinodepb.SatelliteSummaryResponse, err error) {
defer mon.Task()(&ctx)(&err)
if err = authenticate(ctx, payout.apiKeys, req.GetHeader()); err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
}
var totalPaid, totalHeld int64
totalPaid, totalHeld, err = payout.db.GetSatelliteSummary(ctx, req.SatelliteId)
if err != nil {
return &multinodepb.SatelliteSummaryResponse{}, rpcstatus.Wrap(rpcstatus.Internal, err)
}
return &multinodepb.SatelliteSummaryResponse{PayoutInfo: &multinodepb.PayoutInfo{Held: totalHeld, Paid: totalPaid}}, nil
}
// SatellitePeriodSummary returns satellite period payout summary.
func (payout *PayoutEndpoint) SatellitePeriodSummary(ctx context.Context, req *multinodepb.SatellitePeriodSummaryRequest) (_ *multinodepb.SatellitePeriodSummaryResponse, err error) {
defer mon.Task()(&ctx)(&err)
if err = authenticate(ctx, payout.apiKeys, req.GetHeader()); err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
}
var totalPaid, totalHeld int64
totalPaid, totalHeld, err = payout.db.GetSatellitePeriodSummary(ctx, req.SatelliteId, req.Period)
if err != nil {
return &multinodepb.SatellitePeriodSummaryResponse{}, rpcstatus.Wrap(rpcstatus.Internal, err)
}
return &multinodepb.SatellitePeriodSummaryResponse{PayoutInfo: &multinodepb.PayoutInfo{Held: totalHeld, Paid: totalPaid}}, nil
}
// SatellitePaystub returns summed amounts of all values from paystubs from all satellites.
func (payout *PayoutEndpoint) SatellitePaystub(ctx context.Context, req *multinodepb.SatellitePaystubRequest) (_ *multinodepb.SatellitePaystubResponse, err error) {
defer mon.Task()(&ctx)(&err)
if err = authenticate(ctx, payout.apiKeys, req.GetHeader()); err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
}
paystub, err := payout.db.GetSatellitePaystubs(ctx, req.SatelliteId)
if err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Internal, err)
}
return &multinodepb.SatellitePaystubResponse{Paystub: &multinodepb.Paystub{
UsageAtRest: paystub.UsageAtRest,
UsageGet: paystub.UsageGet,
UsageGetRepair: paystub.UsageGetRepair,
UsageGetAudit: paystub.UsageGetAudit,
CompAtRest: paystub.CompAtRest,
CompGet: paystub.CompGet,
CompGetRepair: paystub.CompGetRepair,
CompGetAudit: paystub.CompGetAudit,
Held: paystub.Held,
Paid: paystub.Paid,
Distributed: paystub.Distributed,
Disposed: paystub.Disposed,
}}, nil
}
// SatellitePeriodPaystub returns summed amounts of all values from paystubs from all satellites for specific period.
func (payout *PayoutEndpoint) SatellitePeriodPaystub(ctx context.Context, req *multinodepb.SatellitePeriodPaystubRequest) (_ *multinodepb.SatellitePeriodPaystubResponse, err error) {
defer mon.Task()(&ctx)(&err)
if err = authenticate(ctx, payout.apiKeys, req.GetHeader()); err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
}
paystub, err := payout.db.GetSatellitePeriodPaystubs(ctx, req.Period, req.SatelliteId)
if err != nil {
return nil, rpcstatus.Wrap(rpcstatus.Internal, err)
}
return &multinodepb.SatellitePeriodPaystubResponse{Paystub: &multinodepb.Paystub{
UsageAtRest: paystub.UsageAtRest,
UsageGet: paystub.UsageGet,
UsageGetRepair: paystub.UsageGetRepair,
UsageGetAudit: paystub.UsageGetAudit,
CompAtRest: paystub.CompAtRest,
CompGet: paystub.CompGet,
CompGetRepair: paystub.CompGetRepair,
CompGetAudit: paystub.CompGetAudit,
Held: paystub.Held,
Paid: paystub.Paid,
Distributed: paystub.Distributed,
Disposed: paystub.Disposed,
}}, nil
}

View File

@ -823,7 +823,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten
if err = multinodepb.DRPCRegisterNode(peer.Server.DRPC(), peer.Multinode.Node); err != nil {
return nil, errs.Combine(err, peer.Close())
}
if err = multinodepb.DRPCRegisterPayouts(peer.Server.DRPC(), peer.Multinode.Payout); err != nil {
if err = multinodepb.DRPCRegisterPayout(peer.Server.DRPC(), peer.Multinode.Payout); err != nil {
return nil, errs.Combine(err, peer.Close())
}
}