removes some SignedMessage use (#1258)
Removes most instances of pb.SignedMessage (there's more to take out but they shouldn't hurt anyone as is). There used to be places in psserver where a PieceID was hmac'd with the SatelliteID, which was gotten from a SignedMessage. This PR makes it so some functions access the SatelliteID from the Payer Bandwidth Allocation instead. This requires passing a SatelliteID into psserver functions where they weren't before, so the following proto messages have been changed: * PieceId - satellite_id field added This is so the psserver.Piece function has access to the SatelliteID when it needs to get the namespaced pieceID. This proto message should probably be renamed to PieceRequest, or a new PieceRequest message should be created so this isn't misnamed. * PieceDelete - satellite_id field added This is so the psserver.Delete function has access to the SatelliteID when receiving a request to Delete.
This commit is contained in:
parent
36e4d8c1c2
commit
c3d3f41d30
@ -36,12 +36,9 @@ func TestBasic(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Example of using pointer db
|
// Example of using pointer db
|
||||||
client, err := planet.Uplinks[0].DialPointerDB(planet.Satellites[0], "apikey")
|
_, err = planet.Uplinks[0].DialPointerDB(planet.Satellites[0], "apikey")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
message := client.SignedMessage()
|
|
||||||
t.Log(message)
|
|
||||||
|
|
||||||
// ping a satellite
|
// ping a satellite
|
||||||
_, err = planet.StorageNodes[0].Kademlia.Service.Ping(ctx, planet.Satellites[0].Local())
|
_, err = planet.StorageNodes[0].Kademlia.Service.Ping(ctx, planet.Satellites[0].Local())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
|
|
||||||
"github.com/vivint/infectious"
|
"github.com/vivint/infectious"
|
||||||
|
|
||||||
"storj.io/storj/pkg/auth"
|
|
||||||
"storj.io/storj/pkg/eestream"
|
"storj.io/storj/pkg/eestream"
|
||||||
"storj.io/storj/pkg/identity"
|
"storj.io/storj/pkg/identity"
|
||||||
"storj.io/storj/pkg/pb"
|
"storj.io/storj/pkg/pb"
|
||||||
@ -22,10 +21,9 @@ import (
|
|||||||
|
|
||||||
// Stripe keeps track of a stripe's index and its parent segment
|
// Stripe keeps track of a stripe's index and its parent segment
|
||||||
type Stripe struct {
|
type Stripe struct {
|
||||||
Index int
|
Index int
|
||||||
Segment *pb.Pointer
|
Segment *pb.Pointer
|
||||||
PBA *pb.PayerBandwidthAllocation
|
PBA *pb.PayerBandwidthAllocation
|
||||||
Authorization *pb.SignedMessage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cursor keeps track of audit location in pointer db
|
// Cursor keeps track of audit location in pointer db
|
||||||
@ -85,16 +83,6 @@ func (cursor *Cursor) NextStripe(ctx context.Context) (stripe *Stripe, err error
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
signature, err := auth.GenerateSignature(cursor.identity.ID.Bytes(), cursor.identity)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
authorization, err := auth.NewSignedMessage(signature, cursor.identity)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if pointer.GetType() != pb.Pointer_REMOTE {
|
if pointer.GetType() != pb.Pointer_REMOTE {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@ -115,10 +103,9 @@ func (cursor *Cursor) NextStripe(ctx context.Context) (stripe *Stripe, err error
|
|||||||
}
|
}
|
||||||
|
|
||||||
return &Stripe{
|
return &Stripe{
|
||||||
Index: index,
|
Index: index,
|
||||||
Segment: pointer,
|
Segment: pointer,
|
||||||
PBA: pba,
|
PBA: pba,
|
||||||
Authorization: authorization,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ type Verifier struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type downloader interface {
|
type downloader interface {
|
||||||
DownloadShares(ctx context.Context, pointer *pb.Pointer, stripeIndex int, pba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (shares map[int]Share, nodes map[int]storj.NodeID, err error)
|
DownloadShares(ctx context.Context, pointer *pb.Pointer, stripeIndex int, pba *pb.PayerBandwidthAllocation) (shares map[int]Share, nodes map[int]storj.NodeID, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// defaultDownloader downloads shares from networked storage nodes
|
// defaultDownloader downloads shares from networked storage nodes
|
||||||
@ -58,7 +58,7 @@ func NewVerifier(transport transport.Client, overlay *overlay.Cache, id *identit
|
|||||||
|
|
||||||
// getShare use piece store clients to download shares from a given node
|
// getShare use piece store clients to download shares from a given node
|
||||||
func (d *defaultDownloader) getShare(ctx context.Context, stripeIndex, shareSize, pieceNumber int,
|
func (d *defaultDownloader) getShare(ctx context.Context, stripeIndex, shareSize, pieceNumber int,
|
||||||
id psclient.PieceID, pieceSize int64, fromNode *pb.Node, pba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (s Share, err error) {
|
id psclient.PieceID, pieceSize int64, fromNode *pb.Node, pba *pb.PayerBandwidthAllocation) (s Share, err error) {
|
||||||
// TODO: too many arguments use a struct
|
// TODO: too many arguments use a struct
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ func (d *defaultDownloader) getShare(ctx context.Context, stripeIndex, shareSize
|
|||||||
return s, err
|
return s, err
|
||||||
}
|
}
|
||||||
|
|
||||||
rr, err := ps.Get(ctx, derivedPieceID, pieceSize, pba, authorization)
|
rr, err := ps.Get(ctx, derivedPieceID, pieceSize, pba)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return s, err
|
return s, err
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ func (d *defaultDownloader) getShare(ctx context.Context, stripeIndex, shareSize
|
|||||||
|
|
||||||
// Download Shares downloads shares from the nodes where remote pieces are located
|
// Download Shares downloads shares from the nodes where remote pieces are located
|
||||||
func (d *defaultDownloader) DownloadShares(ctx context.Context, pointer *pb.Pointer,
|
func (d *defaultDownloader) DownloadShares(ctx context.Context, pointer *pb.Pointer,
|
||||||
stripeIndex int, pba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (shares map[int]Share, nodes map[int]storj.NodeID, err error) {
|
stripeIndex int, pba *pb.PayerBandwidthAllocation) (shares map[int]Share, nodes map[int]storj.NodeID, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
var nodeIds storj.NodeIDList
|
var nodeIds storj.NodeIDList
|
||||||
@ -133,7 +133,7 @@ func (d *defaultDownloader) DownloadShares(ctx context.Context, pointer *pb.Poin
|
|||||||
paddedSize := calcPadded(pointer.GetSegmentSize(), shareSize)
|
paddedSize := calcPadded(pointer.GetSegmentSize(), shareSize)
|
||||||
pieceSize := paddedSize / int64(pointer.Remote.Redundancy.GetMinReq())
|
pieceSize := paddedSize / int64(pointer.Remote.Redundancy.GetMinReq())
|
||||||
|
|
||||||
s, err := d.getShare(ctx, stripeIndex, shareSize, int(pieces[i].PieceNum), pieceID, pieceSize, node, pba, authorization)
|
s, err := d.getShare(ctx, stripeIndex, shareSize, int(pieces[i].PieceNum), pieceID, pieceSize, node, pba)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s = Share{
|
s = Share{
|
||||||
Error: err,
|
Error: err,
|
||||||
@ -201,7 +201,7 @@ func calcPadded(size int64, blockSize int) int64 {
|
|||||||
func (verifier *Verifier) verify(ctx context.Context, stripe *Stripe) (verifiedNodes *RecordAuditsInfo, err error) {
|
func (verifier *Verifier) verify(ctx context.Context, stripe *Stripe) (verifiedNodes *RecordAuditsInfo, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
shares, nodes, err := verifier.downloader.DownloadShares(ctx, stripe.Segment, stripe.Index, stripe.PBA, stripe.Authorization)
|
shares, nodes, err := verifier.downloader.DownloadShares(ctx, stripe.Segment, stripe.Index, stripe.PBA)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ func TestPassingAudit(t *testing.T) {
|
|||||||
md := mockDownloader{shares: mockShares}
|
md := mockDownloader{shares: mockShares}
|
||||||
verifier := &audit.Verifier{downloader: &md}
|
verifier := &audit.Verifier{downloader: &md}
|
||||||
pointer := makePointer(tt.nodeAmt)
|
pointer := makePointer(tt.nodeAmt)
|
||||||
verifiedNodes, err := verifier.Verify(ctx, &audit.Stripe{Index: 6, Segment: pointer, PBA: nil, Authorization: nil})
|
verifiedNodes, err := verifier.Verify(ctx, &audit.Stripe{Index: 6, Segment: pointer, PBA: nil})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ func TestSomeNodesPassAudit(t *testing.T) {
|
|||||||
md := mockDownloader{shares: mockShares}
|
md := mockDownloader{shares: mockShares}
|
||||||
verifier := &audit.Verifier{downloader: &md}
|
verifier := &audit.Verifier{downloader: &md}
|
||||||
pointer := makePointer(tt.nodeAmt)
|
pointer := makePointer(tt.nodeAmt)
|
||||||
verifiedNodes, err := verifier.verify(ctx, &audit.Stripe{Index: 6, Segment: pointer, PBA: nil, Authorization: nil})
|
verifiedNodes, err := verifier.verify(ctx, &audit.Stripe{Index: 6, Segment: pointer, PBA: nil})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ func TestCalcPadded(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockDownloader) DownloadShares(ctx context.Context, pointer *pb.Pointer, stripeIndex int,
|
func (m *mockDownloader) DownloadShares(ctx context.Context, pointer *pb.Pointer, stripeIndex int,
|
||||||
pba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (shares map[int]share, nodes map[int]storj.NodeID, err error) {
|
pba *pb.PayerBandwidthAllocation) (shares map[int]share, nodes map[int]storj.NodeID, err error) {
|
||||||
|
|
||||||
nodes = make(map[int]*pb.Node, 30)
|
nodes = make(map[int]*pb.Node, 30)
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ package auth
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"storj.io/storj/pkg/identity"
|
"storj.io/storj/pkg/identity"
|
||||||
"storj.io/storj/pkg/pb"
|
|
||||||
"storj.io/storj/pkg/pkcrypto"
|
"storj.io/storj/pkg/pkcrypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -13,43 +12,3 @@ import (
|
|||||||
func GenerateSignature(data []byte, identity *identity.FullIdentity) ([]byte, error) {
|
func GenerateSignature(data []byte, identity *identity.FullIdentity) ([]byte, error) {
|
||||||
return pkcrypto.HashAndSign(identity.Key, data)
|
return pkcrypto.HashAndSign(identity.Key, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSignedMessage creates instance of signed message
|
|
||||||
func NewSignedMessage(signature []byte, identity *identity.FullIdentity) (*pb.SignedMessage, error) {
|
|
||||||
encodedKey, err := pkcrypto.PublicKeyToPKIX(identity.Leaf.PublicKey)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &pb.SignedMessage{
|
|
||||||
Data: identity.ID.Bytes(),
|
|
||||||
Signature: signature,
|
|
||||||
PublicKey: encodedKey,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedMessageVerifier checks if provided signed message can be verified
|
|
||||||
type SignedMessageVerifier func(signature *pb.SignedMessage) error
|
|
||||||
|
|
||||||
// NewSignedMessageVerifier creates default implementation of SignedMessageVerifier
|
|
||||||
func NewSignedMessageVerifier() SignedMessageVerifier {
|
|
||||||
return func(signedMessage *pb.SignedMessage) error {
|
|
||||||
if signedMessage == nil {
|
|
||||||
return Error.New("no message to verify")
|
|
||||||
}
|
|
||||||
if signedMessage.Signature == nil {
|
|
||||||
return Error.New("missing signature for verification")
|
|
||||||
}
|
|
||||||
if signedMessage.Data == nil {
|
|
||||||
return Error.New("missing data for verification")
|
|
||||||
}
|
|
||||||
if signedMessage.PublicKey == nil {
|
|
||||||
return Error.New("missing public key for verification")
|
|
||||||
}
|
|
||||||
|
|
||||||
k, err := pkcrypto.PublicKeyFromPKIX(signedMessage.GetPublicKey())
|
|
||||||
if err != nil {
|
|
||||||
return Error.Wrap(err)
|
|
||||||
}
|
|
||||||
return pkcrypto.HashAndVerifySignature(k, signedMessage.GetData(), signedMessage.GetSignature())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -38,42 +38,3 @@ func TestGenerateSignature(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSignedMessageVerifier(t *testing.T) {
|
|
||||||
ctx := context.Background()
|
|
||||||
ca, err := testidentity.NewTestCA(ctx)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
identity, err := ca.NewIdentity()
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
signature, err := GenerateSignature(identity.ID.Bytes(), identity)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
signedMessage, err := NewSignedMessage(signature, identity)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
for _, tt := range []struct {
|
|
||||||
signature []byte
|
|
||||||
data []byte
|
|
||||||
publicKey []byte
|
|
||||||
errString string
|
|
||||||
}{
|
|
||||||
{signedMessage.Signature, signedMessage.Data, signedMessage.PublicKey, ""},
|
|
||||||
{nil, signedMessage.Data, signedMessage.PublicKey, "auth error: missing signature for verification"},
|
|
||||||
{signedMessage.Signature, nil, signedMessage.PublicKey, "auth error: missing data for verification"},
|
|
||||||
{signedMessage.Signature, signedMessage.Data, nil, "auth error: missing public key for verification"},
|
|
||||||
|
|
||||||
{signedMessage.Signature, []byte("malformed data"), signedMessage.PublicKey, "signature verification error: signature is not valid"},
|
|
||||||
} {
|
|
||||||
signedMessage.Signature = tt.signature
|
|
||||||
signedMessage.Data = tt.data
|
|
||||||
signedMessage.PublicKey = tt.publicKey
|
|
||||||
|
|
||||||
err := NewSignedMessageVerifier()(signedMessage)
|
|
||||||
if tt.errString != "" {
|
|
||||||
assert.EqualError(t, err, tt.errString)
|
|
||||||
} else {
|
|
||||||
assert.NoError(t, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -58,3 +58,22 @@ func (m *RenterBandwidthAllocation) SetCerts(certs [][]byte) {
|
|||||||
func (m *RenterBandwidthAllocation) SetSignature(signature []byte) {
|
func (m *RenterBandwidthAllocation) SetSignature(signature []byte) {
|
||||||
m.Signature = signature
|
m.Signature = signature
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clone creates a deep copy of PayerBandwidthAllocation
|
||||||
|
func (m *PayerBandwidthAllocation) Clone() (pba PayerBandwidthAllocation) {
|
||||||
|
pba = PayerBandwidthAllocation{
|
||||||
|
SatelliteId: m.SatelliteId,
|
||||||
|
UplinkId: m.UplinkId,
|
||||||
|
MaxSize: m.MaxSize,
|
||||||
|
ExpirationUnixSec: m.ExpirationUnixSec,
|
||||||
|
SerialNumber: m.SerialNumber,
|
||||||
|
Action: m.Action,
|
||||||
|
CreatedUnixSec: m.CreatedUnixSec,
|
||||||
|
}
|
||||||
|
pba.Certs = make([][]byte, len(m.Certs))
|
||||||
|
copy(pba.Certs, m.Certs)
|
||||||
|
pba.Signature = make([]byte, len(m.Signature))
|
||||||
|
copy(pba.Signature, m.Signature)
|
||||||
|
|
||||||
|
return pba
|
||||||
|
}
|
||||||
|
@ -54,7 +54,7 @@ func (x BandwidthAction) String() string {
|
|||||||
return proto.EnumName(BandwidthAction_name, int32(x))
|
return proto.EnumName(BandwidthAction_name, int32(x))
|
||||||
}
|
}
|
||||||
func (BandwidthAction) EnumDescriptor() ([]byte, []int) {
|
func (BandwidthAction) EnumDescriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{0}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
type PayerBandwidthAllocation struct {
|
type PayerBandwidthAllocation struct {
|
||||||
@ -76,7 +76,7 @@ func (m *PayerBandwidthAllocation) Reset() { *m = PayerBandwidthAllocati
|
|||||||
func (m *PayerBandwidthAllocation) String() string { return proto.CompactTextString(m) }
|
func (m *PayerBandwidthAllocation) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PayerBandwidthAllocation) ProtoMessage() {}
|
func (*PayerBandwidthAllocation) ProtoMessage() {}
|
||||||
func (*PayerBandwidthAllocation) Descriptor() ([]byte, []int) {
|
func (*PayerBandwidthAllocation) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{0}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{0}
|
||||||
}
|
}
|
||||||
func (m *PayerBandwidthAllocation) XXX_Unmarshal(b []byte) error {
|
func (m *PayerBandwidthAllocation) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PayerBandwidthAllocation.Unmarshal(m, b)
|
return xxx_messageInfo_PayerBandwidthAllocation.Unmarshal(m, b)
|
||||||
@ -160,7 +160,7 @@ func (m *RenterBandwidthAllocation) Reset() { *m = RenterBandwidthAlloca
|
|||||||
func (m *RenterBandwidthAllocation) String() string { return proto.CompactTextString(m) }
|
func (m *RenterBandwidthAllocation) String() string { return proto.CompactTextString(m) }
|
||||||
func (*RenterBandwidthAllocation) ProtoMessage() {}
|
func (*RenterBandwidthAllocation) ProtoMessage() {}
|
||||||
func (*RenterBandwidthAllocation) Descriptor() ([]byte, []int) {
|
func (*RenterBandwidthAllocation) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{1}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{1}
|
||||||
}
|
}
|
||||||
func (m *RenterBandwidthAllocation) XXX_Unmarshal(b []byte) error {
|
func (m *RenterBandwidthAllocation) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_RenterBandwidthAllocation.Unmarshal(m, b)
|
return xxx_messageInfo_RenterBandwidthAllocation.Unmarshal(m, b)
|
||||||
@ -221,7 +221,7 @@ func (m *PieceStore) Reset() { *m = PieceStore{} }
|
|||||||
func (m *PieceStore) String() string { return proto.CompactTextString(m) }
|
func (m *PieceStore) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PieceStore) ProtoMessage() {}
|
func (*PieceStore) ProtoMessage() {}
|
||||||
func (*PieceStore) Descriptor() ([]byte, []int) {
|
func (*PieceStore) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{2}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{2}
|
||||||
}
|
}
|
||||||
func (m *PieceStore) XXX_Unmarshal(b []byte) error {
|
func (m *PieceStore) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PieceStore.Unmarshal(m, b)
|
return xxx_messageInfo_PieceStore.Unmarshal(m, b)
|
||||||
@ -276,7 +276,7 @@ func (m *PieceStore_PieceData) Reset() { *m = PieceStore_PieceData{} }
|
|||||||
func (m *PieceStore_PieceData) String() string { return proto.CompactTextString(m) }
|
func (m *PieceStore_PieceData) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PieceStore_PieceData) ProtoMessage() {}
|
func (*PieceStore_PieceData) ProtoMessage() {}
|
||||||
func (*PieceStore_PieceData) Descriptor() ([]byte, []int) {
|
func (*PieceStore_PieceData) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{2, 0}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{2, 0}
|
||||||
}
|
}
|
||||||
func (m *PieceStore_PieceData) XXX_Unmarshal(b []byte) error {
|
func (m *PieceStore_PieceData) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PieceStore_PieceData.Unmarshal(m, b)
|
return xxx_messageInfo_PieceStore_PieceData.Unmarshal(m, b)
|
||||||
@ -321,6 +321,7 @@ type PieceId struct {
|
|||||||
// TODO: may want to use customtype and fixed-length byte slice
|
// TODO: may want to use customtype and fixed-length byte slice
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Authorization *SignedMessage `protobuf:"bytes,2,opt,name=authorization,proto3" json:"authorization,omitempty"`
|
Authorization *SignedMessage `protobuf:"bytes,2,opt,name=authorization,proto3" json:"authorization,omitempty"`
|
||||||
|
SatelliteId NodeID `protobuf:"bytes,3,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
XXX_sizecache int32 `json:"-"`
|
XXX_sizecache int32 `json:"-"`
|
||||||
@ -330,7 +331,7 @@ func (m *PieceId) Reset() { *m = PieceId{} }
|
|||||||
func (m *PieceId) String() string { return proto.CompactTextString(m) }
|
func (m *PieceId) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PieceId) ProtoMessage() {}
|
func (*PieceId) ProtoMessage() {}
|
||||||
func (*PieceId) Descriptor() ([]byte, []int) {
|
func (*PieceId) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{3}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{3}
|
||||||
}
|
}
|
||||||
func (m *PieceId) XXX_Unmarshal(b []byte) error {
|
func (m *PieceId) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PieceId.Unmarshal(m, b)
|
return xxx_messageInfo_PieceId.Unmarshal(m, b)
|
||||||
@ -377,7 +378,7 @@ func (m *PieceSummary) Reset() { *m = PieceSummary{} }
|
|||||||
func (m *PieceSummary) String() string { return proto.CompactTextString(m) }
|
func (m *PieceSummary) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PieceSummary) ProtoMessage() {}
|
func (*PieceSummary) ProtoMessage() {}
|
||||||
func (*PieceSummary) Descriptor() ([]byte, []int) {
|
func (*PieceSummary) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{4}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{4}
|
||||||
}
|
}
|
||||||
func (m *PieceSummary) XXX_Unmarshal(b []byte) error {
|
func (m *PieceSummary) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PieceSummary.Unmarshal(m, b)
|
return xxx_messageInfo_PieceSummary.Unmarshal(m, b)
|
||||||
@ -431,7 +432,7 @@ func (m *PieceRetrieval) Reset() { *m = PieceRetrieval{} }
|
|||||||
func (m *PieceRetrieval) String() string { return proto.CompactTextString(m) }
|
func (m *PieceRetrieval) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PieceRetrieval) ProtoMessage() {}
|
func (*PieceRetrieval) ProtoMessage() {}
|
||||||
func (*PieceRetrieval) Descriptor() ([]byte, []int) {
|
func (*PieceRetrieval) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{5}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{5}
|
||||||
}
|
}
|
||||||
func (m *PieceRetrieval) XXX_Unmarshal(b []byte) error {
|
func (m *PieceRetrieval) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PieceRetrieval.Unmarshal(m, b)
|
return xxx_messageInfo_PieceRetrieval.Unmarshal(m, b)
|
||||||
@ -486,7 +487,7 @@ func (m *PieceRetrieval_PieceData) Reset() { *m = PieceRetrieval_PieceDa
|
|||||||
func (m *PieceRetrieval_PieceData) String() string { return proto.CompactTextString(m) }
|
func (m *PieceRetrieval_PieceData) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PieceRetrieval_PieceData) ProtoMessage() {}
|
func (*PieceRetrieval_PieceData) ProtoMessage() {}
|
||||||
func (*PieceRetrieval_PieceData) Descriptor() ([]byte, []int) {
|
func (*PieceRetrieval_PieceData) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{5, 0}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{5, 0}
|
||||||
}
|
}
|
||||||
func (m *PieceRetrieval_PieceData) XXX_Unmarshal(b []byte) error {
|
func (m *PieceRetrieval_PieceData) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PieceRetrieval_PieceData.Unmarshal(m, b)
|
return xxx_messageInfo_PieceRetrieval_PieceData.Unmarshal(m, b)
|
||||||
@ -539,7 +540,7 @@ func (m *PieceRetrievalStream) Reset() { *m = PieceRetrievalStream{} }
|
|||||||
func (m *PieceRetrievalStream) String() string { return proto.CompactTextString(m) }
|
func (m *PieceRetrievalStream) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PieceRetrievalStream) ProtoMessage() {}
|
func (*PieceRetrievalStream) ProtoMessage() {}
|
||||||
func (*PieceRetrievalStream) Descriptor() ([]byte, []int) {
|
func (*PieceRetrievalStream) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{6}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{6}
|
||||||
}
|
}
|
||||||
func (m *PieceRetrievalStream) XXX_Unmarshal(b []byte) error {
|
func (m *PieceRetrievalStream) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PieceRetrievalStream.Unmarshal(m, b)
|
return xxx_messageInfo_PieceRetrievalStream.Unmarshal(m, b)
|
||||||
@ -577,6 +578,7 @@ type PieceDelete struct {
|
|||||||
// TODO: may want to use customtype and fixed-length byte slice
|
// TODO: may want to use customtype and fixed-length byte slice
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Authorization *SignedMessage `protobuf:"bytes,3,opt,name=authorization,proto3" json:"authorization,omitempty"`
|
Authorization *SignedMessage `protobuf:"bytes,3,opt,name=authorization,proto3" json:"authorization,omitempty"`
|
||||||
|
SatelliteId NodeID `protobuf:"bytes,4,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
XXX_sizecache int32 `json:"-"`
|
XXX_sizecache int32 `json:"-"`
|
||||||
@ -586,7 +588,7 @@ func (m *PieceDelete) Reset() { *m = PieceDelete{} }
|
|||||||
func (m *PieceDelete) String() string { return proto.CompactTextString(m) }
|
func (m *PieceDelete) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PieceDelete) ProtoMessage() {}
|
func (*PieceDelete) ProtoMessage() {}
|
||||||
func (*PieceDelete) Descriptor() ([]byte, []int) {
|
func (*PieceDelete) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{7}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{7}
|
||||||
}
|
}
|
||||||
func (m *PieceDelete) XXX_Unmarshal(b []byte) error {
|
func (m *PieceDelete) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PieceDelete.Unmarshal(m, b)
|
return xxx_messageInfo_PieceDelete.Unmarshal(m, b)
|
||||||
@ -631,7 +633,7 @@ func (m *PieceDeleteSummary) Reset() { *m = PieceDeleteSummary{} }
|
|||||||
func (m *PieceDeleteSummary) String() string { return proto.CompactTextString(m) }
|
func (m *PieceDeleteSummary) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PieceDeleteSummary) ProtoMessage() {}
|
func (*PieceDeleteSummary) ProtoMessage() {}
|
||||||
func (*PieceDeleteSummary) Descriptor() ([]byte, []int) {
|
func (*PieceDeleteSummary) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{8}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{8}
|
||||||
}
|
}
|
||||||
func (m *PieceDeleteSummary) XXX_Unmarshal(b []byte) error {
|
func (m *PieceDeleteSummary) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PieceDeleteSummary.Unmarshal(m, b)
|
return xxx_messageInfo_PieceDeleteSummary.Unmarshal(m, b)
|
||||||
@ -670,7 +672,7 @@ func (m *PieceStoreSummary) Reset() { *m = PieceStoreSummary{} }
|
|||||||
func (m *PieceStoreSummary) String() string { return proto.CompactTextString(m) }
|
func (m *PieceStoreSummary) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PieceStoreSummary) ProtoMessage() {}
|
func (*PieceStoreSummary) ProtoMessage() {}
|
||||||
func (*PieceStoreSummary) Descriptor() ([]byte, []int) {
|
func (*PieceStoreSummary) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{9}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{9}
|
||||||
}
|
}
|
||||||
func (m *PieceStoreSummary) XXX_Unmarshal(b []byte) error {
|
func (m *PieceStoreSummary) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PieceStoreSummary.Unmarshal(m, b)
|
return xxx_messageInfo_PieceStoreSummary.Unmarshal(m, b)
|
||||||
@ -714,7 +716,7 @@ func (m *StatsReq) Reset() { *m = StatsReq{} }
|
|||||||
func (m *StatsReq) String() string { return proto.CompactTextString(m) }
|
func (m *StatsReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*StatsReq) ProtoMessage() {}
|
func (*StatsReq) ProtoMessage() {}
|
||||||
func (*StatsReq) Descriptor() ([]byte, []int) {
|
func (*StatsReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{10}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{10}
|
||||||
}
|
}
|
||||||
func (m *StatsReq) XXX_Unmarshal(b []byte) error {
|
func (m *StatsReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_StatsReq.Unmarshal(m, b)
|
return xxx_messageInfo_StatsReq.Unmarshal(m, b)
|
||||||
@ -748,7 +750,7 @@ func (m *StatSummary) Reset() { *m = StatSummary{} }
|
|||||||
func (m *StatSummary) String() string { return proto.CompactTextString(m) }
|
func (m *StatSummary) String() string { return proto.CompactTextString(m) }
|
||||||
func (*StatSummary) ProtoMessage() {}
|
func (*StatSummary) ProtoMessage() {}
|
||||||
func (*StatSummary) Descriptor() ([]byte, []int) {
|
func (*StatSummary) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{11}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{11}
|
||||||
}
|
}
|
||||||
func (m *StatSummary) XXX_Unmarshal(b []byte) error {
|
func (m *StatSummary) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_StatSummary.Unmarshal(m, b)
|
return xxx_messageInfo_StatSummary.Unmarshal(m, b)
|
||||||
@ -809,7 +811,7 @@ func (m *SignedMessage) Reset() { *m = SignedMessage{} }
|
|||||||
func (m *SignedMessage) String() string { return proto.CompactTextString(m) }
|
func (m *SignedMessage) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SignedMessage) ProtoMessage() {}
|
func (*SignedMessage) ProtoMessage() {}
|
||||||
func (*SignedMessage) Descriptor() ([]byte, []int) {
|
func (*SignedMessage) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{12}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{12}
|
||||||
}
|
}
|
||||||
func (m *SignedMessage) XXX_Unmarshal(b []byte) error {
|
func (m *SignedMessage) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_SignedMessage.Unmarshal(m, b)
|
return xxx_messageInfo_SignedMessage.Unmarshal(m, b)
|
||||||
@ -860,7 +862,7 @@ func (m *DashboardReq) Reset() { *m = DashboardReq{} }
|
|||||||
func (m *DashboardReq) String() string { return proto.CompactTextString(m) }
|
func (m *DashboardReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*DashboardReq) ProtoMessage() {}
|
func (*DashboardReq) ProtoMessage() {}
|
||||||
func (*DashboardReq) Descriptor() ([]byte, []int) {
|
func (*DashboardReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{13}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{13}
|
||||||
}
|
}
|
||||||
func (m *DashboardReq) XXX_Unmarshal(b []byte) error {
|
func (m *DashboardReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_DashboardReq.Unmarshal(m, b)
|
return xxx_messageInfo_DashboardReq.Unmarshal(m, b)
|
||||||
@ -898,7 +900,7 @@ func (m *DashboardStats) Reset() { *m = DashboardStats{} }
|
|||||||
func (m *DashboardStats) String() string { return proto.CompactTextString(m) }
|
func (m *DashboardStats) String() string { return proto.CompactTextString(m) }
|
||||||
func (*DashboardStats) ProtoMessage() {}
|
func (*DashboardStats) ProtoMessage() {}
|
||||||
func (*DashboardStats) Descriptor() ([]byte, []int) {
|
func (*DashboardStats) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_piecestore_ef88e5b6fd61ab5b, []int{14}
|
return fileDescriptor_piecestore_c26ae6b59e2ee94d, []int{14}
|
||||||
}
|
}
|
||||||
func (m *DashboardStats) XXX_Unmarshal(b []byte) error {
|
func (m *DashboardStats) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_DashboardStats.Unmarshal(m, b)
|
return xxx_messageInfo_DashboardStats.Unmarshal(m, b)
|
||||||
@ -1326,81 +1328,82 @@ var _PieceStoreRoutes_serviceDesc = grpc.ServiceDesc{
|
|||||||
Metadata: "piecestore.proto",
|
Metadata: "piecestore.proto",
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("piecestore.proto", fileDescriptor_piecestore_ef88e5b6fd61ab5b) }
|
func init() { proto.RegisterFile("piecestore.proto", fileDescriptor_piecestore_c26ae6b59e2ee94d) }
|
||||||
|
|
||||||
var fileDescriptor_piecestore_ef88e5b6fd61ab5b = []byte{
|
var fileDescriptor_piecestore_c26ae6b59e2ee94d = []byte{
|
||||||
// 1159 bytes of a gzipped FileDescriptorProto
|
// 1176 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0xdb, 0x46,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcb, 0x6e, 0xdb, 0x46,
|
||||||
0x10, 0x16, 0xa9, 0xff, 0xd1, 0x6f, 0x36, 0x46, 0x2b, 0x0b, 0xb1, 0xad, 0x32, 0x4d, 0xaa, 0xda,
|
0x17, 0x16, 0x49, 0x5d, 0x8f, 0xae, 0x99, 0x18, 0xff, 0x2f, 0x0b, 0x71, 0xa2, 0x32, 0x4d, 0xaa,
|
||||||
0x80, 0x9c, 0x38, 0x40, 0x81, 0x1e, 0xed, 0xca, 0x08, 0x84, 0xa2, 0x8e, 0xbb, 0xb2, 0x2f, 0x29,
|
0x26, 0x80, 0x92, 0x38, 0x40, 0x81, 0x2e, 0xed, 0xca, 0x08, 0x84, 0xa2, 0x89, 0x3b, 0xb2, 0x37,
|
||||||
0x50, 0x66, 0x45, 0x8e, 0x65, 0x22, 0x14, 0xa9, 0x92, 0x4b, 0x57, 0xf6, 0xb5, 0x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 0x23, 0xe3, 0x68, 0x65, 0xce, 0x94,
|
||||||
0xf0, 0x38, 0x92, 0x2d, 0xc8, 0x1b, 0xe8, 0x71, 0xbf, 0x55, 0xea, 0x64, 0xbb, 0x55, 0x2a, 0x0d,
|
0x84, 0x33, 0x8d, 0x18, 0x4f, 0x3c, 0xd9, 0x83, 0x82, 0x89, 0x3e, 0x0f, 0xda, 0xe5, 0xae, 0xd6,
|
||||||
0xf2, 0x04, 0xca, 0xbe, 0x35, 0x76, 0x18, 0x0f, 0x3c, 0x6c, 0x95, 0x43, 0x5d, 0x68, 0x0a, 0x68,
|
0xab, 0x51, 0x29, 0x90, 0x7b, 0x50, 0x09, 0xec, 0x89, 0xcb, 0x78, 0xe8, 0x63, 0xbb, 0x12, 0xe5,
|
||||||
0xff, 0x29, 0xb0, 0x4d, 0xd1, 0xe1, 0xab, 0xcb, 0xf0, 0x13, 0x34, 0xa7, 0x61, 0x89, 0x74, 0x96,
|
0x85, 0x66, 0x80, 0xfe, 0xb7, 0x02, 0xfb, 0x14, 0x5d, 0xbe, 0xbe, 0x0c, 0xdf, 0x40, 0x6b, 0x16,
|
||||||
0x60, 0xa2, 0x14, 0x95, 0xa3, 0xfd, 0xe5, 0x04, 0xd6, 0x15, 0xf3, 0x24, 0x17, 0x96, 0x81, 0x36,
|
0x95, 0xc8, 0x60, 0x29, 0x26, 0x4a, 0x51, 0x3d, 0x7c, 0xb2, 0x1a, 0xc0, 0xa6, 0x62, 0x1e, 0xe7,
|
||||||
0x84, 0xa7, 0x39, 0xe7, 0x5b, 0x90, 0xe7, 0x2e, 0x67, 0xb6, 0x28, 0x56, 0x96, 0x4a, 0x83, 0x7c,
|
0xa3, 0x32, 0xd0, 0xa6, 0xb0, 0xb4, 0x60, 0x7c, 0x0f, 0x0a, 0xdc, 0xe3, 0xcc, 0x11, 0xc5, 0xd2,
|
||||||
0x03, 0x8d, 0xd0, 0x29, 0x1b, 0xa3, 0xee, 0xb8, 0xa6, 0x28, 0x7e, 0x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x8e, 0xbb, 0x5b, 0x56, 0xfb, 0x4f,
|
||||||
0x76, 0x8c, 0x4d, 0xed, 0x02, 0x1e, 0xa5, 0x27, 0xfc, 0x41, 0x3a, 0x79, 0x06, 0x75, 0x31, 0x18,
|
0x5a, 0x36, 0xbf, 0xbb, 0x65, 0xfb, 0x40, 0x16, 0x1c, 0x4b, 0x1a, 0xb7, 0x0d, 0xa5, 0xa9, 0x3c,
|
||||||
0x75, 0x0f, 0x0d, 0xb4, 0x6e, 0xd0, 0x8c, 0x04, 0xad, 0x09, 0x94, 0x46, 0xa0, 0x06, 0x50, 0x1a,
|
0x22, 0x76, 0x32, 0x11, 0xf5, 0x33, 0xb8, 0x93, 0x4d, 0x92, 0x9d, 0x74, 0xf2, 0x08, 0x1a, 0x62,
|
||||||
0x72, 0xc6, 0x7d, 0x8a, 0xbf, 0x68, 0xbf, 0x2b, 0x50, 0x09, 0x8d, 0xd8, 0xf9, 0x0e, 0x40, 0xe0,
|
0x00, 0x1b, 0x3e, 0x9a, 0x68, 0x5f, 0xa1, 0x15, 0x17, 0xa1, 0x2e, 0x50, 0x1a, 0x83, 0x3a, 0x40,
|
||||||
0xa3, 0xa9, 0xfb, 0x53, 0x66, 0x24, 0x02, 0x86, 0xc8, 0x30, 0x04, 0xc8, 0x57, 0xd0, 0x60, 0x37,
|
0x79, 0xc4, 0x19, 0x0f, 0x28, 0x7e, 0xaf, 0xff, 0xa2, 0x40, 0x35, 0x12, 0x12, 0xe3, 0x07, 0x00,
|
||||||
0xcc, 0xb2, 0xd9, 0xc8, 0xc6, 0x88, 0x23, 0xb7, 0xa8, 0x27, 0xb0, 0x24, 0x3e, 0x83, 0xba, 0xf0,
|
0x61, 0x80, 0x96, 0x11, 0xcc, 0x98, 0x99, 0x26, 0x3d, 0x42, 0x46, 0x11, 0x40, 0x3e, 0x81, 0x26,
|
||||||
0x93, 0xb4, 0x68, 0x54, 0xc0, 0x5a, 0x88, 0x26, 0xcd, 0x4c, 0x0e, 0xe1, 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50, 0xa1, 0x91, 0x02,
|
||||||
0x70, 0x1d, 0x07, 0xc5, 0x95, 0xec, 0x47, 0xfa, 0x34, 0x42, 0xfc, 0xbb, 0x14, 0x26, 0x07, 0xf0,
|
0x22, 0x6f, 0xe4, 0xff, 0x50, 0x4a, 0xde, 0x35, 0x59, 0x81, 0xa2, 0x2b, 0x1f, 0xb0, 0x4f, 0xa1,
|
||||||
0x68, 0xe4, 0xba, 0xdc, 0xe7, 0x1e, 0x9b, 0xea, 0xcc, 0x34, 0x3d, 0xf4, 0x7d, 0x11, 0x4c, 0x99,
|
0x25, 0x14, 0xa6, 0xe7, 0xba, 0x28, 0x9e, 0xfe, 0x20, 0xce, 0x4f, 0x33, 0xc2, 0xbf, 0xc8, 0x60,
|
||||||
0x36, 0x93, 0x85, 0x63, 0x89, 0x87, 0x7e, 0xad, 0x70, 0x0a, 0x38, 0xcc, 0x4e, 0xb8, 0x39, 0xc1,
|
0xf2, 0x14, 0xee, 0x8c, 0x3d, 0x8f, 0x07, 0xdc, 0x67, 0x33, 0x83, 0x59, 0x96, 0x8f, 0x41, 0x20,
|
||||||
0x6d, 0xc4, 0xf8, 0x1c, 0x15, 0x67, 0x0b, 0x54, 0xf9, 0xca, 0x68, 0xc4, 0x78, 0x4c, 0x7d, 0x05,
|
0x9c, 0xa9, 0xd0, 0x56, 0xaa, 0x38, 0x92, 0x78, 0x64, 0xd7, 0x8e, 0x26, 0x87, 0xcb, 0x9c, 0x94,
|
||||||
0x79, 0x3f, 0xcc, 0x47, 0xbc, 0x33, 0x2a, 0x47, 0x3b, 0x2b, 0x9a, 0x39, 0xed, 0x0c, 0x2a, 0xb9,
|
0x9b, 0x17, 0xdc, 0x66, 0x82, 0x2f, 0x50, 0x71, 0xbe, 0x44, 0x95, 0xdb, 0x4c, 0x33, 0xc1, 0x13,
|
||||||
0x64, 0x17, 0x20, 0xcd, 0x4e, 0x3c, 0x2e, 0x4a, 0x74, 0x0e, 0x21, 0x2f, 0xa1, 0x10, 0x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, 0xe4, 0x48, 0x91,
|
0x60, 0xc3, 0x2f, 0x52, 0xdd, 0xf9, 0x78, 0xab, 0x3a, 0x0b, 0x7e, 0x10, 0x39, 0x18, 0xf5, 0x41,
|
||||||
0x15, 0x8a, 0xcf, 0x1f, 0xc0, 0x76, 0x67, 0xc3, 0xba, 0xd8, 0x52, 0xcb, 0xbc, 0x50, 0x4e, 0x72,
|
0x67, 0x7d, 0xb7, 0x44, 0x43, 0xa5, 0xb3, 0xbd, 0x93, 0xf4, 0x1c, 0xf9, 0x1a, 0x2a, 0xe9, 0x95,
|
||||||
0x6f, 0xd5, 0xe9, 0x68, 0x54, 0x10, 0x5d, 0xf6, 0xea, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f,
|
0x22, 0x6b, 0x32, 0xbe, 0x78, 0x01, 0x3b, 0xdd, 0x2d, 0x7a, 0x71, 0xa4, 0x9e, 0x7b, 0xae, 0x1c,
|
||||||
0x14, 0x59, 0xb7, 0x81, 0x0c, 0x00, 0x00,
|
0xe7, 0xdf, 0xaa, 0xb3, 0xf1, 0xb8, 0x28, 0xba, 0xec, 0xe5, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff,
|
||||||
|
0xda, 0xcb, 0x89, 0xc5, 0xe9, 0x0c, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,7 @@ message PieceId {
|
|||||||
string id = 1;
|
string id = 1;
|
||||||
|
|
||||||
SignedMessage authorization = 2;
|
SignedMessage authorization = 2;
|
||||||
|
bytes satellite_id = 3 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
||||||
}
|
}
|
||||||
|
|
||||||
message PieceSummary {
|
message PieceSummary {
|
||||||
@ -96,6 +97,7 @@ message PieceDelete {
|
|||||||
// TODO: may want to use customtype and fixed-length byte slice
|
// TODO: may want to use customtype and fixed-length byte slice
|
||||||
string id = 1;
|
string id = 1;
|
||||||
SignedMessage authorization = 3;
|
SignedMessage authorization = 3;
|
||||||
|
bytes satellite_id = 4 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
||||||
}
|
}
|
||||||
|
|
||||||
message PieceDeleteSummary {
|
message PieceDeleteSummary {
|
||||||
@ -133,4 +135,4 @@ message DashboardStats {
|
|||||||
StatSummary stats = 6;
|
StatSummary stats = 6;
|
||||||
bool connection = 7;
|
bool connection = 7;
|
||||||
google.protobuf.Duration uptime = 8;
|
google.protobuf.Duration uptime = 8;
|
||||||
}
|
}
|
@ -43,9 +43,9 @@ func init() {
|
|||||||
// Client is an interface describing the functions for interacting with piecestore nodes
|
// Client is an interface describing the functions for interacting with piecestore nodes
|
||||||
type Client interface {
|
type Client interface {
|
||||||
Meta(ctx context.Context, id PieceID) (*pb.PieceSummary, error)
|
Meta(ctx context.Context, id PieceID) (*pb.PieceSummary, error)
|
||||||
Put(ctx context.Context, id PieceID, data io.Reader, ttl time.Time, ba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) error
|
Put(ctx context.Context, id PieceID, data io.Reader, ttl time.Time, ba *pb.PayerBandwidthAllocation) error
|
||||||
Get(ctx context.Context, id PieceID, size int64, ba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (ranger.Ranger, error)
|
Get(ctx context.Context, id PieceID, size int64, ba *pb.PayerBandwidthAllocation) (ranger.Ranger, error)
|
||||||
Delete(ctx context.Context, pieceID PieceID, authorization *pb.SignedMessage) error
|
Delete(ctx context.Context, pieceID PieceID, satelliteID storj.NodeID) error
|
||||||
io.Closer
|
io.Closer
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,15 +117,25 @@ func (ps *PieceStore) Meta(ctx context.Context, id PieceID) (*pb.PieceSummary, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Put uploads a Piece to a piece store Server
|
// Put uploads a Piece to a piece store Server
|
||||||
func (ps *PieceStore) Put(ctx context.Context, id PieceID, data io.Reader, ttl time.Time, ba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) error {
|
func (ps *PieceStore) Put(ctx context.Context, id PieceID, data io.Reader, ttl time.Time, pba *pb.PayerBandwidthAllocation) error {
|
||||||
stream, err := ps.client.Store(ctx)
|
stream, err := ps.client.Store(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Making a clone, otherwise there will be a data race
|
||||||
|
// when another goroutine tries to write the cached size
|
||||||
|
// of this instance at the same time.
|
||||||
|
pbaClone := pba.Clone()
|
||||||
|
|
||||||
|
rba := &pb.RenterBandwidthAllocation{
|
||||||
|
PayerAllocation: pbaClone,
|
||||||
|
StorageNodeId: ps.remoteID,
|
||||||
|
}
|
||||||
|
|
||||||
msg := &pb.PieceStore{
|
msg := &pb.PieceStore{
|
||||||
PieceData: &pb.PieceStore_PieceData{Id: id.String(), ExpirationUnixSec: ttl.Unix()},
|
PieceData: &pb.PieceStore_PieceData{Id: id.String(), ExpirationUnixSec: ttl.Unix()},
|
||||||
Authorization: authorization,
|
BandwidthAllocation: rba,
|
||||||
}
|
}
|
||||||
if err = stream.Send(msg); err != nil {
|
if err = stream.Send(msg); err != nil {
|
||||||
if _, closeErr := stream.CloseAndRecv(); closeErr != nil {
|
if _, closeErr := stream.CloseAndRecv(); closeErr != nil {
|
||||||
@ -135,7 +145,7 @@ func (ps *PieceStore) Put(ctx context.Context, id PieceID, data io.Reader, ttl t
|
|||||||
return fmt.Errorf("%v.Send() = %v", stream, err)
|
return fmt.Errorf("%v.Send() = %v", stream, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
writer := &StreamWriter{signer: ps, stream: stream, pba: ba}
|
writer := &StreamWriter{signer: ps, stream: stream, rba: rba}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := writer.Close(); err != nil && err != io.EOF {
|
if err := writer.Close(); err != nil && err != io.EOF {
|
||||||
@ -154,18 +164,18 @@ func (ps *PieceStore) Put(ctx context.Context, id PieceID, data io.Reader, ttl t
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get begins downloading a Piece from a piece store Server
|
// Get begins downloading a Piece from a piece store Server
|
||||||
func (ps *PieceStore) Get(ctx context.Context, id PieceID, size int64, ba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (ranger.Ranger, error) {
|
func (ps *PieceStore) Get(ctx context.Context, id PieceID, size int64, ba *pb.PayerBandwidthAllocation) (ranger.Ranger, error) {
|
||||||
stream, err := ps.client.Retrieve(ctx)
|
stream, err := ps.client.Retrieve(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return PieceRangerSize(ps, stream, id, size, ba, authorization), nil
|
return PieceRangerSize(ps, stream, id, size, ba), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete a Piece from a piece store Server
|
// Delete a Piece from a piece store Server
|
||||||
func (ps *PieceStore) Delete(ctx context.Context, id PieceID, authorization *pb.SignedMessage) error {
|
func (ps *PieceStore) Delete(ctx context.Context, id PieceID, satelliteID storj.NodeID) error {
|
||||||
reply, err := ps.client.Delete(ctx, &pb.PieceDelete{Id: id.String(), Authorization: authorization})
|
reply, err := ps.client.Delete(ctx, &pb.PieceDelete{Id: id.String(), SatelliteId: satelliteID})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -19,28 +19,27 @@ import (
|
|||||||
var Error = errs.Class("pieceRanger error")
|
var Error = errs.Class("pieceRanger error")
|
||||||
|
|
||||||
type pieceRanger struct {
|
type pieceRanger struct {
|
||||||
c *PieceStore
|
c *PieceStore
|
||||||
id PieceID
|
id PieceID
|
||||||
size int64
|
size int64
|
||||||
stream pb.PieceStoreRoutes_RetrieveClient
|
stream pb.PieceStoreRoutes_RetrieveClient
|
||||||
pba *pb.PayerBandwidthAllocation
|
pba *pb.PayerBandwidthAllocation
|
||||||
authorization *pb.SignedMessage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PieceRanger PieceRanger returns a Ranger from a PieceID.
|
// PieceRanger PieceRanger returns a Ranger from a PieceID.
|
||||||
func PieceRanger(ctx context.Context, c *PieceStore, stream pb.PieceStoreRoutes_RetrieveClient, id PieceID, pba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (ranger.Ranger, error) {
|
func PieceRanger(ctx context.Context, c *PieceStore, stream pb.PieceStoreRoutes_RetrieveClient, id PieceID, pba *pb.PayerBandwidthAllocation) (ranger.Ranger, error) {
|
||||||
piece, err := c.Meta(ctx, id)
|
piece, err := c.Meta(ctx, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &pieceRanger{c: c, id: id, size: piece.PieceSize, stream: stream, pba: pba, authorization: authorization}, nil
|
return &pieceRanger{c: c, id: id, size: piece.PieceSize, stream: stream, pba: pba}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// PieceRangerSize creates a PieceRanger with known size.
|
// PieceRangerSize creates a PieceRanger with known size.
|
||||||
// Use it if you know the piece size. This will safe the extra request for
|
// Use it if you know the piece size. This will safe the extra request for
|
||||||
// retrieving the piece size from the piece storage.
|
// retrieving the piece size from the piece storage.
|
||||||
func PieceRangerSize(c *PieceStore, stream pb.PieceStoreRoutes_RetrieveClient, id PieceID, size int64, pba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) ranger.Ranger {
|
func PieceRangerSize(c *PieceStore, stream pb.PieceStoreRoutes_RetrieveClient, id PieceID, size int64, pba *pb.PayerBandwidthAllocation) ranger.Ranger {
|
||||||
return &pieceRanger{c: c, id: id, size: size, stream: stream, pba: pba, authorization: authorization}
|
return &pieceRanger{c: c, id: id, size: size, stream: stream, pba: pba}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size implements Ranger.Size
|
// Size implements Ranger.Size
|
||||||
@ -63,10 +62,23 @@ func (r *pieceRanger) Range(ctx context.Context, offset, length int64) (io.ReadC
|
|||||||
return ioutil.NopCloser(bytes.NewReader([]byte{})), nil
|
return ioutil.NopCloser(bytes.NewReader([]byte{})), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Making a copy, otherwise there will be a data race
|
||||||
|
// when another goroutine tries to write the cached size
|
||||||
|
// of this instance at the same time.
|
||||||
|
pbaClone := r.pba.Clone()
|
||||||
|
|
||||||
|
rba := &pb.RenterBandwidthAllocation{
|
||||||
|
PayerAllocation: pbaClone,
|
||||||
|
StorageNodeId: r.c.remoteID,
|
||||||
|
}
|
||||||
|
|
||||||
// send piece data
|
// send piece data
|
||||||
if err := r.stream.Send(&pb.PieceRetrieval{PieceData: &pb.PieceRetrieval_PieceData{Id: r.id.String(), PieceSize: length, Offset: offset}, Authorization: r.authorization}); err != nil {
|
if err := r.stream.Send(&pb.PieceRetrieval{
|
||||||
|
PieceData: &pb.PieceRetrieval_PieceData{Id: r.id.String(), PieceSize: length, Offset: offset},
|
||||||
|
BandwidthAllocation: rba,
|
||||||
|
}); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewStreamReader(r.c, r.stream, r.pba, r.size), nil
|
return NewStreamReader(r.c, r.stream, rba, r.size), nil
|
||||||
}
|
}
|
||||||
|
@ -59,13 +59,7 @@ func TestPieceRanger(t *testing.T) {
|
|||||||
pid := NewPieceID()
|
pid := NewPieceID()
|
||||||
|
|
||||||
if tt.offset >= 0 && tt.length > 0 && tt.offset+tt.length <= tt.size {
|
if tt.offset >= 0 && tt.length > 0 && tt.offset+tt.length <= tt.size {
|
||||||
msg1 := &pb.PieceRetrieval{
|
stream.EXPECT().Send(gomock.Any()).Return(nil)
|
||||||
PieceData: &pb.PieceRetrieval_PieceData{
|
|
||||||
Id: pid.String(), PieceSize: tt.length, Offset: tt.offset,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.EXPECT().Send(msg1).Return(nil)
|
|
||||||
stream.EXPECT().Send(gomock.Any()).Return(nil).MinTimes(0).MaxTimes(1)
|
stream.EXPECT().Send(gomock.Any()).Return(nil).MinTimes(0).MaxTimes(1)
|
||||||
stream.EXPECT().Recv().Return(
|
stream.EXPECT().Recv().Return(
|
||||||
&pb.PieceRetrievalStream{
|
&pb.PieceRetrievalStream{
|
||||||
@ -86,7 +80,7 @@ func TestPieceRanger(t *testing.T) {
|
|||||||
target.Type.DPanicOnInvalid("pr test")
|
target.Type.DPanicOnInvalid("pr test")
|
||||||
c, err := NewCustomRoute(route, target, 32*1024, id)
|
c, err := NewCustomRoute(route, target, 32*1024, id)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
rr, err := PieceRanger(ctx, c, stream, pid, &pb.PayerBandwidthAllocation{}, nil)
|
rr, err := PieceRanger(ctx, c, stream, pid, &pb.PayerBandwidthAllocation{})
|
||||||
if assert.NoError(t, err, errTag) {
|
if assert.NoError(t, err, errTag) {
|
||||||
assert.Equal(t, tt.size, rr.Size(), errTag)
|
assert.Equal(t, tt.size, rr.Size(), errTag)
|
||||||
}
|
}
|
||||||
@ -139,13 +133,7 @@ func TestPieceRangerSize(t *testing.T) {
|
|||||||
stream := pb.NewMockPieceStoreRoutes_RetrieveClient(ctrl)
|
stream := pb.NewMockPieceStoreRoutes_RetrieveClient(ctrl)
|
||||||
|
|
||||||
if tt.offset >= 0 && tt.length > 0 && tt.offset+tt.length <= tt.size {
|
if tt.offset >= 0 && tt.length > 0 && tt.offset+tt.length <= tt.size {
|
||||||
msg1 := &pb.PieceRetrieval{
|
stream.EXPECT().Send(gomock.Any()).Return(nil)
|
||||||
PieceData: &pb.PieceRetrieval_PieceData{
|
|
||||||
Id: pid.String(), PieceSize: tt.length, Offset: tt.offset,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.EXPECT().Send(msg1).Return(nil)
|
|
||||||
stream.EXPECT().Send(gomock.Any()).Return(nil).MinTimes(0).MaxTimes(1)
|
stream.EXPECT().Send(gomock.Any()).Return(nil).MinTimes(0).MaxTimes(1)
|
||||||
stream.EXPECT().Recv().Return(
|
stream.EXPECT().Recv().Return(
|
||||||
&pb.PieceRetrievalStream{
|
&pb.PieceRetrievalStream{
|
||||||
@ -168,7 +156,7 @@ func TestPieceRangerSize(t *testing.T) {
|
|||||||
target.Type.DPanicOnInvalid("pr test 2")
|
target.Type.DPanicOnInvalid("pr test 2")
|
||||||
c, err := NewCustomRoute(route, target, 32*1024, id)
|
c, err := NewCustomRoute(route, target, 32*1024, id)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
rr := PieceRangerSize(c, stream, pid, tt.size, &pb.PayerBandwidthAllocation{}, nil)
|
rr := PieceRangerSize(c, stream, pid, tt.size, &pb.PayerBandwidthAllocation{})
|
||||||
assert.Equal(t, tt.size, rr.Size(), errTag)
|
assert.Equal(t, tt.size, rr.Size(), errTag)
|
||||||
r, err := rr.Range(ctx, tt.offset, tt.length)
|
r, err := rr.Range(ctx, tt.offset, tt.length)
|
||||||
if tt.errString != "" {
|
if tt.errString != "" {
|
||||||
|
@ -19,24 +19,22 @@ type StreamWriter struct {
|
|||||||
stream pb.PieceStoreRoutes_StoreClient
|
stream pb.PieceStoreRoutes_StoreClient
|
||||||
signer *PieceStore // We need this for signing
|
signer *PieceStore // We need this for signing
|
||||||
totalWritten int64
|
totalWritten int64
|
||||||
pba *pb.PayerBandwidthAllocation
|
rba *pb.RenterBandwidthAllocation
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write Piece data to a piece store server upload stream
|
// Write Piece data to a piece store server upload stream
|
||||||
func (s *StreamWriter) Write(b []byte) (int, error) {
|
func (s *StreamWriter) Write(b []byte) (int, error) {
|
||||||
updatedAllocation := s.totalWritten + int64(len(b))
|
updatedAllocation := s.totalWritten + int64(len(b))
|
||||||
rba := &pb.RenterBandwidthAllocation{
|
|
||||||
PayerAllocation: *s.pba,
|
s.rba.Total = updatedAllocation
|
||||||
Total: updatedAllocation,
|
err := auth.SignMessage(s.rba, *s.signer.selfID)
|
||||||
StorageNodeId: s.signer.remoteID,
|
|
||||||
}
|
|
||||||
err := auth.SignMessage(rba, *s.signer.selfID)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := &pb.PieceStore{
|
msg := &pb.PieceStore{
|
||||||
PieceData: &pb.PieceStore_PieceData{Content: b},
|
PieceData: &pb.PieceStore_PieceData{Content: b},
|
||||||
BandwidthAllocation: rba,
|
BandwidthAllocation: s.rba,
|
||||||
}
|
}
|
||||||
s.totalWritten = updatedAllocation
|
s.totalWritten = updatedAllocation
|
||||||
// Second we send the actual content
|
// Second we send the actual content
|
||||||
@ -70,7 +68,7 @@ type StreamReader struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewStreamReader creates a StreamReader for reading data from the piece store server
|
// NewStreamReader creates a StreamReader for reading data from the piece store server
|
||||||
func NewStreamReader(client *PieceStore, stream pb.PieceStoreRoutes_RetrieveClient, pba *pb.PayerBandwidthAllocation, size int64) *StreamReader {
|
func NewStreamReader(client *PieceStore, stream pb.PieceStoreRoutes_RetrieveClient, rba *pb.RenterBandwidthAllocation, size int64) *StreamReader {
|
||||||
sr := &StreamReader{
|
sr := &StreamReader{
|
||||||
pendingAllocs: sync2.NewThrottle(),
|
pendingAllocs: sync2.NewThrottle(),
|
||||||
client: client,
|
client: client,
|
||||||
@ -92,11 +90,9 @@ func NewStreamReader(client *PieceStore, stream pb.PieceStoreRoutes_RetrieveClie
|
|||||||
if sr.allocated+trustedSize > size {
|
if sr.allocated+trustedSize > size {
|
||||||
allocate = size - sr.allocated
|
allocate = size - sr.allocated
|
||||||
}
|
}
|
||||||
rba := &pb.RenterBandwidthAllocation{
|
|
||||||
PayerAllocation: *pba,
|
rba.Total = sr.allocated + allocate
|
||||||
Total: sr.allocated + allocate,
|
|
||||||
StorageNodeId: sr.client.remoteID,
|
|
||||||
}
|
|
||||||
err := auth.SignMessage(rba, *client.selfID)
|
err := auth.SignMessage(rba, *client.selfID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
sr.pendingAllocs.Fail(err)
|
sr.pendingAllocs.Fail(err)
|
||||||
|
@ -35,17 +35,22 @@ func (s *Server) Retrieve(stream pb.PieceStoreRoutes_RetrieveServer) (err error)
|
|||||||
return RetrieveError.New("error receiving piece data")
|
return RetrieveError.New("error receiving piece data")
|
||||||
}
|
}
|
||||||
|
|
||||||
authorization := recv.GetAuthorization()
|
|
||||||
if err := s.verifier(authorization); err != nil {
|
|
||||||
return ServerError.Wrap(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
pd := recv.GetPieceData()
|
pd := recv.GetPieceData()
|
||||||
if pd == nil {
|
if pd == nil {
|
||||||
return RetrieveError.New("PieceStore message is nil")
|
return RetrieveError.New("PieceStore message is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
id, err := getNamespacedPieceID([]byte(pd.GetId()), getNamespace(authorization))
|
rba := recv.GetBandwidthAllocation()
|
||||||
|
if rba == nil {
|
||||||
|
return RetrieveError.New("RenterBandwidthAllocation message is nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
pba := rba.PayerAllocation
|
||||||
|
if pb.Equal(&pba, &pb.PayerBandwidthAllocation{}) {
|
||||||
|
return RetrieveError.New("PayerBandwidthAllocation message is empty")
|
||||||
|
}
|
||||||
|
|
||||||
|
id, err := getNamespacedPieceID([]byte(pd.GetId()), pba.SatelliteId.Bytes())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -64,7 +63,6 @@ type Server struct {
|
|||||||
totalAllocated int64 // TODO: use memory.Size
|
totalAllocated int64 // TODO: use memory.Size
|
||||||
totalBwAllocated int64 // TODO: use memory.Size
|
totalBwAllocated int64 // TODO: use memory.Size
|
||||||
whitelist map[storj.NodeID]crypto.PublicKey
|
whitelist map[storj.NodeID]crypto.PublicKey
|
||||||
verifier auth.SignedMessageVerifier
|
|
||||||
kad *kademlia.Kademlia
|
kad *kademlia.Kademlia
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +141,6 @@ func NewEndpoint(log *zap.Logger, config Config, storage *pstore.Storage, db *ps
|
|||||||
totalAllocated: allocatedDiskSpace,
|
totalAllocated: allocatedDiskSpace,
|
||||||
totalBwAllocated: allocatedBandwidth,
|
totalBwAllocated: allocatedBandwidth,
|
||||||
whitelist: whitelist,
|
whitelist: whitelist,
|
||||||
verifier: auth.NewSignedMessageVerifier(),
|
|
||||||
kad: k,
|
kad: k,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@ -163,12 +160,7 @@ func (s *Server) Stop(ctx context.Context) error {
|
|||||||
func (s *Server) Piece(ctx context.Context, in *pb.PieceId) (*pb.PieceSummary, error) {
|
func (s *Server) Piece(ctx context.Context, in *pb.PieceId) (*pb.PieceSummary, error) {
|
||||||
s.log.Debug("Getting Meta", zap.String("Piece ID", in.GetId()))
|
s.log.Debug("Getting Meta", zap.String("Piece ID", in.GetId()))
|
||||||
|
|
||||||
authorization := in.GetAuthorization()
|
id, err := getNamespacedPieceID([]byte(in.GetId()), in.SatelliteId.Bytes())
|
||||||
if err := s.verifier(authorization); err != nil {
|
|
||||||
return nil, ServerError.Wrap(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
id, err := getNamespacedPieceID([]byte(in.GetId()), getNamespace(authorization))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -178,15 +170,6 @@ func (s *Server) Piece(ctx context.Context, in *pb.PieceId) (*pb.PieceSummary, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
match, err := regexp.MatchString("^[A-Za-z0-9]{20,64}$", id)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if !match {
|
|
||||||
return nil, ServerError.New("invalid ID")
|
|
||||||
}
|
|
||||||
|
|
||||||
fileInfo, err := os.Stat(path)
|
fileInfo, err := os.Stat(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -261,11 +244,8 @@ func (s *Server) Dashboard(in *pb.DashboardReq, stream pb.PieceStoreRoutes_Dashb
|
|||||||
// Delete -- Delete data by Id from piecestore
|
// Delete -- Delete data by Id from piecestore
|
||||||
func (s *Server) Delete(ctx context.Context, in *pb.PieceDelete) (*pb.PieceDeleteSummary, error) {
|
func (s *Server) Delete(ctx context.Context, in *pb.PieceDelete) (*pb.PieceDeleteSummary, error) {
|
||||||
s.log.Debug("Deleting", zap.String("Piece ID", fmt.Sprint(in.GetId())))
|
s.log.Debug("Deleting", zap.String("Piece ID", fmt.Sprint(in.GetId())))
|
||||||
authorization := in.GetAuthorization()
|
|
||||||
if err := s.verifier(authorization); err != nil {
|
id, err := getNamespacedPieceID([]byte(in.GetId()), in.SatelliteId.Bytes())
|
||||||
return nil, ServerError.Wrap(err)
|
|
||||||
}
|
|
||||||
id, err := getNamespacedPieceID([]byte(in.GetId()), getNamespace(authorization))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -373,10 +353,6 @@ func getNamespacedPieceID(pieceID, namespace []byte) (string, error) {
|
|||||||
return base58.Encode(h), nil
|
return base58.Encode(h), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getNamespace(signedMessage *pb.SignedMessage) []byte {
|
|
||||||
return signedMessage.GetData()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Server) getDashboardData(ctx context.Context) (*pb.DashboardStats, error) {
|
func (s *Server) getDashboardData(ctx context.Context) (*pb.DashboardStats, error) {
|
||||||
statsSummary, err := s.retrieveStats()
|
statsSummary, err := s.retrieveStats()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -47,12 +47,15 @@ func TestPiece(t *testing.T) {
|
|||||||
s, c, cleanup := NewTest(ctx, t, snID, upID, []storj.NodeID{})
|
s, c, cleanup := NewTest(ctx, t, snID, upID, []storj.NodeID{})
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
if err := writeFile(s, "11111111111111111111"); err != nil {
|
namespacedID, err := getNamespacedPieceID([]byte("11111111111111111111"), snID.ID.Bytes())
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
if err := writeFile(s, namespacedID); err != nil {
|
||||||
t.Errorf("Error: %v\nCould not create test piece", err)
|
t.Errorf("Error: %v\nCould not create test piece", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func() { _ = s.storage.Delete("11111111111111111111") }()
|
defer func() { _ = s.storage.Delete(namespacedID) }()
|
||||||
|
|
||||||
// set up test cases
|
// set up test cases
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
@ -67,41 +70,35 @@ func TestPiece(t *testing.T) {
|
|||||||
expiration: 9999999999,
|
expiration: 9999999999,
|
||||||
err: "",
|
err: "",
|
||||||
},
|
},
|
||||||
{ // server should err with invalid id
|
|
||||||
id: "123",
|
|
||||||
size: 5,
|
|
||||||
expiration: 9999999999,
|
|
||||||
err: "rpc error: code = Unknown desc = piecestore error: invalid id length",
|
|
||||||
},
|
|
||||||
{ // server should err with nonexistent file
|
{ // server should err with nonexistent file
|
||||||
id: "22222222222222222222",
|
id: "22222222222222222222",
|
||||||
size: 5,
|
size: 5,
|
||||||
expiration: 9999999999,
|
expiration: 9999999999,
|
||||||
err: fmt.Sprintf("rpc error: code = Unknown desc = stat %s: no such file or directory", func() string {
|
err: fmt.Sprintf("rpc error: code = Unknown desc = stat %s: no such file or directory", func() string {
|
||||||
path, _ := s.storage.PiecePath("22222222222222222222")
|
namespacedID, err := getNamespacedPieceID([]byte("22222222222222222222"), snID.ID.Bytes())
|
||||||
|
require.NoError(t, err)
|
||||||
|
path, _ := s.storage.PiecePath(namespacedID)
|
||||||
return path
|
return path
|
||||||
}()),
|
}()),
|
||||||
},
|
},
|
||||||
{ // server should err with invalid TTL
|
|
||||||
id: "22222222222222222222;DELETE*FROM TTL;;;;",
|
|
||||||
size: 5,
|
|
||||||
expiration: 9999999999,
|
|
||||||
err: "rpc error: code = Unknown desc = PSServer error: invalid ID",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run("", func(t *testing.T) {
|
t.Run("", func(t *testing.T) {
|
||||||
|
|
||||||
|
namespacedID, err := getNamespacedPieceID([]byte(tt.id), snID.ID.Bytes())
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
// simulate piece TTL entry
|
// 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))
|
_, err = s.DB.DB.Exec(fmt.Sprintf(`INSERT INTO ttl (id, created, expires) VALUES ("%s", "%d", "%d")`, namespacedID, 1234567890, tt.expiration))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
_, err := s.DB.DB.Exec(fmt.Sprintf(`DELETE FROM ttl WHERE id="%s"`, tt.id))
|
_, err := s.DB.DB.Exec(fmt.Sprintf(`DELETE FROM ttl WHERE id="%s"`, namespacedID))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req := &pb.PieceId{Id: tt.id}
|
req := &pb.PieceId{Id: tt.id, SatelliteId: snID.ID}
|
||||||
resp, err := c.Piece(ctx, req)
|
resp, err := c.Piece(ctx, req)
|
||||||
|
|
||||||
if tt.err != "" {
|
if tt.err != "" {
|
||||||
@ -305,16 +302,6 @@ func TestStore(t *testing.T) {
|
|||||||
totalReceived: 5,
|
totalReceived: 5,
|
||||||
err: "",
|
err: "",
|
||||||
},
|
},
|
||||||
{ // should err with invalid id length
|
|
||||||
id: "butts",
|
|
||||||
satelliteID: satID.ID,
|
|
||||||
whitelist: []storj.NodeID{satID.ID},
|
|
||||||
ttl: 9999999999,
|
|
||||||
content: []byte("xyzwq"),
|
|
||||||
message: "",
|
|
||||||
totalReceived: 0,
|
|
||||||
err: "rpc error: code = Unknown desc = piecestore error: invalid id length",
|
|
||||||
},
|
|
||||||
{ // should err with piece ID not specified
|
{ // should err with piece ID not specified
|
||||||
id: "",
|
id: "",
|
||||||
satelliteID: satID.ID,
|
satelliteID: satID.ID,
|
||||||
@ -337,14 +324,19 @@ func TestStore(t *testing.T) {
|
|||||||
stream, err := c.Store(ctx)
|
stream, err := c.Store(ctx)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Write the buffer to the stream we opened earlier
|
// Create Bandwidth Allocation Data
|
||||||
err = stream.Send(&pb.PieceStore{PieceData: &pb.PieceStore_PieceData{Id: tt.id, ExpirationUnixSec: tt.ttl}})
|
|
||||||
require.NoError(t, err)
|
|
||||||
// Send Bandwidth Allocation Data
|
|
||||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.BandwidthAction_PUT, snID, upID, time.Hour)
|
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(pb.BandwidthAction_PUT, snID, upID, time.Hour)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
rba, err := testbwagreement.GenerateRenterBandwidthAllocation(pba, snID.ID, upID, tt.totalReceived)
|
rba, err := testbwagreement.GenerateRenterBandwidthAllocation(pba, snID.ID, upID, tt.totalReceived)
|
||||||
require.NoError(t, err)
|
require.NoError(t, 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},
|
||||||
|
BandwidthAllocation: rba,
|
||||||
|
})
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
msg := &pb.PieceStore{
|
msg := &pb.PieceStore{
|
||||||
PieceData: &pb.PieceStore_PieceData{Content: tt.content},
|
PieceData: &pb.PieceStore_PieceData{Content: tt.content},
|
||||||
BandwidthAllocation: rba,
|
BandwidthAllocation: rba,
|
||||||
@ -443,12 +435,7 @@ func TestPbaValidation(t *testing.T) {
|
|||||||
stream, err := c.Store(ctx)
|
stream, err := c.Store(ctx)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
//cleanup incase tests previously paniced
|
// Create Bandwidth Allocation Data
|
||||||
_ = 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}})
|
|
||||||
require.NoError(t, err)
|
|
||||||
// Send Bandwidth Allocation Data
|
|
||||||
content := []byte("content")
|
content := []byte("content")
|
||||||
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(tt.action, satID1, upID, time.Hour)
|
pba, err := testbwagreement.GeneratePayerBandwidthAllocation(tt.action, satID1, upID, time.Hour)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -459,6 +446,15 @@ func TestPbaValidation(t *testing.T) {
|
|||||||
BandwidthAllocation: rba,
|
BandwidthAllocation: rba,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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},
|
||||||
|
BandwidthAllocation: rba,
|
||||||
|
})
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Write the buffer to the stream we opened earlier
|
// Write the buffer to the stream we opened earlier
|
||||||
err = stream.Send(msg)
|
err = stream.Send(msg)
|
||||||
if err != io.EOF && err != nil {
|
if err != io.EOF && err != nil {
|
||||||
@ -498,11 +494,6 @@ func TestDelete(t *testing.T) {
|
|||||||
message: "OK",
|
message: "OK",
|
||||||
err: "",
|
err: "",
|
||||||
},
|
},
|
||||||
{ // should err with invalid id length
|
|
||||||
id: "123",
|
|
||||||
message: "rpc error: code = Unknown desc = piecestore error: invalid id length",
|
|
||||||
err: "rpc error: code = Unknown desc = piecestore error: invalid id length",
|
|
||||||
},
|
|
||||||
{ // should return OK with nonexistent file
|
{ // should return OK with nonexistent file
|
||||||
id: "22222222222222222223",
|
id: "22222222222222222223",
|
||||||
message: "OK",
|
message: "OK",
|
||||||
@ -565,9 +556,6 @@ func NewTest(ctx context.Context, t *testing.T, snID, upID *identity.FullIdentit
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
err = psDB.Migration().Run(zap.NewNop(), psDB)
|
err = psDB.Migration().Run(zap.NewNop(), psDB)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
verifier := func(authorization *pb.SignedMessage) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
whitelist := make(map[storj.NodeID]crypto.PublicKey)
|
whitelist := make(map[storj.NodeID]crypto.PublicKey)
|
||||||
for _, id := range ids {
|
for _, id := range ids {
|
||||||
whitelist[id] = nil
|
whitelist[id] = nil
|
||||||
@ -576,7 +564,6 @@ func NewTest(ctx context.Context, t *testing.T, snID, upID *identity.FullIdentit
|
|||||||
log: zaptest.NewLogger(t),
|
log: zaptest.NewLogger(t),
|
||||||
storage: storage,
|
storage: storage,
|
||||||
DB: psDB,
|
DB: psDB,
|
||||||
verifier: verifier,
|
|
||||||
totalAllocated: math.MaxInt64,
|
totalAllocated: math.MaxInt64,
|
||||||
totalBwAllocated: math.MaxInt64,
|
totalBwAllocated: math.MaxInt64,
|
||||||
whitelist: whitelist,
|
whitelist: whitelist,
|
||||||
|
@ -35,11 +35,6 @@ func (s *Server) Store(reqStream pb.PieceStoreRoutes_StoreServer) (err error) {
|
|||||||
return StoreError.New("error receiving Piece metadata")
|
return StoreError.New("error receiving Piece metadata")
|
||||||
}
|
}
|
||||||
|
|
||||||
authorization := recv.GetAuthorization()
|
|
||||||
if err := s.verifier(authorization); err != nil {
|
|
||||||
return ServerError.Wrap(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
pd := recv.GetPieceData()
|
pd := recv.GetPieceData()
|
||||||
if pd == nil {
|
if pd == nil {
|
||||||
return StoreError.New("PieceStore message is nil")
|
return StoreError.New("PieceStore message is nil")
|
||||||
@ -51,7 +46,17 @@ func (s *Server) Store(reqStream pb.PieceStoreRoutes_StoreServer) (err error) {
|
|||||||
return StoreError.New("piece ID not specified")
|
return StoreError.New("piece ID not specified")
|
||||||
}
|
}
|
||||||
|
|
||||||
id, err := getNamespacedPieceID([]byte(pd.GetId()), getNamespace(authorization))
|
rba := recv.GetBandwidthAllocation()
|
||||||
|
if rba == nil {
|
||||||
|
return StoreError.New("RenterBandwidthAllocation message is nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
pba := rba.PayerAllocation
|
||||||
|
if pb.Equal(&pba, &pb.PayerBandwidthAllocation{}) {
|
||||||
|
return StoreError.New("PayerBandwidthAllocation message is empty")
|
||||||
|
}
|
||||||
|
|
||||||
|
id, err := getNamespacedPieceID([]byte(pd.GetId()), pba.SatelliteId.Bytes())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -65,10 +65,8 @@ func (allocation *AllocationSigner) PayerBandwidthAllocation(ctx context.Context
|
|||||||
Action: action,
|
Action: action,
|
||||||
SerialNumber: serialNum.String(),
|
SerialNumber: serialNum.String(),
|
||||||
}
|
}
|
||||||
if err := auth.SignMessage(pba, *allocation.satelliteIdentity); err != nil {
|
err = auth.SignMessage(pba, *allocation.satelliteIdentity)
|
||||||
return nil, err
|
return pba, err
|
||||||
}
|
|
||||||
return pba, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (allocation *AllocationSigner) restrictActions(peerID storj.NodeID, action pb.BandwidthAction) error {
|
func (allocation *AllocationSigner) restrictActions(peerID storj.NodeID, action pb.BandwidthAction) error {
|
||||||
|
@ -5,8 +5,6 @@ package pdbclient
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"sync/atomic"
|
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
@ -26,8 +24,7 @@ var (
|
|||||||
|
|
||||||
// PointerDB creates a grpcClient
|
// PointerDB creates a grpcClient
|
||||||
type PointerDB struct {
|
type PointerDB struct {
|
||||||
client pb.PointerDBClient
|
client pb.PointerDBClient
|
||||||
authorization unsafe.Pointer // *pb.SignedMessage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New Used as a public function
|
// New Used as a public function
|
||||||
@ -52,7 +49,6 @@ type Client interface {
|
|||||||
List(ctx context.Context, prefix, startAfter, endBefore storj.Path, recursive bool, limit int, metaFlags uint32) (items []ListItem, more bool, err error)
|
List(ctx context.Context, prefix, startAfter, endBefore storj.Path, recursive bool, limit int, metaFlags uint32) (items []ListItem, more bool, err error)
|
||||||
Delete(ctx context.Context, path storj.Path) error
|
Delete(ctx context.Context, path storj.Path) error
|
||||||
|
|
||||||
SignedMessage() *pb.SignedMessage
|
|
||||||
PayerBandwidthAllocation(context.Context, pb.BandwidthAction) (*pb.PayerBandwidthAllocation, error)
|
PayerBandwidthAllocation(context.Context, pb.BandwidthAction) (*pb.PayerBandwidthAllocation, error)
|
||||||
|
|
||||||
// Disconnect() error // TODO: implement
|
// Disconnect() error // TODO: implement
|
||||||
@ -102,8 +98,6 @@ func (pdb *PointerDB) Get(ctx context.Context, path storj.Path) (pointer *pb.Poi
|
|||||||
return nil, nil, nil, Error.Wrap(err)
|
return nil, nil, nil, Error.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic.StorePointer(&pdb.authorization, unsafe.Pointer(res.GetAuthorization()))
|
|
||||||
|
|
||||||
if res.GetPointer().GetType() == pb.Pointer_INLINE {
|
if res.GetPointer().GetType() == pb.Pointer_INLINE {
|
||||||
return res.GetPointer(), nodes, res.GetPba(), nil
|
return res.GetPointer(), nodes, res.GetPba(), nil
|
||||||
}
|
}
|
||||||
@ -174,8 +168,3 @@ func (pdb *PointerDB) PayerBandwidthAllocation(ctx context.Context, action pb.Ba
|
|||||||
}
|
}
|
||||||
return response.GetPba(), nil
|
return response.GetPba(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SignedMessage gets signed message from last request
|
|
||||||
func (pdb *PointerDB) SignedMessage() *pb.SignedMessage {
|
|
||||||
return (*pb.SignedMessage)(atomic.LoadPointer(&pdb.authorization))
|
|
||||||
}
|
|
||||||
|
@ -6,10 +6,8 @@ package mock_pointerdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
reflect "reflect"
|
|
||||||
|
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
|
reflect "reflect"
|
||||||
pb "storj.io/storj/pkg/pb"
|
pb "storj.io/storj/pkg/pb"
|
||||||
pdbclient "storj.io/storj/pkg/pointerdb/pdbclient"
|
pdbclient "storj.io/storj/pkg/pointerdb/pdbclient"
|
||||||
)
|
)
|
||||||
@ -39,6 +37,7 @@ func (m *MockClient) EXPECT() *MockClientMockRecorder {
|
|||||||
|
|
||||||
// Delete mocks base method
|
// Delete mocks base method
|
||||||
func (m *MockClient) Delete(arg0 context.Context, arg1 string) error {
|
func (m *MockClient) Delete(arg0 context.Context, arg1 string) error {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "Delete", arg0, arg1)
|
ret := m.ctrl.Call(m, "Delete", arg0, arg1)
|
||||||
ret0, _ := ret[0].(error)
|
ret0, _ := ret[0].(error)
|
||||||
return ret0
|
return ret0
|
||||||
@ -46,11 +45,13 @@ func (m *MockClient) Delete(arg0 context.Context, arg1 string) error {
|
|||||||
|
|
||||||
// Delete indicates an expected call of Delete
|
// Delete indicates an expected call of Delete
|
||||||
func (mr *MockClientMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockClient)(nil).Delete), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockClient)(nil).Delete), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get mocks base method
|
// Get mocks base method
|
||||||
func (m *MockClient) Get(arg0 context.Context, arg1 string) (*pb.Pointer, []*pb.Node, *pb.PayerBandwidthAllocation, error) {
|
func (m *MockClient) Get(arg0 context.Context, arg1 string) (*pb.Pointer, []*pb.Node, *pb.PayerBandwidthAllocation, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "Get", arg0, arg1)
|
ret := m.ctrl.Call(m, "Get", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*pb.Pointer)
|
ret0, _ := ret[0].(*pb.Pointer)
|
||||||
ret1, _ := ret[1].([]*pb.Node)
|
ret1, _ := ret[1].([]*pb.Node)
|
||||||
@ -61,11 +62,13 @@ func (m *MockClient) Get(arg0 context.Context, arg1 string) (*pb.Pointer, []*pb.
|
|||||||
|
|
||||||
// Get indicates an expected call of Get
|
// Get indicates an expected call of Get
|
||||||
func (mr *MockClientMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockClient)(nil).Get), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockClient)(nil).Get), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// List mocks base method
|
// List mocks base method
|
||||||
func (m *MockClient) List(arg0 context.Context, arg1, arg2, arg3 string, arg4 bool, arg5 int, arg6 uint32) ([]pdbclient.ListItem, bool, error) {
|
func (m *MockClient) List(arg0 context.Context, arg1, arg2, arg3 string, arg4 bool, arg5 int, arg6 uint32) ([]pdbclient.ListItem, bool, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "List", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
ret := m.ctrl.Call(m, "List", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||||
ret0, _ := ret[0].([]pdbclient.ListItem)
|
ret0, _ := ret[0].([]pdbclient.ListItem)
|
||||||
ret1, _ := ret[1].(bool)
|
ret1, _ := ret[1].(bool)
|
||||||
@ -75,11 +78,13 @@ func (m *MockClient) List(arg0 context.Context, arg1, arg2, arg3 string, arg4 bo
|
|||||||
|
|
||||||
// List indicates an expected call of List
|
// List indicates an expected call of List
|
||||||
func (mr *MockClientMockRecorder) List(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) List(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockClient)(nil).List), arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockClient)(nil).List), arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PayerBandwidthAllocation mocks base method
|
// PayerBandwidthAllocation mocks base method
|
||||||
func (m *MockClient) PayerBandwidthAllocation(arg0 context.Context, arg1 pb.BandwidthAction) (*pb.PayerBandwidthAllocation, error) {
|
func (m *MockClient) PayerBandwidthAllocation(arg0 context.Context, arg1 pb.BandwidthAction) (*pb.PayerBandwidthAllocation, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "PayerBandwidthAllocation", arg0, arg1)
|
ret := m.ctrl.Call(m, "PayerBandwidthAllocation", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*pb.PayerBandwidthAllocation)
|
ret0, _ := ret[0].(*pb.PayerBandwidthAllocation)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
@ -88,11 +93,13 @@ func (m *MockClient) PayerBandwidthAllocation(arg0 context.Context, arg1 pb.Band
|
|||||||
|
|
||||||
// PayerBandwidthAllocation indicates an expected call of PayerBandwidthAllocation
|
// PayerBandwidthAllocation indicates an expected call of PayerBandwidthAllocation
|
||||||
func (mr *MockClientMockRecorder) PayerBandwidthAllocation(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) PayerBandwidthAllocation(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PayerBandwidthAllocation", reflect.TypeOf((*MockClient)(nil).PayerBandwidthAllocation), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PayerBandwidthAllocation", reflect.TypeOf((*MockClient)(nil).PayerBandwidthAllocation), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put mocks base method
|
// Put mocks base method
|
||||||
func (m *MockClient) Put(arg0 context.Context, arg1 string, arg2 *pb.Pointer) error {
|
func (m *MockClient) Put(arg0 context.Context, arg1 string, arg2 *pb.Pointer) error {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "Put", arg0, arg1, arg2)
|
ret := m.ctrl.Call(m, "Put", arg0, arg1, arg2)
|
||||||
ret0, _ := ret[0].(error)
|
ret0, _ := ret[0].(error)
|
||||||
return ret0
|
return ret0
|
||||||
@ -100,17 +107,6 @@ func (m *MockClient) Put(arg0 context.Context, arg1 string, arg2 *pb.Pointer) er
|
|||||||
|
|
||||||
// Put indicates an expected call of Put
|
// Put indicates an expected call of Put
|
||||||
func (mr *MockClientMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockClient)(nil).Put), arg0, arg1, arg2)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockClient)(nil).Put), arg0, arg1, arg2)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SignedMessage mocks base method
|
|
||||||
func (m *MockClient) SignedMessage() *pb.SignedMessage {
|
|
||||||
ret := m.ctrl.Call(m, "SignedMessage")
|
|
||||||
ret0, _ := ret[0].(*pb.SignedMessage)
|
|
||||||
return ret0
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignedMessage indicates an expected call of SignedMessage
|
|
||||||
func (mr *MockClientMockRecorder) SignedMessage() *gomock.Call {
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignedMessage", reflect.TypeOf((*MockClient)(nil).SignedMessage))
|
|
||||||
}
|
|
||||||
|
@ -148,19 +148,12 @@ func (s *Server) Get(ctx context.Context, req *pb.GetRequest) (resp *pb.GetRespo
|
|||||||
return nil, status.Errorf(codes.Internal, err.Error())
|
return nil, status.Errorf(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
authorization, err := s.getSignedMessage()
|
|
||||||
if err != nil {
|
|
||||||
s.logger.Error("err getting signed message", zap.Error(err))
|
|
||||||
return nil, status.Errorf(codes.Internal, err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
nodes := []*pb.Node{}
|
nodes := []*pb.Node{}
|
||||||
|
|
||||||
var r = &pb.GetResponse{
|
var r = &pb.GetResponse{
|
||||||
Pointer: pointer,
|
Pointer: pointer,
|
||||||
Nodes: nil,
|
Nodes: nil,
|
||||||
Pba: pba.GetPba(),
|
Pba: pba.GetPba(),
|
||||||
Authorization: authorization,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !s.config.Overlay || pointer.Remote == nil {
|
if !s.config.Overlay || pointer.Remote == nil {
|
||||||
@ -182,10 +175,9 @@ func (s *Server) Get(ctx context.Context, req *pb.GetRequest) (resp *pb.GetRespo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
r = &pb.GetResponse{
|
r = &pb.GetResponse{
|
||||||
Pointer: pointer,
|
Pointer: pointer,
|
||||||
Nodes: nodes,
|
Nodes: nodes,
|
||||||
Pba: pba.GetPba(),
|
Pba: pba.GetPba(),
|
||||||
Authorization: authorization,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r, nil
|
return r, nil
|
||||||
@ -264,12 +256,3 @@ func (s *Server) PayerBandwidthAllocation(ctx context.Context, req *pb.PayerBand
|
|||||||
|
|
||||||
return &pb.PayerBandwidthAllocationResponse{Pba: pba}, nil
|
return &pb.PayerBandwidthAllocationResponse{Pba: pba}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) getSignedMessage() (*pb.SignedMessage, error) {
|
|
||||||
signature, err := auth.GenerateSignature(s.identity.ID.Bytes(), s.identity)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return auth.NewSignedMessage(signature, s.identity)
|
|
||||||
}
|
|
||||||
|
@ -151,7 +151,6 @@ func TestServiceGet(t *testing.T) {
|
|||||||
assert.NoError(t, err, errTag)
|
assert.NoError(t, err, errTag)
|
||||||
assert.True(t, pb.Equal(pr, resp.Pointer), errTag)
|
assert.True(t, pb.Equal(pr, resp.Pointer), errTag)
|
||||||
|
|
||||||
assert.NotNil(t, resp.GetAuthorization())
|
|
||||||
assert.NotNil(t, resp.GetPba())
|
assert.NotNil(t, resp.GetPba())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,9 @@ var mon = monkit.Package()
|
|||||||
|
|
||||||
// Client defines an interface for storing erasure coded data to piece store nodes
|
// Client defines an interface for storing erasure coded data to piece store nodes
|
||||||
type Client interface {
|
type Client interface {
|
||||||
Put(ctx context.Context, nodes []*pb.Node, rs eestream.RedundancyStrategy, pieceID psclient.PieceID, data io.Reader, expiration time.Time, pba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (successfulNodes []*pb.Node, err error)
|
Put(ctx context.Context, nodes []*pb.Node, rs eestream.RedundancyStrategy, pieceID psclient.PieceID, data io.Reader, expiration time.Time, pba *pb.PayerBandwidthAllocation) (successfulNodes []*pb.Node, err error)
|
||||||
Get(ctx context.Context, nodes []*pb.Node, es eestream.ErasureScheme, pieceID psclient.PieceID, size int64, pba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (ranger.Ranger, error)
|
Get(ctx context.Context, nodes []*pb.Node, es eestream.ErasureScheme, pieceID psclient.PieceID, size int64, pba *pb.PayerBandwidthAllocation) (ranger.Ranger, error)
|
||||||
Delete(ctx context.Context, nodes []*pb.Node, pieceID psclient.PieceID, authorization *pb.SignedMessage) error
|
Delete(ctx context.Context, nodes []*pb.Node, pieceID psclient.PieceID, satelliteID storj.NodeID) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type psClientFunc func(context.Context, transport.Client, *pb.Node, int) (psclient.Client, error)
|
type psClientFunc func(context.Context, transport.Client, *pb.Node, int) (psclient.Client, error)
|
||||||
@ -56,7 +56,7 @@ func (ec *ecClient) newPSClient(ctx context.Context, n *pb.Node) (psclient.Clien
|
|||||||
return ec.newPSClientFunc(ctx, ec.transport, n, 0)
|
return ec.newPSClientFunc(ctx, ec.transport, n, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *ecClient) Put(ctx context.Context, nodes []*pb.Node, rs eestream.RedundancyStrategy, pieceID psclient.PieceID, data io.Reader, expiration time.Time, pba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (successfulNodes []*pb.Node, err error) {
|
func (ec *ecClient) Put(ctx context.Context, nodes []*pb.Node, rs eestream.RedundancyStrategy, pieceID psclient.PieceID, data io.Reader, expiration time.Time, pba *pb.PayerBandwidthAllocation) (successfulNodes []*pb.Node, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
if len(nodes) != rs.TotalCount() {
|
if len(nodes) != rs.TotalCount() {
|
||||||
return nil, Error.New("size of nodes slice (%d) does not match total count (%d) of erasure scheme", len(nodes), rs.TotalCount())
|
return nil, Error.New("size of nodes slice (%d) does not match total count (%d) of erasure scheme", len(nodes), rs.TotalCount())
|
||||||
@ -93,7 +93,7 @@ func (ec *ecClient) Put(ctx context.Context, nodes []*pb.Node, rs eestream.Redun
|
|||||||
}
|
}
|
||||||
|
|
||||||
go func(i int, node *pb.Node) {
|
go func(i int, node *pb.Node) {
|
||||||
err := ec.putPiece(psCtx, ctx, node, pieceID, readers[i], expiration, pba, authorization)
|
err := ec.putPiece(psCtx, ctx, node, pieceID, readers[i], expiration, pba)
|
||||||
infos <- info{i: i, err: err}
|
infos <- info{i: i, err: err}
|
||||||
}(i, node)
|
}(i, node)
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ func (ec *ecClient) Put(ctx context.Context, nodes []*pb.Node, rs eestream.Redun
|
|||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
err = utils.CombineErrors(
|
err = utils.CombineErrors(
|
||||||
Error.New("upload cancelled by user"),
|
Error.New("upload cancelled by user"),
|
||||||
ec.Delete(context.Background(), nodes, pieceID, authorization),
|
ec.Delete(context.Background(), nodes, pieceID, pba.SatelliteId),
|
||||||
)
|
)
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ func (ec *ecClient) Put(ctx context.Context, nodes []*pb.Node, rs eestream.Redun
|
|||||||
return successfulNodes, nil
|
return successfulNodes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *ecClient) putPiece(ctx, parent context.Context, node *pb.Node, pieceID psclient.PieceID, data io.ReadCloser, expiration time.Time, pba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (err error) {
|
func (ec *ecClient) putPiece(ctx, parent context.Context, node *pb.Node, pieceID psclient.PieceID, data io.ReadCloser, expiration time.Time, pba *pb.PayerBandwidthAllocation) (err error) {
|
||||||
defer func() { err = errs.Combine(err, data.Close()) }()
|
defer func() { err = errs.Combine(err, data.Close()) }()
|
||||||
|
|
||||||
if node == nil {
|
if node == nil {
|
||||||
@ -165,7 +165,7 @@ func (ec *ecClient) putPiece(ctx, parent context.Context, node *pb.Node, pieceID
|
|||||||
pieceID, derivedPieceID, node.Id, err)
|
pieceID, derivedPieceID, node.Id, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = ps.Put(ctx, derivedPieceID, data, expiration, pba, authorization)
|
err = ps.Put(ctx, derivedPieceID, data, expiration, pba)
|
||||||
defer func() { err = errs.Combine(err, ps.Close()) }()
|
defer func() { err = errs.Combine(err, ps.Close()) }()
|
||||||
// Canceled context means the piece upload was interrupted by user or due
|
// Canceled context means the piece upload was interrupted by user or due
|
||||||
// to slow connection. No error logging for this case.
|
// to slow connection. No error logging for this case.
|
||||||
@ -189,7 +189,7 @@ func (ec *ecClient) putPiece(ctx, parent context.Context, node *pb.Node, pieceID
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ec *ecClient) Get(ctx context.Context, nodes []*pb.Node, es eestream.ErasureScheme,
|
func (ec *ecClient) Get(ctx context.Context, nodes []*pb.Node, es eestream.ErasureScheme,
|
||||||
pieceID psclient.PieceID, size int64, pba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (rr ranger.Ranger, err error) {
|
pieceID psclient.PieceID, size int64, pba *pb.PayerBandwidthAllocation) (rr ranger.Ranger, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
if len(nodes) != es.TotalCount() {
|
if len(nodes) != es.TotalCount() {
|
||||||
@ -236,7 +236,6 @@ func (ec *ecClient) Get(ctx context.Context, nodes []*pb.Node, es eestream.Erasu
|
|||||||
id: derivedPieceID,
|
id: derivedPieceID,
|
||||||
size: pieceSize,
|
size: pieceSize,
|
||||||
pba: pba,
|
pba: pba,
|
||||||
authorization: authorization,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- rangerInfo{i: i, rr: rr, err: nil}
|
ch <- rangerInfo{i: i, rr: rr, err: nil}
|
||||||
@ -258,7 +257,7 @@ func (ec *ecClient) Get(ctx context.Context, nodes []*pb.Node, es eestream.Erasu
|
|||||||
return eestream.Unpad(rr, int(paddedSize-size))
|
return eestream.Unpad(rr, int(paddedSize-size))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *ecClient) Delete(ctx context.Context, nodes []*pb.Node, pieceID psclient.PieceID, authorization *pb.SignedMessage) (err error) {
|
func (ec *ecClient) Delete(ctx context.Context, nodes []*pb.Node, pieceID psclient.PieceID, satelliteID storj.NodeID) (err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
errch := make(chan error, len(nodes))
|
errch := make(chan error, len(nodes))
|
||||||
@ -287,7 +286,7 @@ func (ec *ecClient) Delete(ctx context.Context, nodes []*pb.Node, pieceID psclie
|
|||||||
errch <- err
|
errch <- err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = ps.Delete(ctx, derivedPieceID, authorization)
|
err = ps.Delete(ctx, derivedPieceID, satelliteID)
|
||||||
// normally the bellow call should be deferred, but doing so fails
|
// normally the bellow call should be deferred, but doing so fails
|
||||||
// randomly the unit tests
|
// randomly the unit tests
|
||||||
err = errs.Combine(err, ps.Close())
|
err = errs.Combine(err, ps.Close())
|
||||||
@ -363,7 +362,6 @@ type lazyPieceRanger struct {
|
|||||||
id psclient.PieceID
|
id psclient.PieceID
|
||||||
size int64
|
size int64
|
||||||
pba *pb.PayerBandwidthAllocation
|
pba *pb.PayerBandwidthAllocation
|
||||||
authorization *pb.SignedMessage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size implements Ranger.Size
|
// Size implements Ranger.Size
|
||||||
@ -379,7 +377,7 @@ func (lr *lazyPieceRanger) Range(ctx context.Context, offset, length int64) (io.
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ranger, err := ps.Get(ctx, lr.id, lr.size, lr.pba, lr.authorization)
|
ranger, err := ps.Get(ctx, lr.id, lr.size, lr.pba)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
"storj.io/storj/pkg/peertls/tlsopts"
|
"storj.io/storj/pkg/peertls/tlsopts"
|
||||||
"storj.io/storj/pkg/piecestore/psclient"
|
"storj.io/storj/pkg/piecestore/psclient"
|
||||||
"storj.io/storj/pkg/ranger"
|
"storj.io/storj/pkg/ranger"
|
||||||
|
"storj.io/storj/pkg/storj"
|
||||||
"storj.io/storj/pkg/transport"
|
"storj.io/storj/pkg/transport"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -155,8 +156,8 @@ TestLoop:
|
|||||||
}
|
}
|
||||||
ps := NewMockPSClient(ctrl)
|
ps := NewMockPSClient(ctrl)
|
||||||
gomock.InOrder(
|
gomock.InOrder(
|
||||||
ps.EXPECT().Put(gomock.Any(), derivedID, gomock.Any(), ttl, gomock.Any(), gomock.Any()).Return(errs[n]).
|
ps.EXPECT().Put(gomock.Any(), derivedID, gomock.Any(), ttl, &pb.PayerBandwidthAllocation{}).Return(errs[n]).
|
||||||
Do(func(ctx context.Context, id psclient.PieceID, data io.Reader, ttl time.Time, ba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) {
|
Do(func(ctx context.Context, id psclient.PieceID, data io.Reader, ttl time.Time, ba *pb.PayerBandwidthAllocation) {
|
||||||
// simulate that the mocked piece store client is reading the data
|
// simulate that the mocked piece store client is reading the data
|
||||||
_, err := io.Copy(ioutil.Discard, data)
|
_, err := io.Copy(ioutil.Discard, data)
|
||||||
assert.NoError(t, err, errTag)
|
assert.NoError(t, err, errTag)
|
||||||
@ -172,7 +173,7 @@ TestLoop:
|
|||||||
r := io.LimitReader(rand.Reader, int64(size))
|
r := io.LimitReader(rand.Reader, int64(size))
|
||||||
ec := ecClient{newPSClientFunc: mockNewPSClient(clients)}
|
ec := ecClient{newPSClientFunc: mockNewPSClient(clients)}
|
||||||
|
|
||||||
successfulNodes, err := ec.Put(ctx, tt.nodes, rs, id, r, ttl, nil, nil)
|
successfulNodes, err := ec.Put(ctx, tt.nodes, rs, id, r, ttl, &pb.PayerBandwidthAllocation{})
|
||||||
|
|
||||||
if tt.errString != "" {
|
if tt.errString != "" {
|
||||||
assert.EqualError(t, err, tt.errString, errTag)
|
assert.EqualError(t, err, tt.errString, errTag)
|
||||||
@ -269,12 +270,12 @@ TestLoop:
|
|||||||
continue TestLoop
|
continue TestLoop
|
||||||
}
|
}
|
||||||
ps := NewMockPSClient(ctrl)
|
ps := NewMockPSClient(ctrl)
|
||||||
ps.EXPECT().Get(gomock.Any(), derivedID, int64(size/k), gomock.Any(), gomock.Any()).Return(ranger.ByteRanger(nil), errs[n])
|
ps.EXPECT().Get(gomock.Any(), derivedID, int64(size/k), gomock.Any()).Return(ranger.ByteRanger(nil), errs[n])
|
||||||
clients[n] = ps
|
clients[n] = ps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ec := ecClient{newPSClientFunc: mockNewPSClient(clients), memoryLimit: tt.mbm}
|
ec := ecClient{newPSClientFunc: mockNewPSClient(clients), memoryLimit: tt.mbm}
|
||||||
rr, err := ec.Get(ctx, tt.nodes, es, id, int64(size), nil, nil)
|
rr, err := ec.Get(ctx, tt.nodes, es, id, int64(size), nil)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
_, err := rr.Range(ctx, 0, 0)
|
_, err := rr.Range(ctx, 0, 0)
|
||||||
assert.NoError(t, err, errTag)
|
assert.NoError(t, err, errTag)
|
||||||
@ -337,7 +338,7 @@ TestLoop:
|
|||||||
}
|
}
|
||||||
|
|
||||||
ec := ecClient{newPSClientFunc: mockNewPSClient(clients)}
|
ec := ecClient{newPSClientFunc: mockNewPSClient(clients)}
|
||||||
err := ec.Delete(ctx, tt.nodes, id, nil)
|
err := ec.Delete(ctx, tt.nodes, id, storj.NodeID{})
|
||||||
|
|
||||||
if tt.errString != "" {
|
if tt.errString != "" {
|
||||||
assert.EqualError(t, err, tt.errString, errTag)
|
assert.EqualError(t, err, tt.errString, errTag)
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: storj.io/storj/pkg/storage/ec (interfaces: Client)
|
// Source: storj.io/storj/pkg/storage/ec (interfaces: Client)
|
||||||
|
|
||||||
// Package mock_ecclient is a generated GoMock package.
|
// Package mocks is a generated GoMock package.
|
||||||
package mock_ecclient
|
package mocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
|
gomock "github.com/golang/mock/gomock"
|
||||||
io "io"
|
io "io"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
time "time"
|
|
||||||
|
|
||||||
gomock "github.com/golang/mock/gomock"
|
|
||||||
|
|
||||||
eestream "storj.io/storj/pkg/eestream"
|
eestream "storj.io/storj/pkg/eestream"
|
||||||
pb "storj.io/storj/pkg/pb"
|
pb "storj.io/storj/pkg/pb"
|
||||||
client "storj.io/storj/pkg/piecestore/psclient"
|
psclient "storj.io/storj/pkg/piecestore/psclient"
|
||||||
ranger "storj.io/storj/pkg/ranger"
|
ranger "storj.io/storj/pkg/ranger"
|
||||||
|
storj "storj.io/storj/pkg/storj"
|
||||||
|
time "time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockClient is a mock of Client interface
|
// MockClient is a mock of Client interface
|
||||||
@ -42,7 +41,8 @@ func (m *MockClient) EXPECT() *MockClientMockRecorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete mocks base method
|
// Delete mocks base method
|
||||||
func (m *MockClient) Delete(arg0 context.Context, arg1 []*pb.Node, arg2 client.PieceID, arg3 *pb.SignedMessage) error {
|
func (m *MockClient) Delete(arg0 context.Context, arg1 []*pb.Node, arg2 psclient.PieceID, arg3 storj.NodeID) error {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2, arg3)
|
ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2, arg3)
|
||||||
ret0, _ := ret[0].(error)
|
ret0, _ := ret[0].(error)
|
||||||
return ret0
|
return ret0
|
||||||
@ -50,31 +50,36 @@ func (m *MockClient) Delete(arg0 context.Context, arg1 []*pb.Node, arg2 client.P
|
|||||||
|
|
||||||
// Delete indicates an expected call of Delete
|
// Delete indicates an expected call of Delete
|
||||||
func (mr *MockClientMockRecorder) Delete(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) Delete(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockClient)(nil).Delete), arg0, arg1, arg2, arg3)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockClient)(nil).Delete), arg0, arg1, arg2, arg3)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get mocks base method
|
// Get mocks base method
|
||||||
func (m *MockClient) Get(arg0 context.Context, arg1 []*pb.Node, arg2 eestream.ErasureScheme, arg3 client.PieceID, arg4 int64, arg5 *pb.PayerBandwidthAllocation, arg6 *pb.SignedMessage) (ranger.Ranger, error) {
|
func (m *MockClient) Get(arg0 context.Context, arg1 []*pb.Node, arg2 eestream.ErasureScheme, arg3 psclient.PieceID, arg4 int64, arg5 *pb.PayerBandwidthAllocation) (ranger.Ranger, error) {
|
||||||
ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2, arg3, arg4, arg5)
|
||||||
ret0, _ := ret[0].(ranger.Ranger)
|
ret0, _ := ret[0].(ranger.Ranger)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get indicates an expected call of Get
|
// Get indicates an expected call of Get
|
||||||
func (mr *MockClientMockRecorder) Get(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) Get(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockClient)(nil).Get), arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockClient)(nil).Get), arg0, arg1, arg2, arg3, arg4, arg5)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put mocks base method
|
// Put mocks base method
|
||||||
func (m *MockClient) Put(arg0 context.Context, arg1 []*pb.Node, arg2 eestream.RedundancyStrategy, arg3 client.PieceID, arg4 io.Reader, arg5 time.Time, arg6 *pb.PayerBandwidthAllocation, arg7 *pb.SignedMessage) ([]*pb.Node, error) {
|
func (m *MockClient) Put(arg0 context.Context, arg1 []*pb.Node, arg2 eestream.RedundancyStrategy, arg3 psclient.PieceID, arg4 io.Reader, arg5 time.Time, arg6 *pb.PayerBandwidthAllocation) ([]*pb.Node, error) {
|
||||||
ret := m.ctrl.Call(m, "Put", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "Put", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||||
ret0, _ := ret[0].([]*pb.Node)
|
ret0, _ := ret[0].([]*pb.Node)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put indicates an expected call of Put
|
// Put indicates an expected call of Put
|
||||||
func (mr *MockClientMockRecorder) Put(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) Put(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockClient)(nil).Put), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockClient)(nil).Put), arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,19 @@
|
|||||||
// Copyright (C) 2019 Storj Labs, Inc.
|
|
||||||
// See LICENSE for copying information.
|
|
||||||
|
|
||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: storj.io/storj/pkg/piecestore/rpc/client (interfaces: Client)
|
// Source: storj.io/storj/pkg/piecestore/psclient (interfaces: Client)
|
||||||
|
|
||||||
// mockgen -destination=pkg/storage/ec/psclient_mock_test.go storj.io/storj/pkg/piecestore/rpc/client Client
|
|
||||||
|
|
||||||
// Package ecclient is a generated GoMock package.
|
// Package ecclient is a generated GoMock package.
|
||||||
package ecclient
|
package ecclient
|
||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
|
gomock "github.com/golang/mock/gomock"
|
||||||
io "io"
|
io "io"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
time "time"
|
|
||||||
|
|
||||||
gomock "github.com/golang/mock/gomock"
|
|
||||||
|
|
||||||
pb "storj.io/storj/pkg/pb"
|
pb "storj.io/storj/pkg/pb"
|
||||||
client "storj.io/storj/pkg/piecestore/psclient"
|
psclient "storj.io/storj/pkg/piecestore/psclient"
|
||||||
ranger "storj.io/storj/pkg/ranger"
|
ranger "storj.io/storj/pkg/ranger"
|
||||||
|
storj "storj.io/storj/pkg/storj"
|
||||||
|
time "time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockPSClient is a mock of Client interface
|
// MockPSClient is a mock of Client interface
|
||||||
@ -47,6 +41,7 @@ func (m *MockPSClient) EXPECT() *MockPSClientMockRecorder {
|
|||||||
|
|
||||||
// Close mocks base method
|
// Close mocks base method
|
||||||
func (m *MockPSClient) Close() error {
|
func (m *MockPSClient) Close() error {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "Close")
|
ret := m.ctrl.Call(m, "Close")
|
||||||
ret0, _ := ret[0].(error)
|
ret0, _ := ret[0].(error)
|
||||||
return ret0
|
return ret0
|
||||||
@ -54,11 +49,13 @@ func (m *MockPSClient) Close() error {
|
|||||||
|
|
||||||
// Close indicates an expected call of Close
|
// Close indicates an expected call of Close
|
||||||
func (mr *MockPSClientMockRecorder) Close() *gomock.Call {
|
func (mr *MockPSClientMockRecorder) Close() *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPSClient)(nil).Close))
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPSClient)(nil).Close))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete mocks base method
|
// Delete mocks base method
|
||||||
func (m *MockPSClient) Delete(arg0 context.Context, arg1 client.PieceID, arg2 *pb.SignedMessage) error {
|
func (m *MockPSClient) Delete(arg0 context.Context, arg1 psclient.PieceID, arg2 storj.NodeID) error {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2)
|
ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2)
|
||||||
ret0, _ := ret[0].(error)
|
ret0, _ := ret[0].(error)
|
||||||
return ret0
|
return ret0
|
||||||
@ -66,24 +63,28 @@ func (m *MockPSClient) Delete(arg0 context.Context, arg1 client.PieceID, arg2 *p
|
|||||||
|
|
||||||
// Delete indicates an expected call of Delete
|
// Delete indicates an expected call of Delete
|
||||||
func (mr *MockPSClientMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call {
|
func (mr *MockPSClientMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockPSClient)(nil).Delete), arg0, arg1, arg2)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockPSClient)(nil).Delete), arg0, arg1, arg2)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get mocks base method
|
// Get mocks base method
|
||||||
func (m *MockPSClient) Get(arg0 context.Context, arg1 client.PieceID, arg2 int64, arg3 *pb.PayerBandwidthAllocation, arg4 *pb.SignedMessage) (ranger.Ranger, error) {
|
func (m *MockPSClient) Get(arg0 context.Context, arg1 psclient.PieceID, arg2 int64, arg3 *pb.PayerBandwidthAllocation) (ranger.Ranger, error) {
|
||||||
ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2, arg3, arg4)
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2, arg3)
|
||||||
ret0, _ := ret[0].(ranger.Ranger)
|
ret0, _ := ret[0].(ranger.Ranger)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get indicates an expected call of Get
|
// Get indicates an expected call of Get
|
||||||
func (mr *MockPSClientMockRecorder) Get(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
func (mr *MockPSClientMockRecorder) Get(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockPSClient)(nil).Get), arg0, arg1, arg2, arg3, arg4)
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockPSClient)(nil).Get), arg0, arg1, arg2, arg3)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Meta mocks base method
|
// Meta mocks base method
|
||||||
func (m *MockPSClient) Meta(arg0 context.Context, arg1 client.PieceID) (*pb.PieceSummary, error) {
|
func (m *MockPSClient) Meta(arg0 context.Context, arg1 psclient.PieceID) (*pb.PieceSummary, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "Meta", arg0, arg1)
|
ret := m.ctrl.Call(m, "Meta", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*pb.PieceSummary)
|
ret0, _ := ret[0].(*pb.PieceSummary)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
@ -92,30 +93,20 @@ func (m *MockPSClient) Meta(arg0 context.Context, arg1 client.PieceID) (*pb.Piec
|
|||||||
|
|
||||||
// Meta indicates an expected call of Meta
|
// Meta indicates an expected call of Meta
|
||||||
func (mr *MockPSClientMockRecorder) Meta(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockPSClientMockRecorder) Meta(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Meta", reflect.TypeOf((*MockPSClient)(nil).Meta), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Meta", reflect.TypeOf((*MockPSClient)(nil).Meta), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put mocks base method
|
// Put mocks base method
|
||||||
func (m *MockPSClient) Put(arg0 context.Context, arg1 client.PieceID, arg2 io.Reader, arg3 time.Time, arg4 *pb.PayerBandwidthAllocation, arg5 *pb.SignedMessage) error {
|
func (m *MockPSClient) Put(arg0 context.Context, arg1 psclient.PieceID, arg2 io.Reader, arg3 time.Time, arg4 *pb.PayerBandwidthAllocation) error {
|
||||||
ret := m.ctrl.Call(m, "Put", arg0, arg1, arg2, arg3, arg4, arg5)
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "Put", arg0, arg1, arg2, arg3, arg4)
|
||||||
ret0, _ := ret[0].(error)
|
ret0, _ := ret[0].(error)
|
||||||
return ret0
|
return ret0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put indicates an expected call of Put
|
// Put indicates an expected call of Put
|
||||||
func (mr *MockPSClientMockRecorder) Put(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
|
func (mr *MockPSClientMockRecorder) Put(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockPSClient)(nil).Put), arg0, arg1, arg2, arg3, arg4, arg5)
|
mr.mock.ctrl.T.Helper()
|
||||||
}
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockPSClient)(nil).Put), arg0, arg1, arg2, arg3, arg4)
|
||||||
|
|
||||||
// Stats mocks base method
|
|
||||||
func (m *MockPSClient) Stats(arg0 context.Context) (*pb.StatSummary, error) {
|
|
||||||
ret := m.ctrl.Call(m, "Stats", arg0)
|
|
||||||
ret0, _ := ret[0].(*pb.StatSummary)
|
|
||||||
ret1, _ := ret[1].(error)
|
|
||||||
return ret0, ret1
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stats indicates an expected call of Stats
|
|
||||||
func (mr *MockPSClientMockRecorder) Stats(arg0 interface{}) *gomock.Call {
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stats", reflect.TypeOf((*MockPSClient)(nil).Stats), arg0)
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
// Copyright (C) 2019 Storj Labs, Inc.
|
|
||||||
// See LICENSE for copying information.
|
|
||||||
|
|
||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: storj.io/storj/pkg/transport (interfaces: Client)
|
// Source: storj.io/storj/pkg/transport (interfaces: Client)
|
||||||
|
|
||||||
@ -9,12 +6,12 @@ package ecclient
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
reflect "reflect"
|
|
||||||
|
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
grpc "google.golang.org/grpc"
|
grpc "google.golang.org/grpc"
|
||||||
|
reflect "reflect"
|
||||||
"storj.io/storj/pkg/pb"
|
identity "storj.io/storj/pkg/identity"
|
||||||
|
pb "storj.io/storj/pkg/pb"
|
||||||
|
transport "storj.io/storj/pkg/transport"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockClient is a mock of Client interface
|
// MockClient is a mock of Client interface
|
||||||
@ -40,18 +37,74 @@ func (m *MockClient) EXPECT() *MockClientMockRecorder {
|
|||||||
return m.recorder
|
return m.recorder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DialAddress mocks base method
|
||||||
|
func (m *MockClient) DialAddress(arg0 context.Context, arg1 string, arg2 ...grpc.DialOption) (*grpc.ClientConn, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
varargs := []interface{}{arg0, arg1}
|
||||||
|
for _, a := range arg2 {
|
||||||
|
varargs = append(varargs, a)
|
||||||
|
}
|
||||||
|
ret := m.ctrl.Call(m, "DialAddress", varargs...)
|
||||||
|
ret0, _ := ret[0].(*grpc.ClientConn)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// DialAddress indicates an expected call of DialAddress
|
||||||
|
func (mr *MockClientMockRecorder) DialAddress(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
varargs := append([]interface{}{arg0, arg1}, arg2...)
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DialAddress", reflect.TypeOf((*MockClient)(nil).DialAddress), varargs...)
|
||||||
|
}
|
||||||
|
|
||||||
// DialNode mocks base method
|
// DialNode mocks base method
|
||||||
func (m *MockClient) DialNode(arg0 context.Context, arg1 *pb.Node) (*grpc.ClientConn, error) {
|
func (m *MockClient) DialNode(arg0 context.Context, arg1 *pb.Node, arg2 ...grpc.DialOption) (*grpc.ClientConn, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
arg1.Type.DPanicOnInvalid("mockclient dial node")
|
varargs := []interface{}{arg0, arg1}
|
||||||
|
for _, a := range arg2 {
|
||||||
ret := m.ctrl.Call(m, "DialNode", arg0, arg1)
|
varargs = append(varargs, a)
|
||||||
|
}
|
||||||
|
ret := m.ctrl.Call(m, "DialNode", varargs...)
|
||||||
ret0, _ := ret[0].(*grpc.ClientConn)
|
ret0, _ := ret[0].(*grpc.ClientConn)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// DialNode indicates an expected call of DialNode
|
// DialNode indicates an expected call of DialNode
|
||||||
func (mr *MockClientMockRecorder) DialNode(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) DialNode(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DialNode", reflect.TypeOf((*MockClient)(nil).DialNode), arg0, arg1)
|
mr.mock.ctrl.T.Helper()
|
||||||
|
varargs := append([]interface{}{arg0, arg1}, arg2...)
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DialNode", reflect.TypeOf((*MockClient)(nil).DialNode), varargs...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Identity mocks base method
|
||||||
|
func (m *MockClient) Identity() *identity.FullIdentity {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "Identity")
|
||||||
|
ret0, _ := ret[0].(*identity.FullIdentity)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Identity indicates an expected call of Identity
|
||||||
|
func (mr *MockClientMockRecorder) Identity() *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Identity", reflect.TypeOf((*MockClient)(nil).Identity))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithObservers mocks base method
|
||||||
|
func (m *MockClient) WithObservers(arg0 ...transport.Observer) *transport.Transport {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
varargs := []interface{}{}
|
||||||
|
for _, a := range arg0 {
|
||||||
|
varargs = append(varargs, a)
|
||||||
|
}
|
||||||
|
ret := m.ctrl.Call(m, "WithObservers", varargs...)
|
||||||
|
ret0, _ := ret[0].(*transport.Transport)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithObservers indicates an expected call of WithObservers
|
||||||
|
func (mr *MockClientMockRecorder) WithObservers(arg0 ...interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithObservers", reflect.TypeOf((*MockClient)(nil).WithObservers), arg0...)
|
||||||
}
|
}
|
||||||
|
@ -120,13 +120,12 @@ func (s *Repairer) Repair(ctx context.Context, path storj.Path, lostPieces []int
|
|||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
signedMessage := s.pdb.SignedMessage()
|
|
||||||
pbaGet, err := s.pdb.PayerBandwidthAllocation(ctx, pb.BandwidthAction_GET_REPAIR)
|
pbaGet, err := s.pdb.PayerBandwidthAllocation(ctx, pb.BandwidthAction_GET_REPAIR)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
// Download the segment using just the healthyNodes
|
// Download the segment using just the healthyNodes
|
||||||
rr, err := s.ec.Get(ctx, healthyNodes, rs, pid, pr.GetSegmentSize(), pbaGet, signedMessage)
|
rr, err := s.ec.Get(ctx, healthyNodes, rs, pid, pr.GetSegmentSize(), pbaGet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
@ -142,7 +141,7 @@ func (s *Repairer) Repair(ctx context.Context, path storj.Path, lostPieces []int
|
|||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
// Upload the repaired pieces to the repairNodes
|
// Upload the repaired pieces to the repairNodes
|
||||||
successfulNodes, err := s.ec.Put(ctx, repairNodes, rs, pid, r, convertTime(pr.GetExpirationDate()), pbaPut, signedMessage)
|
successfulNodes, err := s.ec.Put(ctx, repairNodes, rs, pid, r, convertTime(pr.GetExpirationDate()), pbaPut)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
|
@ -101,14 +101,13 @@ func TestSegmentStoreRepairRemote(t *testing.T) {
|
|||||||
}, nil, nil, nil),
|
}, nil, nil, nil),
|
||||||
mockOC.EXPECT().BulkLookup(gomock.Any(), gomock.Any()),
|
mockOC.EXPECT().BulkLookup(gomock.Any(), gomock.Any()),
|
||||||
mockOC.EXPECT().Choose(gomock.Any(), gomock.Any()).Return(tt.newNodes, nil),
|
mockOC.EXPECT().Choose(gomock.Any(), gomock.Any()).Return(tt.newNodes, nil),
|
||||||
mockPDB.EXPECT().SignedMessage(),
|
|
||||||
mockPDB.EXPECT().PayerBandwidthAllocation(gomock.Any(), gomock.Any()),
|
mockPDB.EXPECT().PayerBandwidthAllocation(gomock.Any(), gomock.Any()),
|
||||||
mockEC.EXPECT().Get(
|
mockEC.EXPECT().Get(
|
||||||
gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(),
|
gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(),
|
||||||
).Return(ranger.ByteRanger([]byte(tt.data)), nil),
|
).Return(ranger.ByteRanger([]byte(tt.data)), nil),
|
||||||
mockPDB.EXPECT().PayerBandwidthAllocation(gomock.Any(), gomock.Any()),
|
mockPDB.EXPECT().PayerBandwidthAllocation(gomock.Any(), gomock.Any()),
|
||||||
mockEC.EXPECT().Put(
|
mockEC.EXPECT().Put(
|
||||||
gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(),
|
gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(),
|
||||||
).Return(tt.newNodes, nil),
|
).Return(tt.newNodes, nil),
|
||||||
mockPDB.EXPECT().Put(
|
mockPDB.EXPECT().Put(
|
||||||
gomock.Any(), gomock.Any(), gomock.Any(),
|
gomock.Any(), gomock.Any(), gomock.Any(),
|
||||||
|
@ -137,13 +137,12 @@ func (s *segmentStore) Put(ctx context.Context, data io.Reader, expiration time.
|
|||||||
|
|
||||||
pieceID := psclient.NewPieceID()
|
pieceID := psclient.NewPieceID()
|
||||||
|
|
||||||
authorization := s.pdb.SignedMessage()
|
|
||||||
pba, err := s.pdb.PayerBandwidthAllocation(ctx, pb.BandwidthAction_PUT)
|
pba, err := s.pdb.PayerBandwidthAllocation(ctx, pb.BandwidthAction_PUT)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Meta{}, Error.Wrap(err)
|
return Meta{}, Error.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
successfulNodes, err := s.ec.Put(ctx, nodes, s.rs, pieceID, sizedReader, expiration, pba, authorization)
|
successfulNodes, err := s.ec.Put(ctx, nodes, s.rs, pieceID, sizedReader, expiration, pba)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Meta{}, Error.Wrap(err)
|
return Meta{}, Error.Wrap(err)
|
||||||
}
|
}
|
||||||
@ -218,8 +217,7 @@ func (s *segmentStore) Get(ctx context.Context, path storj.Path) (rr ranger.Rang
|
|||||||
node.Type.DPanicOnInvalid("ss get")
|
node.Type.DPanicOnInvalid("ss get")
|
||||||
}
|
}
|
||||||
|
|
||||||
authorization := s.pdb.SignedMessage()
|
rr, err = s.ec.Get(ctx, selected, rs, pid, pr.GetSegmentSize(), pba)
|
||||||
rr, err = s.ec.Get(ctx, selected, rs, pid, pr.GetSegmentSize(), pba, authorization)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, Meta{}, Error.Wrap(err)
|
return nil, Meta{}, Error.Wrap(err)
|
||||||
}
|
}
|
||||||
@ -269,7 +267,7 @@ func makeRemotePointer(nodes []*pb.Node, rs eestream.RedundancyStrategy, pieceID
|
|||||||
func (s *segmentStore) Delete(ctx context.Context, path storj.Path) (err error) {
|
func (s *segmentStore) Delete(ctx context.Context, path storj.Path) (err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
pr, nodes, _, err := s.pdb.Get(ctx, path)
|
pr, nodes, pba, err := s.pdb.Get(ctx, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
@ -288,9 +286,8 @@ func (s *segmentStore) Delete(ctx context.Context, path storj.Path) (err error)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
authorization := s.pdb.SignedMessage()
|
|
||||||
// ecclient sends delete request
|
// ecclient sends delete request
|
||||||
err = s.ec.Delete(ctx, nodes, pid, authorization)
|
err = s.ec.Delete(ctx, nodes, pid, pba.SatelliteId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
|
@ -118,10 +118,9 @@ func TestSegmentStorePutRemote(t *testing.T) {
|
|||||||
Type: pb.NodeType_STORAGE,
|
Type: pb.NodeType_STORAGE,
|
||||||
},
|
},
|
||||||
}, nil),
|
}, nil),
|
||||||
mockPDB.EXPECT().SignedMessage(),
|
|
||||||
mockPDB.EXPECT().PayerBandwidthAllocation(gomock.Any(), gomock.Any()),
|
mockPDB.EXPECT().PayerBandwidthAllocation(gomock.Any(), gomock.Any()),
|
||||||
mockEC.EXPECT().Put(
|
mockEC.EXPECT().Put(
|
||||||
gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(),
|
gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(),
|
||||||
),
|
),
|
||||||
mockES.EXPECT().RequiredCount().Return(1),
|
mockES.EXPECT().RequiredCount().Return(1),
|
||||||
mockES.EXPECT().TotalCount().Return(1),
|
mockES.EXPECT().TotalCount().Return(1),
|
||||||
@ -282,9 +281,8 @@ func TestSegmentStoreGetRemote(t *testing.T) {
|
|||||||
Metadata: tt.metadata,
|
Metadata: tt.metadata,
|
||||||
}, nil, nil, nil),
|
}, nil, nil, nil),
|
||||||
mockOC.EXPECT().BulkLookup(gomock.Any(), gomock.Any()),
|
mockOC.EXPECT().BulkLookup(gomock.Any(), gomock.Any()),
|
||||||
mockPDB.EXPECT().SignedMessage(),
|
|
||||||
mockEC.EXPECT().Get(
|
mockEC.EXPECT().Get(
|
||||||
gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(),
|
gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
gomock.InOrder(calls...)
|
gomock.InOrder(calls...)
|
||||||
@ -393,9 +391,8 @@ func TestSegmentStoreDeleteRemote(t *testing.T) {
|
|||||||
ExpirationDate: someTime,
|
ExpirationDate: someTime,
|
||||||
SegmentSize: tt.size,
|
SegmentSize: tt.size,
|
||||||
Metadata: tt.metadata,
|
Metadata: tt.metadata,
|
||||||
}, nil, nil, nil),
|
}, nil, &pb.PayerBandwidthAllocation{}, nil),
|
||||||
mockOC.EXPECT().BulkLookup(gomock.Any(), gomock.Any()),
|
mockOC.EXPECT().BulkLookup(gomock.Any(), gomock.Any()),
|
||||||
mockPDB.EXPECT().SignedMessage(),
|
|
||||||
mockEC.EXPECT().Delete(
|
mockEC.EXPECT().Delete(
|
||||||
gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(),
|
gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(),
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user