Instrumentation
In order to gain control over the distributed system, Netrix requires
- Replicas to communicate messages and events through it. The send and receive primitives of the replicas should now communicate with Netrix.
- Ability to start, stop or reset replicas. Netrix sends
Directive
messages to achieve this. Replicas should perform the requested action when they receive aDirective
message.
Libraries
To aid this process, we have language specific libraries. Currently available for go
.
Directives
Directive
messages are used by Netrix to instruct replicas to start, stop or reset. Message structure contains just the action
DirectiveMessage {
Action string
}
Replica API spec
Each replica should run a HTTP server and publish the address of that server to Netrix. The API endpoints are
/message
receives theMessage
object serialized as json in aPOST
request. Should respond with status200
to acknowledge message reception./directive
receives theDirectiveMessage
serialized as json in aPOST
request. Should respond with status200
after completing the requested action./health
:GET
request is called to check the availability of the replica. Should respond with200
to confirm availability.
Communicating with Netrix
Replicas should persist a HTTP connection to Netrix API endpoint. This connection should be used to send replica information, events and messages. See API documentation for details about API.
Before any request is made, replica should call the /replica
API endpoint with the following information
Replica {
ID string
Ready bool
Info map[string]any
Addr string
}
Ready
is used to indicate if the replica is ready to send and receive messages. Netrix will wait for all replicas to be ready before continuing.Addr
should be Replica API endpoint that Netrix will use to communicate messages and directives.Info
can be any additional information. This information can be used when writing unit tests. For example, replicas can submit their private keys such that unit tests can change the contents of messages originating from this replica.
Following this call the replica should use the same ID
when sending messages and events.