make bandwidth agreements sensible: without []byte's (#1152)
removed []byte's from bandwidth agreement protocol buffers
This commit is contained in:
parent
df903ea215
commit
60946c2024
@ -11,7 +11,6 @@ import (
|
||||
"sort"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
@ -195,17 +194,8 @@ func cmdDiag(cmd *cobra.Command, args []string) (err error) {
|
||||
|
||||
for _, baRow := range baRows {
|
||||
// deserializing rbad you get payerbwallocation, total & storage node id
|
||||
rbad := &pb.RenterBandwidthAllocation_Data{}
|
||||
if err := proto.Unmarshal(baRow.Agreement, rbad); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// deserializing pbad you get satelliteID, uplinkID, max size, exp, serial# & action
|
||||
pbad := &pb.PayerBandwidthAllocation_Data{}
|
||||
if err := proto.Unmarshal(rbad.GetPayerAllocation().GetData(), pbad); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rbad := baRow.Agreement
|
||||
pbad := rbad.PayerAllocation
|
||||
uplinkID := pbad.UplinkId
|
||||
summary, ok := summaries[uplinkID]
|
||||
if !ok {
|
||||
@ -215,12 +205,12 @@ func cmdDiag(cmd *cobra.Command, args []string) (err error) {
|
||||
}
|
||||
|
||||
// fill the summary info
|
||||
summary.TotalBytes += rbad.GetTotal()
|
||||
summary.TotalBytes += rbad.Total
|
||||
summary.TotalTransactions++
|
||||
switch pbad.GetAction() {
|
||||
case pb.PayerBandwidthAllocation_PUT:
|
||||
case pb.BandwidthAction_PUT:
|
||||
summary.PutActionCount++
|
||||
case pb.PayerBandwidthAllocation_GET:
|
||||
case pb.BandwidthAction_GET:
|
||||
summary.GetActionCount++
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ import (
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/zeebo/errs"
|
||||
@ -281,38 +280,29 @@ func cmdDiag(cmd *cobra.Command, args []string) (err error) {
|
||||
|
||||
for _, rbaVal := range bwAgreements {
|
||||
for _, rbaDataVal := range rbaVal {
|
||||
// deserializing rbad you get payerbwallocation, total & storage node id
|
||||
rbad := &pb.RenterBandwidthAllocation_Data{}
|
||||
if err := proto.Unmarshal(rbaDataVal.Agreement, rbad); err != nil {
|
||||
return err
|
||||
}
|
||||
rba := rbaDataVal.Agreement
|
||||
pba := rba.PayerAllocation
|
||||
|
||||
// deserializing pbad you get satelliteID, uplinkID, max size, exp, serial# & action
|
||||
pbad := &pb.PayerBandwidthAllocation_Data{}
|
||||
if err := proto.Unmarshal(rbad.GetPayerAllocation().GetData(), pbad); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
summary, ok := summaries[pbad.SatelliteId]
|
||||
summary, ok := summaries[pba.SatelliteId]
|
||||
if !ok {
|
||||
summaries[pbad.SatelliteId] = &SatelliteSummary{}
|
||||
satelliteIDs = append(satelliteIDs, pbad.SatelliteId)
|
||||
summary = summaries[pbad.SatelliteId]
|
||||
summaries[pba.SatelliteId] = &SatelliteSummary{}
|
||||
satelliteIDs = append(satelliteIDs, pba.SatelliteId)
|
||||
summary = summaries[pba.SatelliteId]
|
||||
}
|
||||
|
||||
// fill the summary info
|
||||
summary.TotalBytes += rbad.GetTotal()
|
||||
summary.TotalBytes += rba.Total
|
||||
summary.TotalTransactions++
|
||||
switch pbad.GetAction() {
|
||||
case pb.PayerBandwidthAllocation_PUT:
|
||||
switch pba.Action {
|
||||
case pb.BandwidthAction_PUT:
|
||||
summary.PutActionCount++
|
||||
case pb.PayerBandwidthAllocation_GET:
|
||||
case pb.BandwidthAction_GET:
|
||||
summary.GetActionCount++
|
||||
case pb.PayerBandwidthAllocation_GET_AUDIT:
|
||||
case pb.BandwidthAction_GET_AUDIT:
|
||||
summary.GetAuditActionCount++
|
||||
case pb.PayerBandwidthAllocation_GET_REPAIR:
|
||||
case pb.BandwidthAction_GET_REPAIR:
|
||||
summary.GetRepairActionCount++
|
||||
case pb.PayerBandwidthAllocation_PUT_REPAIR:
|
||||
case pb.BandwidthAction_PUT_REPAIR:
|
||||
summary.PutRepairActionCount++
|
||||
}
|
||||
}
|
||||
|
@ -13,12 +13,12 @@ import (
|
||||
// Constants for accounting_raw, accounting_rollup, and accounting_timestamps
|
||||
const (
|
||||
// AtRest is the data_type representing at-rest data calculated from pointerdb
|
||||
BandwidthPut = int(pb.PayerBandwidthAllocation_PUT)
|
||||
BandwidthGet = int(pb.PayerBandwidthAllocation_GET)
|
||||
BandwidthGetAudit = int(pb.PayerBandwidthAllocation_GET_AUDIT)
|
||||
BandwidthGetRepair = int(pb.PayerBandwidthAllocation_GET_REPAIR)
|
||||
BandwidthPutRepair = int(pb.PayerBandwidthAllocation_PUT_REPAIR)
|
||||
AtRest = int(pb.PayerBandwidthAllocation_PUT_REPAIR + 1)
|
||||
BandwidthPut = int(pb.BandwidthAction_PUT)
|
||||
BandwidthGet = int(pb.BandwidthAction_GET)
|
||||
BandwidthGetAudit = int(pb.BandwidthAction_GET_AUDIT)
|
||||
BandwidthGetRepair = int(pb.BandwidthAction_GET_REPAIR)
|
||||
BandwidthPutRepair = int(pb.BandwidthAction_PUT_REPAIR)
|
||||
AtRest = int(pb.BandwidthAction_PUT_REPAIR + 1)
|
||||
// LastAtRestTally represents the accounting timestamp for the at-rest data calculation
|
||||
LastAtRestTally = "LastAtRestTally"
|
||||
// LastBandwidthTally represents the accounting timestamp for the bandwidth allocation query
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
//BWTally is a convenience alias
|
||||
type BWTally [pb.PayerBandwidthAllocation_PUT_REPAIR + 1]map[storj.NodeID]int64
|
||||
type BWTally [pb.BandwidthAction_PUT_REPAIR + 1]map[storj.NodeID]int64
|
||||
|
||||
//RollupStats is a convenience alias
|
||||
type RollupStats map[time.Time]map[storj.NodeID]*Rollup
|
||||
|
@ -168,19 +168,11 @@ func (t *Tally) QueryBW(ctx context.Context) error {
|
||||
}
|
||||
var latestBwa time.Time
|
||||
for _, baRow := range bwAgreements {
|
||||
rbad := &pb.RenterBandwidthAllocation_Data{}
|
||||
if err := proto.Unmarshal(baRow.Agreement, rbad); err != nil {
|
||||
t.logger.DPanic("Could not deserialize renter bwa in Tally query")
|
||||
continue
|
||||
}
|
||||
pbad := &pb.PayerBandwidthAllocation_Data{}
|
||||
if err := proto.Unmarshal(rbad.GetPayerAllocation().GetData(), pbad); err != nil {
|
||||
return err
|
||||
}
|
||||
rba := baRow.Agreement
|
||||
if baRow.CreatedAt.After(latestBwa) {
|
||||
latestBwa = baRow.CreatedAt
|
||||
}
|
||||
bwTotals[pbad.GetAction()][rbad.StorageNodeId] += rbad.GetTotal()
|
||||
bwTotals[rba.PayerAllocation.Action][rba.StorageNodeId] += rba.Total
|
||||
}
|
||||
return Error.Wrap(t.accountingDB.SaveBWRaw(ctx, latestBwa, isNil, bwTotals))
|
||||
}
|
||||
|
@ -66,24 +66,24 @@ func TestQueryWithBw(t *testing.T) {
|
||||
fiC, err := testidentity.NewTestIdentity(ctx)
|
||||
assert.NoError(t, err)
|
||||
|
||||
makeBWA(ctx, t, bwDb, "1", fiC, pb.PayerBandwidthAllocation_PUT)
|
||||
makeBWA(ctx, t, bwDb, "2", fiC, pb.PayerBandwidthAllocation_GET)
|
||||
makeBWA(ctx, t, bwDb, "3", fiC, pb.PayerBandwidthAllocation_GET_AUDIT)
|
||||
makeBWA(ctx, t, bwDb, "4", fiC, pb.PayerBandwidthAllocation_GET_REPAIR)
|
||||
makeBWA(ctx, t, bwDb, "5", fiC, pb.PayerBandwidthAllocation_PUT_REPAIR)
|
||||
makeBWA(ctx, t, bwDb, fiC, pb.BandwidthAction_PUT)
|
||||
makeBWA(ctx, t, bwDb, fiC, pb.BandwidthAction_GET)
|
||||
makeBWA(ctx, t, bwDb, fiC, pb.BandwidthAction_GET_AUDIT)
|
||||
makeBWA(ctx, t, bwDb, fiC, pb.BandwidthAction_GET_REPAIR)
|
||||
makeBWA(ctx, t, bwDb, fiC, pb.BandwidthAction_PUT_REPAIR)
|
||||
|
||||
//check the db
|
||||
err = tally.QueryBW(ctx)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func makeBWA(ctx context.Context, t *testing.T, bwDb bwagreement.DB, serialNum string, fiC *identity.FullIdentity, action pb.PayerBandwidthAllocation_Action) {
|
||||
func makeBWA(ctx context.Context, t *testing.T, bwDb bwagreement.DB, fiC *identity.FullIdentity, action pb.BandwidthAction) {
|
||||
//generate an agreement with the key
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(action, fiC, fiC, time.Hour)
|
||||
assert.NoError(t, err)
|
||||
rba, err := testbwagreement.GenerateRenterBandwidthAllocation(pba, teststorj.NodeIDFromString("StorageNodeID"), fiC, 666)
|
||||
assert.NoError(t, err)
|
||||
//save to db
|
||||
err = bwDb.CreateAgreement(ctx, serialNum, bwagreement.Agreement{Signature: rba.GetSignature(), Agreement: rba.GetData()})
|
||||
err = bwDb.CreateAgreement(ctx, rba)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ func (cursor *Cursor) NextStripe(ctx context.Context) (stripe *Stripe, err error
|
||||
return nil, err
|
||||
}
|
||||
peerIdentity := &identity.PeerIdentity{ID: cursor.identity.ID, Leaf: cursor.identity.Leaf}
|
||||
pba, err := cursor.allocation.PayerBandwidthAllocation(ctx, peerIdentity, pb.PayerBandwidthAllocation_GET_AUDIT)
|
||||
pba, err := cursor.allocation.PayerBandwidthAllocation(ctx, peerIdentity, pb.BandwidthAction_GET_AUDIT)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -7,48 +7,100 @@ import (
|
||||
"crypto/ecdsa"
|
||||
"crypto/x509"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/gtank/cryptopasta"
|
||||
"github.com/zeebo/errs"
|
||||
|
||||
"storj.io/storj/pkg/identity"
|
||||
"storj.io/storj/pkg/pb"
|
||||
"storj.io/storj/pkg/peertls"
|
||||
"storj.io/storj/pkg/storj"
|
||||
)
|
||||
|
||||
var (
|
||||
//ECDSA indicates a key was not an ECDSA key
|
||||
ECDSA = errs.New("Key is not ecdsa key")
|
||||
//Sign indicates a failure during signing
|
||||
Sign = errs.Class("Failed to sign message")
|
||||
//Verify indicates a failure during signature validation
|
||||
Verify = errs.Class("Failed to validate message signature")
|
||||
//SigLen indicates an invalid signature length
|
||||
SigLen = errs.Class("Invalid signature length")
|
||||
//Serial indicates an invalid serial number length
|
||||
Serial = errs.Class("Invalid SerialNumber")
|
||||
//Expired indicates the agreement is expired
|
||||
Expired = errs.Class("Agreement is expired")
|
||||
//Signer indicates a public key / node id mismatch
|
||||
Signer = errs.Class("Message public key did not match expected signer")
|
||||
//BadID indicates a public key / node id mismatch
|
||||
BadID = errs.Class("Node ID did not match expected id")
|
||||
//ErrECDSA indicates a key was not an ECDSA key
|
||||
ErrECDSA = errs.New("Key is not ecdsa key")
|
||||
//ErrSign indicates a failure during signing
|
||||
ErrSign = errs.Class("Failed to sign message")
|
||||
//ErrVerify indicates a failure during signature validation
|
||||
ErrVerify = errs.Class("Failed to validate message signature")
|
||||
//ErrSigLen indicates an invalid signature length
|
||||
ErrSigLen = errs.Class("Invalid signature length")
|
||||
//ErrSerial indicates an invalid serial number length
|
||||
ErrSerial = errs.Class("Invalid SerialNumber")
|
||||
//ErrExpired indicates the agreement is expired
|
||||
ErrExpired = errs.Class("Agreement is expired")
|
||||
//ErrSigner indicates a public key / node id mismatch
|
||||
ErrSigner = errs.Class("Message public key did not match expected signer")
|
||||
//ErrBadID indicates a public key / node id mismatch
|
||||
ErrBadID = errs.Class("Node ID did not match expected id")
|
||||
|
||||
//ErrMarshal indicates a failure during serialization
|
||||
ErrMarshal = errs.Class("Could not marshal item to bytes")
|
||||
//ErrUnmarshal indicates a failure during deserialization
|
||||
ErrUnmarshal = errs.Class("Could not unmarshal bytes to item")
|
||||
//ErrMissing indicates missing or empty information
|
||||
ErrMissing = errs.Class("Required field is empty")
|
||||
)
|
||||
|
||||
//VerifyMsg checks the crypto-related aspects of signed message
|
||||
func VerifyMsg(sm pb.SignedMsg, signer storj.NodeID) error {
|
||||
//no null fields
|
||||
if ok, err := pb.MsgComplete(sm); !ok {
|
||||
return err
|
||||
//SignableMessage is a protocol buffer with a certs and a signature
|
||||
//Note that we assume proto.Message is a pointer receiver
|
||||
type SignableMessage interface {
|
||||
proto.Message
|
||||
GetCerts() [][]byte
|
||||
GetSignature() []byte
|
||||
SetCerts([][]byte)
|
||||
SetSignature([]byte)
|
||||
}
|
||||
|
||||
//SignMessage adds the crypto-related aspects of signed message
|
||||
func SignMessage(msg SignableMessage, ID identity.FullIdentity) error {
|
||||
if msg == nil {
|
||||
return ErrMissing.New("message")
|
||||
}
|
||||
certs := sm.GetCerts()
|
||||
if len(certs) < 2 {
|
||||
return Verify.New("Expected at least leaf and CA public keys")
|
||||
}
|
||||
//correct signature length
|
||||
err := peertls.VerifyPeerFunc(peertls.VerifyPeerCertChains)(certs, nil)
|
||||
msg.SetSignature(nil)
|
||||
msg.SetCerts(nil)
|
||||
msgBytes, err := proto.Marshal(msg)
|
||||
if err != nil {
|
||||
return Verify.Wrap(err)
|
||||
return ErrMarshal.Wrap(err)
|
||||
}
|
||||
privECDSA, ok := ID.Key.(*ecdsa.PrivateKey)
|
||||
if !ok {
|
||||
return ErrECDSA
|
||||
}
|
||||
signature, err := cryptopasta.Sign(msgBytes, privECDSA)
|
||||
if err != nil {
|
||||
return ErrSign.Wrap(err)
|
||||
}
|
||||
msg.SetSignature(signature)
|
||||
msg.SetCerts(ID.ChainRaw())
|
||||
return nil
|
||||
}
|
||||
|
||||
//VerifyMsg checks the crypto-related aspects of signed message
|
||||
func VerifyMsg(msg SignableMessage, signer storj.NodeID) error {
|
||||
//setup
|
||||
if msg == nil {
|
||||
return ErrMissing.New("message")
|
||||
} else if msg.GetSignature() == nil {
|
||||
return ErrMissing.New("message signature")
|
||||
} else if msg.GetCerts() == nil {
|
||||
return ErrMissing.New("message certificates")
|
||||
}
|
||||
signature := msg.GetSignature()
|
||||
certs := msg.GetCerts()
|
||||
msg.SetSignature(nil)
|
||||
msg.SetCerts(nil)
|
||||
msgBytes, err := proto.Marshal(msg)
|
||||
if err != nil {
|
||||
return ErrMarshal.Wrap(err)
|
||||
}
|
||||
//check certs
|
||||
if len(certs) < 2 {
|
||||
return ErrVerify.New("Expected at least leaf and CA public keys")
|
||||
}
|
||||
err = peertls.VerifyPeerFunc(peertls.VerifyPeerCertChains)(certs, nil)
|
||||
if err != nil {
|
||||
return ErrVerify.Wrap(err)
|
||||
}
|
||||
leafPubKey, err := parseECDSA(certs[0])
|
||||
if err != nil {
|
||||
@ -58,28 +110,31 @@ func VerifyMsg(sm pb.SignedMsg, signer storj.NodeID) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
signatureLength := leafPubKey.Curve.Params().P.BitLen() / 8
|
||||
if len(sm.GetSignature()) < signatureLength {
|
||||
return SigLen.New("%s", sm.GetSignature())
|
||||
}
|
||||
// verify signature
|
||||
signatureLength := leafPubKey.Curve.Params().P.BitLen() / 8
|
||||
if len(signature) < signatureLength {
|
||||
return ErrSigLen.New("%d vs %d", len(signature), signatureLength)
|
||||
}
|
||||
if id, err := identity.NodeIDFromECDSAKey(caPubKey); err != nil || id != signer {
|
||||
return Signer.New("%+v vs %+v", id, signer)
|
||||
return ErrSigner.New("%+v vs %+v", id, signer)
|
||||
}
|
||||
if ok := cryptopasta.Verify(sm.GetData(), sm.GetSignature(), leafPubKey); !ok {
|
||||
return Verify.New("%+v", ok)
|
||||
if ok := cryptopasta.Verify(msgBytes, signature, leafPubKey); !ok {
|
||||
return ErrVerify.New("%+v", ok)
|
||||
}
|
||||
//cleanup
|
||||
msg.SetSignature(signature)
|
||||
msg.SetCerts(certs)
|
||||
return nil
|
||||
}
|
||||
|
||||
func parseECDSA(rawCert []byte) (*ecdsa.PublicKey, error) {
|
||||
cert, err := x509.ParseCertificate(rawCert)
|
||||
if err != nil {
|
||||
return nil, Verify.Wrap(err)
|
||||
return nil, ErrVerify.Wrap(err)
|
||||
}
|
||||
ecdsa, ok := cert.PublicKey.(*ecdsa.PublicKey)
|
||||
if !ok {
|
||||
return nil, ECDSA
|
||||
return nil, ErrECDSA
|
||||
}
|
||||
return ecdsa, nil
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ type Config struct {
|
||||
// DB stores bandwidth agreements.
|
||||
type DB interface {
|
||||
// CreateAgreement adds a new bandwidth agreement.
|
||||
CreateAgreement(context.Context, string, Agreement) error
|
||||
CreateAgreement(context.Context, *pb.RenterBandwidthAllocation) error
|
||||
// GetAgreements gets all bandwidth agreements.
|
||||
GetAgreements(context.Context) ([]Agreement, error)
|
||||
// GetAgreementsSince gets all bandwidth agreements since specific time.
|
||||
@ -47,10 +47,8 @@ type Server struct {
|
||||
|
||||
// Agreement is a struct that contains a bandwidth agreement and the associated signature
|
||||
type Agreement struct {
|
||||
Agreement []byte
|
||||
Signature []byte
|
||||
Agreement pb.RenterBandwidthAllocation
|
||||
CreatedAt time.Time
|
||||
ExpiresAt time.Time
|
||||
}
|
||||
|
||||
// NewServer creates instance of Server
|
||||
@ -69,43 +67,33 @@ func (s *Server) BandwidthAgreements(ctx context.Context, rba *pb.RenterBandwidt
|
||||
reply = &pb.AgreementsSummary{
|
||||
Status: pb.AgreementsSummary_REJECTED,
|
||||
}
|
||||
rbad, pba, pbad, err := rba.Unpack()
|
||||
if err != nil {
|
||||
return reply, err
|
||||
}
|
||||
pba := rba.PayerAllocation
|
||||
//verify message content
|
||||
pi, err := identity.PeerIdentityFromContext(ctx)
|
||||
if err != nil || rbad.StorageNodeId != pi.ID {
|
||||
return reply, auth.BadID.New("Storage Node ID: %s vs %s", rbad.StorageNodeId, pi.ID)
|
||||
if err != nil || rba.StorageNodeId != pi.ID {
|
||||
return reply, auth.ErrBadID.New("Storage Node ID: %s vs %s", rba.StorageNodeId, pi.ID)
|
||||
}
|
||||
//todo: use whitelist for uplinks?
|
||||
if pbad.SatelliteId != s.NodeID {
|
||||
return reply, pb.Payer.New("Satellite ID: %s vs %s", pbad.SatelliteId, s.NodeID)
|
||||
if pba.SatelliteId != s.NodeID {
|
||||
return reply, pb.ErrPayer.New("Satellite ID: %s vs %s", pba.SatelliteId, s.NodeID)
|
||||
}
|
||||
serialNum := pbad.GetSerialNumber() + rbad.StorageNodeId.String()
|
||||
if len(pbad.SerialNumber) == 0 {
|
||||
return reply, pb.Payer.Wrap(pb.Missing.New("Serial"))
|
||||
}
|
||||
exp := time.Unix(pbad.GetExpirationUnixSec(), 0).UTC()
|
||||
exp := time.Unix(pba.GetExpirationUnixSec(), 0).UTC()
|
||||
if exp.Before(time.Now().UTC()) {
|
||||
return reply, pb.Payer.Wrap(auth.Expired.New("%v vs %v", exp, time.Now().UTC()))
|
||||
return reply, pb.ErrPayer.Wrap(auth.ErrExpired.New("%v vs %v", exp, time.Now().UTC()))
|
||||
}
|
||||
//verify message crypto
|
||||
if err := auth.VerifyMsg(rba, pbad.UplinkId); err != nil {
|
||||
return reply, pb.Renter.Wrap(err)
|
||||
if err := auth.VerifyMsg(rba, pba.UplinkId); err != nil {
|
||||
return reply, pb.ErrRenter.Wrap(err)
|
||||
}
|
||||
if err := auth.VerifyMsg(pba, pbad.SatelliteId); err != nil {
|
||||
return reply, pb.Payer.Wrap(err)
|
||||
if err := auth.VerifyMsg(&pba, pba.SatelliteId); err != nil {
|
||||
return reply, pb.ErrPayer.Wrap(err)
|
||||
}
|
||||
|
||||
//save and return rersults
|
||||
err = s.db.CreateAgreement(ctx, serialNum, Agreement{
|
||||
Signature: rba.GetSignature(),
|
||||
Agreement: rba.GetData(),
|
||||
ExpiresAt: exp,
|
||||
})
|
||||
err = s.db.CreateAgreement(ctx, rba)
|
||||
if err != nil {
|
||||
//todo: better classify transport errors (AgreementsSummary_FAIL) vs logical (AgreementsSummary_REJECTED)
|
||||
return reply, pb.Payer.Wrap(auth.Serial.Wrap(err))
|
||||
return reply, pb.ErrPayer.Wrap(auth.ErrSerial.Wrap(err))
|
||||
}
|
||||
reply.Status = pb.AgreementsSummary_OK
|
||||
s.logger.Debug("Stored Agreement...")
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/gtank/cryptopasta"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/peer"
|
||||
@ -66,7 +67,7 @@ func testDatabase(ctx context.Context, t *testing.T, bwdb bwagreement.DB) {
|
||||
satellite := bwagreement.NewServer(bwdb, zap.NewNop(), satID.ID)
|
||||
|
||||
{ // TestSameSerialNumberBandwidthAgreements
|
||||
pbaFile1, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.PayerBandwidthAllocation_GET, satID, upID, time.Hour)
|
||||
pbaFile1, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.BandwidthAction_GET, satID, upID, time.Hour)
|
||||
assert.NoError(t, err)
|
||||
|
||||
ctxSN1, storageNode1 := getPeerContext(ctx, t)
|
||||
@ -94,7 +95,7 @@ func testDatabase(ctx context.Context, t *testing.T, bwdb bwagreement.DB) {
|
||||
/* Storage node can submit a second bwagreement with a different sequence value.
|
||||
Uplink downloads another file. New PayerBandwidthAllocation with a new sequence. */
|
||||
{
|
||||
pbaFile2, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.PayerBandwidthAllocation_GET, satID, upID, time.Hour)
|
||||
pbaFile2, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.BandwidthAction_GET, satID, upID, time.Hour)
|
||||
assert.NoError(t, err)
|
||||
|
||||
rbaNode1, err := testbwagreement.GenerateRenterBandwidthAllocation(pbaFile2, storageNode1, upID, 666)
|
||||
@ -111,7 +112,7 @@ func testDatabase(ctx context.Context, t *testing.T, bwdb bwagreement.DB) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
reply, err := satellite.BandwidthAgreements(ctxSN1, rbaNode1)
|
||||
assert.True(t, auth.Serial.Has(err))
|
||||
assert.True(t, auth.ErrSerial.Has(err))
|
||||
assert.Equal(t, pb.AgreementsSummary_REJECTED, reply.Status)
|
||||
}
|
||||
|
||||
@ -120,14 +121,14 @@ func testDatabase(ctx context.Context, t *testing.T, bwdb bwagreement.DB) {
|
||||
For safety we will try it anyway to make sure nothing strange will happen */
|
||||
{
|
||||
reply, err := satellite.BandwidthAgreements(ctxSN2, rbaNode2)
|
||||
assert.True(t, auth.Serial.Has(err))
|
||||
assert.True(t, auth.ErrSerial.Has(err))
|
||||
assert.Equal(t, pb.AgreementsSummary_REJECTED, reply.Status)
|
||||
}
|
||||
}
|
||||
|
||||
{ // TestExpiredBandwidthAgreements
|
||||
{ // storage nodes can submit a bwagreement that will expire in 30 seconds
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.PayerBandwidthAllocation_GET, satID, upID, 30*time.Second)
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.BandwidthAction_GET, satID, upID, 30*time.Second)
|
||||
assert.NoError(t, err)
|
||||
|
||||
ctxSN1, storageNode1 := getPeerContext(ctx, t)
|
||||
@ -140,7 +141,7 @@ func testDatabase(ctx context.Context, t *testing.T, bwdb bwagreement.DB) {
|
||||
}
|
||||
|
||||
{ // storage nodes can't submit a bwagreement that expires right now
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.PayerBandwidthAllocation_GET, satID, upID, 0*time.Second)
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.BandwidthAction_GET, satID, upID, 0*time.Second)
|
||||
assert.NoError(t, err)
|
||||
|
||||
ctxSN1, storageNode1 := getPeerContext(ctx, t)
|
||||
@ -153,7 +154,7 @@ func testDatabase(ctx context.Context, t *testing.T, bwdb bwagreement.DB) {
|
||||
}
|
||||
|
||||
{ // storage nodes can't submit a bwagreement that expires yesterday
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.PayerBandwidthAllocation_GET, satID, upID, -23*time.Hour-55*time.Second)
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.BandwidthAction_GET, satID, upID, -23*time.Hour-55*time.Second)
|
||||
assert.NoError(t, err)
|
||||
|
||||
ctxSN1, storageNode1 := getPeerContext(ctx, t)
|
||||
@ -167,7 +168,7 @@ func testDatabase(ctx context.Context, t *testing.T, bwdb bwagreement.DB) {
|
||||
}
|
||||
|
||||
{ // TestManipulatedBandwidthAgreements
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.PayerBandwidthAllocation_GET, satID, upID, time.Hour)
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.BandwidthAction_GET, satID, upID, time.Hour)
|
||||
if !assert.NoError(t, err) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -176,178 +177,107 @@ func testDatabase(ctx context.Context, t *testing.T, bwdb bwagreement.DB) {
|
||||
rba, err := testbwagreement.GenerateRenterBandwidthAllocation(pba, storageNode1, upID, 666)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Unmarschal Renter and Payer bwagreements
|
||||
rbaData := &pb.RenterBandwidthAllocation_Data{}
|
||||
err = proto.Unmarshal(rba.GetData(), rbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
pbaData := &pb.PayerBandwidthAllocation_Data{}
|
||||
err = proto.Unmarshal(pba.GetData(), pbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Storage node manipulates the bwagreement
|
||||
rbaData.Total = 1337
|
||||
|
||||
// Marschal the manipulated bwagreement
|
||||
maniprba, err := proto.Marshal(rbaData)
|
||||
assert.NoError(t, err)
|
||||
rba.Total = 1337
|
||||
|
||||
// Generate a new keypair for self signing bwagreements
|
||||
manipID, err := testidentity.NewTestIdentity(ctx)
|
||||
assert.NoError(t, err)
|
||||
manipCerts := manipID.ChainRaw() //todo: do we need RestChain?
|
||||
manipCerts := manipID.ChainRaw()
|
||||
manipPrivKey, ok := manipID.Key.(*ecdsa.PrivateKey)
|
||||
assert.True(t, ok)
|
||||
|
||||
/* Storage node can't manipulate the bwagreement size (or any other field)
|
||||
Satellite will verify Renter's Signature. */
|
||||
{
|
||||
manipRBA := *rba
|
||||
// Using uplink signature
|
||||
reply, err := callBWA(ctxSN1, satellite, rba.GetSignature(), maniprba, rba.GetCerts())
|
||||
assert.True(t, auth.Verify.Has(err) && pb.Renter.Has(err), err.Error())
|
||||
reply, err := callBWA(ctxSN1, t, satellite, rba.GetSignature(), &manipRBA, rba.GetCerts())
|
||||
assert.True(t, auth.ErrVerify.Has(err) && pb.ErrRenter.Has(err), err.Error())
|
||||
assert.Equal(t, pb.AgreementsSummary_REJECTED, reply.Status)
|
||||
}
|
||||
|
||||
/* Storage node can't sign the manipulated bwagreement
|
||||
Satellite will verify Renter's Signature. */
|
||||
{
|
||||
manipSignature, err := cryptopasta.Sign(maniprba, manipPrivKey)
|
||||
manipRBA := *rba
|
||||
manipSignature := GetSignature(t, &manipRBA, manipPrivKey)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Using self created signature
|
||||
reply, err := callBWA(ctxSN1, satellite, manipSignature, maniprba, rba.GetCerts())
|
||||
assert.True(t, auth.Verify.Has(err) && pb.Renter.Has(err), err.Error())
|
||||
reply, err := callBWA(ctxSN1, t, satellite, manipSignature, rba, rba.GetCerts())
|
||||
assert.True(t, auth.ErrVerify.Has(err) && pb.ErrRenter.Has(err), err.Error())
|
||||
assert.Equal(t, pb.AgreementsSummary_REJECTED, reply.Status)
|
||||
}
|
||||
|
||||
/* Storage node can't replace uplink Certs
|
||||
Satellite will check uplink Certs against uplinkeId. */
|
||||
{
|
||||
manipSignature, err := cryptopasta.Sign(maniprba, manipPrivKey)
|
||||
assert.NoError(t, err)
|
||||
|
||||
manipRBA := *rba
|
||||
manipSignature := GetSignature(t, &manipRBA, manipPrivKey)
|
||||
// Using self created signature + public key
|
||||
reply, err := callBWA(ctxSN1, satellite, manipSignature, maniprba, manipCerts)
|
||||
assert.True(t, auth.Signer.Has(err) && pb.Renter.Has(err), err.Error())
|
||||
reply, err := callBWA(ctxSN1, t, satellite, manipSignature, &manipRBA, manipCerts)
|
||||
assert.True(t, auth.ErrSigner.Has(err) && pb.ErrRenter.Has(err), err.Error())
|
||||
assert.Equal(t, pb.AgreementsSummary_REJECTED, reply.Status)
|
||||
}
|
||||
|
||||
/* Storage node can't replace uplink NodeId
|
||||
Satellite will verify the Payer's Signature. */
|
||||
{
|
||||
manipRBA := *rba
|
||||
// Overwrite the uplinkId with our own keypair
|
||||
pbaData.UplinkId = manipID.ID
|
||||
|
||||
manippba, err := proto.Marshal(pbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Overwrite the uplink public key with our own keypair
|
||||
rbaData.PayerAllocation = &pb.PayerBandwidthAllocation{
|
||||
Signature: pba.GetSignature(),
|
||||
Data: manippba,
|
||||
Certs: pba.GetCerts(),
|
||||
}
|
||||
|
||||
maniprba, err := proto.Marshal(rbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
manipSignature, err := cryptopasta.Sign(maniprba, manipPrivKey)
|
||||
assert.NoError(t, err)
|
||||
|
||||
manipRBA.PayerAllocation.UplinkId = manipID.ID
|
||||
manipSignature := GetSignature(t, &manipRBA, manipPrivKey)
|
||||
// Using self created signature + public key
|
||||
reply, err := callBWA(ctxSN1, satellite, manipSignature, maniprba, manipCerts)
|
||||
assert.True(t, auth.Verify.Has(err) && pb.Payer.Has(err), err.Error())
|
||||
reply, err := callBWA(ctxSN1, t, satellite, manipSignature, &manipRBA, manipCerts)
|
||||
assert.True(t, auth.ErrVerify.Has(err) && pb.ErrPayer.Has(err), err.Error())
|
||||
assert.Equal(t, pb.AgreementsSummary_REJECTED, reply.Status)
|
||||
}
|
||||
|
||||
/* Storage node can't self sign the PayerBandwidthAllocation.
|
||||
Satellite will verify the Payer's Signature. */
|
||||
{
|
||||
manipRBA := *rba
|
||||
// Overwrite the uplinkId with our own keypair
|
||||
pbaData.UplinkId = manipID.ID
|
||||
|
||||
manippba, err := proto.Marshal(pbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
manipSignature, err := cryptopasta.Sign(manippba, manipPrivKey)
|
||||
assert.NoError(t, err)
|
||||
|
||||
rbaData.PayerAllocation = &pb.PayerBandwidthAllocation{
|
||||
Signature: manipSignature,
|
||||
Data: manippba,
|
||||
Certs: pba.GetCerts(),
|
||||
}
|
||||
|
||||
maniprba, err := proto.Marshal(rbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
manipSignature, err = cryptopasta.Sign(maniprba, manipPrivKey)
|
||||
assert.NoError(t, err)
|
||||
|
||||
manipRBA.PayerAllocation.UplinkId = manipID.ID
|
||||
manipSignature := GetSignature(t, &manipRBA.PayerAllocation, manipPrivKey)
|
||||
manipRBA.PayerAllocation.Signature = manipSignature
|
||||
manipSignature = GetSignature(t, &manipRBA, manipPrivKey)
|
||||
// Using self created Payer and Renter bwagreement signatures
|
||||
reply, err := callBWA(ctxSN1, satellite, manipSignature, maniprba, manipCerts)
|
||||
assert.True(t, auth.Verify.Has(err) && pb.Payer.Has(err), err.Error())
|
||||
reply, err := callBWA(ctxSN1, t, satellite, manipSignature, &manipRBA, manipCerts)
|
||||
assert.True(t, auth.ErrVerify.Has(err) && pb.ErrPayer.Has(err), err.Error())
|
||||
assert.Equal(t, pb.AgreementsSummary_REJECTED, reply.Status)
|
||||
}
|
||||
|
||||
/* Storage node can't replace the satellite Certs.
|
||||
Satellite will check satellite certs against satelliteId. */
|
||||
{
|
||||
manipRBA := *rba
|
||||
// Overwrite the uplinkId with our own keypair
|
||||
pbaData.UplinkId = manipID.ID
|
||||
|
||||
manippba, err := proto.Marshal(pbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
manipSignature, err := cryptopasta.Sign(manippba, manipPrivKey)
|
||||
assert.NoError(t, err)
|
||||
|
||||
rbaData.PayerAllocation = &pb.PayerBandwidthAllocation{
|
||||
Signature: manipSignature,
|
||||
Data: manippba,
|
||||
Certs: manipCerts,
|
||||
}
|
||||
|
||||
maniprba, err := proto.Marshal(rbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
manipSignature, err = cryptopasta.Sign(maniprba, manipPrivKey)
|
||||
assert.NoError(t, err)
|
||||
|
||||
manipRBA.PayerAllocation.UplinkId = manipID.ID
|
||||
manipSignature := GetSignature(t, &manipRBA.PayerAllocation, manipPrivKey)
|
||||
manipRBA.PayerAllocation.Signature = manipSignature
|
||||
manipRBA.PayerAllocation.Certs = manipCerts
|
||||
manipSignature = GetSignature(t, &manipRBA, manipPrivKey)
|
||||
// Using self created Payer and Renter bwagreement signatures
|
||||
reply, err := callBWA(ctxSN1, satellite, manipSignature, maniprba, manipCerts)
|
||||
assert.True(t, auth.Signer.Has(err) && pb.Payer.Has(err), err.Error())
|
||||
reply, err := callBWA(ctxSN1, t, satellite, manipSignature, &manipRBA, manipCerts)
|
||||
assert.True(t, auth.ErrSigner.Has(err) && pb.ErrPayer.Has(err), err.Error())
|
||||
assert.Equal(t, pb.AgreementsSummary_REJECTED, reply.Status)
|
||||
}
|
||||
|
||||
/* Storage node can't replace the satellite.
|
||||
Satellite will verify the Satellite Id. */
|
||||
{
|
||||
manipRBA := *rba
|
||||
// Overwrite the uplinkId and satelliteID with our own keypair
|
||||
pbaData.UplinkId = manipID.ID
|
||||
pbaData.SatelliteId = manipID.ID
|
||||
|
||||
manippba, err := proto.Marshal(pbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
manipSignature, err := cryptopasta.Sign(manippba, manipPrivKey)
|
||||
assert.NoError(t, err)
|
||||
|
||||
rbaData.PayerAllocation = &pb.PayerBandwidthAllocation{
|
||||
Signature: manipSignature,
|
||||
Data: manippba,
|
||||
Certs: manipCerts,
|
||||
}
|
||||
|
||||
maniprba, err := proto.Marshal(rbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
manipSignature, err = cryptopasta.Sign(maniprba, manipPrivKey)
|
||||
assert.NoError(t, err)
|
||||
|
||||
manipRBA.PayerAllocation.UplinkId = manipID.ID
|
||||
manipRBA.PayerAllocation.SatelliteId = manipID.ID
|
||||
manipSignature := GetSignature(t, &manipRBA.PayerAllocation, manipPrivKey)
|
||||
manipRBA.PayerAllocation.Signature = manipSignature
|
||||
manipRBA.PayerAllocation.Certs = manipCerts
|
||||
manipSignature = GetSignature(t, &manipRBA, manipPrivKey)
|
||||
// Using self created Payer and Renter bwagreement signatures
|
||||
reply, err := callBWA(ctxSN1, satellite, manipSignature, maniprba, manipCerts)
|
||||
assert.True(t, pb.Payer.Has(err), err.Error())
|
||||
reply, err := callBWA(ctxSN1, t, satellite, manipSignature, &manipRBA, manipCerts)
|
||||
assert.True(t, pb.ErrPayer.Has(err), err.Error())
|
||||
assert.Equal(t, pb.AgreementsSummary_REJECTED, reply.Status)
|
||||
}
|
||||
}
|
||||
@ -355,54 +285,47 @@ func testDatabase(ctx context.Context, t *testing.T, bwdb bwagreement.DB) {
|
||||
{ //TestInvalidBandwidthAgreements
|
||||
ctxSN1, storageNode1 := getPeerContext(ctx, t)
|
||||
ctxSN2, storageNode2 := getPeerContext(ctx, t)
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.PayerBandwidthAllocation_GET, satID, upID, time.Hour)
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.BandwidthAction_GET, satID, upID, time.Hour)
|
||||
assert.NoError(t, err)
|
||||
|
||||
{ // Storage node sends an corrupted signuature to force a satellite crash
|
||||
rba, err := testbwagreement.GenerateRenterBandwidthAllocation(pba, storageNode1, upID, 666)
|
||||
assert.NoError(t, err)
|
||||
|
||||
rba.Signature = []byte("invalid")
|
||||
|
||||
reply, err := satellite.BandwidthAgreements(ctxSN1, rba)
|
||||
assert.True(t, auth.SigLen.Has(err) && pb.Renter.Has(err), err.Error())
|
||||
assert.True(t, auth.ErrSigLen.Has(err) && pb.ErrRenter.Has(err), err.Error())
|
||||
assert.Equal(t, pb.AgreementsSummary_REJECTED, reply.Status)
|
||||
}
|
||||
|
||||
{ // Storage node sends an corrupted uplink Certs to force a crash
|
||||
rba, err := testbwagreement.GenerateRenterBandwidthAllocation(pba, storageNode2, upID, 666)
|
||||
assert.NoError(t, err)
|
||||
|
||||
rbaData := &pb.RenterBandwidthAllocation_Data{}
|
||||
err = proto.Unmarshal(rba.GetData(), rbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
pbaData := &pb.PayerBandwidthAllocation_Data{}
|
||||
err = proto.Unmarshal(pba.GetData(), pbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
pba.Certs = nil
|
||||
|
||||
invalidpba, err := proto.Marshal(pbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
rbaData.PayerAllocation = &pb.PayerBandwidthAllocation{
|
||||
Signature: pba.GetSignature(),
|
||||
Data: invalidpba,
|
||||
Certs: pba.GetCerts(),
|
||||
}
|
||||
|
||||
invalidrba, err := proto.Marshal(rbaData)
|
||||
assert.NoError(t, err)
|
||||
|
||||
reply, err := callBWA(ctxSN2, satellite, rba.GetSignature(), invalidrba, rba.GetCerts())
|
||||
assert.True(t, auth.Verify.Has(err) && pb.Renter.Has(err), err.Error())
|
||||
rba.PayerAllocation.Certs = nil
|
||||
reply, err := callBWA(ctxSN2, t, satellite, rba.GetSignature(), rba, rba.GetCerts())
|
||||
assert.True(t, auth.ErrVerify.Has(err) && pb.ErrRenter.Has(err), err.Error())
|
||||
assert.Equal(t, pb.AgreementsSummary_REJECTED, reply.Status)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func callBWA(ctx context.Context, sat *bwagreement.Server, signature, data []byte, certs [][]byte) (*pb.AgreementsSummary, error) {
|
||||
rba := &pb.RenterBandwidthAllocation{Signature: signature, Data: data, Certs: certs}
|
||||
func callBWA(ctx context.Context, t *testing.T, sat *bwagreement.Server, signature []byte, rba *pb.RenterBandwidthAllocation, certs [][]byte) (*pb.AgreementsSummary, error) {
|
||||
rba.SetCerts(certs)
|
||||
rba.SetSignature(signature)
|
||||
return sat.BandwidthAgreements(ctx, rba)
|
||||
}
|
||||
|
||||
//GetSignature returns the signature of the signed message
|
||||
func GetSignature(t *testing.T, msg auth.SignableMessage, privECDSA *ecdsa.PrivateKey) []byte {
|
||||
require.NotNil(t, msg)
|
||||
oldSignature := msg.GetSignature()
|
||||
certs := msg.GetCerts()
|
||||
msg.SetSignature(nil)
|
||||
msg.SetCerts(nil)
|
||||
msgBytes, err := proto.Marshal(msg)
|
||||
require.NoError(t, err)
|
||||
signature, err := cryptopasta.Sign(msgBytes, privECDSA)
|
||||
require.NoError(t, err)
|
||||
msg.SetSignature(oldSignature)
|
||||
msg.SetCerts(certs)
|
||||
return signature
|
||||
}
|
||||
|
@ -4,11 +4,8 @@
|
||||
package testbwagreement
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/gtank/cryptopasta"
|
||||
"github.com/skyrings/skyring-common/tools/uuid"
|
||||
|
||||
"storj.io/storj/pkg/auth"
|
||||
@ -17,63 +14,30 @@ import (
|
||||
"storj.io/storj/pkg/storj"
|
||||
)
|
||||
|
||||
//GeneratePayerBandwidthAllocation creates a signed PayerBandwidthAllocation from a PayerBandwidthAllocation_Action
|
||||
func GeneratePayerBandwidthAllocation(action pb.PayerBandwidthAllocation_Action, satID *identity.FullIdentity, upID *identity.FullIdentity, expiration time.Duration) (*pb.PayerBandwidthAllocation, error) {
|
||||
//GeneratePayerBandwidthAllocation creates a signed PayerBandwidthAllocation from a BandwidthAction
|
||||
func GeneratePayerBandwidthAllocation(action pb.BandwidthAction, satID *identity.FullIdentity, upID *identity.FullIdentity, expiration time.Duration) (*pb.PayerBandwidthAllocation, error) {
|
||||
serialNum, err := uuid.New()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Generate PayerBandwidthAllocation_Data
|
||||
data, _ := proto.Marshal(
|
||||
&pb.PayerBandwidthAllocation_Data{
|
||||
pba := &pb.PayerBandwidthAllocation{
|
||||
SatelliteId: satID.ID,
|
||||
UplinkId: upID.ID,
|
||||
ExpirationUnixSec: time.Now().Add(expiration).Unix(),
|
||||
SerialNumber: serialNum.String(),
|
||||
Action: action,
|
||||
CreatedUnixSec: time.Now().Unix(),
|
||||
},
|
||||
)
|
||||
// Sign the PayerBandwidthAllocation_Data with the "Satellite" Private Key
|
||||
satPrivECDSA, ok := satID.Key.(*ecdsa.PrivateKey)
|
||||
if !ok {
|
||||
return nil, pb.Payer.Wrap(auth.ECDSA)
|
||||
}
|
||||
s, err := cryptopasta.Sign(data, satPrivECDSA)
|
||||
if err != nil {
|
||||
return nil, pb.Payer.Wrap(auth.Sign.Wrap(err))
|
||||
}
|
||||
// Combine Signature and Data for PayerBandwidthAllocation
|
||||
return &pb.PayerBandwidthAllocation{
|
||||
Data: data,
|
||||
Signature: s,
|
||||
Certs: satID.ChainRaw(),
|
||||
}, nil
|
||||
return pba, auth.SignMessage(pba, *satID)
|
||||
}
|
||||
|
||||
//GenerateRenterBandwidthAllocation creates a signed RenterBandwidthAllocation from a PayerBandwidthAllocation
|
||||
func GenerateRenterBandwidthAllocation(pba *pb.PayerBandwidthAllocation, storageNodeID storj.NodeID, upID *identity.FullIdentity, total int64) (*pb.RenterBandwidthAllocation, error) {
|
||||
// Generate RenterBandwidthAllocation_Data
|
||||
data, _ := proto.Marshal(
|
||||
&pb.RenterBandwidthAllocation_Data{
|
||||
PayerAllocation: pba,
|
||||
rba := &pb.RenterBandwidthAllocation{
|
||||
PayerAllocation: *pba,
|
||||
StorageNodeId: storageNodeID,
|
||||
Total: total,
|
||||
},
|
||||
)
|
||||
// Sign the PayerBandwidthAllocation_Data with the "Uplink" Private Key
|
||||
upPrivECDSA, ok := upID.Key.(*ecdsa.PrivateKey)
|
||||
if !ok {
|
||||
return nil, pb.Payer.Wrap(auth.ECDSA)
|
||||
}
|
||||
s, err := cryptopasta.Sign(data, upPrivECDSA)
|
||||
if err != nil {
|
||||
return nil, pb.Payer.Wrap(auth.Sign.Wrap(err))
|
||||
}
|
||||
// Combine Signature and Data for RenterBandwidthAllocation
|
||||
return &pb.RenterBandwidthAllocation{
|
||||
Signature: s,
|
||||
Data: data,
|
||||
Certs: upID.ChainRaw(),
|
||||
}, nil
|
||||
return rba, auth.SignMessage(rba, *upID)
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
@ -260,7 +259,7 @@ func BenchmarkIdentifyInjuredSegments(b *testing.B) {
|
||||
sort.Slice(dequeued, func(i, k int) bool { return dequeued[i].Path < dequeued[k].Path })
|
||||
|
||||
for i := 0; i < len(segs); i++ {
|
||||
assert.True(b, proto.Equal(segs[i], dequeued[i]))
|
||||
assert.True(b, pb.Equal(segs[i], dequeued[i]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"storj.io/storj/internal/testcontext"
|
||||
@ -38,7 +37,7 @@ func TestEnqueueDequeue(t *testing.T) {
|
||||
|
||||
s, err := q.Dequeue(ctx)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, proto.Equal(&s, seg))
|
||||
assert.True(t, pb.Equal(&s, seg))
|
||||
})
|
||||
}
|
||||
|
||||
@ -77,7 +76,7 @@ func TestSequential(t *testing.T) {
|
||||
list, err := q.Peekqueue(ctx, 100)
|
||||
assert.NoError(t, err)
|
||||
for i := 0; i < N; i++ {
|
||||
assert.True(t, proto.Equal(addSegs[i], &list[i]))
|
||||
assert.True(t, pb.Equal(addSegs[i], &list[i]))
|
||||
}
|
||||
|
||||
// TODO: fix out of order issue
|
||||
@ -85,7 +84,7 @@ func TestSequential(t *testing.T) {
|
||||
dequeued, err := q.Dequeue(ctx)
|
||||
assert.NoError(t, err)
|
||||
expected := dequeued.LostPieces[0]
|
||||
assert.True(t, proto.Equal(addSegs[expected], &dequeued))
|
||||
assert.True(t, pb.Equal(addSegs[expected], &dequeued))
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -191,7 +190,7 @@ func benchmarkSequential(b *testing.B, q queue.RepairQueue) {
|
||||
for i := 0; i < N; i++ {
|
||||
dqSeg, err := q.Dequeue(ctx)
|
||||
assert.NoError(b, err)
|
||||
assert.True(b, proto.Equal(addSegs[i], &dqSeg))
|
||||
assert.True(b, pb.Equal(addSegs[i], &dqSeg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,60 +4,57 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
reflect "reflect"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
)
|
||||
|
||||
var (
|
||||
//Renter wraps errors related to renter bandwidth allocations
|
||||
Renter = errs.Class("Renter agreement")
|
||||
//Payer wraps errors related to payer bandwidth allocations
|
||||
Payer = errs.Class("Payer agreement")
|
||||
//Marshal indicates a failure during serialization
|
||||
Marshal = errs.Class("Could not generate byte array from key")
|
||||
//Unmarshal indicates a failure during deserialization
|
||||
Unmarshal = errs.Class("Could not generate key from byte array")
|
||||
//Missing indicates missing or empty information
|
||||
Missing = errs.Class("Required field is empty")
|
||||
//ErrRenter wraps errors related to renter bandwidth allocations
|
||||
ErrRenter = errs.Class("Renter agreement")
|
||||
//ErrPayer wraps errors related to payer bandwidth allocations
|
||||
ErrPayer = errs.Class("Payer agreement")
|
||||
)
|
||||
|
||||
//SignedMsg interface has a key, data, and signature
|
||||
type SignedMsg interface {
|
||||
GetCerts() [][]byte
|
||||
GetData() []byte
|
||||
GetSignature() []byte
|
||||
//Equal compares two Protobuf messages via serialization
|
||||
func Equal(msg1, msg2 proto.Message) bool {
|
||||
//reflect.DeepEqual and proto.Equal don't seem work in all cases
|
||||
//todo: see how slow this is compared to custom equality checks
|
||||
if msg1 == nil {
|
||||
return msg2 == nil
|
||||
}
|
||||
if reflect.TypeOf(msg1) != reflect.TypeOf(msg2) {
|
||||
return false
|
||||
}
|
||||
msg1Bytes, err := proto.Marshal(msg1)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
msg2Bytes, err := proto.Marshal(msg1)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return bytes.Compare(msg1Bytes, msg2Bytes) == 0
|
||||
}
|
||||
|
||||
// MsgComplete ensures a SignedMsg has no nulls
|
||||
func MsgComplete(sm SignedMsg) (bool, error) {
|
||||
if sm == nil {
|
||||
return false, Missing.New("message")
|
||||
} else if sm.GetData() == nil {
|
||||
return false, Missing.New("message data")
|
||||
} else if sm.GetSignature() == nil {
|
||||
return false, Missing.New("message signature")
|
||||
} else if sm.GetCerts() == nil {
|
||||
return false, Missing.New("message certificates")
|
||||
}
|
||||
return true, nil
|
||||
//SetCerts updates the certs field, completing the auth.SignedMsg interface
|
||||
func (m *PayerBandwidthAllocation) SetCerts(certs [][]byte) {
|
||||
m.Certs = certs
|
||||
}
|
||||
|
||||
//Unpack helps get things out of a RenterBandwidthAllocation
|
||||
func (rba *RenterBandwidthAllocation) Unpack() (*RenterBandwidthAllocation_Data, *PayerBandwidthAllocation, *PayerBandwidthAllocation_Data, error) {
|
||||
if ok, err := MsgComplete(rba); !ok {
|
||||
return nil, nil, nil, Renter.Wrap(err)
|
||||
}
|
||||
rbad := &RenterBandwidthAllocation_Data{}
|
||||
if err := proto.Unmarshal(rba.GetData(), rbad); err != nil {
|
||||
return nil, nil, nil, Renter.Wrap(Unmarshal.Wrap(err))
|
||||
}
|
||||
if ok, err := MsgComplete(rba); !ok {
|
||||
return nil, nil, nil, Payer.Wrap(err)
|
||||
}
|
||||
pba := rbad.GetPayerAllocation()
|
||||
pbad := &PayerBandwidthAllocation_Data{}
|
||||
if err := proto.Unmarshal(pba.GetData(), pbad); err != nil {
|
||||
return nil, nil, nil, Payer.Wrap(Unmarshal.Wrap(err))
|
||||
}
|
||||
return rbad, pba, pbad, nil
|
||||
//SetSignature updates the signature field, completing the auth.SignedMsg interface
|
||||
func (m *PayerBandwidthAllocation) SetSignature(signature []byte) {
|
||||
m.Signature = signature
|
||||
}
|
||||
|
||||
//SetCerts updates the certs field, completing the auth.SignedMsg interface
|
||||
func (m *RenterBandwidthAllocation) SetCerts(certs [][]byte) {
|
||||
m.Certs = certs
|
||||
}
|
||||
|
||||
//SetSignature updates the signature field, completing the auth.SignedMsg interface
|
||||
func (m *RenterBandwidthAllocation) SetSignature(signature []byte) {
|
||||
m.Signature = signature
|
||||
}
|
||||
|
@ -25,24 +25,24 @@ var _ = math.Inf
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type PayerBandwidthAllocation_Action int32
|
||||
type BandwidthAction int32
|
||||
|
||||
const (
|
||||
PayerBandwidthAllocation_PUT PayerBandwidthAllocation_Action = 0
|
||||
PayerBandwidthAllocation_GET PayerBandwidthAllocation_Action = 1
|
||||
PayerBandwidthAllocation_GET_AUDIT PayerBandwidthAllocation_Action = 2
|
||||
PayerBandwidthAllocation_GET_REPAIR PayerBandwidthAllocation_Action = 3
|
||||
PayerBandwidthAllocation_PUT_REPAIR PayerBandwidthAllocation_Action = 4
|
||||
BandwidthAction_PUT BandwidthAction = 0
|
||||
BandwidthAction_GET BandwidthAction = 1
|
||||
BandwidthAction_GET_AUDIT BandwidthAction = 2
|
||||
BandwidthAction_GET_REPAIR BandwidthAction = 3
|
||||
BandwidthAction_PUT_REPAIR BandwidthAction = 4
|
||||
)
|
||||
|
||||
var PayerBandwidthAllocation_Action_name = map[int32]string{
|
||||
var BandwidthAction_name = map[int32]string{
|
||||
0: "PUT",
|
||||
1: "GET",
|
||||
2: "GET_AUDIT",
|
||||
3: "GET_REPAIR",
|
||||
4: "PUT_REPAIR",
|
||||
}
|
||||
var PayerBandwidthAllocation_Action_value = map[string]int32{
|
||||
var BandwidthAction_value = map[string]int32{
|
||||
"PUT": 0,
|
||||
"GET": 1,
|
||||
"GET_AUDIT": 2,
|
||||
@ -50,17 +50,23 @@ var PayerBandwidthAllocation_Action_value = map[string]int32{
|
||||
"PUT_REPAIR": 4,
|
||||
}
|
||||
|
||||
func (x PayerBandwidthAllocation_Action) String() string {
|
||||
return proto.EnumName(PayerBandwidthAllocation_Action_name, int32(x))
|
||||
func (x BandwidthAction) String() string {
|
||||
return proto.EnumName(BandwidthAction_name, int32(x))
|
||||
}
|
||||
func (PayerBandwidthAllocation_Action) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{0, 0}
|
||||
func (BandwidthAction) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{0}
|
||||
}
|
||||
|
||||
type PayerBandwidthAllocation struct {
|
||||
Certs [][]byte `protobuf:"bytes,1,rep,name=certs,proto3" json:"certs,omitempty"`
|
||||
Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
|
||||
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
|
||||
SatelliteId NodeID `protobuf:"bytes,1,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"`
|
||||
UplinkId NodeID `protobuf:"bytes,2,opt,name=uplink_id,json=uplinkId,proto3,customtype=NodeID" json:"uplink_id"`
|
||||
MaxSize int64 `protobuf:"varint,3,opt,name=max_size,json=maxSize,proto3" json:"max_size,omitempty"`
|
||||
ExpirationUnixSec int64 `protobuf:"varint,4,opt,name=expiration_unix_sec,json=expirationUnixSec,proto3" json:"expiration_unix_sec,omitempty"`
|
||||
SerialNumber string `protobuf:"bytes,5,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"`
|
||||
Action BandwidthAction `protobuf:"varint,6,opt,name=action,proto3,enum=piecestoreroutes.BandwidthAction" json:"action,omitempty"`
|
||||
CreatedUnixSec int64 `protobuf:"varint,7,opt,name=created_unix_sec,json=createdUnixSec,proto3" json:"created_unix_sec,omitempty"`
|
||||
Certs [][]byte `protobuf:"bytes,8,rep,name=certs,proto3" json:"certs,omitempty"`
|
||||
Signature []byte `protobuf:"bytes,9,opt,name=signature,proto3" json:"signature,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -70,7 +76,7 @@ func (m *PayerBandwidthAllocation) Reset() { *m = PayerBandwidthAllocati
|
||||
func (m *PayerBandwidthAllocation) String() string { return proto.CompactTextString(m) }
|
||||
func (*PayerBandwidthAllocation) ProtoMessage() {}
|
||||
func (*PayerBandwidthAllocation) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{0}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{0}
|
||||
}
|
||||
func (m *PayerBandwidthAllocation) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PayerBandwidthAllocation.Unmarshal(m, b)
|
||||
@ -90,6 +96,41 @@ func (m *PayerBandwidthAllocation) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_PayerBandwidthAllocation proto.InternalMessageInfo
|
||||
|
||||
func (m *PayerBandwidthAllocation) GetMaxSize() int64 {
|
||||
if m != nil {
|
||||
return m.MaxSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *PayerBandwidthAllocation) GetExpirationUnixSec() int64 {
|
||||
if m != nil {
|
||||
return m.ExpirationUnixSec
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *PayerBandwidthAllocation) GetSerialNumber() string {
|
||||
if m != nil {
|
||||
return m.SerialNumber
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *PayerBandwidthAllocation) GetAction() BandwidthAction {
|
||||
if m != nil {
|
||||
return m.Action
|
||||
}
|
||||
return BandwidthAction_PUT
|
||||
}
|
||||
|
||||
func (m *PayerBandwidthAllocation) GetCreatedUnixSec() int64 {
|
||||
if m != nil {
|
||||
return m.CreatedUnixSec
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *PayerBandwidthAllocation) GetCerts() [][]byte {
|
||||
if m != nil {
|
||||
return m.Certs
|
||||
@ -104,89 +145,12 @@ func (m *PayerBandwidthAllocation) GetSignature() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PayerBandwidthAllocation) GetData() []byte {
|
||||
if m != nil {
|
||||
return m.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PayerBandwidthAllocation_Data struct {
|
||||
SatelliteId NodeID `protobuf:"bytes,1,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"`
|
||||
UplinkId NodeID `protobuf:"bytes,2,opt,name=uplink_id,json=uplinkId,proto3,customtype=NodeID" json:"uplink_id"`
|
||||
MaxSize int64 `protobuf:"varint,3,opt,name=max_size,json=maxSize,proto3" json:"max_size,omitempty"`
|
||||
ExpirationUnixSec int64 `protobuf:"varint,4,opt,name=expiration_unix_sec,json=expirationUnixSec,proto3" json:"expiration_unix_sec,omitempty"`
|
||||
SerialNumber string `protobuf:"bytes,5,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"`
|
||||
Action PayerBandwidthAllocation_Action `protobuf:"varint,6,opt,name=action,proto3,enum=piecestoreroutes.PayerBandwidthAllocation_Action" json:"action,omitempty"`
|
||||
CreatedUnixSec int64 `protobuf:"varint,7,opt,name=created_unix_sec,json=createdUnixSec,proto3" json:"created_unix_sec,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *PayerBandwidthAllocation_Data) Reset() { *m = PayerBandwidthAllocation_Data{} }
|
||||
func (m *PayerBandwidthAllocation_Data) String() string { return proto.CompactTextString(m) }
|
||||
func (*PayerBandwidthAllocation_Data) ProtoMessage() {}
|
||||
func (*PayerBandwidthAllocation_Data) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{0, 0}
|
||||
}
|
||||
func (m *PayerBandwidthAllocation_Data) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PayerBandwidthAllocation_Data.Unmarshal(m, b)
|
||||
}
|
||||
func (m *PayerBandwidthAllocation_Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_PayerBandwidthAllocation_Data.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *PayerBandwidthAllocation_Data) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_PayerBandwidthAllocation_Data.Merge(dst, src)
|
||||
}
|
||||
func (m *PayerBandwidthAllocation_Data) XXX_Size() int {
|
||||
return xxx_messageInfo_PayerBandwidthAllocation_Data.Size(m)
|
||||
}
|
||||
func (m *PayerBandwidthAllocation_Data) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_PayerBandwidthAllocation_Data.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_PayerBandwidthAllocation_Data proto.InternalMessageInfo
|
||||
|
||||
func (m *PayerBandwidthAllocation_Data) GetMaxSize() int64 {
|
||||
if m != nil {
|
||||
return m.MaxSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *PayerBandwidthAllocation_Data) GetExpirationUnixSec() int64 {
|
||||
if m != nil {
|
||||
return m.ExpirationUnixSec
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *PayerBandwidthAllocation_Data) GetSerialNumber() string {
|
||||
if m != nil {
|
||||
return m.SerialNumber
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *PayerBandwidthAllocation_Data) GetAction() PayerBandwidthAllocation_Action {
|
||||
if m != nil {
|
||||
return m.Action
|
||||
}
|
||||
return PayerBandwidthAllocation_PUT
|
||||
}
|
||||
|
||||
func (m *PayerBandwidthAllocation_Data) GetCreatedUnixSec() int64 {
|
||||
if m != nil {
|
||||
return m.CreatedUnixSec
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type RenterBandwidthAllocation struct {
|
||||
Certs [][]byte `protobuf:"bytes,1,rep,name=certs,proto3" json:"certs,omitempty"`
|
||||
Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
|
||||
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
|
||||
PayerAllocation PayerBandwidthAllocation `protobuf:"bytes,1,opt,name=payer_allocation,json=payerAllocation,proto3" json:"payer_allocation"`
|
||||
Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"`
|
||||
StorageNodeId NodeID `protobuf:"bytes,3,opt,name=storage_node_id,json=storageNodeId,proto3,customtype=NodeID" json:"storage_node_id"`
|
||||
Certs [][]byte `protobuf:"bytes,4,rep,name=certs,proto3" json:"certs,omitempty"`
|
||||
Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -196,7 +160,7 @@ func (m *RenterBandwidthAllocation) Reset() { *m = RenterBandwidthAlloca
|
||||
func (m *RenterBandwidthAllocation) String() string { return proto.CompactTextString(m) }
|
||||
func (*RenterBandwidthAllocation) ProtoMessage() {}
|
||||
func (*RenterBandwidthAllocation) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{1}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{1}
|
||||
}
|
||||
func (m *RenterBandwidthAllocation) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_RenterBandwidthAllocation.Unmarshal(m, b)
|
||||
@ -216,6 +180,20 @@ func (m *RenterBandwidthAllocation) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_RenterBandwidthAllocation proto.InternalMessageInfo
|
||||
|
||||
func (m *RenterBandwidthAllocation) GetPayerAllocation() PayerBandwidthAllocation {
|
||||
if m != nil {
|
||||
return m.PayerAllocation
|
||||
}
|
||||
return PayerBandwidthAllocation{}
|
||||
}
|
||||
|
||||
func (m *RenterBandwidthAllocation) GetTotal() int64 {
|
||||
if m != nil {
|
||||
return m.Total
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *RenterBandwidthAllocation) GetCerts() [][]byte {
|
||||
if m != nil {
|
||||
return m.Certs
|
||||
@ -230,60 +208,6 @@ func (m *RenterBandwidthAllocation) GetSignature() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *RenterBandwidthAllocation) GetData() []byte {
|
||||
if m != nil {
|
||||
return m.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type RenterBandwidthAllocation_Data struct {
|
||||
PayerAllocation *PayerBandwidthAllocation `protobuf:"bytes,1,opt,name=payer_allocation,json=payerAllocation,proto3" json:"payer_allocation,omitempty"`
|
||||
Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"`
|
||||
StorageNodeId NodeID `protobuf:"bytes,3,opt,name=storage_node_id,json=storageNodeId,proto3,customtype=NodeID" json:"storage_node_id"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *RenterBandwidthAllocation_Data) Reset() { *m = RenterBandwidthAllocation_Data{} }
|
||||
func (m *RenterBandwidthAllocation_Data) String() string { return proto.CompactTextString(m) }
|
||||
func (*RenterBandwidthAllocation_Data) ProtoMessage() {}
|
||||
func (*RenterBandwidthAllocation_Data) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{1, 0}
|
||||
}
|
||||
func (m *RenterBandwidthAllocation_Data) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_RenterBandwidthAllocation_Data.Unmarshal(m, b)
|
||||
}
|
||||
func (m *RenterBandwidthAllocation_Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_RenterBandwidthAllocation_Data.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *RenterBandwidthAllocation_Data) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_RenterBandwidthAllocation_Data.Merge(dst, src)
|
||||
}
|
||||
func (m *RenterBandwidthAllocation_Data) XXX_Size() int {
|
||||
return xxx_messageInfo_RenterBandwidthAllocation_Data.Size(m)
|
||||
}
|
||||
func (m *RenterBandwidthAllocation_Data) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_RenterBandwidthAllocation_Data.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_RenterBandwidthAllocation_Data proto.InternalMessageInfo
|
||||
|
||||
func (m *RenterBandwidthAllocation_Data) GetPayerAllocation() *PayerBandwidthAllocation {
|
||||
if m != nil {
|
||||
return m.PayerAllocation
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *RenterBandwidthAllocation_Data) GetTotal() int64 {
|
||||
if m != nil {
|
||||
return m.Total
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type PieceStore struct {
|
||||
BandwidthAllocation *RenterBandwidthAllocation `protobuf:"bytes,1,opt,name=bandwidth_allocation,json=bandwidthAllocation,proto3" json:"bandwidth_allocation,omitempty"`
|
||||
PieceData *PieceStore_PieceData `protobuf:"bytes,2,opt,name=piece_data,json=pieceData,proto3" json:"piece_data,omitempty"`
|
||||
@ -297,7 +221,7 @@ func (m *PieceStore) Reset() { *m = PieceStore{} }
|
||||
func (m *PieceStore) String() string { return proto.CompactTextString(m) }
|
||||
func (*PieceStore) ProtoMessage() {}
|
||||
func (*PieceStore) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{2}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{2}
|
||||
}
|
||||
func (m *PieceStore) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PieceStore.Unmarshal(m, b)
|
||||
@ -352,7 +276,7 @@ func (m *PieceStore_PieceData) Reset() { *m = PieceStore_PieceData{} }
|
||||
func (m *PieceStore_PieceData) String() string { return proto.CompactTextString(m) }
|
||||
func (*PieceStore_PieceData) ProtoMessage() {}
|
||||
func (*PieceStore_PieceData) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{2, 0}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{2, 0}
|
||||
}
|
||||
func (m *PieceStore_PieceData) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PieceStore_PieceData.Unmarshal(m, b)
|
||||
@ -406,7 +330,7 @@ func (m *PieceId) Reset() { *m = PieceId{} }
|
||||
func (m *PieceId) String() string { return proto.CompactTextString(m) }
|
||||
func (*PieceId) ProtoMessage() {}
|
||||
func (*PieceId) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{3}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{3}
|
||||
}
|
||||
func (m *PieceId) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PieceId.Unmarshal(m, b)
|
||||
@ -453,7 +377,7 @@ func (m *PieceSummary) Reset() { *m = PieceSummary{} }
|
||||
func (m *PieceSummary) String() string { return proto.CompactTextString(m) }
|
||||
func (*PieceSummary) ProtoMessage() {}
|
||||
func (*PieceSummary) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{4}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{4}
|
||||
}
|
||||
func (m *PieceSummary) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PieceSummary.Unmarshal(m, b)
|
||||
@ -507,7 +431,7 @@ func (m *PieceRetrieval) Reset() { *m = PieceRetrieval{} }
|
||||
func (m *PieceRetrieval) String() string { return proto.CompactTextString(m) }
|
||||
func (*PieceRetrieval) ProtoMessage() {}
|
||||
func (*PieceRetrieval) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{5}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{5}
|
||||
}
|
||||
func (m *PieceRetrieval) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PieceRetrieval.Unmarshal(m, b)
|
||||
@ -562,7 +486,7 @@ func (m *PieceRetrieval_PieceData) Reset() { *m = PieceRetrieval_PieceDa
|
||||
func (m *PieceRetrieval_PieceData) String() string { return proto.CompactTextString(m) }
|
||||
func (*PieceRetrieval_PieceData) ProtoMessage() {}
|
||||
func (*PieceRetrieval_PieceData) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{5, 0}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{5, 0}
|
||||
}
|
||||
func (m *PieceRetrieval_PieceData) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PieceRetrieval_PieceData.Unmarshal(m, b)
|
||||
@ -615,7 +539,7 @@ func (m *PieceRetrievalStream) Reset() { *m = PieceRetrievalStream{} }
|
||||
func (m *PieceRetrievalStream) String() string { return proto.CompactTextString(m) }
|
||||
func (*PieceRetrievalStream) ProtoMessage() {}
|
||||
func (*PieceRetrievalStream) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{6}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{6}
|
||||
}
|
||||
func (m *PieceRetrievalStream) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PieceRetrievalStream.Unmarshal(m, b)
|
||||
@ -662,7 +586,7 @@ func (m *PieceDelete) Reset() { *m = PieceDelete{} }
|
||||
func (m *PieceDelete) String() string { return proto.CompactTextString(m) }
|
||||
func (*PieceDelete) ProtoMessage() {}
|
||||
func (*PieceDelete) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{7}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{7}
|
||||
}
|
||||
func (m *PieceDelete) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PieceDelete.Unmarshal(m, b)
|
||||
@ -707,7 +631,7 @@ func (m *PieceDeleteSummary) Reset() { *m = PieceDeleteSummary{} }
|
||||
func (m *PieceDeleteSummary) String() string { return proto.CompactTextString(m) }
|
||||
func (*PieceDeleteSummary) ProtoMessage() {}
|
||||
func (*PieceDeleteSummary) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{8}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{8}
|
||||
}
|
||||
func (m *PieceDeleteSummary) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PieceDeleteSummary.Unmarshal(m, b)
|
||||
@ -746,7 +670,7 @@ func (m *PieceStoreSummary) Reset() { *m = PieceStoreSummary{} }
|
||||
func (m *PieceStoreSummary) String() string { return proto.CompactTextString(m) }
|
||||
func (*PieceStoreSummary) ProtoMessage() {}
|
||||
func (*PieceStoreSummary) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{9}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{9}
|
||||
}
|
||||
func (m *PieceStoreSummary) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PieceStoreSummary.Unmarshal(m, b)
|
||||
@ -790,7 +714,7 @@ func (m *StatsReq) Reset() { *m = StatsReq{} }
|
||||
func (m *StatsReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*StatsReq) ProtoMessage() {}
|
||||
func (*StatsReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{10}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{10}
|
||||
}
|
||||
func (m *StatsReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_StatsReq.Unmarshal(m, b)
|
||||
@ -824,7 +748,7 @@ func (m *StatSummary) Reset() { *m = StatSummary{} }
|
||||
func (m *StatSummary) String() string { return proto.CompactTextString(m) }
|
||||
func (*StatSummary) ProtoMessage() {}
|
||||
func (*StatSummary) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{11}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{11}
|
||||
}
|
||||
func (m *StatSummary) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_StatSummary.Unmarshal(m, b)
|
||||
@ -885,7 +809,7 @@ func (m *SignedMessage) Reset() { *m = SignedMessage{} }
|
||||
func (m *SignedMessage) String() string { return proto.CompactTextString(m) }
|
||||
func (*SignedMessage) ProtoMessage() {}
|
||||
func (*SignedMessage) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{12}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{12}
|
||||
}
|
||||
func (m *SignedMessage) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SignedMessage.Unmarshal(m, b)
|
||||
@ -936,7 +860,7 @@ func (m *DashboardReq) Reset() { *m = DashboardReq{} }
|
||||
func (m *DashboardReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*DashboardReq) ProtoMessage() {}
|
||||
func (*DashboardReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{13}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{13}
|
||||
}
|
||||
func (m *DashboardReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_DashboardReq.Unmarshal(m, b)
|
||||
@ -972,7 +896,7 @@ func (m *DashboardStats) Reset() { *m = DashboardStats{} }
|
||||
func (m *DashboardStats) String() string { return proto.CompactTextString(m) }
|
||||
func (*DashboardStats) ProtoMessage() {}
|
||||
func (*DashboardStats) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_piecestore_ad8894e1f36b2897, []int{14}
|
||||
return fileDescriptor_piecestore_225cf744c22a2be6, []int{14}
|
||||
}
|
||||
func (m *DashboardStats) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_DashboardStats.Unmarshal(m, b)
|
||||
@ -1036,9 +960,7 @@ func (m *DashboardStats) GetUptime() *duration.Duration {
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*PayerBandwidthAllocation)(nil), "piecestoreroutes.PayerBandwidthAllocation")
|
||||
proto.RegisterType((*PayerBandwidthAllocation_Data)(nil), "piecestoreroutes.PayerBandwidthAllocation.Data")
|
||||
proto.RegisterType((*RenterBandwidthAllocation)(nil), "piecestoreroutes.RenterBandwidthAllocation")
|
||||
proto.RegisterType((*RenterBandwidthAllocation_Data)(nil), "piecestoreroutes.RenterBandwidthAllocation.Data")
|
||||
proto.RegisterType((*PieceStore)(nil), "piecestoreroutes.PieceStore")
|
||||
proto.RegisterType((*PieceStore_PieceData)(nil), "piecestoreroutes.PieceStore.PieceData")
|
||||
proto.RegisterType((*PieceId)(nil), "piecestoreroutes.PieceId")
|
||||
@ -1054,7 +976,7 @@ func init() {
|
||||
proto.RegisterType((*SignedMessage)(nil), "piecestoreroutes.SignedMessage")
|
||||
proto.RegisterType((*DashboardReq)(nil), "piecestoreroutes.DashboardReq")
|
||||
proto.RegisterType((*DashboardStats)(nil), "piecestoreroutes.DashboardStats")
|
||||
proto.RegisterEnum("piecestoreroutes.PayerBandwidthAllocation_Action", PayerBandwidthAllocation_Action_name, PayerBandwidthAllocation_Action_value)
|
||||
proto.RegisterEnum("piecestoreroutes.BandwidthAction", BandwidthAction_name, BandwidthAction_value)
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -1388,79 +1310,79 @@ var _PieceStoreRoutes_serviceDesc = grpc.ServiceDesc{
|
||||
Metadata: "piecestore.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("piecestore.proto", fileDescriptor_piecestore_ad8894e1f36b2897) }
|
||||
func init() { proto.RegisterFile("piecestore.proto", fileDescriptor_piecestore_225cf744c22a2be6) }
|
||||
|
||||
var fileDescriptor_piecestore_ad8894e1f36b2897 = []byte{
|
||||
var fileDescriptor_piecestore_225cf744c22a2be6 = []byte{
|
||||
// 1121 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0xdb, 0x46,
|
||||
0x10, 0x16, 0x29, 0x5b, 0xb2, 0x46, 0x3f, 0x56, 0x36, 0x46, 0x2b, 0x0b, 0xb1, 0x2d, 0x30, 0x4d,
|
||||
0xaa, 0x26, 0x80, 0x1c, 0x3b, 0x40, 0xef, 0x76, 0x65, 0x04, 0x42, 0x51, 0xc7, 0x5d, 0xd9, 0x97,
|
||||
0x1c, 0xca, 0xac, 0xc8, 0xb1, 0x4c, 0x84, 0x22, 0x55, 0x72, 0xe9, 0xda, 0x7e, 0x8b, 0x3e, 0x47,
|
||||
0xd1, 0xf7, 0x28, 0xd0, 0x7b, 0x0f, 0x3d, 0x04, 0xe8, 0x0b, 0xf4, 0xd8, 0x4b, 0x2f, 0xc5, 0xfe,
|
||||
0x88, 0xb4, 0xad, 0xbf, 0x22, 0x80, 0x6f, 0x3b, 0x3f, 0x3b, 0x33, 0xfb, 0xcd, 0xb7, 0x3b, 0x0b,
|
||||
0xf5, 0xb1, 0x87, 0x0e,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37, 0x28, 0x0b, 0xc8, 0xd3, 0xe2, 0x88, 0x5d, 0xf5, 0xbd, 0x1b, 0x24, 0x1d, 0x78, 0x8c,
|
||||
0x57, 0x63, 0x4f, 0x1d, 0xde, 0x4e, 0x02, 0xef, 0xca, 0x8e, 0xd1, 0x69, 0xac, 0x48, 0xaf, 0x47,
|
||||
0x99, 0xe9, 0x2c, 0xf0, 0xae, 0xfa, 0xe8, 0x90, 0xa7, 0x50, 0x8d, 0x31, 0xf2, 0x98, 0x6f, 0x07,
|
||||
0xc9, 0x68, 0x80, 0x51, 0x63, 0xb5, 0x65, 0xb4, 0x4b, 0xb4, 0xa2, 0x94, 0xc7, 0x52, 0x47, 0x7a,
|
||||
0x50, 0x60, 0x8e, 0xd8, 0xd5, 0x28, 0xb4, 0x8c, 0x76, 0x6d, 0x7f, 0xaf, 0x73, 0xbf, 0x31, 0x9d,
|
||||
0x79, 0xe0, 0x76, 0x0e, 0xe4, 0x46, 0xaa, 0x03, 0x90, 0x36, 0xd4, 0x9d, 0x08, 0x19, 0x47, 0x37,
|
||||
0x2b, 0xae, 0x28, 0x8b, 0xab, 0x69, 0xbd, 0xae, 0xcc, 0xea, 0x41, 0x41, 0xed, 0x25, 0x45, 0xc8,
|
||||
0x9f, 0x9c, 0x9d, 0xd6, 0x73, 0x62, 0xf1, 0xe6, 0xe8, 0xb4, 0x6e, 0x90, 0x2a, 0x94, 0xde, 0x1c,
|
||||
0x9d, 0xda, 0x07, 0x67, 0xdd, 0xde, 0x69, 0xdd, 0x24, 0x35, 0x00, 0x21, 0xd2, 0xa3, 0x93, 0x83,
|
||||
0x1e, 0xad, 0xe7, 0x85, 0x7c, 0x72, 0x96, 0xca, 0x2b, 0xd6, 0xcf, 0x26, 0x6c, 0x52, 0x0c, 0xf8,
|
||||
0xc3, 0xb6, 0xff, 0x17, 0x43, 0xb7, 0xff, 0x0c, 0xea, 0x63, 0x01, 0x87, 0xcd, 0xd2, 0x24, 0x92,
|
||||
0x02, 0xe5, 0xfd, 0x17, 0xff, 0x1f, 0x38, 0xba, 0x2e, 0x63, 0xdc, 0xad, 0x93, 0x87, 0x9c, 0xf9,
|
||||
0xb2, 0x9a, 0x3c, 0x55, 0x02, 0xf9, 0x1a, 0xd6, 0x45, 0x38, 0x36, 0x44, 0x5b, 0xdc, 0x0d, 0x41,
|
||||
0x9f, 0xfc, 0x4c, 0xfa, 0x54, 0xb5, 0x9b, 0x14, 0x5d, 0xeb, 0x2f, 0x13, 0xe0, 0x44, 0x14, 0xd3,
|
||||
0x17, 0xc5, 0x90, 0x1f, 0x60, 0x63, 0x30, 0x29, 0x62, 0xba, 0xee, 0x97, 0xd3, 0x75, 0xcf, 0xc5,
|
||||
0x93, 0x3e, 0x1e, 0xcc, 0x00, 0xf9, 0x08, 0x40, 0x86, 0xb0, 0x25, 0x6c, 0xa6, 0x8c, 0xfa, 0x7c,
|
||||
0x06, 0x1a, 0x69, 0x45, 0x6a, 0x29, 0xf0, 0xa4, 0xa5, 0xf1, 0x64, 0x49, 0x8e, 0xa0, 0xca, 0x12,
|
||||
0x7e, 0x11, 0x46, 0xde, 0x8d, 0xaa, 0x2f, 0x2f, 0x23, 0xed, 0x4c, 0x47, 0xea, 0x7b, 0xc3, 0x00,
|
||||
0xdd, 0xef, 0x30, 0x8e, 0xd9, 0x10, 0xe9, 0xdd, 0x5d, 0x4d, 0x84, 0x52, 0x1a, 0x9e, 0xd4, 0xc0,
|
||||
0xd4, 0x77, 0xb4, 0x44, 0x4d, 0xcf, 0x9d, 0x77, 0x85, 0xcc, 0x79, 0x57, 0xa8, 0x01, 0x45, 0x27,
|
||||
0x0c, 0x38, 0x06, 0x5c, 0xd3, 0x61, 0x22, 0x5a, 0xef, 0xa1, 0x28, 0xd3, 0xf4, 0xdc, 0xa9, 0x24,
|
||||
0x53, 0x07, 0x31, 0x3f, 0xe5, 0x20, 0xd6, 0x08, 0x2a, 0x0a, 0xb2, 0x64, 0x34, 0x62, 0xd1, 0xf5,
|
||||
0x54, 0x9a, 0xad, 0x09, 0xec, 0xf2, 0xad, 0x50, 0x47, 0x50, 0x70, 0x2e, 0x7a, 0x2d, 0xf2, 0x73,
|
||||
0x8e, 0x6a, 0xfd, 0x61, 0x42, 0x4d, 0xe6, 0xa3, 0xc8, 0x23, 0x0f, 0x2f, 0x99, 0xff, 0xe0, 0xc4,
|
||||
0xe9, 0xcd, 0x20, 0xce, 0x8b, 0x39, 0xc4, 0x49, 0xab, 0x7a, 0x50, 0xf2, 0xd0, 0x45, 0xe4, 0x59,
|
||||
0x02, 0xf8, 0x67, 0x50, 0x08, 0xcf, 0xcf, 0x63, 0xe4, 0x1a, 0x63, 0x2d, 0x59, 0x6f, 0x61, 0xe3,
|
||||
0xee, 0x09, 0xfa, 0x3c, 0x42, 0x36, 0xba, 0x17, 0xce, 0xb8, 0x1f, 0xee, 0x16, 0xf5, 0xcc, 0xbb,
|
||||
0xd4, 0x73, 0xa1, 0xac, 0x8a, 0x44, 0x1f, 0x39, 0x2e, 0xa7, 0xdf, 0x27, 0x41, 0x61, 0x75, 0x80,
|
||||
0xdc, 0xca, 0x32, 0x21, 0x61, 0x03, 0x8a, 0x23, 0xe5, 0xaf, 0x33, 0x4e, 0x44, 0xeb, 0x14, 0x1e,
|
||||
0x65, 0x37, 0x7c, 0xa9, 0x3b, 0x79, 0x06, 0x35, 0xf9, 0xc8, 0xd9, 0x11, 0x3a, 0xe8, 0x5d, 0xa2,
|
||||
0xab, 0x01, 0xad, 0x4a, 0x2d, 0xd5, 0x4a, 0x0b, 0x60, 0xad, 0xcf, 0x19, 0x8f, 0x29, 0xfe, 0x68,
|
||||
0xfd, 0x6a, 0x40, 0x59, 0x08, 0x93, 0xe0, 0x5b, 0x00, 0x49, 0x8c, 0xae, 0x1d, 0x8f, 0x99, 0x93,
|
||||
0x02, 0x28, 0x34, 0x7d, 0xa1, 0x20, 0x5f, 0xc2, 0x3a, 0xbb, 0x64, 0x9e, 0xcf, 0x06, 0x3e, 0x6a,
|
||||
0x1f, 0x95, 0xa2, 0x96, 0xaa, 0x95, 0xe3, 0x33, 0xa8, 0xc9, 0x38, 0x29, 0x45, 0x75, 0x03, 0xab,
|
||||
0x42, 0x9b, 0x92, 0x99, 0xec, 0xc2, 0xe3, 0x2c, 0x5e, 0xe6, 0xab, 0xc6, 0x2f, 0x49, 0x4d, 0xe9,
|
||||
0x06, 0xeb, 0x3d, 0x54, 0xef, 0x20, 0x9c, 0x4e, 0x16, 0x23, 0x9b, 0x2c, 0x4b, 0x66, 0x91, 0xe0,
|
||||
0x48, 0x32, 0xf0, 0x3d, 0xc7, 0xfe, 0x80, 0xd7, 0xfa, 0x09, 0x2a, 0x29, 0xcd, 0xb7, 0x78, 0x6d,
|
||||
0xd5, 0xa0, 0xd2, 0x65, 0xf1, 0xc5, 0x20, 0x64, 0x91, 0x2b, 0x10, 0xfa, 0xc7, 0x80, 0x5a, 0xaa,
|
||||
0x90, 0xb8, 0x91, 0xcf, 0xa1, 0x38, 0x99, 0x1d, 0xaa, 0x03, 0x85, 0x40, 0x0e, 0x09, 0xf2, 0x15,
|
||||
0xd4, 0xa5, 0xc1, 0x09, 0x83, 0x00, 0xe5, 0x30, 0x8e, 0x35, 0x3e, 0xeb, 0x42, 0xff, 0x4d, 0xa6,
|
||||
0x16, 0x5d, 0x64, 0xae, 0x1b, 0x61, 0x1c, 0xcb, 0x12, 0x4a, 0x74, 0x22, 0x92, 0xd7, 0xb0, 0x1a,
|
||||
0x8b, 0x34, 0x12, 0x85, 0xf2, 0xfe, 0xd6, 0x0c, 0x8e, 0x65, 0x0d, 0xa3, 0xca, 0x97, 0x6c, 0x03,
|
||||
0x64, 0x49, 0xe5, 0xa7, 0x64, 0x8d, 0xde, 0xd2, 0x90, 0x3d, 0x28, 0x24, 0x63, 0xee, 0x8d, 0x50,
|
||||
0x7e, 0x49, 0xca, 0xfb, 0x9b, 0x1d, 0xf5, 0x03, 0xec, 0x4c, 0x7e, 0x80, 0x9d, 0xae, 0xfe, 0x01,
|
||||
0x52, 0xed, 0xb8, 0xff, 0x77, 0x1e, 0xea, 0x19, 0xfb, 0xa8, 0x4c, 0x4d, 0xba, 0xb0, 0x2a, 0x75,
|
||||
0x64, 0x73, 0xce, 0x9b, 0xd2, 0x73, 0x9b, 0xdb, 0xf3, 0xe6, 0x94, 0x2a, 0xd9, 0xca, 0x91, 0x77,
|
||||
0xb0, 0xa6, 0x6f, 0x2e, 0x92, 0xd6, 0xb2, 0xc7, 0xa9, 0xf9, 0x7c, 0x99, 0x87, 0xba, 0xfc, 0x56,
|
||||
0xae, 0x6d, 0xbc, 0x32, 0xc8, 0x31, 0xac, 0xaa, 0x11, 0xfd, 0x64, 0xd1, 0xb8, 0x6c, 0x3e, 0x5d,
|
||||
0x64, 0x4d, 0x2b, 0x6d, 0x1b, 0xe4, 0x2d, 0x14, 0xf4, 0xa3, 0xb0, 0x35, 0x67, 0x8b, 0x32, 0x37,
|
||||
0xbf, 0x58, 0x68, 0xce, 0x0e, 0xdf, 0x15, 0x05, 0x8a, 0x9e, 0x35, 0x67, 0x77, 0x56, 0xdc, 0xcb,
|
||||
0xe6, 0xe2, 0xae, 0x5b, 0x39, 0xf2, 0x3d, 0x94, 0x52, 0x56, 0x92, 0x19, 0x88, 0xdf, 0xe6, 0x70,
|
||||
0xb3, 0xb5, 0xc0, 0x2e, 0x53, 0x5a, 0xb9, 0x57, 0xc6, 0xe1, 0xca, 0x3b, 0x73, 0x3c, 0x18, 0x14,
|
||||
0x24, 0x23, 0x5e, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xc4, 0x7c, 0xff, 0x5a, 0x5f, 0x0c, 0x00,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcb, 0x6e, 0xdb, 0x46,
|
||||
0x14, 0x15, 0xf5, 0xd6, 0xd5, 0xc3, 0xca, 0xc4, 0x68, 0x65, 0x21, 0x8e, 0x55, 0xa6, 0x49, 0x55,
|
||||
0x07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xbc, 0x18, 0x03,
|
||||
0xdd, 0x92, 0x91, 0xe6, 0x82, 0x6f, 0x43, 0x81, 0x7b, 0x9c, 0x39, 0x72, 0x58, 0x39, 0xaa, 0x0c,
|
||||
0xf2, 0x0d, 0x6c, 0x89, 0xa0, 0x6c, 0x82, 0x86, 0xeb, 0x59, 0x72, 0xf8, 0xb9, 0x95, 0xc3, 0xac,
|
||||
0x47, 0x6e, 0xd2, 0xb4, 0xd2, 0xe6, 0xf3, 0x6b, 0x9b, 0x2f, 0x2c, 0x36, 0xff, 0x77, 0x16, 0xe0,
|
||||
0x54, 0xb4, 0x31, 0x12, 0x6d, 0x90, 0x9f, 0x61, 0x7b, 0x1c, 0x97, 0xbf, 0xdc, 0xf1, 0xf3, 0xe5,
|
||||
0x8e, 0xd7, 0x12, 0x47, 0x1f, 0x8e, 0x57, 0xb0, 0x79, 0x0c, 0x20, 0x43, 0x18, 0x16, 0xe3, 0x4c,
|
||||
0x76, 0x5d, 0xed, 0x3f, 0x5b, 0xc1, 0x63, 0x52, 0x91, 0xfa, 0x1c, 0x30, 0xce, 0x68, 0x65, 0x16,
|
||||
0x7f, 0x92, 0x63, 0xa8, 0xb3, 0x90, 0x5f, 0x7a, 0xbe, 0x7d, 0xab, 0xea, 0xcb, 0xc9, 0x48, 0x7b,
|
||||
0xcb, 0x91, 0x46, 0xf6, 0xc4, 0x45, 0xeb, 0x07, 0x0c, 0x02, 0x36, 0x41, 0x7a, 0xf7, 0xaf, 0x36,
|
||||
0x42, 0x25, 0x09, 0x4f, 0x1a, 0x90, 0x8d, 0x76, 0x59, 0x85, 0x66, 0x6d, 0x6b, 0xdd, 0x26, 0xc8,
|
||||
0xae, 0xdb, 0x04, 0x2d, 0x28, 0x99, 0x9e, 0xcb, 0xd1, 0xe5, 0x6a, 0x5a, 0x34, 0x36, 0xf5, 0x77,
|
||||
0x50, 0x92, 0x69, 0x86, 0xd6, 0x52, 0x92, 0xa5, 0x46, 0xb2, 0x1f, 0xd3, 0x88, 0x3e, 0x85, 0x9a,
|
||||
0xa2, 0x2c, 0x9c, 0x4e, 0x99, 0x7f, 0xb3, 0x94, 0x66, 0x37, 0xa6, 0x5d, 0xee, 0x76, 0xd5, 0x82,
|
||||
0xa2, 0x73, 0xd3, 0x7e, 0xcf, 0xad, 0x69, 0x55, 0xff, 0x33, 0x0b, 0x0d, 0x99, 0x8f, 0x22, 0xf7,
|
||||
0x6d, 0xbc, 0x62, 0xce, 0x27, 0x17, 0xce, 0x70, 0x85, 0x70, 0xf6, 0xd7, 0x08, 0x27, 0xa9, 0xea,
|
||||
0x93, 0x8a, 0x87, 0x6e, 0x12, 0xcf, 0x3d, 0x84, 0x7f, 0x06, 0x45, 0xef, 0xe2, 0x22, 0x40, 0x1e,
|
||||
0x71, 0x1c, 0x59, 0xfa, 0x1b, 0xd8, 0xbe, 0xdb, 0xc1, 0x88, 0xfb, 0xc8, 0xa6, 0x0b, 0xe1, 0xb4,
|
||||
0xc5, 0x70, 0x73, 0xd2, 0xcb, 0xde, 0x95, 0x9e, 0x05, 0x55, 0x55, 0x24, 0x3a, 0xc8, 0xf1, 0x7e,
|
||||
0xf9, 0x7d, 0x14, 0x15, 0x7a, 0x0f, 0xc8, 0x5c, 0x96, 0x58, 0x84, 0x2d, 0x28, 0x4d, 0x95, 0x7f,
|
||||
0x94, 0x31, 0x36, 0xf5, 0x33, 0x78, 0x90, 0xee, 0xf0, 0x7b, 0xdd, 0xc9, 0x53, 0x68, 0xc8, 0x83,
|
||||
0xd1, 0xf0, 0xd1, 0x44, 0xfb, 0x0a, 0xad, 0x88, 0xd0, 0xba, 0x44, 0x69, 0x04, 0xea, 0x00, 0xe5,
|
||||
0x11, 0x67, 0x3c, 0xa0, 0xf8, 0x8b, 0xfe, 0xbb, 0x06, 0x55, 0x61, 0xc4, 0xc1, 0x77, 0x01, 0xc2,
|
||||
0x00, 0x2d, 0x23, 0x98, 0x31, 0x33, 0x21, 0x50, 0x20, 0x23, 0x01, 0x90, 0xaf, 0x60, 0x8b, 0x5d,
|
||||
0x31, 0xdb, 0x61, 0x63, 0x07, 0x23, 0x1f, 0x95, 0xa2, 0x91, 0xc0, 0xca, 0xf1, 0x29, 0x34, 0x64,
|
||||
0x9c, 0x44, 0xa2, 0xd1, 0x00, 0xeb, 0x02, 0x4d, 0xc4, 0x4c, 0x0e, 0xe0, 0x61, 0x1a, 0x2f, 0xf5,
|
||||
0x55, 0x17, 0x28, 0x49, 0x96, 0x92, 0x1f, 0xf4, 0x77, 0x50, 0xbf, 0xc3, 0x30, 0x21, 0x90, 0x97,
|
||||
0x4a, 0x97, 0xb7, 0x3e, 0x95, 0xdf, 0x77, 0x4f, 0xf2, 0xec, 0xc2, 0x49, 0x2e, 0x35, 0x12, 0x8e,
|
||||
0x1d, 0xdb, 0x34, 0xde, 0xe3, 0x4d, 0x74, 0x04, 0x55, 0x14, 0xf2, 0x3d, 0xde, 0xe8, 0x0d, 0xa8,
|
||||
0x0d, 0x58, 0x70, 0x39, 0xf6, 0x98, 0x6f, 0x09, 0x86, 0xfe, 0xd5, 0xa0, 0x91, 0x00, 0x92, 0x37,
|
||||
0xf2, 0x39, 0x94, 0xe2, 0xfb, 0x46, 0x4d, 0xa0, 0xe8, 0xaa, 0x8b, 0xe5, 0x6b, 0x68, 0xca, 0x05,
|
||||
0xd3, 0x73, 0x5d, 0x94, 0x57, 0x72, 0x10, 0xf1, 0xb3, 0x25, 0xf0, 0xef, 0x52, 0x58, 0x4c, 0x91,
|
||||
0x59, 0x96, 0x8f, 0x41, 0x20, 0x4b, 0xa8, 0xd0, 0xd8, 0x24, 0xaf, 0xa0, 0x10, 0x88, 0x34, 0x92,
|
||||
0x85, 0x6a, 0x7f, 0x77, 0x85, 0xc6, 0xd2, 0x81, 0x51, 0xe5, 0x4b, 0x1e, 0x03, 0xa4, 0x49, 0xe5,
|
||||
0xed, 0x55, 0xa6, 0x73, 0x08, 0x79, 0x09, 0xc5, 0x70, 0xc6, 0xed, 0x29, 0xca, 0x47, 0x45, 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0x59, 0xc1, 0xf8, 0xfc, 0xbe, 0x68,
|
||||
0x77, 0x36, 0xac, 0xcb, 0x94, 0x7a, 0xe6, 0x85, 0x76, 0x94, 0x7f, 0x9b, 0x9d, 0x8d, 0xc7, 0x45,
|
||||
0xa9, 0xb2, 0x57, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x2e, 0xc8, 0x8f, 0x18, 0x0c, 0x00,
|
||||
0x00,
|
||||
}
|
||||
|
@ -6,59 +6,46 @@ option go_package = "pb";
|
||||
|
||||
package piecestoreroutes;
|
||||
|
||||
import "node.proto";
|
||||
import "gogo.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
service PieceStoreRoutes {
|
||||
rpc Piece(PieceId) returns (PieceSummary) {}
|
||||
|
||||
rpc Retrieve(stream PieceRetrieval) returns (stream PieceRetrievalStream) {}
|
||||
|
||||
rpc Store(stream PieceStore) returns (PieceStoreSummary) {}
|
||||
|
||||
rpc Delete(PieceDelete) returns (PieceDeleteSummary) {}
|
||||
|
||||
rpc Stats(StatsReq) returns (StatSummary) {}
|
||||
|
||||
rpc Dashboard(DashboardReq) returns (stream DashboardStats) {}
|
||||
}
|
||||
|
||||
message PayerBandwidthAllocation { // Payer refers to satellite
|
||||
|
||||
enum Action {
|
||||
enum BandwidthAction {
|
||||
PUT = 0;
|
||||
GET = 1;
|
||||
GET_AUDIT = 2;
|
||||
GET_REPAIR = 3;
|
||||
PUT_REPAIR = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message Data {
|
||||
message PayerBandwidthAllocation { // Payer refers to satellite
|
||||
bytes satellite_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; // Satellite Identity
|
||||
bytes uplink_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; // Uplink Identity
|
||||
int64 max_size = 3; // Max amount of data the satellite will pay for in bytes
|
||||
int64 expiration_unix_sec = 4; // Unix timestamp for when data is no longer being paid for
|
||||
string serial_number = 5; // Unique serial number
|
||||
Action action = 6; // GET or PUT
|
||||
BandwidthAction action = 6; // GET or PUT
|
||||
int64 created_unix_sec = 7; // Unix timestamp for when PayerbandwidthAllocation was created
|
||||
}
|
||||
|
||||
repeated bytes certs = 1; // Satellite certificate chain
|
||||
bytes signature = 2; // Proof that the data was signed by the Satellite
|
||||
bytes data = 3; // Serialization of above Data Struct
|
||||
repeated bytes certs = 8; // Satellite certificate chain
|
||||
bytes signature = 9; // Proof that the data was signed by the Satellite
|
||||
}
|
||||
|
||||
message RenterBandwidthAllocation { // Renter refers to uplink
|
||||
message Data {
|
||||
PayerBandwidthAllocation payer_allocation = 1; // Bandwidth Allocation from Satellite
|
||||
PayerBandwidthAllocation payer_allocation = 1 [(gogoproto.nullable) = false]; // Bandwidth Allocation from Satellite
|
||||
int64 total = 2; // Total Bytes Stored
|
||||
bytes storage_node_id = 3 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; // Storage Node Identity
|
||||
}
|
||||
|
||||
repeated bytes certs = 1; // Uplink certificate chain
|
||||
bytes signature = 2; // Proof that the data was signed by the Uplink
|
||||
bytes data = 3; // Serialization of above Data Struct
|
||||
repeated bytes certs = 4; // Uplink certificate chain
|
||||
bytes signature = 5; // Proof that the data was signed by the Uplink
|
||||
}
|
||||
|
||||
message PieceStore {
|
||||
|
@ -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_a17404d4c37610e8, []int{0, 0}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []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_a17404d4c37610e8, []int{3, 0}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []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_a17404d4c37610e8, []int{0}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []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_a17404d4c37610e8, []int{1}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []int{1}
|
||||
}
|
||||
func (m *RemotePiece) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_RemotePiece.Unmarshal(m, b)
|
||||
@ -187,10 +187,10 @@ func (m *RemotePiece) GetPieceNum() int32 {
|
||||
}
|
||||
|
||||
type RemoteSegment struct {
|
||||
Redundancy *RedundancyScheme `protobuf:"bytes,1,opt,name=redundancy" json:"redundancy,omitempty"`
|
||||
Redundancy *RedundancyScheme `protobuf:"bytes,1,opt,name=redundancy,proto3" json:"redundancy,omitempty"`
|
||||
// TODO: may want to use customtype and fixed-length byte slice
|
||||
PieceId string `protobuf:"bytes,2,opt,name=piece_id,json=pieceId,proto3" json:"piece_id,omitempty"`
|
||||
RemotePieces []*RemotePiece `protobuf:"bytes,3,rep,name=remote_pieces,json=remotePieces" json:"remote_pieces,omitempty"`
|
||||
RemotePieces []*RemotePiece `protobuf:"bytes,3,rep,name=remote_pieces,json=remotePieces,proto3" json:"remote_pieces,omitempty"`
|
||||
MerkleRoot []byte `protobuf:"bytes,4,opt,name=merkle_root,json=merkleRoot,proto3" json:"merkle_root,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
@ -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_a17404d4c37610e8, []int{2}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []int{2}
|
||||
}
|
||||
func (m *RemoteSegment) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_RemoteSegment.Unmarshal(m, b)
|
||||
@ -252,10 +252,10 @@ func (m *RemoteSegment) GetMerkleRoot() []byte {
|
||||
type Pointer struct {
|
||||
Type Pointer_DataType `protobuf:"varint,1,opt,name=type,proto3,enum=pointerdb.Pointer_DataType" json:"type,omitempty"`
|
||||
InlineSegment []byte `protobuf:"bytes,3,opt,name=inline_segment,json=inlineSegment,proto3" json:"inline_segment,omitempty"`
|
||||
Remote *RemoteSegment `protobuf:"bytes,4,opt,name=remote" json:"remote,omitempty"`
|
||||
Remote *RemoteSegment `protobuf:"bytes,4,opt,name=remote,proto3" json:"remote,omitempty"`
|
||||
SegmentSize int64 `protobuf:"varint,5,opt,name=segment_size,json=segmentSize,proto3" json:"segment_size,omitempty"`
|
||||
CreationDate *timestamp.Timestamp `protobuf:"bytes,6,opt,name=creation_date,json=creationDate" json:"creation_date,omitempty"`
|
||||
ExpirationDate *timestamp.Timestamp `protobuf:"bytes,7,opt,name=expiration_date,json=expirationDate" json:"expiration_date,omitempty"`
|
||||
CreationDate *timestamp.Timestamp `protobuf:"bytes,6,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"`
|
||||
ExpirationDate *timestamp.Timestamp `protobuf:"bytes,7,opt,name=expiration_date,json=expirationDate,proto3" json:"expiration_date,omitempty"`
|
||||
Metadata []byte `protobuf:"bytes,8,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
@ -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_a17404d4c37610e8, []int{3}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []int{3}
|
||||
}
|
||||
func (m *Pointer) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Pointer.Unmarshal(m, b)
|
||||
@ -338,7 +338,7 @@ func (m *Pointer) GetMetadata() []byte {
|
||||
// PutRequest is a request message for the Put rpc call
|
||||
type PutRequest struct {
|
||||
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
|
||||
Pointer *Pointer `protobuf:"bytes,2,opt,name=pointer" json:"pointer,omitempty"`
|
||||
Pointer *Pointer `protobuf:"bytes,2,opt,name=pointer,proto3" json:"pointer,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -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_a17404d4c37610e8, []int{4}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []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_a17404d4c37610e8, []int{5}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []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_a17404d4c37610e8, []int{6}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []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_a17404d4c37610e8, []int{7}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []int{7}
|
||||
}
|
||||
func (m *PutResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PutResponse.Unmarshal(m, b)
|
||||
@ -533,10 +533,10 @@ var xxx_messageInfo_PutResponse proto.InternalMessageInfo
|
||||
|
||||
// GetResponse is a response message for the Get rpc call
|
||||
type GetResponse struct {
|
||||
Pointer *Pointer `protobuf:"bytes,1,opt,name=pointer" json:"pointer,omitempty"`
|
||||
Nodes []*Node `protobuf:"bytes,2,rep,name=nodes" json:"nodes,omitempty"`
|
||||
Pba *PayerBandwidthAllocation `protobuf:"bytes,3,opt,name=pba" json:"pba,omitempty"`
|
||||
Authorization *SignedMessage `protobuf:"bytes,4,opt,name=authorization" json:"authorization,omitempty"`
|
||||
Pointer *Pointer `protobuf:"bytes,1,opt,name=pointer,proto3" json:"pointer,omitempty"`
|
||||
Nodes []*Node `protobuf:"bytes,2,rep,name=nodes,proto3" json:"nodes,omitempty"`
|
||||
Pba *PayerBandwidthAllocation `protobuf:"bytes,3,opt,name=pba,proto3" json:"pba,omitempty"`
|
||||
Authorization *SignedMessage `protobuf:"bytes,4,opt,name=authorization,proto3" json:"authorization,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -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_a17404d4c37610e8, []int{8}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []int{8}
|
||||
}
|
||||
func (m *GetResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetResponse.Unmarshal(m, b)
|
||||
@ -596,7 +596,7 @@ func (m *GetResponse) GetAuthorization() *SignedMessage {
|
||||
|
||||
// ListResponse is a response message for the List rpc call
|
||||
type ListResponse struct {
|
||||
Items []*ListResponse_Item `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"`
|
||||
Items []*ListResponse_Item `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
|
||||
More bool `protobuf:"varint,2,opt,name=more,proto3" json:"more,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
@ -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_a17404d4c37610e8, []int{9}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []int{9}
|
||||
}
|
||||
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListResponse.Unmarshal(m, b)
|
||||
@ -643,7 +643,7 @@ func (m *ListResponse) GetMore() bool {
|
||||
|
||||
type ListResponse_Item struct {
|
||||
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
|
||||
Pointer *Pointer `protobuf:"bytes,2,opt,name=pointer" json:"pointer,omitempty"`
|
||||
Pointer *Pointer `protobuf:"bytes,2,opt,name=pointer,proto3" json:"pointer,omitempty"`
|
||||
IsPrefix bool `protobuf:"varint,3,opt,name=is_prefix,json=isPrefix,proto3" json:"is_prefix,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
@ -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_a17404d4c37610e8, []int{9, 0}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []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_a17404d4c37610e8, []int{10}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []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_a17404d4c37610e8, []int{11}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []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_a17404d4c37610e8, []int{12}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []int{12}
|
||||
}
|
||||
func (m *IterateRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_IterateRequest.Unmarshal(m, b)
|
||||
@ -828,7 +828,7 @@ func (m *IterateRequest) GetReverse() bool {
|
||||
}
|
||||
|
||||
type PayerBandwidthAllocationRequest struct {
|
||||
Action PayerBandwidthAllocation_Action `protobuf:"varint,1,opt,name=action,proto3,enum=piecestoreroutes.PayerBandwidthAllocation_Action" json:"action,omitempty"`
|
||||
Action BandwidthAction `protobuf:"varint,1,opt,name=action,proto3,enum=piecestoreroutes.BandwidthAction" json:"action,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -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_a17404d4c37610e8, []int{13}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []int{13}
|
||||
}
|
||||
func (m *PayerBandwidthAllocationRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PayerBandwidthAllocationRequest.Unmarshal(m, b)
|
||||
@ -858,15 +858,15 @@ func (m *PayerBandwidthAllocationRequest) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_PayerBandwidthAllocationRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *PayerBandwidthAllocationRequest) GetAction() PayerBandwidthAllocation_Action {
|
||||
func (m *PayerBandwidthAllocationRequest) GetAction() BandwidthAction {
|
||||
if m != nil {
|
||||
return m.Action
|
||||
}
|
||||
return PayerBandwidthAllocation_PUT
|
||||
return BandwidthAction_PUT
|
||||
}
|
||||
|
||||
type PayerBandwidthAllocationResponse struct {
|
||||
Pba *PayerBandwidthAllocation `protobuf:"bytes,1,opt,name=pba" json:"pba,omitempty"`
|
||||
Pba *PayerBandwidthAllocation `protobuf:"bytes,1,opt,name=pba,proto3" json:"pba,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -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_a17404d4c37610e8, []int{14}
|
||||
return fileDescriptor_pointerdb_afdf954a8fe5efcf, []int{14}
|
||||
}
|
||||
func (m *PayerBandwidthAllocationResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PayerBandwidthAllocationResponse.Unmarshal(m, b)
|
||||
@ -1138,77 +1138,77 @@ var _PointerDB_serviceDesc = grpc.ServiceDesc{
|
||||
Metadata: "pointerdb.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("pointerdb.proto", fileDescriptor_pointerdb_a17404d4c37610e8) }
|
||||
func init() { proto.RegisterFile("pointerdb.proto", fileDescriptor_pointerdb_afdf954a8fe5efcf) }
|
||||
|
||||
var fileDescriptor_pointerdb_a17404d4c37610e8 = []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,
|
||||
0xd2, 0x56, 0x5b, 0x30, 0x95, 0x90, 0x28, 0x08, 0x35, 0x24, 0x54, 0x96, 0xda, 0x10, 0x8d, 0x73,
|
||||
0xc5, 0xcd, 0x32, 0xf1, 0x1e, 0xdb, 0x23, 0xbc, 0x1f, 0x9d, 0x99, 0x2d, 0x4d, 0xff, 0x09, 0xff,
|
||||
0x84, 0x1b, 0x2e, 0x91, 0xf8, 0x0d, 0x5c, 0xf4, 0x02, 0xf1, 0x33, 0xb8, 0x40, 0xf3, 0xb1, 0xf6,
|
||||
0xba, 0x21, 0x69, 0x05, 0x37, 0xc9, 0x9e, 0x73, 0x9e, 0x73, 0xe6, 0x9c, 0xf3, 0x3c, 0x33, 0x86,
|
||||
0xab, 0x79, 0xc6, 0x53, 0x85, 0x22, 0x3e, 0x0d, 0x73, 0x91, 0xa9, 0x8c, 0x74, 0x57, 0x8e, 0xe1,
|
||||
0xee, 0x3c, 0xcb, 0xe6, 0x4b, 0xbc, 0x6f, 0x02, 0xa7, 0xc5, 0xec, 0xbe, 0xe2, 0x09, 0x4a, 0xc5,
|
||||
0x92, 0xdc, 0x62, 0x87, 0x30, 0xcf, 0xe6, 0x59, 0xf9, 0x9d, 0x66, 0x31, 0xba, 0xef, 0x41, 0xce,
|
||||
0x71, 0x8a, 0x52, 0x65, 0xc2, 0x79, 0x82, 0x9f, 0xea, 0x30, 0xa0, 0x18, 0x17, 0x69, 0xcc, 0xd2,
|
||||
0xe9, 0xd9, 0x64, 0xba, 0xc0, 0x04, 0xc9, 0xe7, 0xd0, 0x54, 0x67, 0x39, 0xfa, 0xb5, 0xbd, 0xda,
|
||||
0xed, 0xed, 0xd1, 0x07, 0xe1, 0xba, 0x95, 0xd7, 0xa1, 0xa1, 0xfd, 0x77, 0x72, 0x96, 0x23, 0x35,
|
||||
0x39, 0xe4, 0x3a, 0x74, 0x12, 0x9e, 0x46, 0x02, 0x9f, 0xf9, 0xf5, 0xbd, 0xda, 0xed, 0x16, 0x6d,
|
||||
0x27, 0x3c, 0xa5, 0xf8, 0x8c, 0x5c, 0x83, 0x96, 0xca, 0x14, 0x5b, 0xfa, 0x0d, 0xe3, 0xb6, 0x06,
|
||||
0xf9, 0x08, 0x06, 0x02, 0x73, 0xc6, 0x45, 0xa4, 0x16, 0x02, 0xe5, 0x22, 0x5b, 0xc6, 0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, 0x38, 0xa8, 0x05, 0x47,
|
||||
0x00, 0xc7, 0x85, 0xa2, 0xf8, 0xac, 0x40, 0xa9, 0x08, 0x81, 0x66, 0xce, 0xd4, 0xc2, 0x10, 0xd0,
|
||||
0xa5, 0xe6, 0x9b, 0xdc, 0x83, 0x8e, 0xdb, 0x96, 0x11, 0x86, 0x37, 0x22, 0xe7, 0x79, 0xa1, 0x25,
|
||||
0x24, 0xd8, 0x03, 0x78, 0x8c, 0x97, 0xd5, 0x0b, 0x7e, 0xae, 0x81, 0xf7, 0x84, 0xcb, 0x15, 0x66,
|
||||
0x07, 0xda, 0xb9, 0xc0, 0x19, 0x7f, 0xe1, 0x50, 0xce, 0xd2, 0xca, 0x91, 0x8a, 0x09, 0x15, 0xb1,
|
||||
0x59, 0x79, 0x76, 0x97, 0x82, 0x71, 0x3d, 0xd2, 0x1e, 0xf2, 0x0e, 0x00, 0xa6, 0x71, 0x74, 0x8a,
|
||||
0xb3, 0x4c, 0xa0, 0x21, 0xbe, 0x4b, 0xbb, 0x98, 0xc6, 0xfb, 0xc6, 0x41, 0x6e, 0x41, 0x57, 0xe0,
|
||||
0xb4, 0x10, 0x92, 0x3f, 0xb7, 0xbc, 0x6f, 0xd1, 0xb5, 0x43, 0xbf, 0x22, 0x4b, 0x9e, 0x70, 0xe5,
|
||||
0x2e, 0xbe, 0x35, 0x74, 0x49, 0xbd, 0xbd, 0x68, 0xb6, 0x64, 0x73, 0x69, 0x08, 0xed, 0xd0, 0xae,
|
||||
0xf6, 0x7c, 0xa3, 0x1d, 0x41, 0x1f, 0x3c, 0xb3, 0x2c, 0x99, 0x67, 0xa9, 0xc4, 0xe0, 0x8f, 0x1a,
|
||||
0x78, 0x66, 0x58, 0x6b, 0x57, 0x37, 0x55, 0x7b, 0xe3, 0xa6, 0xc8, 0x1e, 0xb4, 0xf4, 0x55, 0x96,
|
||||
0x7e, 0xdd, 0x5c, 0x27, 0x08, 0xcd, 0xfb, 0xaa, 0x6f, 0x39, 0xb5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 0x88, 0x31, 0x83, 0x25, 0xec, 0x5e, 0x48,
|
||||
0xa9, 0x6b, 0x62, 0x0c, 0x6d, 0x36, 0x35, 0x6c, 0xda, 0x37, 0xf2, 0x93, 0xb7, 0x57, 0x45, 0xf8,
|
||||
0xc8, 0x24, 0x52, 0x57, 0x20, 0xf8, 0x1e, 0xf6, 0x2e, 0x3e, 0xcd, 0x71, 0xed, 0x14, 0x58, 0xfb,
|
||||
0x57, 0x0a, 0x1c, 0xfd, 0x59, 0x87, 0xae, 0x23, 0xeb, 0x60, 0x9f, 0x3c, 0x80, 0xc6, 0x71, 0xa1,
|
||||
0xc8, 0xff, 0xab, 0x4c, 0xae, 0x5e, 0x9e, 0xe1, 0xce, 0xeb, 0x6e, 0xd7, 0xc1, 0x03, 0x68, 0x3c,
|
||||
0xc6, 0xcd, 0xac, 0xf5, 0xfb, 0xb2, 0x91, 0x55, 0xbd, 0x89, 0x9f, 0x41, 0x53, 0x6b, 0x91, 0xec,
|
||||
0x9c, 0x13, 0xa7, 0xcd, 0xbb, 0x7e, 0x81, 0x68, 0xc9, 0x97, 0xd0, 0xb6, 0x42, 0x20, 0xd5, 0xdf,
|
||||
0x88, 0x0d, 0x01, 0x0d, 0x6f, 0xfc, 0x43, 0xc4, 0xa5, 0x4b, 0xf0, 0x2f, 0x5a, 0x09, 0xb9, 0x53,
|
||||
0x9d, 0xf0, 0x72, 0x9a, 0x87, 0x77, 0xdf, 0x0a, 0x6b, 0x0f, 0xdd, 0x6f, 0x7e, 0x57, 0xcf, 0x4f,
|
||||
0x4f, 0xdb, 0xe6, 0xc7, 0xe2, 0xd3, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xfa, 0x56, 0x48, 0xf9,
|
||||
0xf0, 0x09, 0x00, 0x00,
|
||||
var fileDescriptor_pointerdb_afdf954a8fe5efcf = []byte{
|
||||
// 1090 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x5f, 0x6f, 0x1b, 0x45,
|
||||
0x10, 0xaf, 0xff, 0xc7, 0x73, 0x76, 0x6a, 0x56, 0x25, 0xbd, 0xba, 0x45, 0x49, 0x0f, 0x01, 0xa5,
|
||||
0xad, 0x5c, 0x64, 0x2a, 0x21, 0x28, 0x08, 0x35, 0x24, 0x54, 0x96, 0xda, 0x10, 0xad, 0xf3, 0x84,
|
||||
0x90, 0x8e, 0xb5, 0x6f, 0x6c, 0xaf, 0xf0, 0xfd, 0xe9, 0xee, 0x5e, 0x69, 0xf2, 0x4d, 0xf8, 0x26,
|
||||
0xbc, 0xf0, 0x88, 0xc4, 0x67, 0xe0, 0xa1, 0x0f, 0x88, 0x8f, 0xc1, 0x03, 0xda, 0x3f, 0x67, 0x9f,
|
||||
0x1b, 0x92, 0x22, 0x78, 0x49, 0x6e, 0x66, 0x7e, 0x33, 0x3b, 0x33, 0xbf, 0xdf, 0xae, 0xe1, 0x6a,
|
||||
0x96, 0xf2, 0x44, 0xa1, 0x88, 0x26, 0x83, 0x4c, 0xa4, 0x2a, 0x25, 0xed, 0x95, 0xa3, 0xbf, 0x3b,
|
||||
0x4f, 0xd3, 0xf9, 0x12, 0x1f, 0x98, 0xc0, 0x24, 0x9f, 0x3d, 0x50, 0x3c, 0x46, 0xa9, 0x58, 0x9c,
|
||||
0x59, 0x6c, 0x1f, 0xe6, 0xe9, 0x3c, 0x2d, 0xbe, 0x93, 0x34, 0x42, 0xf7, 0xdd, 0xcb, 0x38, 0x4e,
|
||||
0x51, 0xaa, 0x54, 0x38, 0x4f, 0xf0, 0x53, 0x15, 0x7a, 0x14, 0xa3, 0x3c, 0x89, 0x58, 0x32, 0x3d,
|
||||
0x1d, 0x4f, 0x17, 0x18, 0x23, 0xf9, 0x0c, 0xea, 0xea, 0x34, 0x43, 0xbf, 0xb2, 0x57, 0xb9, 0xb3,
|
||||
0x3d, 0x7c, 0x7f, 0xb0, 0x6e, 0xe5, 0x75,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 0xd0, 0xb5, 0x55, 0xc7, 0x38, 0x8f, 0x31, 0x51, 0xe4, 0x11, 0x80, 0x58,
|
||||
0xad, 0xd5, 0x14, 0xf6, 0x86, 0x37, 0x2f, 0xd9, 0x39, 0x2d, 0xc1, 0xc9, 0x0d, 0xb0, 0x3d, 0x14,
|
||||
0x07, 0xb7, 0x69, 0xcb, 0xd8, 0xa3, 0x88, 0x3c, 0x82, 0xae, 0x30, 0x07, 0x85, 0x96, 0x75, 0xbf,
|
||||
0xb6, 0x57, 0xbb, 0xe3, 0x0d, 0x77, 0x36, 0x4a, 0xaf, 0xc6, 0xa3, 0x1d, 0xb1, 0x36, 0x24, 0xd9,
|
||||
0x05, 0x2f, 0x46, 0xf1, 0xc3, 0x12, 0x43, 0x91, 0xa6, 0xca, 0x50, 0xd2, 0xa1, 0x60, 0x5d, 0x34,
|
||||
0x4d, 0x55, 0xf0, 0x57, 0x15, 0x5a, 0xc7, 0xb6, 0x10, 0x79, 0xb0, 0xa1, 0x97, 0x72, 0xef, 0x0e,
|
||||
0x31, 0x38, 0x60, 0x8a, 0x95, 0x44, 0xf2, 0x1e, 0x6c, 0xf3, 0x64, 0xc9, 0x13, 0x0c, 0xa5, 0x5d,
|
||||
0x82, 0x11, 0x45, 0x87, 0x76, 0xad, 0xb7, 0xd8, 0xcc, 0x47, 0xd0, 0xb4, 0x4d, 0x99, 0xf3, 0xbd,
|
||||
0xa1, 0x7f, 0xae, 0x75, 0x87, 0xa4, 0x0e, 0x47, 0x6e, 0x43, 0xc7, 0x55, 0xb4, 0x84, 0x6b, 0x79,
|
||||
0xd4, 0xa8, 0xe7, 0x7c, 0x9a, 0x6b, 0xf2, 0x25, 0x74, 0xa7, 0x02, 0x99, 0xe2, 0x69, 0x12, 0x46,
|
||||
0x4c, 0x59, 0x51, 0x78, 0xc3, 0xfe, 0xc0, 0x5e, 0xaa, 0x41, 0x71, 0xa9, 0x06, 0x27, 0xc5, 0xa5,
|
||||
0xa2, 0x9d, 0x22, 0xe1, 0x80, 0x29, 0x24, 0x5f, 0xc1, 0x55, 0x7c, 0x99, 0x71, 0x51, 0x2a, 0xd1,
|
||||
0x7a, 0x63, 0x89, 0xed, 0x75, 0x8a, 0x29, 0xd2, 0x87, 0xad, 0x18, 0x15, 0x8b, 0x98, 0x62, 0xfe,
|
||||
0x96, 0x99, 0x7d, 0x65, 0x07, 0x01, 0x6c, 0x15, 0xfb, 0x22, 0x00, 0xcd, 0xd1, 0xd1, 0xd3, 0xd1,
|
||||
0xd1, 0x61, 0xef, 0x8a, 0xfe, 0xa6, 0x87, 0xcf, 0xbe, 0x39, 0x39, 0xec, 0x55, 0x82, 0x23, 0x80,
|
||||
0xe3, 0x5c, 0x51, 0x7c, 0x9e, 0xa3, 0x54, 0x84, 0x40, 0x3d, 0x63, 0x6a, 0x61, 0x08, 0x68, 0x53,
|
||||
0xf3, 0x4d, 0xee, 0x43, 0xcb, 0x6d, 0xcb, 0x08, 0xc3, 0x1b, 0x92, 0xf3, 0xbc, 0xd0, 0x02, 0x12,
|
||||
0xec, 0x01, 0x3c, 0xc1, 0xcb, 0xea, 0x05, 0x3f, 0x57, 0xc0, 0x7b, 0xca, 0xe5, 0x0a, 0xb3, 0x03,
|
||||
0xcd, 0x4c, 0xe0, 0x8c, 0xbf, 0x74, 0x28, 0x67, 0x69, 0xe5, 0x48, 0xc5, 0x84, 0x0a, 0xd9, 0xac,
|
||||
0x38, 0xbb, 0x4d, 0xc1, 0xb8, 0x1e, 0x6b, 0x0f, 0x79, 0x07, 0x00, 0x93, 0x28, 0x9c, 0xe0, 0x2c,
|
||||
0x15, 0x68, 0x88, 0x6f, 0xd3, 0x36, 0x26, 0xd1, 0xbe, 0x71, 0x90, 0x5b, 0xd0, 0x16, 0x38, 0xcd,
|
||||
0x85, 0xe4, 0x2f, 0x2c, 0xef, 0x5b, 0x74, 0xed, 0xd0, 0xaf, 0xc8, 0x92, 0xc7, 0x5c, 0xb9, 0x8b,
|
||||
0x6f, 0x0d, 0x5d,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, 0x09,
|
||||
0x2f, 0xa7, 0xb5, 0x7f, 0xef, 0x5f, 0x61, 0xed, 0xa1, 0xfb, 0xf5, 0x6f, 0xab, 0xd9, 0x64, 0xd2,
|
||||
0x34, 0x3f, 0x0e, 0x1f, 0xff, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x68, 0xba, 0x5b, 0xd0, 0xe0, 0x09,
|
||||
0x00, 0x00,
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ message IterateRequest {
|
||||
}
|
||||
|
||||
message PayerBandwidthAllocationRequest {
|
||||
piecestoreroutes.PayerBandwidthAllocation.Action action = 1;
|
||||
piecestoreroutes.BandwidthAction action = 1;
|
||||
}
|
||||
|
||||
message PayerBandwidthAllocationResponse {
|
||||
|
@ -5,19 +5,18 @@ package psclient
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"crypto/ecdsa"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/gtank/cryptopasta"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"storj.io/storj/internal/memory"
|
||||
"storj.io/storj/pkg/auth"
|
||||
"storj.io/storj/pkg/identity"
|
||||
"storj.io/storj/pkg/pb"
|
||||
"storj.io/storj/pkg/ranger"
|
||||
@ -184,14 +183,6 @@ func (ps *PieceStore) Delete(ctx context.Context, id PieceID, authorization *pb.
|
||||
}
|
||||
|
||||
// sign a message using the clients private key
|
||||
func (ps *PieceStore) sign(msg []byte) (signature []byte, err error) {
|
||||
if ps.selfID == nil || ps.selfID.Key == nil {
|
||||
return nil, ClientError.New("failed to sign msg: Private Key not Set")
|
||||
}
|
||||
return cryptopasta.Sign(msg, ps.selfID.Key.(*ecdsa.PrivateKey))
|
||||
}
|
||||
|
||||
//certs returns this uplink's certificates
|
||||
func (ps *PieceStore) certs() [][]byte {
|
||||
return ps.selfID.ChainRaw()
|
||||
func (ps *PieceStore) sign(rba *pb.RenterBandwidthAllocation) (err error) {
|
||||
return auth.SignMessage(rba, *ps.selfID)
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ package psclient
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"storj.io/storj/internal/sync2"
|
||||
"storj.io/storj/pkg/auth"
|
||||
"storj.io/storj/pkg/pb"
|
||||
"storj.io/storj/pkg/utils"
|
||||
)
|
||||
@ -25,38 +25,24 @@ type StreamWriter struct {
|
||||
// Write Piece data to a piece store server upload stream
|
||||
func (s *StreamWriter) Write(b []byte) (int, error) {
|
||||
updatedAllocation := s.totalWritten + int64(len(b))
|
||||
renterBWA := &pb.RenterBandwidthAllocation_Data{
|
||||
PayerAllocation: s.pba,
|
||||
rba := &pb.RenterBandwidthAllocation{
|
||||
PayerAllocation: *s.pba,
|
||||
Total: updatedAllocation,
|
||||
StorageNodeId: s.signer.remoteID,
|
||||
}
|
||||
|
||||
serializedAllocation, err := proto.Marshal(renterBWA)
|
||||
err := auth.SignMessage(rba, *s.signer.selfID)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
sig, err := s.signer.sign(serializedAllocation)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
msg := &pb.PieceStore{
|
||||
PieceData: &pb.PieceStore_PieceData{Content: b},
|
||||
BandwidthAllocation: &pb.RenterBandwidthAllocation{
|
||||
Data: serializedAllocation,
|
||||
Signature: sig,
|
||||
Certs: s.signer.certs(),
|
||||
},
|
||||
BandwidthAllocation: rba,
|
||||
}
|
||||
|
||||
s.totalWritten = updatedAllocation
|
||||
|
||||
// Second we send the actual content
|
||||
if err := s.stream.Send(msg); err != nil {
|
||||
return 0, fmt.Errorf("%v.Send() = %v", s.stream, err)
|
||||
}
|
||||
|
||||
return len(b), nil
|
||||
}
|
||||
|
||||
@ -91,11 +77,9 @@ func NewStreamReader(client *PieceStore, stream pb.PieceStoreRoutes_RetrieveClie
|
||||
stream: stream,
|
||||
size: size,
|
||||
}
|
||||
|
||||
// TODO: make these flag/config-file configurable
|
||||
trustLimit := int64(client.bandwidthMsgSize * 64)
|
||||
sendThreshold := int64(client.bandwidthMsgSize * 8)
|
||||
certs := client.certs()
|
||||
|
||||
// Send signed allocations to the piece store server
|
||||
go func() {
|
||||
@ -108,32 +92,16 @@ func NewStreamReader(client *PieceStore, stream pb.PieceStoreRoutes_RetrieveClie
|
||||
if sr.allocated+trustedSize > size {
|
||||
allocate = size - sr.allocated
|
||||
}
|
||||
|
||||
allocationData := &pb.RenterBandwidthAllocation_Data{
|
||||
PayerAllocation: pba,
|
||||
rba := &pb.RenterBandwidthAllocation{
|
||||
PayerAllocation: *pba,
|
||||
Total: sr.allocated + allocate,
|
||||
StorageNodeId: sr.client.remoteID,
|
||||
}
|
||||
|
||||
serializedAllocation, err := proto.Marshal(allocationData)
|
||||
err := auth.SignMessage(rba, *client.selfID)
|
||||
if err != nil {
|
||||
sr.pendingAllocs.Fail(err)
|
||||
return
|
||||
}
|
||||
|
||||
sig, err := client.sign(serializedAllocation)
|
||||
if err != nil {
|
||||
sr.pendingAllocs.Fail(err)
|
||||
return
|
||||
}
|
||||
|
||||
msg := &pb.PieceRetrieval{
|
||||
BandwidthAllocation: &pb.RenterBandwidthAllocation{
|
||||
Signature: sig,
|
||||
Data: serializedAllocation,
|
||||
Certs: certs,
|
||||
},
|
||||
}
|
||||
msg := &pb.PieceRetrieval{BandwidthAllocation: rba}
|
||||
|
||||
if err = stream.Send(msg); err != nil {
|
||||
sr.pendingAllocs.Fail(err)
|
||||
|
@ -87,12 +87,12 @@ func (as *AgreementSender) sendAgreementsToSatellite(ctx context.Context, satID
|
||||
|
||||
//todo: stop sending these one-by-one, send all at once
|
||||
for _, agreement := range agreements {
|
||||
msg := &pb.RenterBandwidthAllocation{
|
||||
Data: agreement.Agreement,
|
||||
Signature: agreement.Signature,
|
||||
}
|
||||
rba := agreement.Agreement
|
||||
if err != nil {
|
||||
as.log.Warn("Agreementsender failed to deserialize agreement : will delete", zap.Error(err))
|
||||
} else {
|
||||
// Send agreement to satellite
|
||||
r, err := client.BandwidthAgreements(ctx, msg)
|
||||
r, err := client.BandwidthAgreements(ctx, &rba)
|
||||
if err != nil || r.GetStatus() == pb.AgreementsSummary_FAIL {
|
||||
as.log.Warn("Agreementsender failed to send agreement to satellite : will retry", zap.Error(err))
|
||||
continue
|
||||
@ -100,6 +100,7 @@ func (as *AgreementSender) sendAgreementsToSatellite(ctx context.Context, satID
|
||||
//todo: something better than a delete here?
|
||||
as.log.Error("Agreementsender had agreement explicitly rejected by satellite : will delete", zap.Error(err))
|
||||
}
|
||||
}
|
||||
// Delete from PSDB by signature
|
||||
if err = as.DB.DeleteBandwidthAllocationBySignature(agreement.Signature); err != nil {
|
||||
as.log.Error("Agreementsender failed to delete bandwidth allocation", zap.Error(err))
|
||||
|
@ -44,7 +44,7 @@ type DB struct {
|
||||
|
||||
// Agreement is a struct that contains a bandwidth agreement and the associated signature
|
||||
type Agreement struct {
|
||||
Agreement []byte
|
||||
Agreement pb.RenterBandwidthAllocation
|
||||
Signature []byte
|
||||
}
|
||||
|
||||
@ -212,40 +212,33 @@ func (db *DB) garbageCollect(ctx context.Context) {
|
||||
}
|
||||
|
||||
// WriteBandwidthAllocToDB -- Insert bandwidth agreement into DB
|
||||
func (db *DB) WriteBandwidthAllocToDB(ba *pb.RenterBandwidthAllocation) error {
|
||||
func (db *DB) WriteBandwidthAllocToDB(rba *pb.RenterBandwidthAllocation) error {
|
||||
rbaBytes, err := proto.Marshal(rba)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer db.locked()()
|
||||
|
||||
// We begin extracting the satellite_id
|
||||
// The satellite id can be used to sort the bandwidth agreements
|
||||
// If the agreements are sorted we can send them in bulk streams to the satellite
|
||||
rbad := &pb.RenterBandwidthAllocation_Data{}
|
||||
if err := proto.Unmarshal(ba.GetData(), rbad); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pbad := &pb.PayerBandwidthAllocation_Data{}
|
||||
if err := proto.Unmarshal(rbad.GetPayerAllocation().GetData(), pbad); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err := db.DB.Exec(`INSERT INTO bandwidth_agreements (satellite, agreement, signature) VALUES (?, ?, ?)`, pbad.SatelliteId.Bytes(), ba.GetData(), ba.GetSignature())
|
||||
_, err = db.DB.Exec(`INSERT INTO bandwidth_agreements (satellite, agreement, signature) VALUES (?, ?, ?)`,
|
||||
rba.PayerAllocation.SatelliteId.Bytes(), rbaBytes, rba.GetSignature())
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteBandwidthAllocationBySignature finds an allocation by signature and deletes it
|
||||
func (db *DB) DeleteBandwidthAllocationBySignature(signature []byte) error {
|
||||
defer db.locked()()
|
||||
|
||||
_, err := db.DB.Exec(`DELETE FROM bandwidth_agreements WHERE signature=?`, signature)
|
||||
if err == sql.ErrNoRows {
|
||||
err = nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// GetBandwidthAllocationBySignature finds allocation info by signature
|
||||
func (db *DB) GetBandwidthAllocationBySignature(signature []byte) ([][]byte, error) {
|
||||
func (db *DB) GetBandwidthAllocationBySignature(signature []byte) ([]*pb.RenterBandwidthAllocation, error) {
|
||||
defer db.locked()()
|
||||
|
||||
rows, err := db.DB.Query(`SELECT agreement FROM bandwidth_agreements WHERE signature = ?`, signature)
|
||||
@ -258,14 +251,19 @@ func (db *DB) GetBandwidthAllocationBySignature(signature []byte) ([][]byte, err
|
||||
}
|
||||
}()
|
||||
|
||||
agreements := [][]byte{}
|
||||
agreements := []*pb.RenterBandwidthAllocation{}
|
||||
for rows.Next() {
|
||||
var agreement []byte
|
||||
err := rows.Scan(&agreement)
|
||||
var rbaBytes []byte
|
||||
err := rows.Scan(&rbaBytes)
|
||||
if err != nil {
|
||||
return agreements, err
|
||||
}
|
||||
agreements = append(agreements, agreement)
|
||||
rba := &pb.RenterBandwidthAllocation{}
|
||||
err = proto.Unmarshal(rbaBytes, rba)
|
||||
if err != nil {
|
||||
return agreements, err
|
||||
}
|
||||
agreements = append(agreements, rba)
|
||||
}
|
||||
return agreements, nil
|
||||
}
|
||||
@ -286,13 +284,17 @@ func (db *DB) GetBandwidthAllocations() (map[storj.NodeID][]*Agreement, error) {
|
||||
|
||||
agreements := make(map[storj.NodeID][]*Agreement)
|
||||
for rows.Next() {
|
||||
rbaBytes := []byte{}
|
||||
agreement := &Agreement{}
|
||||
var satellite []byte
|
||||
err := rows.Scan(&satellite, &agreement.Agreement, &agreement.Signature)
|
||||
err := rows.Scan(&satellite, &rbaBytes, &agreement.Signature)
|
||||
if err != nil {
|
||||
return agreements, err
|
||||
}
|
||||
err = proto.Unmarshal(rbaBytes, &agreement.Agreement)
|
||||
if err != nil {
|
||||
return agreements, err
|
||||
}
|
||||
|
||||
// if !satellite.Valid {
|
||||
// return agreements, nil
|
||||
// }
|
||||
|
@ -4,7 +4,6 @@
|
||||
package psdb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@ -13,7 +12,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
||||
"storj.io/storj/internal/teststorj"
|
||||
@ -26,8 +24,8 @@ var ctx = context.Background()
|
||||
|
||||
const concurrency = 10
|
||||
|
||||
func newDB(t testing.TB) (*DB, func()) {
|
||||
tmpdir, err := ioutil.TempDir("", "storj-psdb")
|
||||
func newDB(t testing.TB, id string) (*DB, func()) {
|
||||
tmpdir, err := ioutil.TempDir("", "storj-psdb-"+id)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -68,7 +66,7 @@ func TestNewInmemory(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHappyPath(t *testing.T) {
|
||||
db, cleanup := newDB(t)
|
||||
db, cleanup := newDB(t, "1")
|
||||
defer cleanup()
|
||||
|
||||
type TTL struct {
|
||||
@ -145,36 +143,21 @@ func TestHappyPath(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
bandwidthAllocation := func(satelliteID storj.NodeID, total int64) []byte {
|
||||
return serialize(t, &pb.RenterBandwidthAllocation_Data{
|
||||
PayerAllocation: &pb.PayerBandwidthAllocation{
|
||||
Data: serialize(t, &pb.PayerBandwidthAllocation_Data{
|
||||
SatelliteId: satelliteID,
|
||||
}),
|
||||
},
|
||||
bandwidthAllocation := func(signature string, satelliteID storj.NodeID, total int64) *pb.RenterBandwidthAllocation {
|
||||
return &pb.RenterBandwidthAllocation{
|
||||
PayerAllocation: pb.PayerBandwidthAllocation{SatelliteId: satelliteID},
|
||||
Total: total,
|
||||
})
|
||||
Signature: []byte(signature),
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: use better data
|
||||
nodeIDAB := teststorj.NodeIDFromString("AB")
|
||||
allocationTests := []*pb.RenterBandwidthAllocation{
|
||||
{
|
||||
Signature: []byte("signed by test"),
|
||||
Data: bandwidthAllocation(nodeIDAB, 0),
|
||||
},
|
||||
{
|
||||
Signature: []byte("signed by sigma"),
|
||||
Data: bandwidthAllocation(nodeIDAB, 10),
|
||||
},
|
||||
{
|
||||
Signature: []byte("signed by sigma"),
|
||||
Data: bandwidthAllocation(nodeIDAB, 98),
|
||||
},
|
||||
{
|
||||
Signature: []byte("signed by test"),
|
||||
Data: bandwidthAllocation(nodeIDAB, 3),
|
||||
},
|
||||
bandwidthAllocation("signed by test", nodeIDAB, 0),
|
||||
bandwidthAllocation("signed by sigma", nodeIDAB, 10),
|
||||
bandwidthAllocation("signed by sigma", nodeIDAB, 98),
|
||||
bandwidthAllocation("signed by test", nodeIDAB, 3),
|
||||
}
|
||||
|
||||
t.Run("Bandwidth Allocation", func(t *testing.T) {
|
||||
@ -194,7 +177,7 @@ func TestHappyPath(t *testing.T) {
|
||||
|
||||
found := false
|
||||
for _, agreement := range agreements {
|
||||
if bytes.Equal(agreement, test.Data) {
|
||||
if pb.Equal(agreement, test) {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
@ -222,7 +205,7 @@ func TestHappyPath(t *testing.T) {
|
||||
for _, agreements := range agreementGroups {
|
||||
for _, agreement := range agreements {
|
||||
for _, test := range allocationTests {
|
||||
if bytes.Equal(agreement.Agreement, test.Data) {
|
||||
if pb.Equal(&agreement.Agreement, test) {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
@ -239,7 +222,7 @@ func TestHappyPath(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBandwidthUsage(t *testing.T) {
|
||||
db, cleanup := newDB(t)
|
||||
db, cleanup := newDB(t, "2")
|
||||
defer cleanup()
|
||||
|
||||
type BWUSAGE struct {
|
||||
@ -303,32 +286,18 @@ func TestBandwidthUsage(t *testing.T) {
|
||||
}
|
||||
|
||||
func BenchmarkWriteBandwidthAllocation(b *testing.B) {
|
||||
db, cleanup := newDB(b)
|
||||
db, cleanup := newDB(b, "3")
|
||||
defer cleanup()
|
||||
|
||||
const WritesPerLoop = 10
|
||||
|
||||
data := serialize(b, &pb.RenterBandwidthAllocation_Data{
|
||||
PayerAllocation: &pb.PayerBandwidthAllocation{},
|
||||
Total: 156,
|
||||
})
|
||||
|
||||
b.RunParallel(func(b *testing.PB) {
|
||||
for b.Next() {
|
||||
for i := 0; i < WritesPerLoop; i++ {
|
||||
_ = db.WriteBandwidthAllocToDB(&pb.RenterBandwidthAllocation{
|
||||
PayerAllocation: pb.PayerBandwidthAllocation{},
|
||||
Total: 156,
|
||||
Signature: []byte("signed by test"),
|
||||
Data: data,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func serialize(t testing.TB, v proto.Message) []byte {
|
||||
data, err := proto.Marshal(v)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
package psserver
|
||||
|
||||
import (
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
|
||||
"storj.io/storj/pkg/pb"
|
||||
@ -59,42 +58,26 @@ func NewStreamReader(s *Server, stream pb.PieceStoreRoutes_StoreServer, bandwidt
|
||||
}
|
||||
|
||||
pd := recv.GetPieceData()
|
||||
ba := recv.GetBandwidthAllocation()
|
||||
rba := recv.BandwidthAllocation
|
||||
|
||||
if ba != nil {
|
||||
if err = s.verifySignature(stream.Context(), ba); err != nil {
|
||||
if err = s.verifySignature(stream.Context(), rba); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
deserializedData := &pb.RenterBandwidthAllocation_Data{}
|
||||
err = proto.Unmarshal(ba.GetData(), deserializedData)
|
||||
if err != nil {
|
||||
pba := rba.PayerAllocation
|
||||
if err = s.verifyPayerAllocation(&pba, "PUT"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pbaData := &pb.PayerBandwidthAllocation_Data{}
|
||||
if err = proto.Unmarshal(deserializedData.GetPayerAllocation().GetData(), pbaData); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = s.verifyPayerAllocation(pbaData, "PUT"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// if whitelist does not contain PBA satellite ID, reject storage request
|
||||
if len(s.whitelist) != 0 {
|
||||
if !s.approved(pbaData.SatelliteId) {
|
||||
if !s.approved(pba.SatelliteId) {
|
||||
return nil, StoreError.New("Satellite ID not approved")
|
||||
}
|
||||
}
|
||||
|
||||
// Update bandwidthallocation to be stored
|
||||
if deserializedData.GetTotal() > sr.currentTotal {
|
||||
sr.bandwidthAllocation = ba
|
||||
sr.currentTotal = deserializedData.GetTotal()
|
||||
if rba.Total > sr.currentTotal {
|
||||
sr.bandwidthAllocation = rba
|
||||
sr.currentTotal = rba.Total
|
||||
}
|
||||
}
|
||||
|
||||
return pd.GetContent(), nil
|
||||
})
|
||||
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
"os"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
|
||||
@ -126,50 +125,32 @@ func (s *Server) retrieveData(ctx context.Context, stream pb.PieceStoreRoutes_Re
|
||||
allocationTracking.Fail(err)
|
||||
return
|
||||
}
|
||||
|
||||
alloc := recv.GetBandwidthAllocation()
|
||||
allocData := &pb.RenterBandwidthAllocation_Data{}
|
||||
if err = proto.Unmarshal(alloc.GetData(), allocData); err != nil {
|
||||
rba := recv.BandwidthAllocation
|
||||
if err = s.verifySignature(stream.Context(), rba); err != nil {
|
||||
allocationTracking.Fail(err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = s.verifySignature(stream.Context(), alloc); err != nil {
|
||||
pba := rba.PayerAllocation
|
||||
if err = s.verifyPayerAllocation(&pba, "GET"); err != nil {
|
||||
allocationTracking.Fail(err)
|
||||
return
|
||||
}
|
||||
|
||||
if allocData.GetPayerAllocation() == nil {
|
||||
allocationTracking.Fail(StoreError.New("no payer bandwidth allocation"))
|
||||
//todo: figure out why this fails tests
|
||||
// if rba.Total > pba.MaxSize {
|
||||
// allocationTracking.Fail(fmt.Errorf("attempt to send more data than allocation %v got %v", rba.Total, pba.MaxSize))
|
||||
// return
|
||||
// }
|
||||
if lastTotal > rba.Total {
|
||||
allocationTracking.Fail(fmt.Errorf("got lower allocation was %v got %v", lastTotal, rba.Total))
|
||||
return
|
||||
}
|
||||
atomic.StoreInt64(&totalAllocated, rba.Total)
|
||||
if err = allocationTracking.Produce(rba.Total - lastTotal); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
pbaData := &pb.PayerBandwidthAllocation_Data{}
|
||||
if err = proto.Unmarshal(allocData.GetPayerAllocation().GetData(), pbaData); err != nil {
|
||||
allocationTracking.Fail(err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = s.verifyPayerAllocation(pbaData, "GET"); err != nil {
|
||||
allocationTracking.Fail(err)
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: break when lastTotal >= allocData.GetPayer_allocation().GetData().GetMax_size()
|
||||
|
||||
if lastTotal > allocData.GetTotal() {
|
||||
allocationTracking.Fail(fmt.Errorf("got lower allocation was %v got %v", lastTotal, allocData.GetTotal()))
|
||||
return
|
||||
}
|
||||
|
||||
atomic.StoreInt64(&totalAllocated, allocData.GetTotal())
|
||||
|
||||
if err = allocationTracking.Produce(allocData.GetTotal() - lastTotal); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
lastAllocation = alloc
|
||||
lastTotal = allocData.GetTotal()
|
||||
lastAllocation = rba
|
||||
lastTotal = rba.Total
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -288,40 +288,37 @@ func (s *Server) deleteByID(id string) error {
|
||||
|
||||
func (s *Server) verifySignature(ctx context.Context, rba *pb.RenterBandwidthAllocation) error {
|
||||
// TODO(security): detect replay attacks
|
||||
_, pba, pbad, err := rba.Unpack()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pba := rba.PayerAllocation
|
||||
//verify message content
|
||||
pi, err := identity.PeerIdentityFromContext(ctx)
|
||||
if err != nil || pbad.UplinkId != pi.ID {
|
||||
return auth.BadID.New("Uplink Node ID: %s vs %s", pbad.UplinkId, pi.ID)
|
||||
if err != nil || pba.UplinkId != pi.ID {
|
||||
return auth.ErrBadID.New("Uplink Node ID: %s vs %s", pba.UplinkId, pi.ID)
|
||||
}
|
||||
//todo: use whitelist for uplinks?
|
||||
//todo: use whitelist for satellites?
|
||||
switch {
|
||||
case len(pbad.SerialNumber) == 0:
|
||||
return pb.Payer.Wrap(pb.Missing.New("serial"))
|
||||
case pbad.SatelliteId.IsZero():
|
||||
return pb.Payer.Wrap(pb.Missing.New("satellite id"))
|
||||
case pbad.UplinkId.IsZero():
|
||||
return pb.Payer.Wrap(pb.Missing.New("uplink id"))
|
||||
case len(pba.SerialNumber) == 0:
|
||||
return pb.ErrPayer.Wrap(auth.ErrMissing.New("serial"))
|
||||
case pba.SatelliteId.IsZero():
|
||||
return pb.ErrPayer.Wrap(auth.ErrMissing.New("satellite id"))
|
||||
case pba.UplinkId.IsZero():
|
||||
return pb.ErrPayer.Wrap(auth.ErrMissing.New("uplink id"))
|
||||
}
|
||||
exp := time.Unix(pbad.GetExpirationUnixSec(), 0).UTC()
|
||||
exp := time.Unix(pba.GetExpirationUnixSec(), 0).UTC()
|
||||
if exp.Before(time.Now().UTC()) {
|
||||
return pb.Payer.Wrap(auth.Expired.New("%v vs %v", exp, time.Now().UTC()))
|
||||
return pb.ErrPayer.Wrap(auth.ErrExpired.New("%v vs %v", exp, time.Now().UTC()))
|
||||
}
|
||||
//verify message crypto
|
||||
if err := auth.VerifyMsg(rba, pbad.UplinkId); err != nil {
|
||||
return pb.Renter.Wrap(err)
|
||||
if err := auth.VerifyMsg(rba, pba.UplinkId); err != nil {
|
||||
return pb.ErrRenter.Wrap(err)
|
||||
}
|
||||
if err := auth.VerifyMsg(pba, pbad.SatelliteId); err != nil {
|
||||
return pb.Payer.Wrap(err)
|
||||
if err := auth.VerifyMsg(&pba, pba.SatelliteId); err != nil {
|
||||
return pb.ErrPayer.Wrap(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Server) verifyPayerAllocation(pba *pb.PayerBandwidthAllocation_Data, actionPrefix string) (err error) {
|
||||
func (s *Server) verifyPayerAllocation(pba *pb.PayerBandwidthAllocation, actionPrefix string) (err error) {
|
||||
switch {
|
||||
case pba.SatelliteId.IsZero():
|
||||
return StoreError.New("payer bandwidth allocation: missing satellite id")
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap/zaptest"
|
||||
"golang.org/x/net/context"
|
||||
@ -88,35 +88,35 @@ func TestPiece(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run("should return expected PieceSummary values", func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
require := require.New(t)
|
||||
|
||||
// simulate piece TTL entry
|
||||
_, err := s.DB.DB.Exec(fmt.Sprintf(`INSERT INTO ttl (id, created, expires) VALUES ("%s", "%d", "%d")`, tt.id, 1234567890, tt.expiration))
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
|
||||
defer func() {
|
||||
_, err := s.DB.DB.Exec(fmt.Sprintf(`DELETE FROM ttl WHERE id="%s"`, tt.id))
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
}()
|
||||
|
||||
req := &pb.PieceId{Id: tt.id}
|
||||
resp, err := c.Piece(ctx, req)
|
||||
|
||||
if tt.err != "" {
|
||||
assert.NotNil(err)
|
||||
require.NotNil(err)
|
||||
if runtime.GOOS == "windows" && strings.Contains(tt.err, "no such file or directory") {
|
||||
//TODO (windows): ignoring for windows due to different underlying error
|
||||
return
|
||||
}
|
||||
assert.Equal(tt.err, err.Error())
|
||||
require.Equal(tt.err, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
|
||||
assert.Equal(tt.id, resp.GetId())
|
||||
assert.Equal(tt.size, resp.GetPieceSize())
|
||||
assert.Equal(tt.expiration, resp.GetExpirationUnixSec())
|
||||
require.Equal(tt.id, resp.GetId())
|
||||
require.Equal(tt.size, resp.GetPieceSize())
|
||||
require.Equal(tt.expiration, resp.GetExpirationUnixSec())
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -225,16 +225,16 @@ func TestRetrieve(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run("should return expected PieceRetrievalStream values", func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
require := require.New(t)
|
||||
stream, err := c.Retrieve(ctx)
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
|
||||
// send piece database
|
||||
err = stream.Send(&pb.PieceRetrieval{PieceData: &pb.PieceRetrieval_PieceData{Id: tt.id, PieceSize: tt.reqSize, Offset: tt.offset}})
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.PayerBandwidthAllocation_GET, snID, upID, time.Hour)
|
||||
assert.NoError(err)
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.BandwidthAction_GET, snID, upID, time.Hour)
|
||||
require.NoError(err)
|
||||
|
||||
totalAllocated := int64(0)
|
||||
var data string
|
||||
@ -245,23 +245,19 @@ func TestRetrieve(t *testing.T) {
|
||||
totalAllocated += tt.allocSize
|
||||
|
||||
rba, err := testbwagreement.GenerateRenterBandwidthAllocation(pba, snID.ID, upID, totalAllocated)
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
|
||||
err = stream.Send(
|
||||
&pb.PieceRetrieval{
|
||||
BandwidthAllocation: rba,
|
||||
},
|
||||
)
|
||||
assert.NoError(err)
|
||||
err = stream.Send(&pb.PieceRetrieval{BandwidthAllocation: rba})
|
||||
require.NoError(err)
|
||||
|
||||
resp, err = stream.Recv()
|
||||
if tt.err != "" {
|
||||
assert.NotNil(err)
|
||||
require.NotNil(err)
|
||||
if runtime.GOOS == "windows" && strings.Contains(tt.err, "no such file or directory") {
|
||||
//TODO (windows): ignoring for windows due to different underlying error
|
||||
return
|
||||
}
|
||||
assert.Equal(tt.err, err.Error())
|
||||
require.Equal(tt.err, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
@ -269,11 +265,11 @@ func TestRetrieve(t *testing.T) {
|
||||
totalRetrieved += resp.GetPieceSize()
|
||||
}
|
||||
|
||||
assert.NoError(err)
|
||||
assert.NotNil(resp)
|
||||
require.NoError(err)
|
||||
require.NotNil(resp)
|
||||
if resp != nil {
|
||||
assert.Equal(tt.respSize, totalRetrieved)
|
||||
assert.Equal(string(tt.content), data)
|
||||
require.Equal(tt.respSize, totalRetrieved)
|
||||
require.Equal(string(tt.content), data)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -334,18 +330,18 @@ func TestStore(t *testing.T) {
|
||||
defer cleanup()
|
||||
db := s.DB.DB
|
||||
|
||||
assert := assert.New(t)
|
||||
require := require.New(t)
|
||||
stream, err := c.Store(ctx)
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
|
||||
// Write the buffer to the stream we opened earlier
|
||||
err = stream.Send(&pb.PieceStore{PieceData: &pb.PieceStore_PieceData{Id: tt.id, ExpirationUnixSec: tt.ttl}})
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
// Send Bandwidth Allocation Data
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.PayerBandwidthAllocation_PUT, snID, upID, time.Hour)
|
||||
assert.NoError(err)
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.BandwidthAction_PUT, snID, upID, time.Hour)
|
||||
require.NoError(err)
|
||||
rba, err := testbwagreement.GenerateRenterBandwidthAllocation(pba, snID.ID, upID, tt.totalReceived)
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
msg := &pb.PieceStore{
|
||||
PieceData: &pb.PieceStore_PieceData{Content: tt.content},
|
||||
BandwidthAllocation: rba,
|
||||
@ -353,54 +349,42 @@ func TestStore(t *testing.T) {
|
||||
// Write the buffer to the stream we opened earlier
|
||||
err = stream.Send(msg)
|
||||
if err != io.EOF && err != nil {
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
}
|
||||
|
||||
resp, err := stream.CloseAndRecv()
|
||||
if tt.err != "" {
|
||||
assert.NotNil(err)
|
||||
assert.True(strings.HasPrefix(err.Error(), tt.err), "expected")
|
||||
require.NotNil(err)
|
||||
require.True(strings.HasPrefix(err.Error(), tt.err), "expected")
|
||||
return
|
||||
}
|
||||
if !assert.NoError(err) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
_, err := db.Exec(fmt.Sprintf(`DELETE FROM ttl WHERE id="%s"`, tt.id))
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
}()
|
||||
|
||||
// check db to make sure agreement and signature were stored correctly
|
||||
rows, err := db.Query(`SELECT agreement, signature FROM bandwidth_agreements`)
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
|
||||
defer func() { assert.NoError(rows.Close()) }()
|
||||
defer func() { require.NoError(rows.Close()) }()
|
||||
for rows.Next() {
|
||||
var (
|
||||
agreement []byte
|
||||
signature []byte
|
||||
)
|
||||
|
||||
var agreement, signature []byte
|
||||
err = rows.Scan(&agreement, &signature)
|
||||
assert.NoError(err)
|
||||
|
||||
decoded := &pb.RenterBandwidthAllocation_Data{}
|
||||
|
||||
err = proto.Unmarshal(agreement, decoded)
|
||||
assert.NoError(err)
|
||||
assert.Equal(msg.BandwidthAllocation.GetSignature(), signature)
|
||||
assert.True(proto.Equal(pba, decoded.GetPayerAllocation()))
|
||||
assert.Equal(int64(len(tt.content)), decoded.GetTotal())
|
||||
require.NoError(err)
|
||||
rba := &pb.RenterBandwidthAllocation{}
|
||||
require.NoError(proto.Unmarshal(agreement, rba))
|
||||
require.Equal(msg.BandwidthAllocation.GetSignature(), signature)
|
||||
require.True(pb.Equal(pba, &rba.PayerAllocation))
|
||||
require.Equal(int64(len(tt.content)), rba.Total)
|
||||
|
||||
}
|
||||
err = rows.Err()
|
||||
assert.NoError(err)
|
||||
if !assert.NotNil(resp) {
|
||||
t.Fatalf("resp is null")
|
||||
}
|
||||
assert.Equal(tt.message, resp.Message)
|
||||
assert.Equal(tt.totalReceived, resp.TotalReceived)
|
||||
require.NoError(err)
|
||||
require.NotNil(resp)
|
||||
require.Equal(tt.message, resp.Message)
|
||||
require.Equal(tt.totalReceived, resp.TotalReceived)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -415,35 +399,35 @@ func TestPbaValidation(t *testing.T) {
|
||||
satelliteID storj.NodeID
|
||||
uplinkID storj.NodeID
|
||||
whitelist []storj.NodeID
|
||||
action pb.PayerBandwidthAllocation_Action
|
||||
action pb.BandwidthAction
|
||||
err string
|
||||
}{
|
||||
{ // unapproved satellite id
|
||||
satelliteID: satID1.ID,
|
||||
uplinkID: upID.ID,
|
||||
whitelist: []storj.NodeID{satID1.ID, satID2.ID, satID3.ID},
|
||||
action: pb.PayerBandwidthAllocation_PUT,
|
||||
action: pb.BandwidthAction_PUT,
|
||||
err: "rpc error: code = Unknown desc = store error: Satellite ID not approved",
|
||||
},
|
||||
{ // missing satellite id
|
||||
satelliteID: storj.NodeID{},
|
||||
uplinkID: upID.ID,
|
||||
whitelist: []storj.NodeID{satID1.ID, satID2.ID, satID3.ID},
|
||||
action: pb.PayerBandwidthAllocation_PUT,
|
||||
action: pb.BandwidthAction_PUT,
|
||||
err: "rpc error: code = Unknown desc = store error: payer bandwidth allocation: missing satellite id",
|
||||
},
|
||||
{ // missing uplink id
|
||||
satelliteID: satID1.ID,
|
||||
uplinkID: storj.NodeID{},
|
||||
whitelist: []storj.NodeID{satID1.ID, satID2.ID, satID3.ID},
|
||||
action: pb.PayerBandwidthAllocation_PUT,
|
||||
action: pb.BandwidthAction_PUT,
|
||||
err: "rpc error: code = Unknown desc = store error: payer bandwidth allocation: missing uplink id",
|
||||
},
|
||||
{ // wrong action type
|
||||
satelliteID: satID1.ID,
|
||||
uplinkID: upID.ID,
|
||||
whitelist: []storj.NodeID{satID1.ID, satID2.ID, satID3.ID},
|
||||
action: pb.PayerBandwidthAllocation_GET,
|
||||
action: pb.BandwidthAction_GET,
|
||||
err: "rpc error: code = Unknown desc = store error: payer bandwidth allocation: invalid action GET",
|
||||
},
|
||||
}
|
||||
@ -453,21 +437,21 @@ func TestPbaValidation(t *testing.T) {
|
||||
s, c, cleanup := NewTest(ctx, t, snID, upID, tt.whitelist)
|
||||
defer cleanup()
|
||||
|
||||
assert := assert.New(t)
|
||||
require := require.New(t)
|
||||
stream, err := c.Store(ctx)
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
|
||||
//cleanup incase tests previously paniced
|
||||
_ = s.storage.Delete("99999999999999999999")
|
||||
// Write the buffer to the stream we opened earlier
|
||||
err = stream.Send(&pb.PieceStore{PieceData: &pb.PieceStore_PieceData{Id: "99999999999999999999", ExpirationUnixSec: 9999999999}})
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
// Send Bandwidth Allocation Data
|
||||
content := []byte("content")
|
||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(tt.action, satID1, upID, time.Hour)
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
rba, err := testbwagreement.GenerateRenterBandwidthAllocation(pba, snID.ID, upID, int64(len(content)))
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
msg := &pb.PieceStore{
|
||||
PieceData: &pb.PieceStore_PieceData{Content: content},
|
||||
BandwidthAllocation: rba,
|
||||
@ -476,15 +460,15 @@ func TestPbaValidation(t *testing.T) {
|
||||
// Write the buffer to the stream we opened earlier
|
||||
err = stream.Send(msg)
|
||||
if err != io.EOF && err != nil {
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
}
|
||||
|
||||
_, err = stream.CloseAndRecv()
|
||||
if err != nil {
|
||||
//assert.NotNil(err)
|
||||
//require.NotNil(err)
|
||||
t.Log("Expected err string", tt.err)
|
||||
t.Log("Actual err.Error:", err.Error())
|
||||
assert.Equal(tt.err, err.Error())
|
||||
require.Equal(tt.err, err.Error())
|
||||
return
|
||||
}
|
||||
})
|
||||
@ -526,7 +510,7 @@ func TestDelete(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run("should return expected PieceDeleteSummary values", func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
require := require.New(t)
|
||||
|
||||
// simulate piece stored with storagenode
|
||||
if err := writeFile(s, "11111111111111111111"); err != nil {
|
||||
@ -536,31 +520,31 @@ func TestDelete(t *testing.T) {
|
||||
|
||||
// simulate piece TTL entry
|
||||
_, err := db.Exec(fmt.Sprintf(`INSERT INTO ttl (id, created, expires) VALUES ("%s", "%d", "%d")`, tt.id, 1234567890, 1234567890))
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
|
||||
defer func() {
|
||||
_, err := db.Exec(fmt.Sprintf(`DELETE FROM ttl WHERE id="%s"`, tt.id))
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
}()
|
||||
|
||||
defer func() {
|
||||
assert.NoError(s.storage.Delete("11111111111111111111"))
|
||||
require.NoError(s.storage.Delete("11111111111111111111"))
|
||||
}()
|
||||
|
||||
req := &pb.PieceDelete{Id: tt.id}
|
||||
resp, err := c.Delete(ctx, req)
|
||||
|
||||
if tt.err != "" {
|
||||
assert.Equal(tt.err, err.Error())
|
||||
require.Equal(tt.err, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
assert.NoError(err)
|
||||
assert.Equal(tt.message, resp.GetMessage())
|
||||
require.NoError(err)
|
||||
require.Equal(tt.message, resp.GetMessage())
|
||||
|
||||
// if test passes, check if file was indeed deleted
|
||||
filePath, err := s.storage.PiecePath(tt.id)
|
||||
assert.NoError(err)
|
||||
require.NoError(err)
|
||||
if _, err = os.Stat(filePath); os.IsExist(err) {
|
||||
t.Errorf("File not deleted")
|
||||
return
|
||||
@ -573,12 +557,12 @@ func NewTest(ctx context.Context, t *testing.T, snID, upID *identity.FullIdentit
|
||||
ids []storj.NodeID) (*Server, pb.PieceStoreRoutesClient, func()) {
|
||||
//init ps server backend
|
||||
tmp, err := ioutil.TempDir("", "storj-piecestore")
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
tempDBPath := filepath.Join(tmp, "test.db")
|
||||
tempDir := filepath.Join(tmp, "test-data", "3000")
|
||||
storage := pstore.NewStorage(tempDir)
|
||||
psDB, err := psdb.Open(ctx, storage, tempDBPath)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
verifier := func(authorization *pb.SignedMessage) error {
|
||||
return nil
|
||||
}
|
||||
@ -593,26 +577,26 @@ func NewTest(ctx context.Context, t *testing.T, snID, upID *identity.FullIdentit
|
||||
}
|
||||
//init ps server grpc
|
||||
listener, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
publicConfig := server.Config{Address: "127.0.0.1:0"}
|
||||
publicOptions, err := server.NewOptions(snID, publicConfig)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
grpcServer, err := server.New(publicOptions, listener, nil)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
pb.RegisterPieceStoreRoutesServer(grpcServer.GRPC(), psServer)
|
||||
go func() { assert.NoError(t, grpcServer.Run(ctx)) }()
|
||||
go func() { require.NoError(t, grpcServer.Run(ctx)) }()
|
||||
//init client
|
||||
co, err := upID.DialOption(storj.NodeID{})
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
conn, err := grpc.Dial(listener.Addr().String(), co)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
psClient := pb.NewPieceStoreRoutesClient(conn)
|
||||
//cleanup callback
|
||||
cleanup := func() {
|
||||
assert.NoError(t, conn.Close())
|
||||
assert.NoError(t, psServer.Close())
|
||||
assert.NoError(t, psServer.Stop(ctx))
|
||||
assert.NoError(t, os.RemoveAll(tmp))
|
||||
require.NoError(t, conn.Close())
|
||||
require.NoError(t, psServer.Close())
|
||||
require.NoError(t, psServer.Stop(ctx))
|
||||
require.NoError(t, os.RemoveAll(tmp))
|
||||
}
|
||||
return psServer, psClient, cleanup
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/skyrings/skyring-common/tools/uuid"
|
||||
|
||||
"storj.io/storj/pkg/auth"
|
||||
@ -30,22 +29,19 @@ func NewAllocationSigner(satelliteIdentity *identity.FullIdentity, bwExpiration
|
||||
}
|
||||
|
||||
// PayerBandwidthAllocation returns generated payer bandwidth allocation
|
||||
func (allocation *AllocationSigner) PayerBandwidthAllocation(ctx context.Context, peerIdentity *identity.PeerIdentity, action pb.PayerBandwidthAllocation_Action) (pba *pb.PayerBandwidthAllocation, err error) {
|
||||
func (allocation *AllocationSigner) PayerBandwidthAllocation(ctx context.Context, peerIdentity *identity.PeerIdentity, action pb.BandwidthAction) (pba *pb.PayerBandwidthAllocation, err error) {
|
||||
if peerIdentity == nil {
|
||||
return nil, Error.New("missing peer identity")
|
||||
}
|
||||
|
||||
serialNum, err := uuid.New()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
created := time.Now().Unix()
|
||||
|
||||
// convert ttl from days to seconds
|
||||
ttl := allocation.bwExpiration
|
||||
ttl *= 86400
|
||||
|
||||
pbad := &pb.PayerBandwidthAllocation_Data{
|
||||
pba = &pb.PayerBandwidthAllocation{
|
||||
SatelliteId: allocation.satelliteIdentity.ID,
|
||||
UplinkId: peerIdentity.ID,
|
||||
CreatedUnixSec: created,
|
||||
@ -53,15 +49,8 @@ func (allocation *AllocationSigner) PayerBandwidthAllocation(ctx context.Context
|
||||
Action: action,
|
||||
SerialNumber: serialNum.String(),
|
||||
}
|
||||
|
||||
data, err := proto.Marshal(pbad)
|
||||
if err != nil {
|
||||
if err := auth.SignMessage(pba, *allocation.satelliteIdentity); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
signature, err := auth.GenerateSignature(data, allocation.satelliteIdentity)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
certs := allocation.satelliteIdentity.ChainRaw()
|
||||
return &pb.PayerBandwidthAllocation{Signature: signature, Data: data, Certs: certs}, nil
|
||||
return pba, nil
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ type Client interface {
|
||||
Delete(ctx context.Context, path storj.Path) error
|
||||
|
||||
SignedMessage() *pb.SignedMessage
|
||||
PayerBandwidthAllocation(context.Context, pb.PayerBandwidthAllocation_Action) (*pb.PayerBandwidthAllocation, error)
|
||||
PayerBandwidthAllocation(context.Context, pb.BandwidthAction) (*pb.PayerBandwidthAllocation, error)
|
||||
|
||||
// Disconnect() error // TODO: implement
|
||||
}
|
||||
@ -145,7 +145,7 @@ func (pdb *PointerDB) Delete(ctx context.Context, path storj.Path) (err error) {
|
||||
}
|
||||
|
||||
// PayerBandwidthAllocation gets payer bandwidth allocation message
|
||||
func (pdb *PointerDB) PayerBandwidthAllocation(ctx context.Context, action pb.PayerBandwidthAllocation_Action) (resp *pb.PayerBandwidthAllocation, err error) {
|
||||
func (pdb *PointerDB) PayerBandwidthAllocation(ctx context.Context, action pb.BandwidthAction) (resp *pb.PayerBandwidthAllocation, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
response, err := pdb.client.PayerBandwidthAllocation(ctx, &pb.PayerBandwidthAllocationRequest{Action: action})
|
||||
|
@ -79,7 +79,7 @@ func (mr *MockClientMockRecorder) List(arg0, arg1, arg2, arg3, arg4, arg5, arg6
|
||||
}
|
||||
|
||||
// PayerBandwidthAllocation mocks base method
|
||||
func (m *MockClient) PayerBandwidthAllocation(arg0 context.Context, arg1 pb.PayerBandwidthAllocation_Action) (*pb.PayerBandwidthAllocation, error) {
|
||||
func (m *MockClient) PayerBandwidthAllocation(arg0 context.Context, arg1 pb.BandwidthAction) (*pb.PayerBandwidthAllocation, error) {
|
||||
ret := m.ctrl.Call(m, "PayerBandwidthAllocation", arg0, arg1)
|
||||
ret0, _ := ret[0].(*pb.PayerBandwidthAllocation)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
@ -124,7 +124,7 @@ func (s *Server) Get(ctx context.Context, req *pb.GetRequest) (resp *pb.GetRespo
|
||||
return nil, status.Errorf(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
pba, err := s.PayerBandwidthAllocation(ctx, &pb.PayerBandwidthAllocationRequest{Action: pb.PayerBandwidthAllocation_GET})
|
||||
pba, err := s.PayerBandwidthAllocation(ctx, &pb.PayerBandwidthAllocationRequest{Action: pb.BandwidthAction_GET})
|
||||
if err != nil {
|
||||
s.logger.Error("err getting payer bandwidth allocation", zap.Error(err))
|
||||
return nil, status.Errorf(codes.Internal, err.Error())
|
||||
|
@ -118,7 +118,7 @@ func TestServiceGet(t *testing.T) {
|
||||
} else {
|
||||
assert.NoError(t, err, errTag)
|
||||
assert.NoError(t, err, errTag)
|
||||
assert.True(t, proto.Equal(pr, resp.Pointer), errTag)
|
||||
assert.True(t, pb.Equal(pr, resp.Pointer), errTag)
|
||||
|
||||
assert.NotNil(t, resp.GetAuthorization())
|
||||
assert.NotNil(t, resp.GetPba())
|
||||
@ -345,7 +345,7 @@ func TestServiceList(t *testing.T) {
|
||||
test.Error(i, err)
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(test.Expected, resp, cmp.Comparer(proto.Equal)); diff != "" {
|
||||
if diff := cmp.Diff(test.Expected, resp, cmp.Comparer(pb.Equal)); diff != "" {
|
||||
t.Errorf("%d: (-want +got) %v\n%s", i, test.Request.String(), diff)
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ func (s *Repairer) Repair(ctx context.Context, path storj.Path, lostPieces []int
|
||||
}
|
||||
|
||||
signedMessage := s.pdb.SignedMessage()
|
||||
pbaGet, err := s.pdb.PayerBandwidthAllocation(ctx, pb.PayerBandwidthAllocation_GET_REPAIR)
|
||||
pbaGet, err := s.pdb.PayerBandwidthAllocation(ctx, pb.BandwidthAction_GET_REPAIR)
|
||||
if err != nil {
|
||||
return Error.Wrap(err)
|
||||
}
|
||||
@ -134,7 +134,7 @@ func (s *Repairer) Repair(ctx context.Context, path storj.Path, lostPieces []int
|
||||
}
|
||||
defer utils.LogClose(r)
|
||||
|
||||
pbaPut, err := s.pdb.PayerBandwidthAllocation(ctx, pb.PayerBandwidthAllocation_PUT_REPAIR)
|
||||
pbaPut, err := s.pdb.PayerBandwidthAllocation(ctx, pb.BandwidthAction_PUT_REPAIR)
|
||||
if err != nil {
|
||||
return Error.Wrap(err)
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ func (s *segmentStore) Put(ctx context.Context, data io.Reader, expiration time.
|
||||
pieceID := psclient.NewPieceID()
|
||||
|
||||
authorization := s.pdb.SignedMessage()
|
||||
pba, err := s.pdb.PayerBandwidthAllocation(ctx, pb.PayerBandwidthAllocation_PUT)
|
||||
pba, err := s.pdb.PayerBandwidthAllocation(ctx, pb.BandwidthAction_PUT)
|
||||
if err != nil {
|
||||
return Meta{}, Error.Wrap(err)
|
||||
}
|
||||
|
@ -7,7 +7,10 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
"storj.io/storj/pkg/bwagreement"
|
||||
"storj.io/storj/pkg/pb"
|
||||
dbx "storj.io/storj/satellite/satellitedb/dbx"
|
||||
)
|
||||
|
||||
@ -15,13 +18,18 @@ type bandwidthagreement struct {
|
||||
db *dbx.DB
|
||||
}
|
||||
|
||||
func (b *bandwidthagreement) CreateAgreement(ctx context.Context, serialNum string, agreement bwagreement.Agreement) error {
|
||||
_, err := b.db.Create_Bwagreement(
|
||||
func (b *bandwidthagreement) CreateAgreement(ctx context.Context, rba *pb.RenterBandwidthAllocation) error {
|
||||
rbaBytes, err := proto.Marshal(rba)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
expiration := time.Unix(rba.PayerAllocation.ExpirationUnixSec, 0)
|
||||
_, err = b.db.Create_Bwagreement(
|
||||
ctx,
|
||||
dbx.Bwagreement_Signature(agreement.Signature),
|
||||
dbx.Bwagreement_Serialnum(serialNum),
|
||||
dbx.Bwagreement_Data(agreement.Agreement),
|
||||
dbx.Bwagreement_ExpiresAt(agreement.ExpiresAt),
|
||||
dbx.Bwagreement_Signature(rba.Signature),
|
||||
dbx.Bwagreement_Serialnum(rba.PayerAllocation.SerialNumber+rba.StorageNodeId.String()),
|
||||
dbx.Bwagreement_Data(rbaBytes),
|
||||
dbx.Bwagreement_ExpiresAt(expiration),
|
||||
)
|
||||
return err
|
||||
}
|
||||
@ -33,9 +41,13 @@ func (b *bandwidthagreement) GetAgreements(ctx context.Context) ([]bwagreement.A
|
||||
}
|
||||
agreements := make([]bwagreement.Agreement, len(rows))
|
||||
for i, entry := range rows {
|
||||
rba := pb.RenterBandwidthAllocation{}
|
||||
err := proto.Unmarshal(entry.Data, &rba)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
agreement := &agreements[i]
|
||||
agreement.Signature = entry.Signature
|
||||
agreement.Agreement = entry.Data
|
||||
agreement.Agreement = rba
|
||||
agreement.CreatedAt = entry.CreatedAt
|
||||
}
|
||||
return agreements, nil
|
||||
@ -49,9 +61,13 @@ func (b *bandwidthagreement) GetAgreementsSince(ctx context.Context, since time.
|
||||
|
||||
agreements := make([]bwagreement.Agreement, len(rows))
|
||||
for i, entry := range rows {
|
||||
rba := pb.RenterBandwidthAllocation{}
|
||||
err := proto.Unmarshal(entry.Data, &rba)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
agreement := &agreements[i]
|
||||
agreement.Signature = entry.Signature
|
||||
agreement.Agreement = entry.Data
|
||||
agreement.Agreement = rba
|
||||
agreement.CreatedAt = entry.CreatedAt
|
||||
}
|
||||
return agreements, nil
|
||||
|
@ -104,10 +104,10 @@ type lockedBandwidthAgreement struct {
|
||||
}
|
||||
|
||||
// CreateAgreement adds a new bandwidth agreement.
|
||||
func (m *lockedBandwidthAgreement) CreateAgreement(ctx context.Context, a1 string, a2 bwagreement.Agreement) error {
|
||||
func (m *lockedBandwidthAgreement) CreateAgreement(ctx context.Context, a1 *pb.RenterBandwidthAllocation) error {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
return m.db.CreateAgreement(ctx, a1, a2)
|
||||
return m.db.CreateAgreement(ctx, a1)
|
||||
}
|
||||
|
||||
// GetAgreements gets all bandwidth agreements.
|
||||
|
Loading…
Reference in New Issue
Block a user