satellite: send external address in order limits (#2278)

This commit is contained in:
JT Olio 2019-06-21 03:19:52 -06:00 committed by Egon Elbre
parent 24918e072b
commit 76b54458e9
5 changed files with 166 additions and 128 deletions

View File

@ -106,14 +106,17 @@ type OrderLimit2 struct {
// piece which is allowed to be touched
PieceId PieceID `protobuf:"bytes,5,opt,name=piece_id,json=pieceId,proto3,customtype=PieceID" json:"piece_id"`
// limit in bytes how much can be changed
Limit int64 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"`
Action PieceAction `protobuf:"varint,7,opt,name=action,proto3,enum=orders.PieceAction" json:"action,omitempty"`
PieceExpiration *timestamp.Timestamp `protobuf:"bytes,8,opt,name=piece_expiration,json=pieceExpiration,proto3" json:"piece_expiration,omitempty"`
OrderExpiration *timestamp.Timestamp `protobuf:"bytes,9,opt,name=order_expiration,json=orderExpiration,proto3" json:"order_expiration,omitempty"`
SatelliteSignature []byte `protobuf:"bytes,10,opt,name=satellite_signature,json=satelliteSignature,proto3" json:"satellite_signature,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Limit int64 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"`
Action PieceAction `protobuf:"varint,7,opt,name=action,proto3,enum=orders.PieceAction" json:"action,omitempty"`
PieceExpiration *timestamp.Timestamp `protobuf:"bytes,8,opt,name=piece_expiration,json=pieceExpiration,proto3" json:"piece_expiration,omitempty"`
OrderExpiration *timestamp.Timestamp `protobuf:"bytes,9,opt,name=order_expiration,json=orderExpiration,proto3" json:"order_expiration,omitempty"`
SatelliteSignature []byte `protobuf:"bytes,10,opt,name=satellite_signature,json=satelliteSignature,proto3" json:"satellite_signature,omitempty"`
// satellites aren't necessarily discoverable in kademlia. this allows
// a storage node to find a satellite and handshake with it to get its key.
SatelliteAddress *NodeAddress `protobuf:"bytes,11,opt,name=satellite_address,json=satelliteAddress,proto3" json:"satellite_address,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *OrderLimit2) Reset() { *m = OrderLimit2{} }
@ -175,6 +178,13 @@ func (m *OrderLimit2) GetSatelliteSignature() []byte {
return nil
}
func (m *OrderLimit2) GetSatelliteAddress() *NodeAddress {
if m != nil {
return m.SatelliteAddress
}
return nil
}
// Order2 is a one step of fullfilling Amount number of bytes from an OrderLimit2 with SerialNumber
type Order2 struct {
// serial of the order limit that was signed
@ -374,47 +384,49 @@ func init() {
func init() { proto.RegisterFile("orders.proto", fileDescriptor_e0f5d4cf0fc9e41b) }
var fileDescriptor_e0f5d4cf0fc9e41b = []byte{
// 634 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x4d, 0x6f, 0xd3, 0x40,
0x10, 0xed, 0xe6, 0xc3, 0x49, 0x26, 0x69, 0x62, 0xb6, 0x15, 0x0a, 0x11, 0x52, 0x43, 0xc4, 0x21,
0xb4, 0x52, 0x4a, 0x8d, 0x84, 0xd4, 0x63, 0xda, 0x58, 0xc5, 0xa8, 0x2a, 0xd1, 0xc6, 0xe5, 0xc0,
0x25, 0x72, 0xea, 0xc5, 0xb5, 0x70, 0xbc, 0xc6, 0xbb, 0x96, 0xf8, 0x05, 0x1c, 0xf9, 0x47, 0xdc,
0xf9, 0x0d, 0x1c, 0xfa, 0x5b, 0x90, 0xc7, 0x4e, 0xe2, 0x42, 0x50, 0x0f, 0xbd, 0xf9, 0xcd, 0xbc,
0xb7, 0x6f, 0x77, 0xde, 0x18, 0x5a, 0x22, 0x76, 0x79, 0x2c, 0x47, 0x51, 0x2c, 0x94, 0xa0, 0x5a,
0x86, 0x7a, 0xe0, 0x09, 0x4f, 0x64, 0xb5, 0xde, 0x81, 0x27, 0x84, 0x17, 0xf0, 0x63, 0x44, 0x8b,
0xe4, 0xf3, 0xb1, 0xf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ac, 0x8c, 0xff, 0xb5, 0x19, 0xcd, 0x90, 0xc8, 0x72, 0xc1, 0xe0, 0x04,
0xb4, 0xac, 0x42, 0x9b, 0x50, 0xb3, 0xae, 0x3e, 0x8e, 0x2f, 0xad, 0x89, 0xbe, 0x43, 0x5b, 0x50,
0x1f, 0x9f, 0x9f, 0x9b, 0x53, 0xdb, 0x9c, 0xe8, 0x24, 0x45, 0xcc, 0x7c, 0x6f, 0x9e, 0xa7, 0xa8,
0x74, 0xe8, 0x41, 0xb3, 0xb0, 0xef, 0xf7, 0x75, 0x35, 0x28, 0x4f, 0xaf, 0x6d, 0x9d, 0xa4, 0x1f,
0x17, 0xa6, 0xad, 0x97, 0xe8, 0x2e, 0x34, 0x2e, 0x4c, 0x7b, 0x3e, 0xbe, 0x9e, 0x58, 0xb6, 0x5e,
0xa6, 0x6d, 0x80, 0x14, 0x32, 0x73, 0x3a, 0xb6, 0x98, 0x5e, 0x49, 0xf1, 0xf4, 0x7a, 0x8d, 0xab,
0x14, 0x40, 0x9b, 0x98, 0x97, 0xa6, 0x6d, 0xea, 0x9a, 0x31, 0xcb, 0x37, 0x50, 0x52, 0x0b, 0x60,
0xf3, 0x14, 0xfa, 0x6c, 0xdb, 0xf3, 0x30, 0xac, 0x5e, 0xef, 0xff, 0x2f, 0x1f, 0xec, 0x0c, 0xc9,
0x6b, 0x72, 0x56, 0xf9, 0x54, 0x8a, 0x16, 0x0b, 0x0d, 0xff, 0x99, 0x37, 0x7f, 0x02, 0x00, 0x00,
0xff, 0xff, 0xbc, 0xfe, 0x4a, 0x7c, 0x3a, 0x05, 0x00, 0x00,
// 667 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xcd, 0x6e, 0xd3, 0x40,
0x10, 0xae, 0xf3, 0xe3, 0x24, 0x93, 0x34, 0x71, 0xb7, 0x15, 0x0a, 0x11, 0x52, 0x83, 0xc5, 0x21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d, 0x67, 0x3e, 0xbe, 0x9a, 0xd8,
0x8e, 0x56, 0x25, 0x5d, 0x00, 0x09, 0xa9, 0x35, 0x1d, 0xdb, 0x54, 0xab, 0x49, 0x3c, 0xbd, 0x2a,
0x71, 0x9d, 0x00, 0xa8, 0x13, 0xeb, 0xc2, 0x72, 0x2c, 0x4d, 0x35, 0x67, 0x85, 0x03, 0x39, 0xb1,
0x01, 0xd6, 0xa3, 0x90, 0xa7, 0xf7, 0x8d, 0x87, 0xc7, 0x1a, 0x0c, 0xfe, 0x3f, 0xb9, 0xbe, 0x35,
0x52, 0x5e, 0x29, 0xa7, 0xb5, 0x4f, 0x95, 0x64, 0xb1, 0x50, 0xf1, 0xcd, 0xbd, 0xfe, 0x13, 0x00,
0x00, 0xff, 0xff, 0xab, 0x0a, 0xc7, 0x5c, 0x86, 0x05, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View File

@ -8,6 +8,7 @@ package orders;
import "gogo.proto";
import "google/protobuf/timestamp.proto";
import "node.proto";
// PieceAction is an enumeration of all possible executed actions on storage node
enum PieceAction {
@ -25,22 +26,26 @@ message OrderLimit2 {
// unique serial to avoid replay attacks
bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false];
// satellite who issued this order limit allowing orderer to do the specified action
bytes satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
bytes satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
// uplink who requested or whom behalf the order limit to do an action
bytes uplink_id = 3 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
// storage node who can reclaim the order limit specified by serial
bytes storage_node_id = 4 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
// piece which is allowed to be touched
bytes piece_id = 5 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false];
// limit in bytes how much can be changed
int64 limit = 6;
PieceAction action = 7;
google.protobuf.Timestamp piece_expiration = 8;
google.protobuf.Timestamp order_expiration = 9;
bytes satellite_signature = 10;
// satellites aren't necessarily discoverable in kademlia. this allows
// a storage node to find a satellite and handshake with it to get its key.
node.NodeAddress satellite_address = 11;
}
// Order2 is a one step of fullfilling Amount number of bytes from an OrderLimit2 with SerialNumber
@ -81,4 +86,4 @@ message SettlementResponse {
bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false];
Status status = 2;
}
}

View File

@ -2231,6 +2231,11 @@
"id": 10,
"name": "satellite_signature",
"type": "bytes"
},
{
"id": 11,
"name": "satellite_address",
"type": "node.NodeAddress"
}
]
},
@ -2355,6 +2360,9 @@
},
{
"path": "google/protobuf/timestamp.proto"
},
{
"path": "node.proto"
}
],
"package": {

View File

@ -24,24 +24,26 @@ import (
// Service for creating order limits.
type Service struct {
log *zap.Logger
satellite signing.Signer
cache *overlay.Cache
certdb certdb.DB
orders DB
log *zap.Logger
satellite signing.Signer
cache *overlay.Cache
certdb certdb.DB
orders DB
satelliteAddress *pb.NodeAddress
orderExpiration time.Duration
}
// NewService creates new service for creating order limits.
func NewService(log *zap.Logger, satellite signing.Signer, cache *overlay.Cache, certdb certdb.DB, orders DB, orderExpiration time.Duration) *Service {
func NewService(log *zap.Logger, satellite signing.Signer, cache *overlay.Cache, certdb certdb.DB, orders DB, orderExpiration time.Duration, satelliteAddress *pb.NodeAddress) *Service {
return &Service{
log: log,
satellite: satellite,
cache: cache,
certdb: certdb,
orders: orders,
orderExpiration: orderExpiration,
log: log,
satellite: satellite,
cache: cache,
certdb: certdb,
orders: orders,
satelliteAddress: satelliteAddress,
orderExpiration: orderExpiration,
}
}
@ -155,15 +157,16 @@ func (service *Service) CreateGetOrderLimits(ctx context.Context, uplink *identi
}
orderLimit, err := signing.SignOrderLimit(ctx, service.satellite, &pb.OrderLimit2{
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
UplinkId: uplink.ID,
StorageNodeId: piece.NodeId,
PieceId: rootPieceID.Derive(piece.NodeId),
Action: pb.PieceAction_GET,
Limit: pieceSize,
PieceExpiration: expiration,
OrderExpiration: orderExpiration,
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
SatelliteAddress: service.satelliteAddress,
UplinkId: uplink.ID,
StorageNodeId: piece.NodeId,
PieceId: rootPieceID.Derive(piece.NodeId),
Action: pb.PieceAction_GET,
Limit: pieceSize,
PieceExpiration: expiration,
OrderExpiration: orderExpiration,
})
if err != nil {
return nil, Error.Wrap(err)
@ -217,15 +220,16 @@ func (service *Service) CreatePutOrderLimits(ctx context.Context, uplink *identi
var pieceNum int32
for _, node := range nodes {
orderLimit, err := signing.SignOrderLimit(ctx, service.satellite, &pb.OrderLimit2{
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
UplinkId: uplink.ID,
StorageNodeId: node.Id,
PieceId: rootPieceID.Derive(node.Id),
Action: pb.PieceAction_PUT,
Limit: maxPieceSize,
PieceExpiration: expiration,
OrderExpiration: orderExpiration,
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
SatelliteAddress: service.satelliteAddress,
UplinkId: uplink.ID,
StorageNodeId: node.Id,
PieceId: rootPieceID.Derive(node.Id),
Action: pb.PieceAction_PUT,
Limit: maxPieceSize,
PieceExpiration: expiration,
OrderExpiration: orderExpiration,
})
if err != nil {
return storj.PieceID{}, nil, Error.Wrap(err)
@ -294,15 +298,16 @@ func (service *Service) CreateDeleteOrderLimits(ctx context.Context, uplink *ide
}
orderLimit, err := signing.SignOrderLimit(ctx, service.satellite, &pb.OrderLimit2{
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
UplinkId: uplink.ID,
StorageNodeId: piece.NodeId,
PieceId: rootPieceID.Derive(piece.NodeId),
Action: pb.PieceAction_DELETE,
Limit: 0,
PieceExpiration: expiration,
OrderExpiration: orderExpiration,
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
SatelliteAddress: service.satelliteAddress,
UplinkId: uplink.ID,
StorageNodeId: piece.NodeId,
PieceId: rootPieceID.Derive(piece.NodeId),
Action: pb.PieceAction_DELETE,
Limit: 0,
PieceExpiration: expiration,
OrderExpiration: orderExpiration,
})
if err != nil {
return nil, Error.Wrap(err)
@ -385,15 +390,16 @@ func (service *Service) CreateAuditOrderLimits(ctx context.Context, auditor *ide
}
orderLimit, err := signing.SignOrderLimit(ctx, service.satellite, &pb.OrderLimit2{
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
UplinkId: auditor.ID,
StorageNodeId: piece.NodeId,
PieceId: rootPieceID.Derive(piece.NodeId),
Action: pb.PieceAction_GET_AUDIT,
Limit: int64(shareSize),
PieceExpiration: expiration,
OrderExpiration: orderExpiration,
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
SatelliteAddress: service.satelliteAddress,
UplinkId: auditor.ID,
StorageNodeId: piece.NodeId,
PieceId: rootPieceID.Derive(piece.NodeId),
Action: pb.PieceAction_GET_AUDIT,
Limit: int64(shareSize),
PieceExpiration: expiration,
OrderExpiration: orderExpiration,
})
if err != nil {
return nil, Error.Wrap(err)
@ -452,14 +458,15 @@ func (service *Service) CreateAuditOrderLimit(ctx context.Context, auditor *iden
}
orderLimit, err := signing.SignOrderLimit(ctx, service.satellite, &pb.OrderLimit2{
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
UplinkId: auditor.ID,
StorageNodeId: nodeID,
PieceId: rootPieceID.Derive(nodeID),
Action: pb.PieceAction_GET_AUDIT,
Limit: int64(shareSize),
OrderExpiration: orderExpiration,
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
SatelliteAddress: service.satelliteAddress,
UplinkId: auditor.ID,
StorageNodeId: nodeID,
PieceId: rootPieceID.Derive(nodeID),
Action: pb.PieceAction_GET_AUDIT,
Limit: int64(shareSize),
OrderExpiration: orderExpiration,
})
if err != nil {
return nil, Error.Wrap(err)
@ -528,15 +535,16 @@ func (service *Service) CreateGetRepairOrderLimits(ctx context.Context, repairer
}
orderLimit, err := signing.SignOrderLimit(ctx, service.satellite, &pb.OrderLimit2{
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
UplinkId: repairer.ID,
StorageNodeId: piece.NodeId,
PieceId: rootPieceID.Derive(piece.NodeId),
Action: pb.PieceAction_GET_REPAIR,
Limit: pieceSize,
PieceExpiration: expiration,
OrderExpiration: orderExpiration,
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
SatelliteAddress: service.satelliteAddress,
UplinkId: repairer.ID,
StorageNodeId: piece.NodeId,
PieceId: rootPieceID.Derive(piece.NodeId),
Action: pb.PieceAction_GET_REPAIR,
Limit: pieceSize,
PieceExpiration: expiration,
OrderExpiration: orderExpiration,
})
if err != nil {
return nil, Error.Wrap(err)
@ -602,15 +610,16 @@ func (service *Service) CreatePutRepairOrderLimits(ctx context.Context, repairer
}
orderLimit, err := signing.SignOrderLimit(ctx, service.satellite, &pb.OrderLimit2{
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
UplinkId: repairer.ID,
StorageNodeId: node.Id,
PieceId: rootPieceID.Derive(node.Id),
Action: pb.PieceAction_PUT_REPAIR,
Limit: pieceSize,
PieceExpiration: expiration,
OrderExpiration: orderExpiration,
SerialNumber: serialNumber,
SatelliteId: service.satellite.ID(),
SatelliteAddress: service.satelliteAddress,
UplinkId: repairer.ID,
StorageNodeId: node.Id,
PieceId: rootPieceID.Derive(node.Id),
Action: pb.PieceAction_PUT_REPAIR,
Limit: pieceSize,
PieceExpiration: expiration,
OrderExpiration: orderExpiration,
})
if err != nil {
return nil, Error.Wrap(err)

View File

@ -392,6 +392,10 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, config *Config, ve
peer.DB.CertDB(),
peer.DB.Orders(),
45*24*time.Hour, // TODO: make it configurable?
&pb.NodeAddress{
Transport: pb.NodeTransport_TCP_TLS_GRPC,
Address: config.Kademlia.ExternalAddress,
},
)
pb.RegisterOrdersServer(peer.Server.GRPC(), peer.Orders.Endpoint)
}