Fix import path
This commit is contained in:
1
hyperspace_rpc/__init__.py
Normal file
1
hyperspace_rpc/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
"""hyperspace-rpc module."""
|
14
hyperspace_rpc/hrpc.proto
Normal file
14
hyperspace_rpc/hrpc.proto
Normal file
@ -0,0 +1,14 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package hrpc;
|
||||
|
||||
import "google/protobuf/descriptor.proto";
|
||||
|
||||
extend google.protobuf.ServiceOptions {
|
||||
optional uint32 service = 50000;
|
||||
}
|
||||
extend google.protobuf.MethodOptions {
|
||||
optional uint32 method = 50001;
|
||||
}
|
||||
|
||||
message Void {}
|
283
hyperspace_rpc/schema.proto
Normal file
283
hyperspace_rpc/schema.proto
Normal file
@ -0,0 +1,283 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package hyperspace;
|
||||
import "hrpc.proto";
|
||||
|
||||
// General Structs
|
||||
message Peer {
|
||||
required bytes remotePublicKey = 1;
|
||||
required string remoteAddress = 2;
|
||||
required string type = 3;
|
||||
}
|
||||
|
||||
// Hyperspace Methods
|
||||
message HyperspaceStatusResponse {
|
||||
required string apiVersion = 1;
|
||||
optional bool holepunchable = 2;
|
||||
optional string remoteAddress = 3;
|
||||
}
|
||||
|
||||
// Corestore Methods
|
||||
|
||||
message OpenRequest {
|
||||
required uint32 id = 1;
|
||||
optional bytes key = 2;
|
||||
optional string name = 3;
|
||||
optional bool weak = 4;
|
||||
}
|
||||
|
||||
message OpenResponse {
|
||||
required bytes key = 1;
|
||||
required uint64 length = 2;
|
||||
required uint64 byteLength = 3;
|
||||
required bool writable = 4;
|
||||
repeated Peer peers = 5;
|
||||
}
|
||||
|
||||
// Corestore Events
|
||||
|
||||
message FeedEvent {
|
||||
required bytes key = 1;
|
||||
}
|
||||
|
||||
// Networking Methods
|
||||
|
||||
message OpenNetworkResponse {
|
||||
required bytes publicKey = 1;
|
||||
repeated Peer peers = 2;
|
||||
}
|
||||
|
||||
message NetworkStatus {
|
||||
required bytes discoveryKey = 1;
|
||||
optional bool announce = 2;
|
||||
optional bool lookup = 3;
|
||||
optional bool remember = 4;
|
||||
}
|
||||
|
||||
message ConfigureNetworkRequest {
|
||||
required NetworkStatus configuration = 1;
|
||||
optional bool flush = 2;
|
||||
optional bytes copyFrom = 3;
|
||||
optional bool overwrite = 4 [default = true];
|
||||
}
|
||||
|
||||
message NetworkStatusRequest {
|
||||
required bytes discoveryKey = 1;
|
||||
}
|
||||
|
||||
message NetworkStatusResponse {
|
||||
optional NetworkStatus status = 1;
|
||||
}
|
||||
|
||||
message AllNetworkStatusesResponse {
|
||||
repeated NetworkStatus statuses = 1;
|
||||
}
|
||||
|
||||
message RegisterNetworkExtensionRequest {
|
||||
required uint64 resourceId = 1;
|
||||
required string name = 2;
|
||||
}
|
||||
|
||||
message NetworkExtensionMessage {
|
||||
required uint64 id = 1;
|
||||
required uint64 resourceId = 2;
|
||||
optional bytes remotePublicKey = 3;
|
||||
required bytes data = 4;
|
||||
}
|
||||
|
||||
// Hypercore Methods
|
||||
|
||||
message CloseRequest {
|
||||
required uint32 id = 1;
|
||||
}
|
||||
|
||||
message GetRequest {
|
||||
required uint32 id = 1;
|
||||
required uint64 seq = 2;
|
||||
required uint64 resourceId = 3;
|
||||
optional bool wait = 4 [default = true];
|
||||
optional bool ifAvailable = 5 [default = true];
|
||||
optional uint64 onWaitId = 6;
|
||||
}
|
||||
message GetResponse {
|
||||
optional bytes block = 1;
|
||||
}
|
||||
|
||||
message AppendRequest {
|
||||
required uint32 id = 1;
|
||||
repeated bytes blocks = 2;
|
||||
}
|
||||
message AppendResponse {
|
||||
required uint64 length = 1;
|
||||
required uint64 byteLength = 2;
|
||||
required uint64 seq = 3;
|
||||
}
|
||||
|
||||
message UpdateRequest {
|
||||
required uint32 id = 1;
|
||||
optional uint64 minLength = 2;
|
||||
optional bool ifAvailable = 3 [default = true];
|
||||
optional bool hash = 4 [default = true];
|
||||
}
|
||||
|
||||
message SeekRequest {
|
||||
required uint32 id = 1;
|
||||
required uint64 byteOffset = 2;
|
||||
optional uint64 start = 3;
|
||||
optional uint64 end = 4;
|
||||
optional bool wait = 5 [default = true];
|
||||
optional bool ifAvailable = 6 [default = true];
|
||||
}
|
||||
message SeekResponse {
|
||||
required uint64 seq = 1;
|
||||
required uint64 blockOffset = 2;
|
||||
}
|
||||
|
||||
message HasRequest {
|
||||
required uint32 id = 1;
|
||||
required uint64 seq = 2;
|
||||
}
|
||||
message HasResponse {
|
||||
required bool has = 1;
|
||||
}
|
||||
|
||||
message CancelRequest {
|
||||
required uint64 id = 1;
|
||||
required uint64 resourceId = 2;
|
||||
}
|
||||
|
||||
message DownloadRequest {
|
||||
required uint64 id = 1;
|
||||
required uint64 resourceId = 2;
|
||||
optional uint64 start = 3;
|
||||
optional uint64 end = 4;
|
||||
repeated uint64 blocks = 5;
|
||||
optional bool linear = 6;
|
||||
}
|
||||
|
||||
message DownloadedRequest {
|
||||
required uint64 id = 1;
|
||||
optional uint64 start = 2;
|
||||
optional uint64 end = 3;
|
||||
}
|
||||
|
||||
message DownloadedResponse {
|
||||
required uint64 bytes = 1;
|
||||
}
|
||||
|
||||
message UndownloadRequest {
|
||||
required uint64 id = 1;
|
||||
required uint64 resourceId = 2;
|
||||
}
|
||||
|
||||
message LockRequest {
|
||||
required uint64 id = 1;
|
||||
}
|
||||
|
||||
|
||||
// Hypercore Events
|
||||
|
||||
message AppendEvent {
|
||||
required uint64 id = 1;
|
||||
required uint64 length = 2;
|
||||
required uint64 byteLength = 3;
|
||||
}
|
||||
|
||||
message PeerEvent {
|
||||
required uint64 id = 1;
|
||||
required Peer peer = 2;
|
||||
}
|
||||
|
||||
message CloseEvent {
|
||||
required uint64 id = 1;
|
||||
}
|
||||
|
||||
message WaitEvent {
|
||||
required uint64 id = 1;
|
||||
required uint64 onWaitId = 2;
|
||||
}
|
||||
|
||||
// Extension Methods
|
||||
|
||||
message RegisterExtensionRequest {
|
||||
required uint64 id = 1;
|
||||
required uint64 resourceId = 2;
|
||||
required string name = 3;
|
||||
}
|
||||
|
||||
message UnregisterExtensionRequest {
|
||||
required uint64 id = 1;
|
||||
required uint64 resourceId = 2;
|
||||
}
|
||||
|
||||
message ExtensionMessage {
|
||||
required uint64 id = 1;
|
||||
required uint64 resourceId = 2;
|
||||
optional bytes remotePublicKey = 3;
|
||||
required bytes data = 4;
|
||||
}
|
||||
|
||||
service Hyperspace {
|
||||
option (hrpc.service) = 1;
|
||||
|
||||
// Methods
|
||||
rpc Status (hrpc.Void) returns (HyperspaceStatusResponse) { option (hrpc.method) = 1; }
|
||||
}
|
||||
|
||||
service Corestore {
|
||||
option (hrpc.service) = 2;
|
||||
|
||||
// Methods
|
||||
rpc Open (OpenRequest) returns (OpenResponse) { option (hrpc.method) = 1; }
|
||||
|
||||
// Events
|
||||
rpc OnFeed (FeedEvent) returns (hrpc.Void) { option (hrpc.method) = 2; }
|
||||
}
|
||||
|
||||
service Hypercore {
|
||||
option (hrpc.service) = 3;
|
||||
|
||||
// Methods
|
||||
rpc Get (GetRequest) returns (GetResponse) { option (hrpc.method) = 1; }
|
||||
rpc Append (AppendRequest) returns (AppendResponse) { option (hrpc.method) = 2; }
|
||||
rpc Update (UpdateRequest) returns (hrpc.Void) { option (hrpc.method) = 3; }
|
||||
rpc Seek (SeekRequest) returns (SeekResponse) { option (hrpc.method) = 4; }
|
||||
rpc Has (HasRequest) returns (HasResponse) { option (hrpc.method) = 5; }
|
||||
rpc Cancel (CancelRequest) returns (hrpc.Void) { option (hrpc.method) = 6; }
|
||||
rpc Download (DownloadRequest) returns (hrpc.Void) { option (hrpc.method) = 7; }
|
||||
rpc Downloaded (DownloadedRequest) returns (DownloadedResponse) { option (hrpc.method) = 8; }
|
||||
rpc Undownload (UndownloadRequest) returns (hrpc.Void) { option (hrpc.method) = 9; }
|
||||
rpc Close (CloseRequest) returns (hrpc.Void) { option (hrpc.method) = 10; }
|
||||
rpc RegisterExtension (RegisterExtensionRequest) returns (hrpc.Void) { option (hrpc.method) = 11; }
|
||||
rpc UnregisterExtension (UnregisterExtensionRequest) returns (hrpc.Void) { option (hrpc.method) = 12; }
|
||||
rpc SendExtension (ExtensionMessage) returns (hrpc.Void) { option (hrpc.method) = 13; }
|
||||
|
||||
rpc AcquireLock (LockRequest) returns (hrpc.Void) { option (hrpc.method) = 14; }
|
||||
rpc ReleaseLock (LockRequest) returns (hrpc.Void) { option (hrpc.method) = 15; }
|
||||
|
||||
// Events
|
||||
rpc OnAppend (AppendEvent) returns (hrpc.Void) { option (hrpc.method) = 16; }
|
||||
rpc OnClose (CloseEvent) returns (hrpc.Void) { option (hrpc.method) = 17; }
|
||||
rpc OnPeerOpen (PeerEvent) returns (hrpc.Void) { option (hrpc.method) = 18; }
|
||||
rpc OnPeerRemove (PeerEvent) returns (hrpc.Void) { option (hrpc.method) = 19; }
|
||||
rpc OnExtension (ExtensionMessage) returns (hrpc.Void) { option (hrpc.method) = 20; }
|
||||
rpc OnWait (WaitEvent) returns (hrpc.Void) { option (hrpc.method) = 21; }
|
||||
}
|
||||
|
||||
service Network {
|
||||
option (hrpc.service) = 4;
|
||||
|
||||
// Methods
|
||||
rpc Open (hrpc.Void) returns (OpenNetworkResponse) { option (hrpc.method) = 1; }
|
||||
rpc Configure (ConfigureNetworkRequest) returns (NetworkStatusResponse) { option (hrpc.method) = 2; }
|
||||
rpc Status (NetworkStatusRequest) returns (NetworkStatusResponse) { option (hrpc.method) = 3; }
|
||||
rpc AllStatuses (hrpc.Void) returns (AllNetworkStatusesResponse) { option (hrpc.method) = 4; }
|
||||
rpc RegisterExtension (RegisterExtensionRequest) returns (hrpc.Void) { option (hrpc.method) = 5; }
|
||||
rpc UnregisterExtension (UnregisterExtensionRequest) returns (hrpc.Void) { option (hrpc.method) = 6; }
|
||||
rpc SendExtension (ExtensionMessage) returns (hrpc.Void) { option (hrpc.method) = 7; }
|
||||
|
||||
// Events
|
||||
rpc OnPeerAdd (PeerEvent) returns (hrpc.Void) { option (hrpc.method) = 8; }
|
||||
rpc OnPeerRemove (PeerEvent) returns (hrpc.Void) { option (hrpc.method) = 9; }
|
||||
rpc OnExtension (ExtensionMessage) returns (hrpc.Void) { option (hrpc.method) = 10; }
|
||||
}
|
732
hyperspace_rpc/schema_grpc.py
Normal file
732
hyperspace_rpc/schema_grpc.py
Normal file
@ -0,0 +1,732 @@
|
||||
import hrpc_pb2 as hrpc__pb2
|
||||
import purerpc
|
||||
|
||||
import schema_pb2 as schema__pb2
|
||||
|
||||
|
||||
class HyperspaceServicer(purerpc.Servicer):
|
||||
async def Status(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
@property
|
||||
def service(self) -> purerpc.Service:
|
||||
service_obj = purerpc.Service("hyperspace.Hyperspace")
|
||||
service_obj.add_method(
|
||||
"Status",
|
||||
self.Status,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
hrpc__pb2.Void,
|
||||
schema__pb2.HyperspaceStatusResponse,
|
||||
),
|
||||
)
|
||||
return service_obj
|
||||
|
||||
|
||||
class HyperspaceStub:
|
||||
def __init__(self, channel):
|
||||
self._client = purerpc.Client("hyperspace.Hyperspace", channel)
|
||||
self.Status = self._client.get_method_stub(
|
||||
"Status",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
hrpc__pb2.Void,
|
||||
schema__pb2.HyperspaceStatusResponse,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class CorestoreServicer(purerpc.Servicer):
|
||||
async def Open(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def OnFeed(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
@property
|
||||
def service(self) -> purerpc.Service:
|
||||
service_obj = purerpc.Service("hyperspace.Corestore")
|
||||
service_obj.add_method(
|
||||
"Open",
|
||||
self.Open,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.OpenRequest,
|
||||
schema__pb2.OpenResponse,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"OnFeed",
|
||||
self.OnFeed,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.FeedEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
return service_obj
|
||||
|
||||
|
||||
class CorestoreStub:
|
||||
def __init__(self, channel):
|
||||
self._client = purerpc.Client("hyperspace.Corestore", channel)
|
||||
self.Open = self._client.get_method_stub(
|
||||
"Open",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.OpenRequest,
|
||||
schema__pb2.OpenResponse,
|
||||
),
|
||||
)
|
||||
self.OnFeed = self._client.get_method_stub(
|
||||
"OnFeed",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.FeedEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class HypercoreServicer(purerpc.Servicer):
|
||||
async def Get(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def Append(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def Update(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def Seek(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def Has(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def Cancel(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def Download(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def Downloaded(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def Undownload(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def Close(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def RegisterExtension(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def UnregisterExtension(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def SendExtension(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def AcquireLock(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def ReleaseLock(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def OnAppend(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def OnClose(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def OnPeerOpen(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def OnPeerRemove(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def OnExtension(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def OnWait(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
@property
|
||||
def service(self) -> purerpc.Service:
|
||||
service_obj = purerpc.Service("hyperspace.Hypercore")
|
||||
service_obj.add_method(
|
||||
"Get",
|
||||
self.Get,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.GetRequest,
|
||||
schema__pb2.GetResponse,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"Append",
|
||||
self.Append,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.AppendRequest,
|
||||
schema__pb2.AppendResponse,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"Update",
|
||||
self.Update,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.UpdateRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"Seek",
|
||||
self.Seek,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.SeekRequest,
|
||||
schema__pb2.SeekResponse,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"Has",
|
||||
self.Has,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.HasRequest,
|
||||
schema__pb2.HasResponse,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"Cancel",
|
||||
self.Cancel,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.CancelRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"Download",
|
||||
self.Download,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.DownloadRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"Downloaded",
|
||||
self.Downloaded,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.DownloadedRequest,
|
||||
schema__pb2.DownloadedResponse,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"Undownload",
|
||||
self.Undownload,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.UndownloadRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"Close",
|
||||
self.Close,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.CloseRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"RegisterExtension",
|
||||
self.RegisterExtension,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.RegisterExtensionRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"UnregisterExtension",
|
||||
self.UnregisterExtension,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.UnregisterExtensionRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"SendExtension",
|
||||
self.SendExtension,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.ExtensionMessage,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"AcquireLock",
|
||||
self.AcquireLock,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.LockRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"ReleaseLock",
|
||||
self.ReleaseLock,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.LockRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"OnAppend",
|
||||
self.OnAppend,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.AppendEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"OnClose",
|
||||
self.OnClose,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.CloseEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"OnPeerOpen",
|
||||
self.OnPeerOpen,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.PeerEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"OnPeerRemove",
|
||||
self.OnPeerRemove,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.PeerEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"OnExtension",
|
||||
self.OnExtension,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.ExtensionMessage,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"OnWait",
|
||||
self.OnWait,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.WaitEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
return service_obj
|
||||
|
||||
|
||||
class HypercoreStub:
|
||||
def __init__(self, channel):
|
||||
self._client = purerpc.Client("hyperspace.Hypercore", channel)
|
||||
self.Get = self._client.get_method_stub(
|
||||
"Get",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.GetRequest,
|
||||
schema__pb2.GetResponse,
|
||||
),
|
||||
)
|
||||
self.Append = self._client.get_method_stub(
|
||||
"Append",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.AppendRequest,
|
||||
schema__pb2.AppendResponse,
|
||||
),
|
||||
)
|
||||
self.Update = self._client.get_method_stub(
|
||||
"Update",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.UpdateRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.Seek = self._client.get_method_stub(
|
||||
"Seek",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.SeekRequest,
|
||||
schema__pb2.SeekResponse,
|
||||
),
|
||||
)
|
||||
self.Has = self._client.get_method_stub(
|
||||
"Has",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.HasRequest,
|
||||
schema__pb2.HasResponse,
|
||||
),
|
||||
)
|
||||
self.Cancel = self._client.get_method_stub(
|
||||
"Cancel",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.CancelRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.Download = self._client.get_method_stub(
|
||||
"Download",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.DownloadRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.Downloaded = self._client.get_method_stub(
|
||||
"Downloaded",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.DownloadedRequest,
|
||||
schema__pb2.DownloadedResponse,
|
||||
),
|
||||
)
|
||||
self.Undownload = self._client.get_method_stub(
|
||||
"Undownload",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.UndownloadRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.Close = self._client.get_method_stub(
|
||||
"Close",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.CloseRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.RegisterExtension = self._client.get_method_stub(
|
||||
"RegisterExtension",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.RegisterExtensionRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.UnregisterExtension = self._client.get_method_stub(
|
||||
"UnregisterExtension",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.UnregisterExtensionRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.SendExtension = self._client.get_method_stub(
|
||||
"SendExtension",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.ExtensionMessage,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.AcquireLock = self._client.get_method_stub(
|
||||
"AcquireLock",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.LockRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.ReleaseLock = self._client.get_method_stub(
|
||||
"ReleaseLock",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.LockRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.OnAppend = self._client.get_method_stub(
|
||||
"OnAppend",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.AppendEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.OnClose = self._client.get_method_stub(
|
||||
"OnClose",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.CloseEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.OnPeerOpen = self._client.get_method_stub(
|
||||
"OnPeerOpen",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.PeerEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.OnPeerRemove = self._client.get_method_stub(
|
||||
"OnPeerRemove",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.PeerEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.OnExtension = self._client.get_method_stub(
|
||||
"OnExtension",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.ExtensionMessage,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.OnWait = self._client.get_method_stub(
|
||||
"OnWait",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.WaitEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class NetworkServicer(purerpc.Servicer):
|
||||
async def Open(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def Configure(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def Status(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def AllStatuses(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def RegisterExtension(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def UnregisterExtension(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def SendExtension(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def OnPeerAdd(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def OnPeerRemove(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
async def OnExtension(self, input_message):
|
||||
raise NotImplementedError()
|
||||
|
||||
@property
|
||||
def service(self) -> purerpc.Service:
|
||||
service_obj = purerpc.Service("hyperspace.Network")
|
||||
service_obj.add_method(
|
||||
"Open",
|
||||
self.Open,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
hrpc__pb2.Void,
|
||||
schema__pb2.OpenNetworkResponse,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"Configure",
|
||||
self.Configure,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.ConfigureNetworkRequest,
|
||||
schema__pb2.NetworkStatusResponse,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"Status",
|
||||
self.Status,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.NetworkStatusRequest,
|
||||
schema__pb2.NetworkStatusResponse,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"AllStatuses",
|
||||
self.AllStatuses,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
hrpc__pb2.Void,
|
||||
schema__pb2.AllNetworkStatusesResponse,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"RegisterExtension",
|
||||
self.RegisterExtension,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.RegisterExtensionRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"UnregisterExtension",
|
||||
self.UnregisterExtension,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.UnregisterExtensionRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"SendExtension",
|
||||
self.SendExtension,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.ExtensionMessage,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"OnPeerAdd",
|
||||
self.OnPeerAdd,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.PeerEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"OnPeerRemove",
|
||||
self.OnPeerRemove,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.PeerEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
service_obj.add_method(
|
||||
"OnExtension",
|
||||
self.OnExtension,
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.ExtensionMessage,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
return service_obj
|
||||
|
||||
|
||||
class NetworkStub:
|
||||
def __init__(self, channel):
|
||||
self._client = purerpc.Client("hyperspace.Network", channel)
|
||||
self.Open = self._client.get_method_stub(
|
||||
"Open",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
hrpc__pb2.Void,
|
||||
schema__pb2.OpenNetworkResponse,
|
||||
),
|
||||
)
|
||||
self.Configure = self._client.get_method_stub(
|
||||
"Configure",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.ConfigureNetworkRequest,
|
||||
schema__pb2.NetworkStatusResponse,
|
||||
),
|
||||
)
|
||||
self.Status = self._client.get_method_stub(
|
||||
"Status",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.NetworkStatusRequest,
|
||||
schema__pb2.NetworkStatusResponse,
|
||||
),
|
||||
)
|
||||
self.AllStatuses = self._client.get_method_stub(
|
||||
"AllStatuses",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
hrpc__pb2.Void,
|
||||
schema__pb2.AllNetworkStatusesResponse,
|
||||
),
|
||||
)
|
||||
self.RegisterExtension = self._client.get_method_stub(
|
||||
"RegisterExtension",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.RegisterExtensionRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.UnregisterExtension = self._client.get_method_stub(
|
||||
"UnregisterExtension",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.UnregisterExtensionRequest,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.SendExtension = self._client.get_method_stub(
|
||||
"SendExtension",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.ExtensionMessage,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.OnPeerAdd = self._client.get_method_stub(
|
||||
"OnPeerAdd",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.PeerEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.OnPeerRemove = self._client.get_method_stub(
|
||||
"OnPeerRemove",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.PeerEvent,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
||||
self.OnExtension = self._client.get_method_stub(
|
||||
"OnExtension",
|
||||
purerpc.RPCSignature(
|
||||
purerpc.Cardinality.UNARY_UNARY,
|
||||
schema__pb2.ExtensionMessage,
|
||||
hrpc__pb2.Void,
|
||||
),
|
||||
)
|
3491
hyperspace_rpc/schema_pb2.py
Normal file
3491
hyperspace_rpc/schema_pb2.py
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user