You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The purpose of the NodeManagerWorker is to be started as a Worker on a node and receive requests to create entities on that node: inlets, outlets, secure channels, etc...
This should be the only responsibility of the NodeManagerWorker:
accept Requests, with a specific path
based on the path, unpack the request arguments and call the relevant method on the NodeManager
get a value back from the NodeManager and make a Response out of it
pubasyncfnget_tcp_connection(&self,req:&RequestHeader,address:String)
-> Result<Response<TransportStatus>,Response<Error>>{let tcp_transport = &self.node_manager.tcp_transport;let sender = matchSelf::find_connection(tcp_transport, address.to_string()){None => {returnErr(Response::not_found(
req,&format!("Connection {address} was not found in the registry."),));}Some(sender) => sender,};let status = TransportStatus::new(ApiTransport{tt:TransportType::Tcp,tm:(*sender.mode()).into(),socket_address: sender.socket_address(),worker_address: sender.address().to_string(),processor_address: sender.receiver_address().to_string(),flow_control_id: sender.flow_control_id().clone(),});Ok(Response::ok(req).body(status))}
It should actually be something like:
pubasyncfnget_tcp_connection(&self,req:&RequestHeader,address:String)
-> Result<Response<TransportStatus>,Response<Error>>{match&self.node_manager.get_tcp_connection(address.to_string()).await? {Some(transport_status) => Ok(Response::ok(req).body(transport_status),None => {Err(Response::not_found(
req,&format!("Connection {address} was not found in the registry."),))}}}
In the code above all the logic is handled by the NodeManager and the NodeManagerWorker only deals with Request/Responses.
Stories
The following independent stories can be carved out this epic (each line corresponds to some paths in the handle_request method):
node / node status
node / tcp connection
node / tcp listener
node / credentials
node / secure channel
node / secure channel listener
node / services / kafka
node / services / other services
node / inlet
node / outlet
node / flow controls
node / workers
policy
Additional notes
You can follow the way relays are handled in this PR (here is the section on relays).
You will notice that the NodeManagerWorker does not contain a direct reference to a NodeManager but to an InMemoryNode, which itself contains a NodeManager.
This intermediary layer is only required to monitor sessions for relays and portals. In most cases when you call self.node_manager in NodeManagerWorker the node_manager can be dereferenced to a NodeManager on which regular calls can be made: to list workers, get a credential etc....
The purpose of the
NodeManagerWorker
is to be started as aWorker
on a node and receive requests to create entities on that node: inlets, outlets, secure channels, etc...This should be the only responsibility of the
NodeManagerWorker
:Requests
, with a specific pathNodeManager
NodeManager
and make aResponse
out of itExample
For example if we look at this dispatched request:
The implementation in the
NodeManagerWorker
is:It should actually be something like:
In the code above all the logic is handled by the
NodeManager
and theNodeManagerWorker
only deals with Request/Responses.Stories
The following independent stories can be carved out this epic (each line corresponds to some paths in the
handle_request
method):Additional notes
You can follow the way
relays
are handled in this PR (here is the section on relays).You will notice that the
NodeManagerWorker
does not contain a direct reference to aNodeManager
but to anInMemoryNode
, which itself contains aNodeManager
.This intermediary layer is only required to monitor sessions for relays and portals. In most cases when you call
self.node_manager
inNodeManagerWorker
thenode_manager
can be dereferenced to aNodeManager
on which regular calls can be made: to list workers, get a credential etc....Note
Github project tracking these issues: https://github.com/orgs/build-trust/projects/37/views/1?filterQuery=eric+
Related issues:
NodeManagerWorker
fornode / node status
#6707NodeManagerWorker
fornode / tcp
#6708NodeManagerWorker
fornode / credentials
#6709NodeManagerWorker
fornode / secure channel
#6710NodeManagerWorker
fornode / services / kafka
#6711NodeManagerWorker
fornode / services / other services
#6712NodeManagerWorker
fornode / inlet
andnode / outlet
#6713NodeManagerWorker
fornode / flow controls
#6714NodeManagerWorker
fornode / workers
#6715NodeManagerWorker
forpolicy
#6716The text was updated successfully, but these errors were encountered: