Framework documentation
Netrix provides the basic building blocks to enable central monitoring and control of replicas in a distributed system. With this central control, the framework aims to implement testing and visualization of the system. Netrix is modular to allow all class of distributed systems and protocol to be plugged in and is extensible in the form of control that can be exercised. Refer []
Configuration
A global configuration object provides the details needed for Netrix to run. Configuration consists of,
Config {
NumReplicas int
APIServerAddr string
LogConfig {
Path string
Format string
Level string
}
}
LogConfig
Path
is used to log to a file. If unspecified, Netrix logs tostdout
.Format
: Valid values arejson
. If left empty, Netrix logs in text formatLevel
: Valid values arepanic,fatal,error,warn,warning,info,debug,trace
signifying the log level
Context
RootContext
object serves the backbone of the framework. To run any components, one needs to pass a RootContext
instance. The context contains the necessary queues and stores that components can make use of.
ctx.ReplicaStore
: thread safe key value store ofReplica
informationctx.MessageStore
: thread safe message pool indexed by the messageID
ctx.EventQueue
: thread safe event queue that components can subscribe to.ctx.Config
: reference to the configuration objectctx.Logger
: A generic logger that components use to instantiate component specific logger objects
APIServer
uses the RootContext
object to push information about messages, events and replicas.
Components
The main components of Netrix are as follows
APIServer
APIServer
instantiates a HTTP server at the configured APIServerAddr
and implements the API spec. APIServer
requires a MessageParser
as an input parameter. MessageParser
object is specific to the protocol being tested and allows a developer to plug in the deserializing and serializing of messages received on the /message
endpoint.
APIServer
also hosts a dashboard that can be used to provide a user interface for interactivity. DashboardRouter
interface allows the mode used to provide UI specific APIs that can be used to control the components and measure metrics
Dispatcher
Dispatcher
is used to send messages and directives to the replica. Instantiated with a context object, the Dispatcher
communicates with the replicas in the Replica API spec.