diff --git a/bootstrap/peer.go b/bootstrap/peer.go index 2236a8375..13e6a6779 100644 --- a/bootstrap/peer.go +++ b/bootstrap/peer.go @@ -162,9 +162,11 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revDB extensions.R peer.Kademlia.Endpoint = kademlia.NewEndpoint(peer.Log.Named("kademlia:endpoint"), peer.Kademlia.Service, nil, peer.Kademlia.RoutingTable, nil) pb.RegisterNodesServer(peer.Server.GRPC(), peer.Kademlia.Endpoint) + pb.DRPCRegisterNodes(peer.Server.DRPC(), peer.Kademlia.Endpoint) peer.Kademlia.Inspector = kademlia.NewInspector(peer.Kademlia.Service, peer.Identity) pb.RegisterKadInspectorServer(peer.Server.PrivateGRPC(), peer.Kademlia.Inspector) + pb.DRPCRegisterKadInspector(peer.Server.PrivateDRPC(), peer.Kademlia.Inspector) } { // setup bootstrap web ui diff --git a/go.mod b/go.mod index 1ae9aee61..b34462e9b 100644 --- a/go.mod +++ b/go.mod @@ -125,5 +125,5 @@ require ( gopkg.in/olivere/elastic.v5 v5.0.76 // indirect gopkg.in/spacemonkeygo/monkit.v2 v2.0.0-20190612171030-cf5a9e6f8fd2 gopkg.in/yaml.v2 v2.2.2 - storj.io/drpc v0.0.2 + storj.io/drpc v0.0.3 ) diff --git a/go.sum b/go.sum index 231ac3837..27d9a61c8 100644 --- a/go.sum +++ b/go.sum @@ -527,5 +527,5 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -storj.io/drpc v0.0.2 h1:cf3EMOpEtd9F2xLlx8Lp7+UrcQsRBC1f50JWfbg8co8= -storj.io/drpc v0.0.2/go.mod h1:/ascUDbzNAv0A3Jj7wUIKFBH2JdJ2uJIBO/b9+2yHgQ= +storj.io/drpc v0.0.3 h1:W7y0HeMA9VpiWtl2efNbavD9WF+jzfTyP9Od+fSYd6s= +storj.io/drpc v0.0.3/go.mod h1:/ascUDbzNAv0A3Jj7wUIKFBH2JdJ2uJIBO/b9+2yHgQ= diff --git a/pkg/certificate/peer.go b/pkg/certificate/peer.go index 842ab4d21..e131fab57 100644 --- a/pkg/certificate/peer.go +++ b/pkg/certificate/peer.go @@ -86,6 +86,7 @@ func New(log *zap.Logger, ident *identity.FullIdentity, ca *identity.FullCertifi peer.Certificate.Endpoint = NewEndpoint(log.Named("certificate"), ca, authorizationDB, uint16(config.MinDifficulty)) pb.RegisterCertificatesServer(peer.Server.GRPC(), peer.Certificate.Endpoint) + pb.DRPCRegisterCertificates(peer.Server.DRPC(), peer.Certificate.Endpoint) var err error peer.Authorization.Listener, err = net.Listen("tcp", config.AuthorizationAddr) diff --git a/pkg/pb/certificate.pb.go b/pkg/pb/certificate.pb.go index e1d97f4a0..4d48f62f0 100644 --- a/pkg/pb/certificate.pb.go +++ b/pkg/pb/certificate.pb.go @@ -157,7 +157,7 @@ func (c *drpcCertificatesClient) Sign(ctx context.Context, in *SigningRequest) ( } type DRPCCertificatesServer interface { - DRPCSign(context.Context, *SigningRequest) (*SigningResponse, error) + Sign(context.Context, *SigningRequest) (*SigningResponse, error) } type DRPCCertificatesDescription struct{} @@ -170,16 +170,20 @@ func (DRPCCertificatesDescription) Method(n int) (string, drpc.Handler, interfac return "/node.Certificates/Sign", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCCertificatesServer). - DRPCSign( + Sign( ctx, in1.(*SigningRequest), ) - }, DRPCCertificatesServer.DRPCSign, true + }, DRPCCertificatesServer.Sign, true default: return "", nil, nil, false } } +func DRPCRegisterCertificates(srv drpc.Server, impl DRPCCertificatesServer) { + srv.Register(impl, DRPCCertificatesDescription{}) +} + type DRPCCertificates_SignStream interface { drpc.Stream SendAndClose(*SigningResponse) error diff --git a/pkg/pb/contact.pb.go b/pkg/pb/contact.pb.go index f5d70d5a4..f9a854971 100644 --- a/pkg/pb/contact.pb.go +++ b/pkg/pb/contact.pb.go @@ -241,7 +241,7 @@ func (c *drpcContactClient) PingNode(ctx context.Context, in *ContactPingRequest } type DRPCContactServer interface { - DRPCPingNode(context.Context, *ContactPingRequest) (*ContactPingResponse, error) + PingNode(context.Context, *ContactPingRequest) (*ContactPingResponse, error) } type DRPCContactDescription struct{} @@ -254,16 +254,20 @@ func (DRPCContactDescription) Method(n int) (string, drpc.Handler, interface{}, return "/contact.Contact/PingNode", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCContactServer). - DRPCPingNode( + PingNode( ctx, in1.(*ContactPingRequest), ) - }, DRPCContactServer.DRPCPingNode, true + }, DRPCContactServer.PingNode, true default: return "", nil, nil, false } } +func DRPCRegisterContact(srv drpc.Server, impl DRPCContactServer) { + srv.Register(impl, DRPCContactDescription{}) +} + type DRPCContact_PingNodeStream interface { drpc.Stream SendAndClose(*ContactPingResponse) error @@ -306,7 +310,7 @@ func (c *drpcNodeClient) Checkin(ctx context.Context, in *CheckinRequest) (*Chec } type DRPCNodeServer interface { - DRPCCheckin(context.Context, *CheckinRequest) (*CheckinResponse, error) + Checkin(context.Context, *CheckinRequest) (*CheckinResponse, error) } type DRPCNodeDescription struct{} @@ -319,16 +323,20 @@ func (DRPCNodeDescription) Method(n int) (string, drpc.Handler, interface{}, boo return "/contact.Node/Checkin", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCNodeServer). - DRPCCheckin( + Checkin( ctx, in1.(*CheckinRequest), ) - }, DRPCNodeServer.DRPCCheckin, true + }, DRPCNodeServer.Checkin, true default: return "", nil, nil, false } } +func DRPCRegisterNode(srv drpc.Server, impl DRPCNodeServer) { + srv.Register(impl, DRPCNodeDescription{}) +} + type DRPCNode_CheckinStream interface { drpc.Stream SendAndClose(*CheckinResponse) error diff --git a/pkg/pb/inspector.pb.go b/pkg/pb/inspector.pb.go index 57108939a..df10c884f 100644 --- a/pkg/pb/inspector.pb.go +++ b/pkg/pb/inspector.pb.go @@ -1729,19 +1729,19 @@ func (c *drpcKadInspectorClient) GetBucketList(ctx context.Context, in *GetBucke type DRPCKadInspectorServer interface { // CountNodes returns the number of nodes in the routing table - DRPCCountNodes(context.Context, *CountNodesRequest) (*CountNodesResponse, error) + CountNodes(context.Context, *CountNodesRequest) (*CountNodesResponse, error) // PingNode sends a PING RPC to a node and returns its availability - DRPCPingNode(context.Context, *PingNodeRequest) (*PingNodeResponse, error) + PingNode(context.Context, *PingNodeRequest) (*PingNodeResponse, error) // LookupNode triggers a Kademlia FindNode and returns the response - DRPCLookupNode(context.Context, *LookupNodeRequest) (*LookupNodeResponse, error) + LookupNode(context.Context, *LookupNodeRequest) (*LookupNodeResponse, error) // NodeInfo sends a PING RPC to a node and returns its local info - DRPCNodeInfo(context.Context, *NodeInfoRequest) (*NodeInfoResponse, error) + NodeInfo(context.Context, *NodeInfoRequest) (*NodeInfoResponse, error) // FindNear returns limit number of IDs "near" the Start ID - DRPCFindNear(context.Context, *FindNearRequest) (*FindNearResponse, error) + FindNear(context.Context, *FindNearRequest) (*FindNearResponse, error) // DumpNodes returns all the nodes in the node database - DRPCDumpNodes(context.Context, *DumpNodesRequest) (*DumpNodesResponse, error) + DumpNodes(context.Context, *DumpNodesRequest) (*DumpNodesResponse, error) // GetBucketList returns all the buckets with all their nodes - DRPCGetBucketList(context.Context, *GetBucketListRequest) (*GetBucketListResponse, error) + GetBucketList(context.Context, *GetBucketListRequest) (*GetBucketListResponse, error) } type DRPCKadInspectorDescription struct{} @@ -1754,70 +1754,74 @@ func (DRPCKadInspectorDescription) Method(n int) (string, drpc.Handler, interfac return "/inspector.KadInspector/CountNodes", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCKadInspectorServer). - DRPCCountNodes( + CountNodes( ctx, in1.(*CountNodesRequest), ) - }, DRPCKadInspectorServer.DRPCCountNodes, true + }, DRPCKadInspectorServer.CountNodes, true case 1: return "/inspector.KadInspector/PingNode", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCKadInspectorServer). - DRPCPingNode( + PingNode( ctx, in1.(*PingNodeRequest), ) - }, DRPCKadInspectorServer.DRPCPingNode, true + }, DRPCKadInspectorServer.PingNode, true case 2: return "/inspector.KadInspector/LookupNode", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCKadInspectorServer). - DRPCLookupNode( + LookupNode( ctx, in1.(*LookupNodeRequest), ) - }, DRPCKadInspectorServer.DRPCLookupNode, true + }, DRPCKadInspectorServer.LookupNode, true case 3: return "/inspector.KadInspector/NodeInfo", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCKadInspectorServer). - DRPCNodeInfo( + NodeInfo( ctx, in1.(*NodeInfoRequest), ) - }, DRPCKadInspectorServer.DRPCNodeInfo, true + }, DRPCKadInspectorServer.NodeInfo, true case 4: return "/inspector.KadInspector/FindNear", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCKadInspectorServer). - DRPCFindNear( + FindNear( ctx, in1.(*FindNearRequest), ) - }, DRPCKadInspectorServer.DRPCFindNear, true + }, DRPCKadInspectorServer.FindNear, true case 5: return "/inspector.KadInspector/DumpNodes", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCKadInspectorServer). - DRPCDumpNodes( + DumpNodes( ctx, in1.(*DumpNodesRequest), ) - }, DRPCKadInspectorServer.DRPCDumpNodes, true + }, DRPCKadInspectorServer.DumpNodes, true case 6: return "/inspector.KadInspector/GetBucketList", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCKadInspectorServer). - DRPCGetBucketList( + GetBucketList( ctx, in1.(*GetBucketListRequest), ) - }, DRPCKadInspectorServer.DRPCGetBucketList, true + }, DRPCKadInspectorServer.GetBucketList, true default: return "", nil, nil, false } } +func DRPCRegisterKadInspector(srv drpc.Server, impl DRPCKadInspectorServer) { + srv.Register(impl, DRPCKadInspectorDescription{}) +} + type DRPCKadInspector_CountNodesStream interface { drpc.Stream SendAndClose(*CountNodesResponse) error @@ -1969,9 +1973,9 @@ func (c *drpcOverlayInspectorClient) DumpNodes(ctx context.Context, in *DumpNode type DRPCOverlayInspectorServer interface { // CountNodes returns the number of nodes in the cache - DRPCCountNodes(context.Context, *CountNodesRequest) (*CountNodesResponse, error) + CountNodes(context.Context, *CountNodesRequest) (*CountNodesResponse, error) // DumpNodes returns all the nodes in the cache - DRPCDumpNodes(context.Context, *DumpNodesRequest) (*DumpNodesResponse, error) + DumpNodes(context.Context, *DumpNodesRequest) (*DumpNodesResponse, error) } type DRPCOverlayInspectorDescription struct{} @@ -1984,25 +1988,29 @@ func (DRPCOverlayInspectorDescription) Method(n int) (string, drpc.Handler, inte return "/inspector.OverlayInspector/CountNodes", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCOverlayInspectorServer). - DRPCCountNodes( + CountNodes( ctx, in1.(*CountNodesRequest), ) - }, DRPCOverlayInspectorServer.DRPCCountNodes, true + }, DRPCOverlayInspectorServer.CountNodes, true case 1: return "/inspector.OverlayInspector/DumpNodes", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCOverlayInspectorServer). - DRPCDumpNodes( + DumpNodes( ctx, in1.(*DumpNodesRequest), ) - }, DRPCOverlayInspectorServer.DRPCDumpNodes, true + }, DRPCOverlayInspectorServer.DumpNodes, true default: return "", nil, nil, false } } +func DRPCRegisterOverlayInspector(srv drpc.Server, impl DRPCOverlayInspectorServer) { + srv.Register(impl, DRPCOverlayInspectorDescription{}) +} + type DRPCOverlayInspector_CountNodesStream interface { drpc.Stream SendAndClose(*CountNodesResponse) error @@ -2074,9 +2082,9 @@ func (c *drpcPieceStoreInspectorClient) Dashboard(ctx context.Context, in *Dashb type DRPCPieceStoreInspectorServer interface { // Stats return space and bandwidth stats for a storagenode - DRPCStats(context.Context, *StatsRequest) (*StatSummaryResponse, error) + Stats(context.Context, *StatsRequest) (*StatSummaryResponse, error) // Dashboard returns stats for a specific storagenode - DRPCDashboard(context.Context, *DashboardRequest) (*DashboardResponse, error) + Dashboard(context.Context, *DashboardRequest) (*DashboardResponse, error) } type DRPCPieceStoreInspectorDescription struct{} @@ -2089,25 +2097,29 @@ func (DRPCPieceStoreInspectorDescription) Method(n int) (string, drpc.Handler, i return "/inspector.PieceStoreInspector/Stats", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCPieceStoreInspectorServer). - DRPCStats( + Stats( ctx, in1.(*StatsRequest), ) - }, DRPCPieceStoreInspectorServer.DRPCStats, true + }, DRPCPieceStoreInspectorServer.Stats, true case 1: return "/inspector.PieceStoreInspector/Dashboard", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCPieceStoreInspectorServer). - DRPCDashboard( + Dashboard( ctx, in1.(*DashboardRequest), ) - }, DRPCPieceStoreInspectorServer.DRPCDashboard, true + }, DRPCPieceStoreInspectorServer.Dashboard, true default: return "", nil, nil, false } } +func DRPCRegisterPieceStoreInspector(srv drpc.Server, impl DRPCPieceStoreInspectorServer) { + srv.Register(impl, DRPCPieceStoreInspectorDescription{}) +} + type DRPCPieceStoreInspector_StatsStream interface { drpc.Stream SendAndClose(*StatSummaryResponse) error @@ -2168,7 +2180,7 @@ func (c *drpcIrreparableInspectorClient) ListIrreparableSegments(ctx context.Con type DRPCIrreparableInspectorServer interface { // ListIrreparableSegments returns damaged segments - DRPCListIrreparableSegments(context.Context, *ListIrreparableSegmentsRequest) (*ListIrreparableSegmentsResponse, error) + ListIrreparableSegments(context.Context, *ListIrreparableSegmentsRequest) (*ListIrreparableSegmentsResponse, error) } type DRPCIrreparableInspectorDescription struct{} @@ -2181,16 +2193,20 @@ func (DRPCIrreparableInspectorDescription) Method(n int) (string, drpc.Handler, return "/inspector.IrreparableInspector/ListIrreparableSegments", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCIrreparableInspectorServer). - DRPCListIrreparableSegments( + ListIrreparableSegments( ctx, in1.(*ListIrreparableSegmentsRequest), ) - }, DRPCIrreparableInspectorServer.DRPCListIrreparableSegments, true + }, DRPCIrreparableInspectorServer.ListIrreparableSegments, true default: return "", nil, nil, false } } +func DRPCRegisterIrreparableInspector(srv drpc.Server, impl DRPCIrreparableInspectorServer) { + srv.Register(impl, DRPCIrreparableInspectorDescription{}) +} + type DRPCIrreparableInspector_ListIrreparableSegmentsStream interface { drpc.Stream SendAndClose(*ListIrreparableSegmentsResponse) error @@ -2246,9 +2262,9 @@ func (c *drpcHealthInspectorClient) SegmentHealth(ctx context.Context, in *Segme type DRPCHealthInspectorServer interface { // ObjectHealth will return stats about the health of an object - DRPCObjectHealth(context.Context, *ObjectHealthRequest) (*ObjectHealthResponse, error) + ObjectHealth(context.Context, *ObjectHealthRequest) (*ObjectHealthResponse, error) // SegmentHealth will return stats about the health of a segment - DRPCSegmentHealth(context.Context, *SegmentHealthRequest) (*SegmentHealthResponse, error) + SegmentHealth(context.Context, *SegmentHealthRequest) (*SegmentHealthResponse, error) } type DRPCHealthInspectorDescription struct{} @@ -2261,25 +2277,29 @@ func (DRPCHealthInspectorDescription) Method(n int) (string, drpc.Handler, inter return "/inspector.HealthInspector/ObjectHealth", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCHealthInspectorServer). - DRPCObjectHealth( + ObjectHealth( ctx, in1.(*ObjectHealthRequest), ) - }, DRPCHealthInspectorServer.DRPCObjectHealth, true + }, DRPCHealthInspectorServer.ObjectHealth, true case 1: return "/inspector.HealthInspector/SegmentHealth", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCHealthInspectorServer). - DRPCSegmentHealth( + SegmentHealth( ctx, in1.(*SegmentHealthRequest), ) - }, DRPCHealthInspectorServer.DRPCSegmentHealth, true + }, DRPCHealthInspectorServer.SegmentHealth, true default: return "", nil, nil, false } } +func DRPCRegisterHealthInspector(srv drpc.Server, impl DRPCHealthInspectorServer) { + srv.Register(impl, DRPCHealthInspectorDescription{}) +} + type DRPCHealthInspector_ObjectHealthStream interface { drpc.Stream SendAndClose(*ObjectHealthResponse) error diff --git a/pkg/pb/metainfo.pb.go b/pkg/pb/metainfo.pb.go index e71f8bbf2..a71b1c75e 100644 --- a/pkg/pb/metainfo.pb.go +++ b/pkg/pb/metainfo.pb.go @@ -5401,34 +5401,34 @@ func (c *drpcMetainfoClient) ProjectInfo(ctx context.Context, in *ProjectInfoReq type DRPCMetainfoServer interface { // Bucket - DRPCCreateBucket(context.Context, *BucketCreateRequest) (*BucketCreateResponse, error) - DRPCGetBucket(context.Context, *BucketGetRequest) (*BucketGetResponse, error) - DRPCDeleteBucket(context.Context, *BucketDeleteRequest) (*BucketDeleteResponse, error) - DRPCListBuckets(context.Context, *BucketListRequest) (*BucketListResponse, error) - DRPCSetBucketAttribution(context.Context, *BucketSetAttributionRequest) (*BucketSetAttributionResponse, error) + CreateBucket(context.Context, *BucketCreateRequest) (*BucketCreateResponse, error) + GetBucket(context.Context, *BucketGetRequest) (*BucketGetResponse, error) + DeleteBucket(context.Context, *BucketDeleteRequest) (*BucketDeleteResponse, error) + ListBuckets(context.Context, *BucketListRequest) (*BucketListResponse, error) + SetBucketAttribution(context.Context, *BucketSetAttributionRequest) (*BucketSetAttributionResponse, error) // Object - DRPCBeginObject(context.Context, *ObjectBeginRequest) (*ObjectBeginResponse, error) - DRPCCommitObject(context.Context, *ObjectCommitRequest) (*ObjectCommitResponse, error) - DRPCGetObject(context.Context, *ObjectGetRequest) (*ObjectGetResponse, error) - DRPCListObjects(context.Context, *ObjectListRequest) (*ObjectListResponse, error) - DRPCBeginDeleteObject(context.Context, *ObjectBeginDeleteRequest) (*ObjectBeginDeleteResponse, error) - DRPCFinishDeleteObject(context.Context, *ObjectFinishDeleteRequest) (*ObjectFinishDeleteResponse, error) - DRPCBeginSegment(context.Context, *SegmentBeginRequest) (*SegmentBeginResponse, error) - DRPCCommitSegment(context.Context, *SegmentCommitRequest) (*SegmentCommitResponse, error) - DRPCMakeInlineSegment(context.Context, *SegmentMakeInlineRequest) (*SegmentMakeInlineResponse, error) - DRPCBeginDeleteSegment(context.Context, *SegmentBeginDeleteRequest) (*SegmentBeginDeleteResponse, error) - DRPCFinishDeleteSegment(context.Context, *SegmentFinishDeleteRequest) (*SegmentFinishDeleteResponse, error) - DRPCListSegments(context.Context, *SegmentListRequest) (*SegmentListResponse, error) - DRPCDownloadSegment(context.Context, *SegmentDownloadRequest) (*SegmentDownloadResponse, error) - DRPCBatch(context.Context, *BatchRequest) (*BatchResponse, error) - DRPCCreateSegmentOld(context.Context, *SegmentWriteRequestOld) (*SegmentWriteResponseOld, error) - DRPCCommitSegmentOld(context.Context, *SegmentCommitRequestOld) (*SegmentCommitResponseOld, error) - DRPCSegmentInfoOld(context.Context, *SegmentInfoRequestOld) (*SegmentInfoResponseOld, error) - DRPCDownloadSegmentOld(context.Context, *SegmentDownloadRequestOld) (*SegmentDownloadResponseOld, error) - DRPCDeleteSegmentOld(context.Context, *SegmentDeleteRequestOld) (*SegmentDeleteResponseOld, error) - DRPCListSegmentsOld(context.Context, *ListSegmentsRequestOld) (*ListSegmentsResponseOld, error) - DRPCSetAttributionOld(context.Context, *SetAttributionRequestOld) (*SetAttributionResponseOld, error) - DRPCProjectInfo(context.Context, *ProjectInfoRequest) (*ProjectInfoResponse, error) + BeginObject(context.Context, *ObjectBeginRequest) (*ObjectBeginResponse, error) + CommitObject(context.Context, *ObjectCommitRequest) (*ObjectCommitResponse, error) + GetObject(context.Context, *ObjectGetRequest) (*ObjectGetResponse, error) + ListObjects(context.Context, *ObjectListRequest) (*ObjectListResponse, error) + BeginDeleteObject(context.Context, *ObjectBeginDeleteRequest) (*ObjectBeginDeleteResponse, error) + FinishDeleteObject(context.Context, *ObjectFinishDeleteRequest) (*ObjectFinishDeleteResponse, error) + BeginSegment(context.Context, *SegmentBeginRequest) (*SegmentBeginResponse, error) + CommitSegment(context.Context, *SegmentCommitRequest) (*SegmentCommitResponse, error) + MakeInlineSegment(context.Context, *SegmentMakeInlineRequest) (*SegmentMakeInlineResponse, error) + BeginDeleteSegment(context.Context, *SegmentBeginDeleteRequest) (*SegmentBeginDeleteResponse, error) + FinishDeleteSegment(context.Context, *SegmentFinishDeleteRequest) (*SegmentFinishDeleteResponse, error) + ListSegments(context.Context, *SegmentListRequest) (*SegmentListResponse, error) + DownloadSegment(context.Context, *SegmentDownloadRequest) (*SegmentDownloadResponse, error) + Batch(context.Context, *BatchRequest) (*BatchResponse, error) + CreateSegmentOld(context.Context, *SegmentWriteRequestOld) (*SegmentWriteResponseOld, error) + CommitSegmentOld(context.Context, *SegmentCommitRequestOld) (*SegmentCommitResponseOld, error) + SegmentInfoOld(context.Context, *SegmentInfoRequestOld) (*SegmentInfoResponseOld, error) + DownloadSegmentOld(context.Context, *SegmentDownloadRequestOld) (*SegmentDownloadResponseOld, error) + DeleteSegmentOld(context.Context, *SegmentDeleteRequestOld) (*SegmentDeleteResponseOld, error) + ListSegmentsOld(context.Context, *ListSegmentsRequestOld) (*ListSegmentsResponseOld, error) + SetAttributionOld(context.Context, *SetAttributionRequestOld) (*SetAttributionResponseOld, error) + ProjectInfo(context.Context, *ProjectInfoRequest) (*ProjectInfoResponse, error) } type DRPCMetainfoDescription struct{} @@ -5441,250 +5441,254 @@ func (DRPCMetainfoDescription) Method(n int) (string, drpc.Handler, interface{}, return "/metainfo.Metainfo/CreateBucket", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCCreateBucket( + CreateBucket( ctx, in1.(*BucketCreateRequest), ) - }, DRPCMetainfoServer.DRPCCreateBucket, true + }, DRPCMetainfoServer.CreateBucket, true case 1: return "/metainfo.Metainfo/GetBucket", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCGetBucket( + GetBucket( ctx, in1.(*BucketGetRequest), ) - }, DRPCMetainfoServer.DRPCGetBucket, true + }, DRPCMetainfoServer.GetBucket, true case 2: return "/metainfo.Metainfo/DeleteBucket", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCDeleteBucket( + DeleteBucket( ctx, in1.(*BucketDeleteRequest), ) - }, DRPCMetainfoServer.DRPCDeleteBucket, true + }, DRPCMetainfoServer.DeleteBucket, true case 3: return "/metainfo.Metainfo/ListBuckets", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCListBuckets( + ListBuckets( ctx, in1.(*BucketListRequest), ) - }, DRPCMetainfoServer.DRPCListBuckets, true + }, DRPCMetainfoServer.ListBuckets, true case 4: return "/metainfo.Metainfo/SetBucketAttribution", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCSetBucketAttribution( + SetBucketAttribution( ctx, in1.(*BucketSetAttributionRequest), ) - }, DRPCMetainfoServer.DRPCSetBucketAttribution, true + }, DRPCMetainfoServer.SetBucketAttribution, true case 5: return "/metainfo.Metainfo/BeginObject", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCBeginObject( + BeginObject( ctx, in1.(*ObjectBeginRequest), ) - }, DRPCMetainfoServer.DRPCBeginObject, true + }, DRPCMetainfoServer.BeginObject, true case 6: return "/metainfo.Metainfo/CommitObject", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCCommitObject( + CommitObject( ctx, in1.(*ObjectCommitRequest), ) - }, DRPCMetainfoServer.DRPCCommitObject, true + }, DRPCMetainfoServer.CommitObject, true case 7: return "/metainfo.Metainfo/GetObject", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCGetObject( + GetObject( ctx, in1.(*ObjectGetRequest), ) - }, DRPCMetainfoServer.DRPCGetObject, true + }, DRPCMetainfoServer.GetObject, true case 8: return "/metainfo.Metainfo/ListObjects", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCListObjects( + ListObjects( ctx, in1.(*ObjectListRequest), ) - }, DRPCMetainfoServer.DRPCListObjects, true + }, DRPCMetainfoServer.ListObjects, true case 9: return "/metainfo.Metainfo/BeginDeleteObject", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCBeginDeleteObject( + BeginDeleteObject( ctx, in1.(*ObjectBeginDeleteRequest), ) - }, DRPCMetainfoServer.DRPCBeginDeleteObject, true + }, DRPCMetainfoServer.BeginDeleteObject, true case 10: return "/metainfo.Metainfo/FinishDeleteObject", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCFinishDeleteObject( + FinishDeleteObject( ctx, in1.(*ObjectFinishDeleteRequest), ) - }, DRPCMetainfoServer.DRPCFinishDeleteObject, true + }, DRPCMetainfoServer.FinishDeleteObject, true case 11: return "/metainfo.Metainfo/BeginSegment", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCBeginSegment( + BeginSegment( ctx, in1.(*SegmentBeginRequest), ) - }, DRPCMetainfoServer.DRPCBeginSegment, true + }, DRPCMetainfoServer.BeginSegment, true case 12: return "/metainfo.Metainfo/CommitSegment", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCCommitSegment( + CommitSegment( ctx, in1.(*SegmentCommitRequest), ) - }, DRPCMetainfoServer.DRPCCommitSegment, true + }, DRPCMetainfoServer.CommitSegment, true case 13: return "/metainfo.Metainfo/MakeInlineSegment", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCMakeInlineSegment( + MakeInlineSegment( ctx, in1.(*SegmentMakeInlineRequest), ) - }, DRPCMetainfoServer.DRPCMakeInlineSegment, true + }, DRPCMetainfoServer.MakeInlineSegment, true case 14: return "/metainfo.Metainfo/BeginDeleteSegment", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCBeginDeleteSegment( + BeginDeleteSegment( ctx, in1.(*SegmentBeginDeleteRequest), ) - }, DRPCMetainfoServer.DRPCBeginDeleteSegment, true + }, DRPCMetainfoServer.BeginDeleteSegment, true case 15: return "/metainfo.Metainfo/FinishDeleteSegment", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCFinishDeleteSegment( + FinishDeleteSegment( ctx, in1.(*SegmentFinishDeleteRequest), ) - }, DRPCMetainfoServer.DRPCFinishDeleteSegment, true + }, DRPCMetainfoServer.FinishDeleteSegment, true case 16: return "/metainfo.Metainfo/ListSegments", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCListSegments( + ListSegments( ctx, in1.(*SegmentListRequest), ) - }, DRPCMetainfoServer.DRPCListSegments, true + }, DRPCMetainfoServer.ListSegments, true case 17: return "/metainfo.Metainfo/DownloadSegment", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCDownloadSegment( + DownloadSegment( ctx, in1.(*SegmentDownloadRequest), ) - }, DRPCMetainfoServer.DRPCDownloadSegment, true + }, DRPCMetainfoServer.DownloadSegment, true case 18: return "/metainfo.Metainfo/Batch", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCBatch( + Batch( ctx, in1.(*BatchRequest), ) - }, DRPCMetainfoServer.DRPCBatch, true + }, DRPCMetainfoServer.Batch, true case 19: return "/metainfo.Metainfo/CreateSegmentOld", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCCreateSegmentOld( + CreateSegmentOld( ctx, in1.(*SegmentWriteRequestOld), ) - }, DRPCMetainfoServer.DRPCCreateSegmentOld, true + }, DRPCMetainfoServer.CreateSegmentOld, true case 20: return "/metainfo.Metainfo/CommitSegmentOld", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCCommitSegmentOld( + CommitSegmentOld( ctx, in1.(*SegmentCommitRequestOld), ) - }, DRPCMetainfoServer.DRPCCommitSegmentOld, true + }, DRPCMetainfoServer.CommitSegmentOld, true case 21: return "/metainfo.Metainfo/SegmentInfoOld", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCSegmentInfoOld( + SegmentInfoOld( ctx, in1.(*SegmentInfoRequestOld), ) - }, DRPCMetainfoServer.DRPCSegmentInfoOld, true + }, DRPCMetainfoServer.SegmentInfoOld, true case 22: return "/metainfo.Metainfo/DownloadSegmentOld", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCDownloadSegmentOld( + DownloadSegmentOld( ctx, in1.(*SegmentDownloadRequestOld), ) - }, DRPCMetainfoServer.DRPCDownloadSegmentOld, true + }, DRPCMetainfoServer.DownloadSegmentOld, true case 23: return "/metainfo.Metainfo/DeleteSegmentOld", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCDeleteSegmentOld( + DeleteSegmentOld( ctx, in1.(*SegmentDeleteRequestOld), ) - }, DRPCMetainfoServer.DRPCDeleteSegmentOld, true + }, DRPCMetainfoServer.DeleteSegmentOld, true case 24: return "/metainfo.Metainfo/ListSegmentsOld", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCListSegmentsOld( + ListSegmentsOld( ctx, in1.(*ListSegmentsRequestOld), ) - }, DRPCMetainfoServer.DRPCListSegmentsOld, true + }, DRPCMetainfoServer.ListSegmentsOld, true case 25: return "/metainfo.Metainfo/SetAttributionOld", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCSetAttributionOld( + SetAttributionOld( ctx, in1.(*SetAttributionRequestOld), ) - }, DRPCMetainfoServer.DRPCSetAttributionOld, true + }, DRPCMetainfoServer.SetAttributionOld, true case 26: return "/metainfo.Metainfo/ProjectInfo", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCMetainfoServer). - DRPCProjectInfo( + ProjectInfo( ctx, in1.(*ProjectInfoRequest), ) - }, DRPCMetainfoServer.DRPCProjectInfo, true + }, DRPCMetainfoServer.ProjectInfo, true default: return "", nil, nil, false } } +func DRPCRegisterMetainfo(srv drpc.Server, impl DRPCMetainfoServer) { + srv.Register(impl, DRPCMetainfoDescription{}) +} + type DRPCMetainfo_CreateBucketStream interface { drpc.Stream SendAndClose(*BucketCreateResponse) error diff --git a/pkg/pb/nodestats.pb.go b/pkg/pb/nodestats.pb.go index cbf70b373..c9d013ce9 100644 --- a/pkg/pb/nodestats.pb.go +++ b/pkg/pb/nodestats.pb.go @@ -398,8 +398,8 @@ func (c *drpcNodeStatsClient) DailyStorageUsage(ctx context.Context, in *DailySt } type DRPCNodeStatsServer interface { - DRPCGetStats(context.Context, *GetStatsRequest) (*GetStatsResponse, error) - DRPCDailyStorageUsage(context.Context, *DailyStorageUsageRequest) (*DailyStorageUsageResponse, error) + GetStats(context.Context, *GetStatsRequest) (*GetStatsResponse, error) + DailyStorageUsage(context.Context, *DailyStorageUsageRequest) (*DailyStorageUsageResponse, error) } type DRPCNodeStatsDescription struct{} @@ -412,25 +412,29 @@ func (DRPCNodeStatsDescription) Method(n int) (string, drpc.Handler, interface{} return "/nodestats.NodeStats/GetStats", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCNodeStatsServer). - DRPCGetStats( + GetStats( ctx, in1.(*GetStatsRequest), ) - }, DRPCNodeStatsServer.DRPCGetStats, true + }, DRPCNodeStatsServer.GetStats, true case 1: return "/nodestats.NodeStats/DailyStorageUsage", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCNodeStatsServer). - DRPCDailyStorageUsage( + DailyStorageUsage( ctx, in1.(*DailyStorageUsageRequest), ) - }, DRPCNodeStatsServer.DRPCDailyStorageUsage, true + }, DRPCNodeStatsServer.DailyStorageUsage, true default: return "", nil, nil, false } } +func DRPCRegisterNodeStats(srv drpc.Server, impl DRPCNodeStatsServer) { + srv.Register(impl, DRPCNodeStatsDescription{}) +} + type DRPCNodeStats_GetStatsStream interface { drpc.Stream SendAndClose(*GetStatsResponse) error diff --git a/pkg/pb/orders.pb.go b/pkg/pb/orders.pb.go index 7182286a3..843b1e979 100644 --- a/pkg/pb/orders.pb.go +++ b/pkg/pb/orders.pb.go @@ -765,7 +765,7 @@ func (x *drpcOrdersSettlementClient) Recv() (*SettlementResponse, error) { } type DRPCOrdersServer interface { - DRPCSettlement(DRPCOrders_SettlementStream) error + Settlement(DRPCOrders_SettlementStream) error } type DRPCOrdersDescription struct{} @@ -778,15 +778,19 @@ func (DRPCOrdersDescription) Method(n int) (string, drpc.Handler, interface{}, b return "/orders.Orders/Settlement", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return nil, srv.(DRPCOrdersServer). - DRPCSettlement( + Settlement( &drpcOrdersSettlementStream{in1.(drpc.Stream)}, ) - }, DRPCOrdersServer.DRPCSettlement, true + }, DRPCOrdersServer.Settlement, true default: return "", nil, nil, false } } +func DRPCRegisterOrders(srv drpc.Server, impl DRPCOrdersServer) { + srv.Register(impl, DRPCOrdersDescription{}) +} + type DRPCOrders_SettlementStream interface { drpc.Stream Send(*SettlementResponse) error diff --git a/pkg/pb/overlay.pb.go b/pkg/pb/overlay.pb.go index 6ac122390..550338a91 100644 --- a/pkg/pb/overlay.pb.go +++ b/pkg/pb/overlay.pb.go @@ -503,9 +503,9 @@ func (c *drpcNodesClient) RequestInfo(ctx context.Context, in *InfoRequest) (*In } type DRPCNodesServer interface { - DRPCQuery(context.Context, *QueryRequest) (*QueryResponse, error) - DRPCPing(context.Context, *PingRequest) (*PingResponse, error) - DRPCRequestInfo(context.Context, *InfoRequest) (*InfoResponse, error) + Query(context.Context, *QueryRequest) (*QueryResponse, error) + Ping(context.Context, *PingRequest) (*PingResponse, error) + RequestInfo(context.Context, *InfoRequest) (*InfoResponse, error) } type DRPCNodesDescription struct{} @@ -518,34 +518,38 @@ func (DRPCNodesDescription) Method(n int) (string, drpc.Handler, interface{}, bo return "/overlay.Nodes/Query", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCNodesServer). - DRPCQuery( + Query( ctx, in1.(*QueryRequest), ) - }, DRPCNodesServer.DRPCQuery, true + }, DRPCNodesServer.Query, true case 1: return "/overlay.Nodes/Ping", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCNodesServer). - DRPCPing( + Ping( ctx, in1.(*PingRequest), ) - }, DRPCNodesServer.DRPCPing, true + }, DRPCNodesServer.Ping, true case 2: return "/overlay.Nodes/RequestInfo", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCNodesServer). - DRPCRequestInfo( + RequestInfo( ctx, in1.(*InfoRequest), ) - }, DRPCNodesServer.DRPCRequestInfo, true + }, DRPCNodesServer.RequestInfo, true default: return "", nil, nil, false } } +func DRPCRegisterNodes(srv drpc.Server, impl DRPCNodesServer) { + srv.Register(impl, DRPCNodesDescription{}) +} + type DRPCNodes_QueryStream interface { drpc.Stream SendAndClose(*QueryResponse) error diff --git a/pkg/pb/piecestore2.pb.go b/pkg/pb/piecestore2.pb.go index 440e4a212..c1b8841b9 100644 --- a/pkg/pb/piecestore2.pb.go +++ b/pkg/pb/piecestore2.pb.go @@ -811,10 +811,10 @@ func (c *drpcPiecestoreClient) Retain(ctx context.Context, in *RetainRequest) (* } type DRPCPiecestoreServer interface { - DRPCUpload(DRPCPiecestore_UploadStream) error - DRPCDownload(DRPCPiecestore_DownloadStream) error - DRPCDelete(context.Context, *PieceDeleteRequest) (*PieceDeleteResponse, error) - DRPCRetain(context.Context, *RetainRequest) (*RetainResponse, error) + Upload(DRPCPiecestore_UploadStream) error + Download(DRPCPiecestore_DownloadStream) error + Delete(context.Context, *PieceDeleteRequest) (*PieceDeleteResponse, error) + Retain(context.Context, *RetainRequest) (*RetainResponse, error) } type DRPCPiecestoreDescription struct{} @@ -827,41 +827,45 @@ func (DRPCPiecestoreDescription) Method(n int) (string, drpc.Handler, interface{ return "/piecestore.Piecestore/Upload", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return nil, srv.(DRPCPiecestoreServer). - DRPCUpload( + Upload( &drpcPiecestoreUploadStream{in1.(drpc.Stream)}, ) - }, DRPCPiecestoreServer.DRPCUpload, true + }, DRPCPiecestoreServer.Upload, true case 1: return "/piecestore.Piecestore/Download", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return nil, srv.(DRPCPiecestoreServer). - DRPCDownload( + Download( &drpcPiecestoreDownloadStream{in1.(drpc.Stream)}, ) - }, DRPCPiecestoreServer.DRPCDownload, true + }, DRPCPiecestoreServer.Download, true case 2: return "/piecestore.Piecestore/Delete", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCPiecestoreServer). - DRPCDelete( + Delete( ctx, in1.(*PieceDeleteRequest), ) - }, DRPCPiecestoreServer.DRPCDelete, true + }, DRPCPiecestoreServer.Delete, true case 3: return "/piecestore.Piecestore/Retain", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCPiecestoreServer). - DRPCRetain( + Retain( ctx, in1.(*RetainRequest), ) - }, DRPCPiecestoreServer.DRPCRetain, true + }, DRPCPiecestoreServer.Retain, true default: return "", nil, nil, false } } +func DRPCRegisterPiecestore(srv drpc.Server, impl DRPCPiecestoreServer) { + srv.Register(impl, DRPCPiecestoreDescription{}) +} + type DRPCPiecestore_UploadStream interface { drpc.Stream SendAndClose(*PieceUploadResponse) error diff --git a/pkg/pb/vouchers.pb.go b/pkg/pb/vouchers.pb.go index c2ffed0e2..f12eb1023 100644 --- a/pkg/pb/vouchers.pb.go +++ b/pkg/pb/vouchers.pb.go @@ -242,7 +242,7 @@ func (c *drpcVouchersClient) Request(ctx context.Context, in *VoucherRequest) (* } type DRPCVouchersServer interface { - DRPCRequest(context.Context, *VoucherRequest) (*VoucherResponse, error) + Request(context.Context, *VoucherRequest) (*VoucherResponse, error) } type DRPCVouchersDescription struct{} @@ -255,16 +255,20 @@ func (DRPCVouchersDescription) Method(n int) (string, drpc.Handler, interface{}, return "/vouchers.Vouchers/Request", func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCVouchersServer). - DRPCRequest( + Request( ctx, in1.(*VoucherRequest), ) - }, DRPCVouchersServer.DRPCRequest, true + }, DRPCVouchersServer.Request, true default: return "", nil, nil, false } } +func DRPCRegisterVouchers(srv drpc.Server, impl DRPCVouchersServer) { + srv.Register(impl, DRPCVouchersDescription{}) +} + type DRPCVouchers_RequestStream interface { drpc.Stream SendAndClose(*VoucherResponse) error diff --git a/satellite/orders/endpoint.go b/satellite/orders/endpoint.go index 90d6aefc1..91c17136d 100644 --- a/satellite/orders/endpoint.go +++ b/satellite/orders/endpoint.go @@ -86,6 +86,12 @@ type Endpoint struct { settlementBatchSize int } +// drpcEndpoint wraps streaming methods so that they can be used with drpc +type drpcEndpoint struct{ *Endpoint } + +// DRPC returns a DRPC form of the endpoint. +func (endpoint *Endpoint) DRPC() pb.DRPCOrdersServer { return &drpcEndpoint{Endpoint: endpoint} } + // NewEndpoint new orders receiving endpoint func NewEndpoint(log *zap.Logger, satelliteSignee signing.Signee, db DB, settlementBatchSize int) *Endpoint { return &Endpoint{ @@ -96,12 +102,12 @@ func NewEndpoint(log *zap.Logger, satelliteSignee signing.Signee, db DB, settlem } } -func monitoredSettlementStreamReceive(ctx context.Context, stream pb.Orders_SettlementServer) (_ *pb.SettlementRequest, err error) { +func monitoredSettlementStreamReceive(ctx context.Context, stream settlementStream) (_ *pb.SettlementRequest, err error) { defer mon.Task()(&ctx)(&err) return stream.Recv() } -func monitoredSettlementStreamSend(ctx context.Context, stream pb.Orders_SettlementServer, resp *pb.SettlementResponse) (err error) { +func monitoredSettlementStreamSend(ctx context.Context, stream settlementStream, resp *pb.SettlementResponse) (err error) { defer mon.Task()(&ctx)(&err) switch resp.Status { case pb.SettlementResponse_ACCEPTED: @@ -116,6 +122,23 @@ func monitoredSettlementStreamSend(ctx context.Context, stream pb.Orders_Settlem // Settlement receives orders and handles them in batches func (endpoint *Endpoint) Settlement(stream pb.Orders_SettlementServer) (err error) { + return endpoint.doSettlement(stream) +} + +// Settlement receives orders and handles them in batches +func (endpoint *drpcEndpoint) Settlement(stream pb.DRPCOrders_SettlementStream) (err error) { + return endpoint.doSettlement(stream) +} + +// settlementStream is the minimum interface required to perform settlements. +type settlementStream interface { + Context() context.Context + Send(*pb.SettlementResponse) error + Recv() (*pb.SettlementRequest, error) +} + +// doSettlement receives orders and handles them in batches +func (endpoint *Endpoint) doSettlement(stream settlementStream) (err error) { ctx := stream.Context() defer mon.Task()(&ctx)(&err) @@ -213,7 +236,7 @@ func (endpoint *Endpoint) Settlement(stream pb.Orders_SettlementServer) (err err } } -func (endpoint *Endpoint) processOrders(ctx context.Context, stream pb.Orders_SettlementServer, requests []*ProcessOrderRequest) (err error) { +func (endpoint *Endpoint) processOrders(ctx context.Context, stream settlementStream, requests []*ProcessOrderRequest) (err error) { defer mon.Task()(&ctx)(&err) responses, err := endpoint.DB.ProcessOrders(ctx, requests) diff --git a/satellite/peer.go b/satellite/peer.go index 18bf55b8f..48dc083a0 100644 --- a/satellite/peer.go +++ b/satellite/peer.go @@ -299,6 +299,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten peer.Overlay.Inspector = overlay.NewInspector(peer.Overlay.Service) pb.RegisterOverlayInspectorServer(peer.Server.PrivateGRPC(), peer.Overlay.Inspector) + pb.DRPCRegisterOverlayInspector(peer.Server.PrivateDRPC(), peer.Overlay.Inspector) } { // setup kademlia @@ -360,9 +361,11 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten peer.Kademlia.Endpoint = kademlia.NewEndpoint(peer.Log.Named("kademlia:endpoint"), peer.Kademlia.Service, nil, peer.Kademlia.RoutingTable, nil) pb.RegisterNodesServer(peer.Server.GRPC(), peer.Kademlia.Endpoint) + pb.DRPCRegisterNodes(peer.Server.DRPC(), peer.Kademlia.Endpoint) peer.Kademlia.Inspector = kademlia.NewInspector(peer.Kademlia.Service, peer.Identity) pb.RegisterKadInspectorServer(peer.Server.PrivateGRPC(), peer.Kademlia.Inspector) + pb.DRPCRegisterKadInspector(peer.Server.PrivateDRPC(), peer.Kademlia.Inspector) } { // setup contact service @@ -370,6 +373,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten peer.Contact.Service = contact.NewService(peer.Log.Named("contact"), peer.Overlay.Service, peer.DB.PeerIdentities(), peer.Transport) peer.Contact.Endpoint = contact.NewEndpoint(peer.Log.Named("contact:endpoint"), peer.Contact.Service) pb.RegisterNodeServer(peer.Server.GRPC(), peer.Contact.Endpoint) + pb.DRPCRegisterNode(peer.Server.DRPC(), peer.Contact.Endpoint) } { // setup discovery @@ -381,6 +385,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten { // setup vouchers log.Debug("Setting up vouchers") pb.RegisterVouchersServer(peer.Server.GRPC(), peer.Vouchers.Endpoint) + pb.DRPCRegisterVouchers(peer.Server.DRPC(), peer.Vouchers.Endpoint) } { // setup live accounting @@ -424,6 +429,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten config.Repairer.MaxExcessRateOptimalThreshold, ) pb.RegisterOrdersServer(peer.Server.GRPC(), peer.Orders.Endpoint) + pb.DRPCRegisterOrders(peer.Server.DRPC(), peer.Orders.Endpoint.DRPC()) } { // setup metainfo @@ -454,6 +460,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten ) pb.RegisterMetainfoServer(peer.Server.GRPC(), peer.Metainfo.Endpoint2) + pb.DRPCRegisterMetainfo(peer.Server.DRPC(), peer.Metainfo.Endpoint2) } { // setup datarepair @@ -488,6 +495,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten peer.Repair.Inspector = irreparable.NewInspector(peer.DB.Irreparable()) pb.RegisterIrreparableInspectorServer(peer.Server.PrivateGRPC(), peer.Repair.Inspector) + pb.DRPCRegisterIrreparableInspector(peer.Server.PrivateDRPC(), peer.Repair.Inspector) } { // setup audit @@ -564,6 +572,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten ) pb.RegisterHealthInspectorServer(peer.Server.PrivateGRPC(), peer.Inspector.Endpoint) + pb.DRPCRegisterHealthInspector(peer.Server.PrivateDRPC(), peer.Inspector.Endpoint) } { // setup mailservice @@ -706,6 +715,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten peer.DB.StoragenodeAccounting()) pb.RegisterNodeStatsServer(peer.Server.GRPC(), peer.NodeStats.Endpoint) + pb.DRPCRegisterNodeStats(peer.Server.DRPC(), peer.NodeStats.Endpoint) } return peer, nil diff --git a/storagenode/peer.go b/storagenode/peer.go index aaede8dfb..972a7c33d 100644 --- a/storagenode/peer.go +++ b/storagenode/peer.go @@ -250,15 +250,18 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten peer.Kademlia.Endpoint = kademlia.NewEndpoint(peer.Log.Named("kademlia:endpoint"), peer.Kademlia.Service, peer.Contact.PingStats, peer.Kademlia.RoutingTable, peer.Storage2.Trust) pb.RegisterNodesServer(peer.Server.GRPC(), peer.Kademlia.Endpoint) + pb.DRPCRegisterNodes(peer.Server.DRPC(), peer.Kademlia.Endpoint) peer.Kademlia.Inspector = kademlia.NewInspector(peer.Kademlia.Service, peer.Identity) pb.RegisterKadInspectorServer(peer.Server.PrivateGRPC(), peer.Kademlia.Inspector) + pb.DRPCRegisterKadInspector(peer.Server.PrivateDRPC(), peer.Kademlia.Inspector) } { // setup contact service peer.Contact.Chore = contact.NewChore(peer.Log.Named("contact:chore"), config.Contact.Interval, config.Contact.MaxSleep, peer.Storage2.Trust, peer.Transport, peer.Kademlia.RoutingTable) peer.Contact.Endpoint = contact.NewEndpoint(peer.Log.Named("contact:endpoint"), peer.Contact.PingStats) pb.RegisterContactServer(peer.Server.GRPC(), peer.Contact.Endpoint) + pb.DRPCRegisterContact(peer.Server.DRPC(), peer.Contact.Endpoint) } { // setup storage @@ -312,6 +315,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten return nil, errs.Combine(err, peer.Close()) } pb.RegisterPiecestoreServer(peer.Server.GRPC(), peer.Storage2.Endpoint) + pb.DRPCRegisterPiecestore(peer.Server.DRPC(), peer.Storage2.Endpoint.DRPC()) sc := config.Server options, err := tlsopts.NewOptions(peer.Identity, sc.Config, revocationDB) @@ -395,6 +399,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten peer.Console.Listener.Addr(), ) pb.RegisterPieceStoreInspectorServer(peer.Server.PrivateGRPC(), peer.Storage2.Inspector) + pb.DRPCRegisterPieceStoreInspector(peer.Server.PrivateDRPC(), peer.Storage2.Inspector) } peer.Collector = collector.NewService(peer.Log.Named("collector"), peer.Storage2.Store, peer.DB.UsedSerials(), config.Collector) diff --git a/storagenode/piecestore/endpoint.go b/storagenode/piecestore/endpoint.go index 18da78202..48a72e281 100644 --- a/storagenode/piecestore/endpoint.go +++ b/storagenode/piecestore/endpoint.go @@ -88,6 +88,12 @@ type Endpoint struct { liveRequests int32 } +// drpcEndpoint wraps streaming methods so that they can be used with drpc +type drpcEndpoint struct{ *Endpoint } + +// DRPC returns a DRPC form of the endpoint. +func (endpoint *Endpoint) DRPC() pb.DRPCPiecestoreServer { return &drpcEndpoint{Endpoint: endpoint} } + // NewEndpoint creates a new piecestore endpoint. func NewEndpoint(log *zap.Logger, signer signing.Signer, trust *trust.Pool, monitor *monitor.Service, retain *retain.Service, store *pieces.Store, orders orders.DB, usage bandwidth.DB, usedSerials UsedSerials, config Config) (*Endpoint, error) { return &Endpoint{ @@ -142,6 +148,23 @@ func (endpoint *Endpoint) Delete(ctx context.Context, delete *pb.PieceDeleteRequ // Upload handles uploading a piece on piece store. func (endpoint *Endpoint) Upload(stream pb.Piecestore_UploadServer) (err error) { + return endpoint.doUpload(stream) +} + +// Upload handles uploading a piece on piece store. +func (endpoint *drpcEndpoint) Upload(stream pb.DRPCPiecestore_UploadStream) (err error) { + return endpoint.doUpload(stream) +} + +// uploadStream is the minimum interface required to perform settlements. +type uploadStream interface { + Context() context.Context + Recv() (*pb.PieceUploadRequest, error) + SendAndClose(*pb.PieceUploadResponse) error +} + +// doUpload handles uploading a piece on piece store. +func (endpoint *Endpoint) doUpload(stream uploadStream) (err error) { ctx := stream.Context() defer monLiveRequests(&ctx)(&err) defer mon.Task()(&ctx)(&err) @@ -328,8 +351,25 @@ func (endpoint *Endpoint) Upload(stream pb.Piecestore_UploadServer) (err error) } } -// Download implements downloading a piece from piece store. +// Download handles Downloading a piece on piece store. func (endpoint *Endpoint) Download(stream pb.Piecestore_DownloadServer) (err error) { + return endpoint.doDownload(stream) +} + +// Download handles Downloading a piece on piece store. +func (endpoint *drpcEndpoint) Download(stream pb.DRPCPiecestore_DownloadStream) (err error) { + return endpoint.doDownload(stream) +} + +// downloadStream is the minimum interface required to perform settlements. +type downloadStream interface { + Context() context.Context + Recv() (*pb.PieceDownloadRequest, error) + Send(*pb.PieceDownloadResponse) error +} + +// Download implements downloading a piece from piece store. +func (endpoint *Endpoint) doDownload(stream downloadStream) (err error) { ctx := stream.Context() defer monLiveRequests(&ctx)(&err) defer mon.Task()(&ctx)(&err)