Generate Payments Report (#1079)

This commit is contained in:
Jennifer Li Johnson 2019-01-17 13:34:13 -05:00 committed by GitHub
parent b2e69d847f
commit e6fbf63620
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 1068 additions and 95 deletions

144
cmd/payments/main.go Normal file
View File

@ -0,0 +1,144 @@
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package main
import (
"context"
"fmt"
"os"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/spf13/cobra"
"github.com/zeebo/errs"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/provider"
"storj.io/storj/pkg/transport"
)
var (
ctx = context.Background()
// ErrPaymentsDial throws when there are errors dialing the payments client
ErrPaymentsDial = errs.Class("error dialing payments client")
// ErrRequest is for gRPC request errors after dialing
ErrRequest = errs.Class("error processing request")
// ErrIdentity is for errors during identity creation for this CLI
ErrIdentity = errs.Class("error creating identity")
// ErrArgs throws when there are errors with CLI args
ErrArgs = errs.Class("error with CLI args")
port string
rootCmd = &cobra.Command{Use: "payments"}
cmdGenerate = &cobra.Command{
Use: "generatecsv",
Short: "generates payment csv",
Args: cobra.MinimumNArgs(2),
RunE: generatecsv,
}
cmdTest = &cobra.Command{
Use: "test",
Short: "test only: add records to accounting rollup",
RunE: test,
}
)
// Payments gives access to the payments api
type Payments struct {
client pb.PaymentsClient
}
func main() {
rootCmd.PersistentFlags().StringVarP(&port, "port", "p", ":10000", "satellite port")
rootCmd.AddCommand(cmdGenerate)
rootCmd.AddCommand(cmdTest)
err := rootCmd.Execute()
if err != nil {
fmt.Println("Error", err)
os.Exit(1)
}
}
// NewPayments creates a payments object
func NewPayments() (*Payments, error) {
identity, err := provider.NewFullIdentity(ctx, 12, 4)
if err != nil {
return &Payments{}, ErrIdentity.Wrap(err)
}
tc := transport.NewClient(identity)
// TODO: this might be blocked after requiring authorization
// use satellite identity or later private grpc
fmt.Println("Warning: created new ID, may not be able to connect to satellite")
conn, err := tc.DialAddress(ctx, port)
if err != nil {
return &Payments{}, ErrPaymentsDial.Wrap(err)
}
c := pb.NewPaymentsClient(conn)
return &Payments{client: c}, nil
}
// generateCSV makes a call to the payments client to query the db and generate a csv
func generatecsv(cmd *cobra.Command, args []string) error {
fmt.Println("entering payments generatecsv")
layout := "2006-01-02"
start, err := time.Parse(layout, args[0])
if err != nil {
return ErrArgs.Wrap(errs.New("Invalid date format. Please use YYYY-MM-DD"))
}
end, err := time.Parse(layout, args[1])
if err != nil {
return ErrArgs.Wrap(errs.New("Invalid date format. Please use YYYY-MM-DD"))
}
// Ensure that start date is not after end date
if start.After(end) {
return errs.New("Invalid time period (%v) - (%v)", start, end)
}
startTimestamp, err := ptypes.TimestampProto(start)
if err != nil {
return err
}
endTimestamp, err := ptypes.TimestampProto(end)
if err != nil {
return err
}
p, err := NewPayments()
if err != nil {
return err
}
req := &pb.GenerateCSVRequest{
StartTime: startTimestamp,
EndTime: endTimestamp,
}
resp, err := p.client.GenerateCSV(ctx, req)
if err != nil {
return ErrRequest.Wrap(err)
}
fmt.Println("Created payments report at", resp.GetFilepath())
return nil
}
// test only: add records to accounting rollup
func test(cmd *cobra.Command, args []string) error {
p, err := NewPayments()
if err != nil {
return err
}
req := &pb.TestRequest{}
_, err = p.client.Test(ctx, req)
fmt.Println("Added nodes to accounting rollup")
return err
}

View File

@ -27,6 +27,7 @@ import (
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/kademlia"
"storj.io/storj/pkg/overlay"
"storj.io/storj/pkg/payments"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/pointerdb"
"storj.io/storj/pkg/process"
@ -52,6 +53,7 @@ type Satellite struct {
Discovery discovery.Config
Database string `help:"satellite database connection string" default:"sqlite3://$CONFDIR/master.db"`
StatDB statdb.Config
Payments payments.Config
}
var (
@ -147,6 +149,7 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) {
runCfg.BwAgreement,
runCfg.Discovery,
runCfg.StatDB,
runCfg.Payments,
)
}

View File

@ -3,7 +3,12 @@
package accounting
import "storj.io/storj/pkg/pb"
import (
"time"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/storj"
)
// Constants for accounting_raw, accounting_rollup, and accounting_timestamps
const (
@ -21,3 +26,18 @@ const (
// LastRollup represents the accounting timestamp for rollup calculations
LastRollup = "LastRollup"
)
// CSVRow represents data from QueryPaymentInfo without exposing dbx
type CSVRow struct {
NodeID storj.NodeID
NodeCreationDate time.Time
AuditSuccessRatio float64
AtRestTotal float64
GetRepairTotal int64
PutRepairTotal int64
GetAuditTotal int64
PutTotal int64
GetTotal int64
Date time.Time
Wallet string
}

View File

@ -54,4 +54,8 @@ type DB interface {
GetRawSince(ctx context.Context, latestRollup time.Time) ([]*Raw, error)
// SaveRollup records raw tallies of at rest data to the database
SaveRollup(ctx context.Context, latestTally time.Time, stats RollupStats) error
// QueryPaymentInfo queries StatDB, Accounting Rollup on nodeID
QueryPaymentInfo(ctx context.Context, start time.Time, end time.Time) ([]*CSVRow, error)
// Adds records to rollup for testing (TODO: remove before merge)
TestPayments(ctx context.Context) error
}

View File

@ -45,6 +45,8 @@ type DB interface {
Update(ctx context.Context, value *pb.Node) error
// Delete deletes node based on id
Delete(ctx context.Context, id storj.NodeID) error
//GetWalletAddress gets the node's wallet address
GetWalletAddress(ctx context.Context, id storj.NodeID) (string, error)
}
// Cache is used to store overlay data in Redis

52
pkg/payments/config.go Normal file
View File

@ -0,0 +1,52 @@
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package payments
import (
"context"
"github.com/zeebo/errs"
"go.uber.org/zap"
monkit "gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/storj/pkg/accounting"
"storj.io/storj/pkg/overlay"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/provider"
)
var (
mon = monkit.Package()
// Error is the main payments error class for this package
Error = errs.Class("payments server error: ")
)
// Config is a configuration struct for everything you need to start the
// Payments responsibility.
type Config struct {
//Filepath
Filepath string `help:"the file path of the generated csv" default:"$CONFDIR/payments"`
}
// Run implements the provider.Responsibility interface
func (c Config) Run(ctx context.Context, server *provider.Provider) (err error) {
defer mon.Task()(&ctx)(&err)
db, ok := ctx.Value("masterdb").(interface {
Accounting() accounting.DB
OverlayCache() overlay.DB
})
if !ok {
return Error.New("unable to get master db instance")
}
srv := &Server{
filepath: c.Filepath,
accountingDB: db.Accounting(),
overlayDB: db.OverlayCache(),
log: zap.L(),
metrics: monkit.Default,
}
pb.RegisterPaymentsServer(server.GRPC(), srv)
return server.Run(ctx)
}

157
pkg/payments/server.go Normal file
View File

@ -0,0 +1,157 @@
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package payments
import (
"context"
"encoding/csv"
"fmt"
"os"
"path/filepath"
"strconv"
"github.com/golang/protobuf/ptypes"
"github.com/zeebo/errs"
"go.uber.org/zap"
monkit "gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/storj/pkg/accounting"
"storj.io/storj/pkg/overlay"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/provider"
"storj.io/storj/pkg/utils"
)
var (
// PaymentsError is a gRPC server error for Payments
PaymentsError = errs.Class("payments server error: ")
)
// Server holds references to ...
type Server struct {
filepath string
accountingDB accounting.DB
overlayDB overlay.DB
log *zap.Logger
metrics *monkit.Registry
}
// Pay creates a payment to a single storage node
func (srv *Server) Pay(ctx context.Context, req *pb.PaymentRequest) (*pb.PaymentResponse, error) {
// TODO
return &pb.PaymentResponse{}, PaymentsError.New("Pay not implemented")
}
// Calculate determines the outstanding balance for a given storage node
func (srv *Server) Calculate(ctx context.Context, req *pb.CalculateRequest) (*pb.CalculateResponse, error) {
// TODO
return &pb.CalculateResponse{}, PaymentsError.New("Calculate not implemented")
}
// AdjustPrices sets the prices paid by a satellite for data at rest and bandwidth
func (srv *Server) AdjustPrices(ctx context.Context, req *pb.AdjustPricesRequest) (*pb.AdjustPricesResponse, error) {
// TODO
return &pb.AdjustPricesResponse{}, PaymentsError.New("AdjustPrices not implemented")
}
// GenerateCSV creates a csv file for payment purposes
func (srv *Server) GenerateCSV(ctx context.Context, req *pb.GenerateCSVRequest) (*pb.GenerateCSVResponse, error) {
fmt.Println("entering server generate csv")
start, err := ptypes.Timestamp(req.StartTime)
if err != nil {
return nil, PaymentsError.Wrap(err)
}
end, err := ptypes.Timestamp(req.EndTime)
if err != nil {
return nil, PaymentsError.Wrap(err)
}
pi, err := provider.PeerIdentityFromContext(ctx)
if err != nil {
return nil, PaymentsError.Wrap(err)
}
layout := "2006-01-02"
if err := os.MkdirAll(srv.filepath, 0700); err != nil {
return nil, PaymentsError.Wrap(err)
}
filename := pi.ID.String() + "--" + start.Format(layout) + "--" + end.Format(layout) + ".csv"
path := filepath.Join(srv.filepath, filename)
file, err := os.Create(path)
if err != nil {
return nil, PaymentsError.Wrap(err)
}
defer utils.LogClose(file)
rows, err := srv.accountingDB.QueryPaymentInfo(ctx, start, end)
if err != nil {
return nil, PaymentsError.Wrap(err)
}
w := csv.NewWriter(file)
headers := []string{
"nodeID",
"nodeCreationDate",
"auditSuccessRatio",
"byte/hr:AtRest",
"byte/hr:BWRepair-GET",
"byte/hr:BWRepair-PUT",
"byte/hr:BWAudit",
"byte/hr:BWGet",
"byte/hr:BWPut",
"date",
"walletAddress",
}
if err := w.Write(headers); err != nil {
return nil, PaymentsError.Wrap(err)
}
for _, row := range rows {
nid := row.NodeID
wallet, err := srv.overlayDB.GetWalletAddress(ctx, nid)
if err != nil {
return nil, PaymentsError.Wrap(err)
}
row.Wallet = wallet
record := structToStringSlice(row)
if err := w.Write(record); err != nil {
return nil, PaymentsError.Wrap(err)
}
}
if err := w.Error(); err != nil {
return nil, PaymentsError.Wrap(err)
}
w.Flush()
abs, err := filepath.Abs(path)
if err != nil {
return nil, err
}
return &pb.GenerateCSVResponse{Filepath: abs}, nil
}
// Test TODO: remove
func (srv *Server) Test(ctx context.Context, req *pb.TestRequest) (*pb.TestResponse, error) {
err := srv.accountingDB.TestPayments(ctx)
return &pb.TestResponse{}, err
}
func structToStringSlice(s *accounting.CSVRow) []string {
record := []string{
s.NodeID.String(),
s.NodeCreationDate.Format("2006-01-02"),
strconv.FormatFloat(s.AuditSuccessRatio, 'f', 5, 64),
strconv.FormatFloat(s.AtRestTotal, 'f', 5, 64),
strconv.FormatInt(s.GetRepairTotal, 10),
strconv.FormatInt(s.PutRepairTotal, 10),
strconv.FormatInt(s.GetAuditTotal, 10),
strconv.FormatInt(s.PutTotal, 10),
strconv.FormatInt(s.GetTotal, 10),
s.Date.Format("2006-01-02"),
s.Wallet,
}
return record
}

View File

@ -46,7 +46,7 @@ func (x AgreementsSummary_Status) String() string {
return proto.EnumName(AgreementsSummary_Status_name, int32(x))
}
func (AgreementsSummary_Status) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_bandwidth_acc7ad1b0a6a13c6, []int{0, 0}
return fileDescriptor_bandwidth_1560d6d92a271e58, []int{0, 0}
}
type AgreementsSummary struct {
@ -60,7 +60,7 @@ func (m *AgreementsSummary) Reset() { *m = AgreementsSummary{} }
func (m *AgreementsSummary) String() string { return proto.CompactTextString(m) }
func (*AgreementsSummary) ProtoMessage() {}
func (*AgreementsSummary) Descriptor() ([]byte, []int) {
return fileDescriptor_bandwidth_acc7ad1b0a6a13c6, []int{0}
return fileDescriptor_bandwidth_1560d6d92a271e58, []int{0}
}
func (m *AgreementsSummary) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AgreementsSummary.Unmarshal(m, b)
@ -164,11 +164,10 @@ var _Bandwidth_serviceDesc = grpc.ServiceDesc{
Metadata: "bandwidth.proto",
}
func init() { proto.RegisterFile("bandwidth.proto", fileDescriptor_bandwidth_acc7ad1b0a6a13c6) }
var fileDescriptor_bandwidth_acc7ad1b0a6a13c6 = []byte{
// 196 bytes of a gzipped FileDescriptorProto
func init() { proto.RegisterFile("bandwidth.proto", fileDescriptor_bandwidth_1560d6d92a271e58) }
var fileDescriptor_bandwidth_1560d6d92a271e58 = []byte{
// 210 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x4a, 0xcc, 0x4b,
0x29, 0xcf, 0x4c, 0x29, 0xc9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0x0b, 0x48,
0x09, 0x14, 0x64, 0xa6, 0x26, 0xa7, 0x16, 0x97, 0xe4, 0x17, 0xa5, 0x42, 0x24, 0x95, 0xaa, 0xb8,

View File

@ -36,7 +36,7 @@ func (m *SigningRequest) Reset() { *m = SigningRequest{} }
func (m *SigningRequest) String() string { return proto.CompactTextString(m) }
func (*SigningRequest) ProtoMessage() {}
func (*SigningRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_certificate_3052a87e436145bc, []int{0}
return fileDescriptor_certificate_c55bd879e75eb964, []int{0}
}
func (m *SigningRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SigningRequest.Unmarshal(m, b)
@ -81,7 +81,7 @@ func (m *SigningResponse) Reset() { *m = SigningResponse{} }
func (m *SigningResponse) String() string { return proto.CompactTextString(m) }
func (*SigningResponse) ProtoMessage() {}
func (*SigningResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_certificate_3052a87e436145bc, []int{1}
return fileDescriptor_certificate_c55bd879e75eb964, []int{1}
}
func (m *SigningResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SigningResponse.Unmarshal(m, b)
@ -185,9 +185,9 @@ var _Certificates_serviceDesc = grpc.ServiceDesc{
Metadata: "certificate.proto",
}
func init() { proto.RegisterFile("certificate.proto", fileDescriptor_certificate_3052a87e436145bc) }
func init() { proto.RegisterFile("certificate.proto", fileDescriptor_certificate_c55bd879e75eb964) }
var fileDescriptor_certificate_3052a87e436145bc = []byte{
var fileDescriptor_certificate_c55bd879e75eb964 = []byte{
// 192 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4c, 0x4e, 0x2d, 0x2a,
0xc9, 0x4c, 0xcb, 0x4c, 0x4e, 0x2c, 0x49, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xc9,

View File

@ -31,7 +31,7 @@ func (m *InjuredSegment) Reset() { *m = InjuredSegment{} }
func (m *InjuredSegment) String() string { return proto.CompactTextString(m) }
func (*InjuredSegment) ProtoMessage() {}
func (*InjuredSegment) Descriptor() ([]byte, []int) {
return fileDescriptor_datarepair_ed86aa1a63e3d6e4, []int{0}
return fileDescriptor_datarepair_13e4beab54f194bd, []int{0}
}
func (m *InjuredSegment) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_InjuredSegment.Unmarshal(m, b)
@ -69,9 +69,9 @@ func init() {
proto.RegisterType((*InjuredSegment)(nil), "repair.InjuredSegment")
}
func init() { proto.RegisterFile("datarepair.proto", fileDescriptor_datarepair_ed86aa1a63e3d6e4) }
func init() { proto.RegisterFile("datarepair.proto", fileDescriptor_datarepair_13e4beab54f194bd) }
var fileDescriptor_datarepair_ed86aa1a63e3d6e4 = []byte{
var fileDescriptor_datarepair_13e4beab54f194bd = []byte{
// 119 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x48, 0x49, 0x2c, 0x49,
0x2c, 0x4a, 0x2d, 0x48, 0xcc, 0x2c, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0,

View File

@ -31,7 +31,7 @@ func (m *SerializableMeta) Reset() { *m = SerializableMeta{} }
func (m *SerializableMeta) String() string { return proto.CompactTextString(m) }
func (*SerializableMeta) ProtoMessage() {}
func (*SerializableMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_meta_16703f2dafac4e74, []int{0}
return fileDescriptor_meta_12afffbb4ed1a0bb, []int{0}
}
func (m *SerializableMeta) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SerializableMeta.Unmarshal(m, b)
@ -70,9 +70,9 @@ func init() {
proto.RegisterMapType((map[string]string)(nil), "objects.SerializableMeta.UserDefinedEntry")
}
func init() { proto.RegisterFile("meta.proto", fileDescriptor_meta_16703f2dafac4e74) }
func init() { proto.RegisterFile("meta.proto", fileDescriptor_meta_12afffbb4ed1a0bb) }
var fileDescriptor_meta_16703f2dafac4e74 = []byte{
var fileDescriptor_meta_12afffbb4ed1a0bb = []byte{
// 191 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xca, 0x4d, 0x2d, 0x49,
0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xcf, 0x4f, 0xca, 0x4a, 0x4d, 0x2e, 0x29, 0x56,

View File

@ -49,7 +49,7 @@ func (x NodeType) String() string {
return proto.EnumName(NodeType_name, int32(x))
}
func (NodeType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_node_85c65d9820f3e8d4, []int{0}
return fileDescriptor_node_67af40c3abfaa4ce, []int{0}
}
// NodeTransport is an enum of possible transports for the overlay network
@ -70,7 +70,7 @@ func (x NodeTransport) String() string {
return proto.EnumName(NodeTransport_name, int32(x))
}
func (NodeTransport) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_node_85c65d9820f3e8d4, []int{1}
return fileDescriptor_node_67af40c3abfaa4ce, []int{1}
}
// NodeRestrictions contains all relevant data about a nodes ability to store data
@ -86,7 +86,7 @@ func (m *NodeRestrictions) Reset() { *m = NodeRestrictions{} }
func (m *NodeRestrictions) String() string { return proto.CompactTextString(m) }
func (*NodeRestrictions) ProtoMessage() {}
func (*NodeRestrictions) Descriptor() ([]byte, []int) {
return fileDescriptor_node_85c65d9820f3e8d4, []int{0}
return fileDescriptor_node_67af40c3abfaa4ce, []int{0}
}
func (m *NodeRestrictions) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_NodeRestrictions.Unmarshal(m, b)
@ -145,7 +145,7 @@ func (m *Node) Reset() { *m = Node{} }
func (m *Node) String() string { return proto.CompactTextString(m) }
func (*Node) ProtoMessage() {}
func (*Node) Descriptor() ([]byte, []int) {
return fileDescriptor_node_85c65d9820f3e8d4, []int{1}
return fileDescriptor_node_67af40c3abfaa4ce, []int{1}
}
func (m *Node) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Node.Unmarshal(m, b)
@ -255,7 +255,7 @@ func (m *NodeAddress) Reset() { *m = NodeAddress{} }
func (m *NodeAddress) String() string { return proto.CompactTextString(m) }
func (*NodeAddress) ProtoMessage() {}
func (*NodeAddress) Descriptor() ([]byte, []int) {
return fileDescriptor_node_85c65d9820f3e8d4, []int{2}
return fileDescriptor_node_67af40c3abfaa4ce, []int{2}
}
func (m *NodeAddress) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_NodeAddress.Unmarshal(m, b)
@ -308,7 +308,7 @@ func (m *NodeStats) Reset() { *m = NodeStats{} }
func (m *NodeStats) String() string { return proto.CompactTextString(m) }
func (*NodeStats) ProtoMessage() {}
func (*NodeStats) Descriptor() ([]byte, []int) {
return fileDescriptor_node_85c65d9820f3e8d4, []int{3}
return fileDescriptor_node_67af40c3abfaa4ce, []int{3}
}
func (m *NodeStats) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_NodeStats.Unmarshal(m, b)
@ -389,7 +389,7 @@ func (m *NodeMetadata) Reset() { *m = NodeMetadata{} }
func (m *NodeMetadata) String() string { return proto.CompactTextString(m) }
func (*NodeMetadata) ProtoMessage() {}
func (*NodeMetadata) Descriptor() ([]byte, []int) {
return fileDescriptor_node_85c65d9820f3e8d4, []int{4}
return fileDescriptor_node_67af40c3abfaa4ce, []int{4}
}
func (m *NodeMetadata) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_NodeMetadata.Unmarshal(m, b)
@ -433,9 +433,9 @@ func init() {
proto.RegisterEnum("node.NodeTransport", NodeTransport_name, NodeTransport_value)
}
func init() { proto.RegisterFile("node.proto", fileDescriptor_node_85c65d9820f3e8d4) }
func init() { proto.RegisterFile("node.proto", fileDescriptor_node_67af40c3abfaa4ce) }
var fileDescriptor_node_85c65d9820f3e8d4 = []byte{
var fileDescriptor_node_67af40c3abfaa4ce = []byte{
// 652 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x94, 0xc1, 0x4e, 0xdb, 0x40,
0x10, 0x86, 0x49, 0x6c, 0x9c, 0x78, 0xec, 0xa4, 0x66, 0x40, 0xc8, 0x6a, 0xd5, 0x12, 0x82, 0xaa,

View File

@ -54,7 +54,7 @@ func (x Restriction_Operator) String() string {
return proto.EnumName(Restriction_Operator_name, int32(x))
}
func (Restriction_Operator) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{11, 0}
return fileDescriptor_overlay_99a51b72c26b0776, []int{11, 0}
}
type Restriction_Operand int32
@ -77,7 +77,7 @@ func (x Restriction_Operand) String() string {
return proto.EnumName(Restriction_Operand_name, int32(x))
}
func (Restriction_Operand) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{11, 1}
return fileDescriptor_overlay_99a51b72c26b0776, []int{11, 1}
}
// LookupRequest is is request message for the lookup rpc call
@ -92,7 +92,7 @@ func (m *LookupRequest) Reset() { *m = LookupRequest{} }
func (m *LookupRequest) String() string { return proto.CompactTextString(m) }
func (*LookupRequest) ProtoMessage() {}
func (*LookupRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{0}
return fileDescriptor_overlay_99a51b72c26b0776, []int{0}
}
func (m *LookupRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LookupRequest.Unmarshal(m, b)
@ -124,7 +124,7 @@ func (m *LookupResponse) Reset() { *m = LookupResponse{} }
func (m *LookupResponse) String() string { return proto.CompactTextString(m) }
func (*LookupResponse) ProtoMessage() {}
func (*LookupResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{1}
return fileDescriptor_overlay_99a51b72c26b0776, []int{1}
}
func (m *LookupResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LookupResponse.Unmarshal(m, b)
@ -163,7 +163,7 @@ func (m *LookupRequests) Reset() { *m = LookupRequests{} }
func (m *LookupRequests) String() string { return proto.CompactTextString(m) }
func (*LookupRequests) ProtoMessage() {}
func (*LookupRequests) Descriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{2}
return fileDescriptor_overlay_99a51b72c26b0776, []int{2}
}
func (m *LookupRequests) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LookupRequests.Unmarshal(m, b)
@ -202,7 +202,7 @@ func (m *LookupResponses) Reset() { *m = LookupResponses{} }
func (m *LookupResponses) String() string { return proto.CompactTextString(m) }
func (*LookupResponses) ProtoMessage() {}
func (*LookupResponses) Descriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{3}
return fileDescriptor_overlay_99a51b72c26b0776, []int{3}
}
func (m *LookupResponses) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LookupResponses.Unmarshal(m, b)
@ -241,7 +241,7 @@ func (m *FindStorageNodesResponse) Reset() { *m = FindStorageNodesRespon
func (m *FindStorageNodesResponse) String() string { return proto.CompactTextString(m) }
func (*FindStorageNodesResponse) ProtoMessage() {}
func (*FindStorageNodesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{4}
return fileDescriptor_overlay_99a51b72c26b0776, []int{4}
}
func (m *FindStorageNodesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FindStorageNodesResponse.Unmarshal(m, b)
@ -284,7 +284,7 @@ func (m *FindStorageNodesRequest) Reset() { *m = FindStorageNodesRequest
func (m *FindStorageNodesRequest) String() string { return proto.CompactTextString(m) }
func (*FindStorageNodesRequest) ProtoMessage() {}
func (*FindStorageNodesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{5}
return fileDescriptor_overlay_99a51b72c26b0776, []int{5}
}
func (m *FindStorageNodesRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FindStorageNodesRequest.Unmarshal(m, b)
@ -349,7 +349,7 @@ func (m *OverlayOptions) Reset() { *m = OverlayOptions{} }
func (m *OverlayOptions) String() string { return proto.CompactTextString(m) }
func (*OverlayOptions) ProtoMessage() {}
func (*OverlayOptions) Descriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{6}
return fileDescriptor_overlay_99a51b72c26b0776, []int{6}
}
func (m *OverlayOptions) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OverlayOptions.Unmarshal(m, b)
@ -418,7 +418,7 @@ func (m *QueryRequest) Reset() { *m = QueryRequest{} }
func (m *QueryRequest) String() string { return proto.CompactTextString(m) }
func (*QueryRequest) ProtoMessage() {}
func (*QueryRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{7}
return fileDescriptor_overlay_99a51b72c26b0776, []int{7}
}
func (m *QueryRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryRequest.Unmarshal(m, b)
@ -478,7 +478,7 @@ func (m *QueryResponse) Reset() { *m = QueryResponse{} }
func (m *QueryResponse) String() string { return proto.CompactTextString(m) }
func (*QueryResponse) ProtoMessage() {}
func (*QueryResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{8}
return fileDescriptor_overlay_99a51b72c26b0776, []int{8}
}
func (m *QueryResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryResponse.Unmarshal(m, b)
@ -522,7 +522,7 @@ func (m *PingRequest) Reset() { *m = PingRequest{} }
func (m *PingRequest) String() string { return proto.CompactTextString(m) }
func (*PingRequest) ProtoMessage() {}
func (*PingRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{9}
return fileDescriptor_overlay_99a51b72c26b0776, []int{9}
}
func (m *PingRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PingRequest.Unmarshal(m, b)
@ -552,7 +552,7 @@ func (m *PingResponse) Reset() { *m = PingResponse{} }
func (m *PingResponse) String() string { return proto.CompactTextString(m) }
func (*PingResponse) ProtoMessage() {}
func (*PingResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{10}
return fileDescriptor_overlay_99a51b72c26b0776, []int{10}
}
func (m *PingResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PingResponse.Unmarshal(m, b)
@ -585,7 +585,7 @@ func (m *Restriction) Reset() { *m = Restriction{} }
func (m *Restriction) String() string { return proto.CompactTextString(m) }
func (*Restriction) ProtoMessage() {}
func (*Restriction) Descriptor() ([]byte, []int) {
return fileDescriptor_overlay_55263e8e6ceef0b4, []int{11}
return fileDescriptor_overlay_99a51b72c26b0776, []int{11}
}
func (m *Restriction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Restriction.Unmarshal(m, b)
@ -884,9 +884,9 @@ var _Nodes_serviceDesc = grpc.ServiceDesc{
Metadata: "overlay.proto",
}
func init() { proto.RegisterFile("overlay.proto", fileDescriptor_overlay_55263e8e6ceef0b4) }
func init() { proto.RegisterFile("overlay.proto", fileDescriptor_overlay_99a51b72c26b0776) }
var fileDescriptor_overlay_55263e8e6ceef0b4 = []byte{
var fileDescriptor_overlay_99a51b72c26b0776 = []byte{
// 845 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xdd, 0x8e, 0xdb, 0x44,
0x14, 0x5e, 0xe7, 0xc7, 0xc9, 0x9e, 0x24, 0x5e, 0x6b, 0xd4, 0xee, 0x06, 0x03, 0xdd, 0x60, 0x55,

View File

@ -6,6 +6,7 @@ package pb
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import timestamp "github.com/golang/protobuf/ptypes/timestamp"
import (
context "golang.org/x/net/context"
@ -36,7 +37,7 @@ func (m *PaymentRequest) Reset() { *m = PaymentRequest{} }
func (m *PaymentRequest) String() string { return proto.CompactTextString(m) }
func (*PaymentRequest) ProtoMessage() {}
func (*PaymentRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_payments_89f2ad202d6d67fc, []int{0}
return fileDescriptor_payments_48b3ff941342a2b2, []int{0}
}
func (m *PaymentRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PaymentRequest.Unmarshal(m, b)
@ -74,7 +75,7 @@ func (m *PaymentResponse) Reset() { *m = PaymentResponse{} }
func (m *PaymentResponse) String() string { return proto.CompactTextString(m) }
func (*PaymentResponse) ProtoMessage() {}
func (*PaymentResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_payments_89f2ad202d6d67fc, []int{1}
return fileDescriptor_payments_48b3ff941342a2b2, []int{1}
}
func (m *PaymentResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PaymentResponse.Unmarshal(m, b)
@ -107,7 +108,7 @@ func (m *CalculateRequest) Reset() { *m = CalculateRequest{} }
func (m *CalculateRequest) String() string { return proto.CompactTextString(m) }
func (*CalculateRequest) ProtoMessage() {}
func (*CalculateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_payments_89f2ad202d6d67fc, []int{2}
return fileDescriptor_payments_48b3ff941342a2b2, []int{2}
}
func (m *CalculateRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CalculateRequest.Unmarshal(m, b)
@ -149,7 +150,7 @@ func (m *CalculateResponse) Reset() { *m = CalculateResponse{} }
func (m *CalculateResponse) String() string { return proto.CompactTextString(m) }
func (*CalculateResponse) ProtoMessage() {}
func (*CalculateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_payments_89f2ad202d6d67fc, []int{3}
return fileDescriptor_payments_48b3ff941342a2b2, []int{3}
}
func (m *CalculateResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CalculateResponse.Unmarshal(m, b)
@ -198,7 +199,7 @@ func (m *AdjustPricesRequest) Reset() { *m = AdjustPricesRequest{} }
func (m *AdjustPricesRequest) String() string { return proto.CompactTextString(m) }
func (*AdjustPricesRequest) ProtoMessage() {}
func (*AdjustPricesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_payments_89f2ad202d6d67fc, []int{4}
return fileDescriptor_payments_48b3ff941342a2b2, []int{4}
}
func (m *AdjustPricesRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AdjustPricesRequest.Unmarshal(m, b)
@ -243,7 +244,7 @@ func (m *AdjustPricesResponse) Reset() { *m = AdjustPricesResponse{} }
func (m *AdjustPricesResponse) String() string { return proto.CompactTextString(m) }
func (*AdjustPricesResponse) ProtoMessage() {}
func (*AdjustPricesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_payments_89f2ad202d6d67fc, []int{5}
return fileDescriptor_payments_48b3ff941342a2b2, []int{5}
}
func (m *AdjustPricesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AdjustPricesResponse.Unmarshal(m, b)
@ -263,6 +264,152 @@ func (m *AdjustPricesResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_AdjustPricesResponse proto.InternalMessageInfo
// The request message for querying the data needed to generate a payments CSV
type GenerateCSVRequest struct {
StartTime *timestamp.Timestamp `protobuf:"bytes,1,opt,name=start_time,json=startTime" json:"start_time,omitempty"`
EndTime *timestamp.Timestamp `protobuf:"bytes,2,opt,name=end_time,json=endTime" json:"end_time,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GenerateCSVRequest) Reset() { *m = GenerateCSVRequest{} }
func (m *GenerateCSVRequest) String() string { return proto.CompactTextString(m) }
func (*GenerateCSVRequest) ProtoMessage() {}
func (*GenerateCSVRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_payments_48b3ff941342a2b2, []int{6}
}
func (m *GenerateCSVRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GenerateCSVRequest.Unmarshal(m, b)
}
func (m *GenerateCSVRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GenerateCSVRequest.Marshal(b, m, deterministic)
}
func (dst *GenerateCSVRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenerateCSVRequest.Merge(dst, src)
}
func (m *GenerateCSVRequest) XXX_Size() int {
return xxx_messageInfo_GenerateCSVRequest.Size(m)
}
func (m *GenerateCSVRequest) XXX_DiscardUnknown() {
xxx_messageInfo_GenerateCSVRequest.DiscardUnknown(m)
}
var xxx_messageInfo_GenerateCSVRequest proto.InternalMessageInfo
func (m *GenerateCSVRequest) GetStartTime() *timestamp.Timestamp {
if m != nil {
return m.StartTime
}
return nil
}
func (m *GenerateCSVRequest) GetEndTime() *timestamp.Timestamp {
if m != nil {
return m.EndTime
}
return nil
}
// The response message for querying the data needed to generate a payments CSV
type GenerateCSVResponse struct {
Filepath string `protobuf:"bytes,1,opt,name=filepath,proto3" json:"filepath,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GenerateCSVResponse) Reset() { *m = GenerateCSVResponse{} }
func (m *GenerateCSVResponse) String() string { return proto.CompactTextString(m) }
func (*GenerateCSVResponse) ProtoMessage() {}
func (*GenerateCSVResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_payments_48b3ff941342a2b2, []int{7}
}
func (m *GenerateCSVResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GenerateCSVResponse.Unmarshal(m, b)
}
func (m *GenerateCSVResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GenerateCSVResponse.Marshal(b, m, deterministic)
}
func (dst *GenerateCSVResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenerateCSVResponse.Merge(dst, src)
}
func (m *GenerateCSVResponse) XXX_Size() int {
return xxx_messageInfo_GenerateCSVResponse.Size(m)
}
func (m *GenerateCSVResponse) XXX_DiscardUnknown() {
xxx_messageInfo_GenerateCSVResponse.DiscardUnknown(m)
}
var xxx_messageInfo_GenerateCSVResponse proto.InternalMessageInfo
func (m *GenerateCSVResponse) GetFilepath() string {
if m != nil {
return m.Filepath
}
return ""
}
type TestRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TestRequest) Reset() { *m = TestRequest{} }
func (m *TestRequest) String() string { return proto.CompactTextString(m) }
func (*TestRequest) ProtoMessage() {}
func (*TestRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_payments_48b3ff941342a2b2, []int{8}
}
func (m *TestRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TestRequest.Unmarshal(m, b)
}
func (m *TestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TestRequest.Marshal(b, m, deterministic)
}
func (dst *TestRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_TestRequest.Merge(dst, src)
}
func (m *TestRequest) XXX_Size() int {
return xxx_messageInfo_TestRequest.Size(m)
}
func (m *TestRequest) XXX_DiscardUnknown() {
xxx_messageInfo_TestRequest.DiscardUnknown(m)
}
var xxx_messageInfo_TestRequest proto.InternalMessageInfo
type TestResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TestResponse) Reset() { *m = TestResponse{} }
func (m *TestResponse) String() string { return proto.CompactTextString(m) }
func (*TestResponse) ProtoMessage() {}
func (*TestResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_payments_48b3ff941342a2b2, []int{9}
}
func (m *TestResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TestResponse.Unmarshal(m, b)
}
func (m *TestResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TestResponse.Marshal(b, m, deterministic)
}
func (dst *TestResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_TestResponse.Merge(dst, src)
}
func (m *TestResponse) XXX_Size() int {
return xxx_messageInfo_TestResponse.Size(m)
}
func (m *TestResponse) XXX_DiscardUnknown() {
xxx_messageInfo_TestResponse.DiscardUnknown(m)
}
var xxx_messageInfo_TestResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*PaymentRequest)(nil), "PaymentRequest")
proto.RegisterType((*PaymentResponse)(nil), "PaymentResponse")
@ -270,6 +417,10 @@ func init() {
proto.RegisterType((*CalculateResponse)(nil), "CalculateResponse")
proto.RegisterType((*AdjustPricesRequest)(nil), "AdjustPricesRequest")
proto.RegisterType((*AdjustPricesResponse)(nil), "AdjustPricesResponse")
proto.RegisterType((*GenerateCSVRequest)(nil), "GenerateCSVRequest")
proto.RegisterType((*GenerateCSVResponse)(nil), "GenerateCSVResponse")
proto.RegisterType((*TestRequest)(nil), "TestRequest")
proto.RegisterType((*TestResponse)(nil), "TestResponse")
}
// Reference imports to suppress errors if they are not otherwise used.
@ -290,6 +441,10 @@ type PaymentsClient interface {
Calculate(ctx context.Context, in *CalculateRequest, opts ...grpc.CallOption) (*CalculateResponse, error)
// AdjustPrices sets the prices paid by a satellite for data at rest and bandwidth
AdjustPrices(ctx context.Context, in *AdjustPricesRequest, opts ...grpc.CallOption) (*AdjustPricesResponse, error)
// GenerateCSV creates a csv file for payment purposes
GenerateCSV(ctx context.Context, in *GenerateCSVRequest, opts ...grpc.CallOption) (*GenerateCSVResponse, error)
// TODO REMOVE
Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error)
}
type paymentsClient struct {
@ -327,6 +482,24 @@ func (c *paymentsClient) AdjustPrices(ctx context.Context, in *AdjustPricesReque
return out, nil
}
func (c *paymentsClient) GenerateCSV(ctx context.Context, in *GenerateCSVRequest, opts ...grpc.CallOption) (*GenerateCSVResponse, error) {
out := new(GenerateCSVResponse)
err := c.cc.Invoke(ctx, "/Payments/GenerateCSV", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *paymentsClient) Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error) {
out := new(TestResponse)
err := c.cc.Invoke(ctx, "/Payments/Test", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// PaymentsServer is the server API for Payments service.
type PaymentsServer interface {
// Pay creates a payment to a single storage node
@ -335,6 +508,10 @@ type PaymentsServer interface {
Calculate(context.Context, *CalculateRequest) (*CalculateResponse, error)
// AdjustPrices sets the prices paid by a satellite for data at rest and bandwidth
AdjustPrices(context.Context, *AdjustPricesRequest) (*AdjustPricesResponse, error)
// GenerateCSV creates a csv file for payment purposes
GenerateCSV(context.Context, *GenerateCSVRequest) (*GenerateCSVResponse, error)
// TODO REMOVE
Test(context.Context, *TestRequest) (*TestResponse, error)
}
func RegisterPaymentsServer(s *grpc.Server, srv PaymentsServer) {
@ -395,6 +572,42 @@ func _Payments_AdjustPrices_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler)
}
func _Payments_GenerateCSV_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GenerateCSVRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentsServer).GenerateCSV(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Payments/GenerateCSV",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentsServer).GenerateCSV(ctx, req.(*GenerateCSVRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Payments_Test_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TestRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentsServer).Test(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Payments/Test",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentsServer).Test(ctx, req.(*TestRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Payments_serviceDesc = grpc.ServiceDesc{
ServiceName: "Payments",
HandlerType: (*PaymentsServer)(nil),
@ -411,30 +624,47 @@ var _Payments_serviceDesc = grpc.ServiceDesc{
MethodName: "AdjustPrices",
Handler: _Payments_AdjustPrices_Handler,
},
{
MethodName: "GenerateCSV",
Handler: _Payments_GenerateCSV_Handler,
},
{
MethodName: "Test",
Handler: _Payments_Test_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "payments.proto",
}
func init() { proto.RegisterFile("payments.proto", fileDescriptor_payments_89f2ad202d6d67fc) }
func init() { proto.RegisterFile("payments.proto", fileDescriptor_payments_48b3ff941342a2b2) }
var fileDescriptor_payments_89f2ad202d6d67fc = []byte{
// 261 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x51, 0xc1, 0x4a, 0xc3, 0x40,
0x14, 0x24, 0x8d, 0xb6, 0xe6, 0x21, 0x6d, 0xf3, 0x8c, 0x1a, 0x82, 0x87, 0xb2, 0xa7, 0x88, 0xb0,
0x87, 0x7a, 0xf4, 0x64, 0x3d, 0x79, 0x10, 0x42, 0x8e, 0x5e, 0x64, 0xd3, 0x5d, 0x34, 0x12, 0xb3,
0x31, 0xef, 0x05, 0xe9, 0x07, 0xf9, 0x9f, 0x62, 0xd3, 0xd6, 0xb6, 0x46, 0x3c, 0xce, 0x30, 0x3b,
0x3b, 0x33, 0x0f, 0x86, 0x95, 0x5a, 0xbc, 0x99, 0x92, 0x49, 0x56, 0xb5, 0x65, 0x2b, 0x2e, 0x61,
0x98, 0xb4, 0x4c, 0x6a, 0xde, 0x1b, 0x43, 0x8c, 0xe7, 0x30, 0x28, 0xad, 0x36, 0x4f, 0xb9, 0x0e,
0x9d, 0x89, 0x13, 0x7b, 0x69, 0xff, 0x1b, 0xde, 0x6b, 0xe1, 0xc3, 0x68, 0x23, 0xa5, 0xca, 0x96,
0x64, 0xc4, 0x15, 0x8c, 0xef, 0x54, 0x31, 0x6f, 0x0a, 0xc5, 0xe6, 0xdf, 0xf7, 0x33, 0xf0, 0xb7,
0xc4, 0xad, 0xc3, 0x9f, 0x6a, 0x0c, 0xe0, 0x90, 0x2d, 0xab, 0x22, 0xec, 0x4d, 0x9c, 0xd8, 0x4d,
0x5b, 0x20, 0x1e, 0xe0, 0xe4, 0x56, 0xbf, 0x36, 0xc4, 0x49, 0x9d, 0xcf, 0x0d, 0xad, 0xff, 0xbc,
0x00, 0x2f, 0x53, 0xa5, 0xfe, 0xc8, 0x35, 0xbf, 0x2c, 0x7d, 0xdc, 0xf4, 0x87, 0xc0, 0x10, 0x06,
0xc4, 0xb6, 0x56, 0xcf, 0x66, 0x65, 0xb6, 0x86, 0xe2, 0x0c, 0x82, 0x5d, 0xbb, 0x36, 0xd5, 0xf4,
0xd3, 0x81, 0xa3, 0x55, 0x57, 0xc2, 0x18, 0xdc, 0x44, 0x2d, 0x70, 0x24, 0x77, 0x87, 0x8a, 0xc6,
0x72, 0x6f, 0x0e, 0x9c, 0x82, 0xb7, 0x69, 0x88, 0xbe, 0xdc, 0x9f, 0x26, 0x42, 0xf9, 0x7b, 0x80,
0x1b, 0x38, 0xde, 0x8e, 0x80, 0x81, 0xec, 0x28, 0x18, 0x9d, 0xca, 0xae, 0x9c, 0xb3, 0x83, 0xc7,
0x5e, 0x95, 0x65, 0xfd, 0xe5, 0x29, 0xaf, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x13, 0xda, 0x72,
0x07, 0xdc, 0x01, 0x00, 0x00,
var fileDescriptor_payments_48b3ff941342a2b2 = []byte{
// 405 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x5f, 0x8b, 0xd3, 0x40,
0x14, 0xc5, 0x49, 0xba, 0x6e, 0x9b, 0xdb, 0x6e, 0x77, 0x3b, 0x8d, 0x5a, 0x06, 0xc1, 0x65, 0x7c,
0xa9, 0x08, 0xb3, 0x58, 0x11, 0x14, 0x9f, 0xdc, 0x3e, 0x88, 0x0f, 0x42, 0x89, 0xc5, 0x07, 0x5f,
0xca, 0xa4, 0x73, 0x5b, 0x23, 0x69, 0x26, 0x66, 0x26, 0x48, 0xdf, 0xc5, 0xcf, 0x2d, 0xc9, 0x24,
0x35, 0xfd, 0xb3, 0xf4, 0xf1, 0x84, 0x73, 0xee, 0xcd, 0xfd, 0x9d, 0x81, 0x7e, 0x2a, 0xb6, 0x1b,
0x4c, 0x8c, 0xe6, 0x69, 0xa6, 0x8c, 0xa2, 0xcf, 0xd7, 0x4a, 0xad, 0x63, 0xbc, 0x2b, 0x55, 0x98,
0xaf, 0xee, 0x4c, 0xb4, 0x41, 0x6d, 0xc4, 0x26, 0xb5, 0x06, 0xf6, 0x12, 0xfa, 0x33, 0x1b, 0x09,
0xf0, 0x57, 0x8e, 0xda, 0x90, 0xa7, 0xd0, 0x4e, 0x94, 0xc4, 0x45, 0x24, 0x47, 0xce, 0xad, 0x33,
0xf6, 0x82, 0xcb, 0x42, 0x7e, 0x96, 0x6c, 0x00, 0xd7, 0x3b, 0xab, 0x4e, 0x55, 0xa2, 0x91, 0xbd,
0x82, 0x9b, 0xa9, 0x88, 0x97, 0x79, 0x2c, 0x0c, 0x9e, 0xcd, 0xdf, 0xc3, 0xa0, 0x61, 0xb6, 0x13,
0x1e, 0x74, 0x13, 0x1f, 0x1e, 0x19, 0x65, 0x44, 0x3c, 0x72, 0x6f, 0x9d, 0x71, 0x2b, 0xb0, 0x82,
0x7d, 0x81, 0xe1, 0x47, 0xf9, 0x33, 0xd7, 0x66, 0x96, 0x45, 0x4b, 0xd4, 0xf5, 0xce, 0x67, 0xe0,
0x85, 0x22, 0x91, 0xbf, 0x23, 0x69, 0x7e, 0x94, 0x73, 0x5a, 0xc1, 0xff, 0x0f, 0x64, 0x04, 0x6d,
0x6d, 0x54, 0x26, 0xd6, 0x58, 0x0d, 0xab, 0x25, 0x7b, 0x02, 0xfe, 0xfe, 0xb8, 0xea, 0xae, 0xbf,
0x0e, 0x90, 0x4f, 0x98, 0x60, 0x26, 0x0c, 0x4e, 0xbf, 0x7e, 0xab, 0xd7, 0xbc, 0x07, 0xd0, 0x46,
0x64, 0x66, 0x51, 0x50, 0x2c, 0xf7, 0x74, 0x27, 0x94, 0x5b, 0xc4, 0xbc, 0x46, 0xcc, 0xe7, 0x35,
0xe2, 0xc0, 0x2b, 0xdd, 0x85, 0x26, 0x6f, 0xa1, 0x83, 0x89, 0xb4, 0x41, 0xf7, 0x6c, 0xb0, 0x8d,
0x89, 0x2c, 0x14, 0x7b, 0x0d, 0xc3, 0xbd, 0xff, 0xa8, 0xa8, 0x51, 0xe8, 0xac, 0xa2, 0x18, 0x53,
0x51, 0x9d, 0xeb, 0x05, 0x3b, 0xcd, 0xae, 0xa0, 0x3b, 0x47, 0x5d, 0xd7, 0xc9, 0xfa, 0xd0, 0xb3,
0xd2, 0x46, 0x27, 0x7f, 0x5c, 0xe8, 0x54, 0x35, 0x6a, 0x32, 0x86, 0xd6, 0x4c, 0x6c, 0xc9, 0x35,
0xdf, 0x7f, 0x03, 0xf4, 0x86, 0x1f, 0x34, 0x4d, 0x26, 0xe0, 0xed, 0xca, 0x23, 0x03, 0x7e, 0xd8,
0x3a, 0x25, 0xfc, 0xb8, 0xdb, 0x0f, 0xd0, 0x6b, 0xd2, 0x25, 0x3e, 0x3f, 0xd1, 0x1d, 0x7d, 0xcc,
0x4f, 0x55, 0x40, 0xde, 0x41, 0xb7, 0x71, 0x39, 0x19, 0xf2, 0xe3, 0x3e, 0xa8, 0xcf, 0x4f, 0xc1,
0x79, 0x01, 0x17, 0xc5, 0xc5, 0xa4, 0xc7, 0x1b, 0x1c, 0xe8, 0x15, 0x6f, 0x62, 0xb8, 0xbf, 0xf8,
0xee, 0xa6, 0x61, 0x78, 0x59, 0xb2, 0x7f, 0xf3, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x9b, 0x83, 0xdd,
0x1e, 0x37, 0x03, 0x00, 0x00,
}

View File

@ -3,6 +3,7 @@
syntax = "proto3";
option go_package = "pb";
import "google/protobuf/timestamp.proto";
// The service definition for the Payments API
service Payments {
@ -12,6 +13,10 @@ service Payments {
rpc Calculate(CalculateRequest) returns (CalculateResponse);
// AdjustPrices sets the prices paid by a satellite for data at rest and bandwidth
rpc AdjustPrices(AdjustPricesRequest) returns (AdjustPricesResponse);
// GenerateCSV creates a csv file for payment purposes
rpc GenerateCSV(GenerateCSVRequest) returns (GenerateCSVResponse);
//TODO REMOVE
rpc Test(TestRequest) returns (TestResponse);
}
// The request message containing the details needed to pay a storage node.
@ -19,7 +24,6 @@ message PaymentRequest {
// ID of the storage node to be paid
string node_id = 1;
}
// The response message for payments.
message PaymentResponse {}
@ -46,4 +50,19 @@ message AdjustPricesRequest {
}
// The response message from adjusting cost basis on satelittes.
message AdjustPricesResponse {}
message AdjustPricesResponse {}
// The request message for querying the data needed to generate a payments CSV
message GenerateCSVRequest {
google.protobuf.Timestamp start_time = 1;
google.protobuf.Timestamp end_time = 2;
}
// The response message for querying the data needed to generate a payments CSV
message GenerateCSVResponse {
string filepath = 1;
}
message TestRequest {}
message TestResponse {}

View File

@ -42,7 +42,7 @@ func (x RedundancyScheme_SchemeType) String() string {
return proto.EnumName(RedundancyScheme_SchemeType_name, int32(x))
}
func (RedundancyScheme_SchemeType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{0, 0}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{0, 0}
}
type Pointer_DataType int32
@ -65,7 +65,7 @@ func (x Pointer_DataType) String() string {
return proto.EnumName(Pointer_DataType_name, int32(x))
}
func (Pointer_DataType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{3, 0}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{3, 0}
}
type RedundancyScheme struct {
@ -85,7 +85,7 @@ func (m *RedundancyScheme) Reset() { *m = RedundancyScheme{} }
func (m *RedundancyScheme) String() string { return proto.CompactTextString(m) }
func (*RedundancyScheme) ProtoMessage() {}
func (*RedundancyScheme) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{0}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{0}
}
func (m *RedundancyScheme) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RedundancyScheme.Unmarshal(m, b)
@ -159,7 +159,7 @@ func (m *RemotePiece) Reset() { *m = RemotePiece{} }
func (m *RemotePiece) String() string { return proto.CompactTextString(m) }
func (*RemotePiece) ProtoMessage() {}
func (*RemotePiece) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{1}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{1}
}
func (m *RemotePiece) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RemotePiece.Unmarshal(m, b)
@ -201,7 +201,7 @@ func (m *RemoteSegment) Reset() { *m = RemoteSegment{} }
func (m *RemoteSegment) String() string { return proto.CompactTextString(m) }
func (*RemoteSegment) ProtoMessage() {}
func (*RemoteSegment) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{2}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{2}
}
func (m *RemoteSegment) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RemoteSegment.Unmarshal(m, b)
@ -266,7 +266,7 @@ func (m *Pointer) Reset() { *m = Pointer{} }
func (m *Pointer) String() string { return proto.CompactTextString(m) }
func (*Pointer) ProtoMessage() {}
func (*Pointer) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{3}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{3}
}
func (m *Pointer) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Pointer.Unmarshal(m, b)
@ -348,7 +348,7 @@ func (m *PutRequest) Reset() { *m = PutRequest{} }
func (m *PutRequest) String() string { return proto.CompactTextString(m) }
func (*PutRequest) ProtoMessage() {}
func (*PutRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{4}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{4}
}
func (m *PutRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PutRequest.Unmarshal(m, b)
@ -394,7 +394,7 @@ func (m *GetRequest) Reset() { *m = GetRequest{} }
func (m *GetRequest) String() string { return proto.CompactTextString(m) }
func (*GetRequest) ProtoMessage() {}
func (*GetRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{5}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{5}
}
func (m *GetRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetRequest.Unmarshal(m, b)
@ -438,7 +438,7 @@ func (m *ListRequest) Reset() { *m = ListRequest{} }
func (m *ListRequest) String() string { return proto.CompactTextString(m) }
func (*ListRequest) ProtoMessage() {}
func (*ListRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{6}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{6}
}
func (m *ListRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRequest.Unmarshal(m, b)
@ -511,7 +511,7 @@ func (m *PutResponse) Reset() { *m = PutResponse{} }
func (m *PutResponse) String() string { return proto.CompactTextString(m) }
func (*PutResponse) ProtoMessage() {}
func (*PutResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{7}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{7}
}
func (m *PutResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PutResponse.Unmarshal(m, b)
@ -546,7 +546,7 @@ func (m *GetResponse) Reset() { *m = GetResponse{} }
func (m *GetResponse) String() string { return proto.CompactTextString(m) }
func (*GetResponse) ProtoMessage() {}
func (*GetResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{8}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{8}
}
func (m *GetResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetResponse.Unmarshal(m, b)
@ -607,7 +607,7 @@ func (m *ListResponse) Reset() { *m = ListResponse{} }
func (m *ListResponse) String() string { return proto.CompactTextString(m) }
func (*ListResponse) ProtoMessage() {}
func (*ListResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{9}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{9}
}
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListResponse.Unmarshal(m, b)
@ -654,7 +654,7 @@ func (m *ListResponse_Item) Reset() { *m = ListResponse_Item{} }
func (m *ListResponse_Item) String() string { return proto.CompactTextString(m) }
func (*ListResponse_Item) ProtoMessage() {}
func (*ListResponse_Item) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{9, 0}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{9, 0}
}
func (m *ListResponse_Item) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListResponse_Item.Unmarshal(m, b)
@ -706,7 +706,7 @@ func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
func (m *DeleteRequest) String() string { return proto.CompactTextString(m) }
func (*DeleteRequest) ProtoMessage() {}
func (*DeleteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{10}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{10}
}
func (m *DeleteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteRequest.Unmarshal(m, b)
@ -744,7 +744,7 @@ func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
func (*DeleteResponse) ProtoMessage() {}
func (*DeleteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{11}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{11}
}
func (m *DeleteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteResponse.Unmarshal(m, b)
@ -779,7 +779,7 @@ func (m *IterateRequest) Reset() { *m = IterateRequest{} }
func (m *IterateRequest) String() string { return proto.CompactTextString(m) }
func (*IterateRequest) ProtoMessage() {}
func (*IterateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{12}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{12}
}
func (m *IterateRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_IterateRequest.Unmarshal(m, b)
@ -838,7 +838,7 @@ func (m *PayerBandwidthAllocationRequest) Reset() { *m = PayerBandwidthA
func (m *PayerBandwidthAllocationRequest) String() string { return proto.CompactTextString(m) }
func (*PayerBandwidthAllocationRequest) ProtoMessage() {}
func (*PayerBandwidthAllocationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{13}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{13}
}
func (m *PayerBandwidthAllocationRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PayerBandwidthAllocationRequest.Unmarshal(m, b)
@ -876,7 +876,7 @@ func (m *PayerBandwidthAllocationResponse) Reset() { *m = PayerBandwidth
func (m *PayerBandwidthAllocationResponse) String() string { return proto.CompactTextString(m) }
func (*PayerBandwidthAllocationResponse) ProtoMessage() {}
func (*PayerBandwidthAllocationResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_pointerdb_37763013b07c9a27, []int{14}
return fileDescriptor_pointerdb_3f3e047a48f87feb, []int{14}
}
func (m *PayerBandwidthAllocationResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PayerBandwidthAllocationResponse.Unmarshal(m, b)
@ -1138,9 +1138,9 @@ var _PointerDB_serviceDesc = grpc.ServiceDesc{
Metadata: "pointerdb.proto",
}
func init() { proto.RegisterFile("pointerdb.proto", fileDescriptor_pointerdb_37763013b07c9a27) }
func init() { proto.RegisterFile("pointerdb.proto", fileDescriptor_pointerdb_3f3e047a48f87feb) }
var fileDescriptor_pointerdb_37763013b07c9a27 = []byte{
var fileDescriptor_pointerdb_3f3e047a48f87feb = []byte{
// 1092 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x5d, 0x6f, 0x1b, 0x45,
0x17, 0xae, 0xbf, 0xe3, 0xb3, 0x76, 0xea, 0x77, 0xd4, 0x37, 0xdd, 0xba, 0x45, 0x09, 0x8b, 0x80,

View File

@ -30,7 +30,7 @@ func (m *SegmentMeta) Reset() { *m = SegmentMeta{} }
func (m *SegmentMeta) String() string { return proto.CompactTextString(m) }
func (*SegmentMeta) ProtoMessage() {}
func (*SegmentMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_streams_c0d9754174b032dc, []int{0}
return fileDescriptor_streams_2b972859339b7bc3, []int{0}
}
func (m *SegmentMeta) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SegmentMeta.Unmarshal(m, b)
@ -78,7 +78,7 @@ func (m *StreamInfo) Reset() { *m = StreamInfo{} }
func (m *StreamInfo) String() string { return proto.CompactTextString(m) }
func (*StreamInfo) ProtoMessage() {}
func (*StreamInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_streams_c0d9754174b032dc, []int{1}
return fileDescriptor_streams_2b972859339b7bc3, []int{1}
}
func (m *StreamInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StreamInfo.Unmarshal(m, b)
@ -140,7 +140,7 @@ func (m *StreamMeta) Reset() { *m = StreamMeta{} }
func (m *StreamMeta) String() string { return proto.CompactTextString(m) }
func (*StreamMeta) ProtoMessage() {}
func (*StreamMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_streams_c0d9754174b032dc, []int{2}
return fileDescriptor_streams_2b972859339b7bc3, []int{2}
}
func (m *StreamMeta) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StreamMeta.Unmarshal(m, b)
@ -194,9 +194,9 @@ func init() {
proto.RegisterType((*StreamMeta)(nil), "streams.StreamMeta")
}
func init() { proto.RegisterFile("streams.proto", fileDescriptor_streams_c0d9754174b032dc) }
func init() { proto.RegisterFile("streams.proto", fileDescriptor_streams_2b972859339b7bc3) }
var fileDescriptor_streams_c0d9754174b032dc = []byte{
var fileDescriptor_streams_2b972859339b7bc3 = []byte{
// 304 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x51, 0xcb, 0x4e, 0xc3, 0x30,
0x10, 0x54, 0x5f, 0x50, 0xb6, 0x29, 0x05, 0x03, 0x52, 0x04, 0x17, 0x14, 0x0e, 0x20, 0x84, 0x7a,

View File

@ -175,3 +175,61 @@ func (db *accountingDB) SaveRollup(ctx context.Context, latestRollup time.Time,
_, err = tx.Update_AccountingTimestamps_By_Name(ctx, dbx.AccountingTimestamps_Name(accounting.LastRollup), update)
return Error.Wrap(err)
}
// QueryPaymentInfo queries StatDB, Accounting Rollup on nodeID
func (db *accountingDB) QueryPaymentInfo(ctx context.Context, start time.Time, end time.Time) ([]*accounting.CSVRow, error) {
s := dbx.AccountingRollup_StartTime(start)
e := dbx.AccountingRollup_StartTime(end)
data, err := db.db.All_Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_By_AccountingRollup_StartTime_GreaterOrEqual_And_AccountingRollup_StartTime_Less_OrderBy_Asc_Node_Id(ctx, s, e)
if err != nil {
return nil, Error.Wrap(err)
}
var rows []*accounting.CSVRow
for _, record := range data {
nodeID, err := storj.NodeIDFromBytes(record.Node_Id)
if err != nil {
return rows, err
}
row := &accounting.CSVRow{
NodeID: nodeID,
NodeCreationDate: record.Node_CreatedAt,
AuditSuccessRatio: record.Node_AuditSuccessRatio,
AtRestTotal: record.AccountingRollup_AtRestTotal,
GetRepairTotal: record.AccountingRollup_GetRepairTotal,
PutRepairTotal: record.AccountingRollup_PutRepairTotal,
GetAuditTotal: record.AccountingRollup_GetAuditTotal,
PutTotal: record.AccountingRollup_PutTotal,
GetTotal: record.AccountingRollup_GetTotal,
Date: record.AccountingRollup_StartTime,
}
rows = append(rows, row)
}
return rows, nil
}
func (db *accountingDB) TestPayments(ctx context.Context) error {
rows, err := db.db.All_Node_Id(ctx)
if err != nil {
return Error.Wrap(err)
}
ids := [][]byte{}
for _, r := range rows {
ids = append(ids, r.Id)
}
for i, id := range ids {
nID := dbx.AccountingRollup_NodeId(id)
st := dbx.AccountingRollup_StartTime(time.Date(2018, time.Month(i+1), i+1, 0, 0, 0, 0, time.UTC))
pt := dbx.AccountingRollup_PutTotal(int64(i))
gt := dbx.AccountingRollup_GetTotal(int64(i))
gat := dbx.AccountingRollup_GetAuditTotal(int64(i))
grt := dbx.AccountingRollup_GetRepairTotal(int64(i))
prt := dbx.AccountingRollup_PutRepairTotal(int64(i))
art := dbx.AccountingRollup_AtRestTotal(float64(i))
_, err = db.db.Create_AccountingRollup(ctx, nID, st, pt, gt, gat, grt, prt, art)
if err != nil {
return Error.Wrap(err)
}
}
return nil
}

View File

@ -156,6 +156,19 @@ read one (
where node.id = ?
)
read all (
select node.id
)
// payment csv generation query
read all (
select node.id node.created_at node.audit_success_ratio accounting_rollup.start_time accounting_rollup.put_total accounting_rollup.get_total accounting_rollup.get_audit_total accounting_rollup.get_repair_total accounting_rollup.put_repair_total accounting_rollup.at_rest_total
where accounting_rollup.start_time >= ?
where accounting_rollup.start_time < ?
join node.id = accounting_rollup.node_id
orderby asc node.id
)
//--- overlaycache ---//
model overlay_cache_node (
@ -192,6 +205,11 @@ read one (
where overlay_cache_node.node_id = ?
)
read one (
select overlay_cache_node.operator_wallet
where overlay_cache_node.node_id = ?
)
read limitoffset (
select overlay_cache_node
where overlay_cache_node.node_id >= ?

View File

@ -2439,6 +2439,27 @@ func (h *__sqlbundle_Hole) Render() string { return h.SQL.Render() }
// end runtime support for building sql statements
//
type Id_Row struct {
Id []byte
}
type Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_Row struct {
Node_Id []byte
Node_CreatedAt time.Time
Node_AuditSuccessRatio float64
AccountingRollup_StartTime time.Time
AccountingRollup_PutTotal int64
AccountingRollup_GetTotal int64
AccountingRollup_GetAuditTotal int64
AccountingRollup_GetRepairTotal int64
AccountingRollup_PutRepairTotal int64
AccountingRollup_AtRestTotal float64
}
type OperatorWallet_Row struct {
OperatorWallet string
}
type Value_Row struct {
Value time.Time
}
@ -3142,6 +3163,72 @@ func (obj *postgresImpl) Get_Node_By_Id(ctx context.Context,
}
func (obj *postgresImpl) All_Node_Id(ctx context.Context) (
rows []*Id_Row, err error) {
var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id FROM nodes")
var __values []interface{}
__values = append(__values)
var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt)
obj.logStmt(__stmt, __values...)
__rows, err := obj.driver.Query(__stmt, __values...)
if err != nil {
return nil, obj.makeErr(err)
}
defer __rows.Close()
for __rows.Next() {
row := &Id_Row{}
err = __rows.Scan(&row.Id)
if err != nil {
return nil, obj.makeErr(err)
}
rows = append(rows, row)
}
if err := __rows.Err(); err != nil {
return nil, obj.makeErr(err)
}
return rows, nil
}
func (obj *postgresImpl) All_Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_By_AccountingRollup_StartTime_GreaterOrEqual_And_AccountingRollup_StartTime_Less_OrderBy_Asc_Node_Id(ctx context.Context,
accounting_rollup_start_time_greater_or_equal AccountingRollup_StartTime_Field,
accounting_rollup_start_time_less AccountingRollup_StartTime_Field) (
rows []*Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_Row, err error) {
var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id, nodes.created_at, nodes.audit_success_ratio, accounting_rollups.start_time, accounting_rollups.put_total, accounting_rollups.get_total, accounting_rollups.get_audit_total, accounting_rollups.get_repair_total, accounting_rollups.put_repair_total, accounting_rollups.at_rest_total FROM nodes JOIN accounting_rollups ON nodes.id = accounting_rollups.node_id WHERE accounting_rollups.start_time >= ? AND accounting_rollups.start_time < ? ORDER BY nodes.id")
var __values []interface{}
__values = append(__values, accounting_rollup_start_time_greater_or_equal.value(), accounting_rollup_start_time_less.value())
var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt)
obj.logStmt(__stmt, __values...)
__rows, err := obj.driver.Query(__stmt, __values...)
if err != nil {
return nil, obj.makeErr(err)
}
defer __rows.Close()
for __rows.Next() {
row := &Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_Row{}
err = __rows.Scan(&row.Node_Id, &row.Node_CreatedAt, &row.Node_AuditSuccessRatio, &row.AccountingRollup_StartTime, &row.AccountingRollup_PutTotal, &row.AccountingRollup_GetTotal, &row.AccountingRollup_GetAuditTotal, &row.AccountingRollup_GetRepairTotal, &row.AccountingRollup_PutRepairTotal, &row.AccountingRollup_AtRestTotal)
if err != nil {
return nil, obj.makeErr(err)
}
rows = append(rows, row)
}
if err := __rows.Err(); err != nil {
return nil, obj.makeErr(err)
}
return rows, nil
}
func (obj *postgresImpl) Get_OverlayCacheNode_By_NodeId(ctx context.Context,
overlay_cache_node_node_id OverlayCacheNode_NodeId_Field) (
overlay_cache_node *OverlayCacheNode, err error) {
@ -3163,6 +3250,27 @@ func (obj *postgresImpl) Get_OverlayCacheNode_By_NodeId(ctx context.Context,
}
func (obj *postgresImpl) Get_OverlayCacheNode_OperatorWallet_By_NodeId(ctx context.Context,
overlay_cache_node_node_id OverlayCacheNode_NodeId_Field) (
row *OperatorWallet_Row, err error) {
var __embed_stmt = __sqlbundle_Literal("SELECT overlay_cache_nodes.operator_wallet FROM overlay_cache_nodes WHERE overlay_cache_nodes.node_id = ?")
var __values []interface{}
__values = append(__values, overlay_cache_node_node_id.value())
var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt)
obj.logStmt(__stmt, __values...)
row = &OperatorWallet_Row{}
err = obj.driver.QueryRow(__stmt, __values...).Scan(&row.OperatorWallet)
if err != nil {
return nil, obj.makeErr(err)
}
return row, nil
}
func (obj *postgresImpl) Limited_OverlayCacheNode_By_NodeId_GreaterOrEqual(ctx context.Context,
overlay_cache_node_node_id_greater_or_equal OverlayCacheNode_NodeId_Field,
limit int, offset int64) (
@ -5220,6 +5328,72 @@ func (obj *sqlite3Impl) Get_Node_By_Id(ctx context.Context,
}
func (obj *sqlite3Impl) All_Node_Id(ctx context.Context) (
rows []*Id_Row, err error) {
var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id FROM nodes")
var __values []interface{}
__values = append(__values)
var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt)
obj.logStmt(__stmt, __values...)
__rows, err := obj.driver.Query(__stmt, __values...)
if err != nil {
return nil, obj.makeErr(err)
}
defer __rows.Close()
for __rows.Next() {
row := &Id_Row{}
err = __rows.Scan(&row.Id)
if err != nil {
return nil, obj.makeErr(err)
}
rows = append(rows, row)
}
if err := __rows.Err(); err != nil {
return nil, obj.makeErr(err)
}
return rows, nil
}
func (obj *sqlite3Impl) All_Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_By_AccountingRollup_StartTime_GreaterOrEqual_And_AccountingRollup_StartTime_Less_OrderBy_Asc_Node_Id(ctx context.Context,
accounting_rollup_start_time_greater_or_equal AccountingRollup_StartTime_Field,
accounting_rollup_start_time_less AccountingRollup_StartTime_Field) (
rows []*Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_Row, err error) {
var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id, nodes.created_at, nodes.audit_success_ratio, accounting_rollups.start_time, accounting_rollups.put_total, accounting_rollups.get_total, accounting_rollups.get_audit_total, accounting_rollups.get_repair_total, accounting_rollups.put_repair_total, accounting_rollups.at_rest_total FROM nodes JOIN accounting_rollups ON nodes.id = accounting_rollups.node_id WHERE accounting_rollups.start_time >= ? AND accounting_rollups.start_time < ? ORDER BY nodes.id")
var __values []interface{}
__values = append(__values, accounting_rollup_start_time_greater_or_equal.value(), accounting_rollup_start_time_less.value())
var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt)
obj.logStmt(__stmt, __values...)
__rows, err := obj.driver.Query(__stmt, __values...)
if err != nil {
return nil, obj.makeErr(err)
}
defer __rows.Close()
for __rows.Next() {
row := &Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_Row{}
err = __rows.Scan(&row.Node_Id, &row.Node_CreatedAt, &row.Node_AuditSuccessRatio, &row.AccountingRollup_StartTime, &row.AccountingRollup_PutTotal, &row.AccountingRollup_GetTotal, &row.AccountingRollup_GetAuditTotal, &row.AccountingRollup_GetRepairTotal, &row.AccountingRollup_PutRepairTotal, &row.AccountingRollup_AtRestTotal)
if err != nil {
return nil, obj.makeErr(err)
}
rows = append(rows, row)
}
if err := __rows.Err(); err != nil {
return nil, obj.makeErr(err)
}
return rows, nil
}
func (obj *sqlite3Impl) Get_OverlayCacheNode_By_NodeId(ctx context.Context,
overlay_cache_node_node_id OverlayCacheNode_NodeId_Field) (
overlay_cache_node *OverlayCacheNode, err error) {
@ -5241,6 +5415,27 @@ func (obj *sqlite3Impl) Get_OverlayCacheNode_By_NodeId(ctx context.Context,
}
func (obj *sqlite3Impl) Get_OverlayCacheNode_OperatorWallet_By_NodeId(ctx context.Context,
overlay_cache_node_node_id OverlayCacheNode_NodeId_Field) (
row *OperatorWallet_Row, err error) {
var __embed_stmt = __sqlbundle_Literal("SELECT overlay_cache_nodes.operator_wallet FROM overlay_cache_nodes WHERE overlay_cache_nodes.node_id = ?")
var __values []interface{}
__values = append(__values, overlay_cache_node_node_id.value())
var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt)
obj.logStmt(__stmt, __values...)
row = &OperatorWallet_Row{}
err = obj.driver.QueryRow(__stmt, __values...).Scan(&row.OperatorWallet)
if err != nil {
return nil, obj.makeErr(err)
}
return row, nil
}
func (obj *sqlite3Impl) Limited_OverlayCacheNode_By_NodeId_GreaterOrEqual(ctx context.Context,
overlay_cache_node_node_id_greater_or_equal OverlayCacheNode_NodeId_Field,
limit int, offset int64) (
@ -6979,6 +7174,26 @@ func (rx *Rx) All_Bwagreement_By_CreatedAt_Greater(ctx context.Context,
return tx.All_Bwagreement_By_CreatedAt_Greater(ctx, bwagreement_created_at_greater)
}
func (rx *Rx) All_Node_Id(ctx context.Context) (
rows []*Id_Row, err error) {
var tx *Tx
if tx, err = rx.getTx(ctx); err != nil {
return
}
return tx.All_Node_Id(ctx)
}
func (rx *Rx) All_Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_By_AccountingRollup_StartTime_GreaterOrEqual_And_AccountingRollup_StartTime_Less_OrderBy_Asc_Node_Id(ctx context.Context,
accounting_rollup_start_time_greater_or_equal AccountingRollup_StartTime_Field,
accounting_rollup_start_time_less AccountingRollup_StartTime_Field) (
rows []*Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_Row, err error) {
var tx *Tx
if tx, err = rx.getTx(ctx); err != nil {
return
}
return tx.All_Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_By_AccountingRollup_StartTime_GreaterOrEqual_And_AccountingRollup_StartTime_Less_OrderBy_Asc_Node_Id(ctx, accounting_rollup_start_time_greater_or_equal, accounting_rollup_start_time_less)
}
func (rx *Rx) All_Project(ctx context.Context) (
rows []*Project, err error) {
var tx *Tx
@ -7442,6 +7657,16 @@ func (rx *Rx) Get_OverlayCacheNode_By_NodeId(ctx context.Context,
return tx.Get_OverlayCacheNode_By_NodeId(ctx, overlay_cache_node_node_id)
}
func (rx *Rx) Get_OverlayCacheNode_OperatorWallet_By_NodeId(ctx context.Context,
overlay_cache_node_node_id OverlayCacheNode_NodeId_Field) (
row *OperatorWallet_Row, err error) {
var tx *Tx
if tx, err = rx.getTx(ctx); err != nil {
return
}
return tx.Get_OverlayCacheNode_OperatorWallet_By_NodeId(ctx, overlay_cache_node_node_id)
}
func (rx *Rx) Get_Project_By_Id(ctx context.Context,
project_id Project_Id_Field) (
project *Project, err error) {
@ -7618,6 +7843,14 @@ type Methods interface {
bwagreement_created_at_greater Bwagreement_CreatedAt_Field) (
rows []*Bwagreement, err error)
All_Node_Id(ctx context.Context) (
rows []*Id_Row, err error)
All_Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_By_AccountingRollup_StartTime_GreaterOrEqual_And_AccountingRollup_StartTime_Less_OrderBy_Asc_Node_Id(ctx context.Context,
accounting_rollup_start_time_greater_or_equal AccountingRollup_StartTime_Field,
accounting_rollup_start_time_less AccountingRollup_StartTime_Field) (
rows []*Node_Id_Node_CreatedAt_Node_AuditSuccessRatio_AccountingRollup_StartTime_AccountingRollup_PutTotal_AccountingRollup_GetTotal_AccountingRollup_GetAuditTotal_AccountingRollup_GetRepairTotal_AccountingRollup_PutRepairTotal_AccountingRollup_AtRestTotal_Row, err error)
All_Project(ctx context.Context) (
rows []*Project, err error)
@ -7827,6 +8060,10 @@ type Methods interface {
overlay_cache_node_node_id OverlayCacheNode_NodeId_Field) (
overlay_cache_node *OverlayCacheNode, err error)
Get_OverlayCacheNode_OperatorWallet_By_NodeId(ctx context.Context,
overlay_cache_node_node_id OverlayCacheNode_NodeId_Field) (
row *OperatorWallet_Row, err error)
Get_Project_By_Id(ctx context.Context,
project_id Project_Id_Field) (
project *Project, err error)

View File

@ -346,6 +346,20 @@ func (m *lockedProjects) Update(ctx context.Context, project *console.Project) e
return m.db.Update(ctx, project)
}
// QueryPaymentInfo queries StatDB, Accounting Rollup on nodeID
func (m *lockedAccounting) QueryPaymentInfo(ctx context.Context, start time.Time, end time.Time) ([]*accounting.CSVRow, error) {
m.Lock()
defer m.Unlock()
return m.db.QueryPaymentInfo(ctx, start, end)
}
// TestPayments ... TODO REMOVE
func (m *lockedAccounting) TestPayments(ctx context.Context) error {
m.Lock()
defer m.Unlock()
return m.db.TestPayments(ctx)
}
// Users is a getter for Users repository
func (m *lockedConsole) Users() console.Users {
m.Lock()
@ -483,6 +497,13 @@ func (m *lockedOverlayCache) Update(ctx context.Context, value *pb.Node) error {
return m.db.Update(ctx, value)
}
//GetWalletAddress gets the node's wallet address
func (m *lockedOverlayCache) GetWalletAddress(ctx context.Context, id storj.NodeID) (string, error) {
m.Lock()
defer m.Unlock()
return m.db.GetWalletAddress(ctx, id)
}
// RepairQueue returns queue for segments that need repairing
func (m *locked) RepairQueue() queue.RepairQueue {
m.Lock()

View File

@ -243,3 +243,12 @@ func convertOverlayNode(info *dbx.OverlayCacheNode) (*pb.Node, error) {
return node, nil
}
//GetWalletAddress gets the node's wallet address
func (cache *overlaycache) GetWalletAddress(ctx context.Context, id storj.NodeID) (string, error) {
w, err := cache.db.Get_OverlayCacheNode_OperatorWallet_By_NodeId(ctx, dbx.OverlayCacheNode_NodeId(id.Bytes()))
if err != nil {
return "", err
}
return w.OperatorWallet, nil
}