mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
msggen: RequestStructs for notification-streams
I'm working to expose a stream of notifications over grpc. This requries me to define structs that can be used to request a stream of notifications. These structs are all empty.
This commit is contained in:
parent
6b34c722f3
commit
c5a47c3149
3 changed files with 32 additions and 1 deletions
|
@ -82,3 +82,27 @@ pub struct CustomMsgNotification {
|
|||
pub peer_id: PublicKey,
|
||||
}
|
||||
|
||||
pub mod requests{
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct StreamBlockAddedRequest {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct StreamChannelOpenFailedRequest {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct StreamChannelOpenedRequest {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct StreamConnectRequest {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct StreamCustomMsgRequest {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ class GrpcConverterGenerator(IGenerator):
|
|||
camel_case += word.capitalize()
|
||||
return camel_case
|
||||
|
||||
def generate_requests(self, service):
|
||||
def generate_requests(self, service: Service):
|
||||
for meth in service.methods:
|
||||
req = meth.request
|
||||
self.generate_composite("requests", req)
|
||||
|
|
|
@ -45,3 +45,10 @@ class NotificationGenerator(IGenerator):
|
|||
for notification in service.notifications:
|
||||
_, resp_decl = gen_composite(notification.response, self.meta)
|
||||
self.write(resp_decl)
|
||||
|
||||
self.write("pub mod requests{\n")
|
||||
self.write(" use serde::{Serialize, Deserialize};\n\n")
|
||||
for notification in service.notifications:
|
||||
_, req_decl = gen_composite(notification.request, self.meta)
|
||||
self.write(req_decl, numindent=1)
|
||||
self.write("}\n")
|
||||
|
|
Loading…
Add table
Reference in a new issue