-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: RPC server for node while running in server mode (#170)
- Loading branch information
Showing
17 changed files
with
741 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
"ignore": [ | ||
"**/dist/*", | ||
"**/docs/*", | ||
"**/*_pb.js", | ||
"**/*_pb.ts", | ||
"**/bundle/*", | ||
"**/package.json" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
version: v2 | ||
managed: | ||
enabled: true | ||
plugins: | ||
- local: ./node_modules/ts-proto/protoc-gen-ts_proto | ||
strategy: directory | ||
out: ./packages | ||
opt: | ||
- esModuleInterop=true | ||
- fileSuffix=_pb | ||
- ts_proto_opt=outputServices=grpc-js | ||
- remote: buf.build/grpc/node | ||
out: ./packages | ||
opt: | ||
- ts_proto_opt=esModuleInterop=true | ||
inputs: | ||
- directory: ./packages | ||
exclude_paths: | ||
- packages/node/node_modules | ||
- packages/network/node_modules | ||
- packages/object/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Generated by buf. DO NOT EDIT. | ||
version: v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: v2 | ||
modules: | ||
# - path: packages/node | ||
# excludes: | ||
# - packages/node/node_modules | ||
- path: packages/network | ||
excludes: | ||
- packages/network/node_modules | ||
- path: packages/object | ||
excludes: | ||
- packages/object/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
syntax = "proto3"; | ||
package topology.node; | ||
|
||
service TopologyRpc { | ||
rpc subscribeCro (SubscribeCroRequest ) returns (SubscribeCroResponse ); | ||
rpc unsubscribeCro (UnsubscribeCroRequest ) returns (UnsubscribeCroRequest ); | ||
rpc getCroHashGraph (GetCroHashGraphRequest ) returns (GetCroHashGraphResponse ); | ||
} | ||
|
||
message SubscribeCroRequest { | ||
string cro_id = 1; | ||
} | ||
|
||
message SubscribeCroResponse { | ||
// can return error codes if different than 0 | ||
int32 return_code = 1; | ||
} | ||
|
||
message UnsubscribeCroRequest { | ||
string cro_id = 1; | ||
} | ||
|
||
message UnsubscribeCroResponse { | ||
// can return error codes if different than 0 | ||
int32 return_code = 1; | ||
} | ||
|
||
message GetCroHashGraphRequest { | ||
string cro_id = 1; | ||
} | ||
|
||
message GetCroHashGraphResponse { | ||
// linearized vertices hashes | ||
repeated string vertices_hashes = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import * as node_src_proto_rpc_pb from './rpc_pb.js'; | ||
|
||
function serialize_topology_node_GetCroHashGraphRequest(arg) { | ||
let encoded = node_src_proto_rpc_pb.GetCroHashGraphRequest.encode(arg).finish() | ||
return Buffer.from(encoded); | ||
} | ||
|
||
function deserialize_topology_node_GetCroHashGraphRequest(buffer_arg) { | ||
return node_src_proto_rpc_pb.GetCroHashGraphRequest.decode(new Uint8Array(buffer_arg)); | ||
} | ||
|
||
function serialize_topology_node_GetCroHashGraphResponse(arg) { | ||
let encoded = node_src_proto_rpc_pb.GetCroHashGraphResponse.encode(arg).finish() | ||
return Buffer.from(encoded); | ||
} | ||
|
||
function deserialize_topology_node_GetCroHashGraphResponse(buffer_arg) { | ||
return node_src_proto_rpc_pb.GetCroHashGraphResponse.decode(new Uint8Array(buffer_arg)); | ||
} | ||
|
||
function serialize_topology_node_SubscribeCroRequest(arg) { | ||
let encoded = node_src_proto_rpc_pb.SubscribeCroRequest.encode(arg).finish() | ||
return Buffer.from(encoded); | ||
} | ||
|
||
function deserialize_topology_node_SubscribeCroRequest(buffer_arg) { | ||
return node_src_proto_rpc_pb.SubscribeCroRequest.decode(new Uint8Array(buffer_arg)); | ||
} | ||
|
||
function serialize_topology_node_SubscribeCroResponse(arg) { | ||
let encoded = node_src_proto_rpc_pb.SubscribeCroResponse.encode(arg).finish() | ||
return Buffer.from(encoded); | ||
} | ||
|
||
function deserialize_topology_node_SubscribeCroResponse(buffer_arg) { | ||
return node_src_proto_rpc_pb.SubscribeCroResponse.decode(new Uint8Array(buffer_arg)); | ||
} | ||
|
||
function serialize_topology_node_UnsubscribeCroRequest(arg) { | ||
let encoded = node_src_proto_rpc_pb.UnsubscribeCroRequest.encode(arg).finish() | ||
return Buffer.from(encoded); | ||
} | ||
|
||
function deserialize_topology_node_UnsubscribeCroRequest(buffer_arg) { | ||
return node_src_proto_rpc_pb.UnsubscribeCroRequest.decode(new Uint8Array(buffer_arg)); | ||
} | ||
|
||
export const TopologyRpcService = { | ||
subscribeCro: { | ||
path: '/topology.node.TopologyRpc/subscribeCro', | ||
requestStream: false, | ||
responseStream: false, | ||
requestType: node_src_proto_rpc_pb.SubscribeCroRequest, | ||
responseType: node_src_proto_rpc_pb.SubscribeCroResponse, | ||
requestSerialize: serialize_topology_node_SubscribeCroRequest, | ||
requestDeserialize: deserialize_topology_node_SubscribeCroRequest, | ||
responseSerialize: serialize_topology_node_SubscribeCroResponse, | ||
responseDeserialize: deserialize_topology_node_SubscribeCroResponse, | ||
}, | ||
unsubscribeCro: { | ||
path: '/topology.node.TopologyRpc/unsubscribeCro', | ||
requestStream: false, | ||
responseStream: false, | ||
requestType: node_src_proto_rpc_pb.UnsubscribeCroRequest, | ||
responseType: node_src_proto_rpc_pb.UnsubscribeCroRequest, | ||
requestSerialize: serialize_topology_node_UnsubscribeCroRequest, | ||
requestDeserialize: deserialize_topology_node_UnsubscribeCroRequest, | ||
responseSerialize: serialize_topology_node_UnsubscribeCroRequest, | ||
responseDeserialize: deserialize_topology_node_UnsubscribeCroRequest, | ||
}, | ||
getCroHashGraph: { | ||
path: '/topology.node.TopologyRpc/getCroHashGraph', | ||
requestStream: false, | ||
responseStream: false, | ||
requestType: node_src_proto_rpc_pb.GetCroHashGraphRequest, | ||
responseType: node_src_proto_rpc_pb.GetCroHashGraphResponse, | ||
requestSerialize: serialize_topology_node_GetCroHashGraphRequest, | ||
requestDeserialize: deserialize_topology_node_GetCroHashGraphRequest, | ||
responseSerialize: serialize_topology_node_GetCroHashGraphResponse, | ||
responseDeserialize: deserialize_topology_node_GetCroHashGraphResponse, | ||
}, | ||
}; |
Oops, something went wrong.