Convenience implementation of ConnectionHandler which provides implementations for all of the necessary functions.
ClientConnectionHandler is a trait meant to be used with outgoing connections.
ClientConnectionHandler is a trait meant to be used with outgoing connections. It provides a call back function connectionFailed, which is called when a connection to an external system could not be established.
This is the base trait for all connection handlers.
This is the base trait for all connection handlers. When attached to a connection by a Delegator, these methods will be called in the worker's thread.
A ConnectionHandler is what directly interfaces with a Connection and is the reactor for all of the Connection events that a Worker captures in its SelectLoop.
A trait encapsulating live information about a connection.
A trait encapsulating live information about a connection. This should only contain read-only fields
This class is used to report some basic stats about a Connection.
This class is used to report some basic stats about a Connection. This is used in conjunction with the Metrics library and ConnectionPageRenderer.
The domain of this Connection
The host of this Connection
The port of this Connection
The id of this Connection
The amount of time this Connection has been open
milliseconds since the last read activity on the connection
milliseconds since the last write activity on the connection
The amount of bytes that this Connection has sent
The amount of bytes that this Connection has received
Represent the connection state.
Represent the connection state. NotConnected, Connected or Connecting.
ConnectionVolumeState indicates whether or not if the Server is operating with a normal workload, which is represented by the current ratio of used / available connections being beneath the ServerSettings.highWatermarkPercentage amount.
ConnectionVolumeState indicates whether or not if the Server is operating with a normal workload, which is represented by the current ratio of used / available connections being beneath the ServerSettings.highWatermarkPercentage amount. Once this ratio is breached, the state will be changed to the HighWater state.
In this state, the server will more aggressively timeout and close idle connections. Effectively what this means is that when the Server polls its connections in the Highwater state, any connection that is seen as idle for longer than ServerSettings.highWaterMaxIdleTime will be reaped. It does this in an effort to free up space.
The Server will return back to its normal state when the connection ratio recedes past the lowWater mark.
A thin wrapper around a NIO ByteBuffer with data to read
A thin wrapper around a NIO ByteBuffer with data to read
DataBuffers are the primary way that data is read from and written to a connection. DataBuffers are mutable and not thread safe. They can only be read from once and cannot be reset.
A DataReader is the result of codec's encode operation.
A DataReader is the result of codec's encode operation. It can either return a DataBuffer, which contains the entire encoded object at once, or it can return a DataStream, which has a Sink for streaming the encoded object.
A Delegator is in charge of creating new ConnectionHandler’s for each new connection.
A Delegator is in charge of creating new ConnectionHandler’s for each new connection. Delegators live inside workers and run as part of the worker’s event loop
Delegators are the liaison between the outside world and your application's connection handling logic.
They can hold state, and pass that state to newly created ConnectionHandlers.
They can receive messages from the outside world, and thus be notified of changes in their environment by way of the handleMessage.
This is triggered by utilizing the ServerRef's delegatorBroadcast function.
Currently unused; but will eventually be for async delegators, if we decide to allow them
Messages representing why a disconnect occurred.
Messages representing why a disconnect occurred. These can be either normal disconnects or error cases
Subset of DisconnectCause which represent errors which resulted in a disconnect.
A Simple mixin trait that will cause the worker to not automatically unbind this handler if the connection it's attached to is closed.
A Simple mixin trait that will cause the worker to not automatically unbind this handler if the connection it's attached to is closed. This mixin is required if a connection handler wants to handle retry logic, since this trait will allow it to continue to receive messages during the reconnection process and bind to another connection
Simple class which contains parameters for configuring a polling operation
Simple class which contains parameters for configuring a polling operation
The interval of the poll
The number of times to execute the poll
Configuration used to specify a Server's application-level behavior
Configuration used to specify a Server's application-level behavior
As opposed to ServerSettings which contains just lower-level config, ServiceConfig contains higher-level settings. Ideally, abstraction layers on top of the core layer should provide an API that allows users to create a specialized server, where the delegator factory is provided by the API and the name and settings by the user.
Name of the Server, all reported metrics are prefixed using this name
Factory to generate colossus.core.Delegators for each Worker
lower-level server configuration settings
Mixin containing events just for server connection handlers
A ServerRef is the public interface of a Server.
A ServerRef is the public interface of a Server. Servers should ONLY be interfaced with through this class. Both from an application design and from Akka idioms and best practices, passing around an actual Actor is strongly discouraged.
The ServerConfig used to create this Server
The ActorRef of the Server
The IOSystem to which this Server belongs
The current state of the Server.
Contains values for configuring how a Server operates
Contains values for configuring how a Server operates
These are all lower-level configuration settings that are for the most part not concerned with a server's application behavior
The low/high watermark percentages are used to help mitigate connection
overload. When a server hits the high watermark percentage of live
connections, it will change the idle timeout from maxIdleTime
to
highWaterMaxIdleTime
in an attempt to more aggressively close idle
connections. This will continue until the percentage drops below
lowWatermarkPercentage
. This can be totally disabled by just setting both
watermarks to 1.
Port on which this Server will accept connections
Max number of simultaneous live connections
Maximum idle time for connections when in non high water conditions
Percentage of live/max connections which represent a normal state
Percentage of live/max connections which represent a high water state.
Max idle time for connections when in high water conditions.
Set the max number of simultaneous connections awaiting accepting, or None for NIO default
The polling configuration for binding to a port. The The IOSystem will check PollingDuration.interval PollingDuration.maximumTries times. If the server cannot bind to the port, during this duration, it will shutdown. If this is not specified, the IOSystem will wait indefinitely.
The polling configuration for creating The IOSystem will wait PollingDuration.interval for all colossus.core.Delegators to be created. It will fail to startup after PollingDuration.maximumTries and shutdown if it cannot successfully create the colossus.core.Delegators
Once a Server begins to shutdown, it will signal a request to every open connection. This determines how long it will wait for every connection to self-terminate before it forcibly closes them and completes the shutdown.
Represents the current state of a Server.
Represents the current state of a Server.
Represents if the a Server's connections are normal or in highwater
Represents the Server's current status
Represents the startup status of the server.
Represents the startup status of the server.
- Initializing
: The server was just started and is registering with the IOSystem
- Binding
: The server is registered and in the process of binding to its port
- Bound
: The server is actively listening on the port and accepting connections
- ShuttingDown
: The server is shutting down. It is no longer accepting new connections and waiting for existing connections to close
- Dead
: The server is fully shutdown
A Watched handler allows an actor to be tied to a connection.
A Watched handler allows an actor to be tied to a connection. The worker will watch the actor, and on termination will shutdown the connection associated with the actor
These are a different class of Commands to which a worker will respond.
These are a different class of Commands to which a worker will respond. These are more relevant to the lifecycle of WorkerItems
Contains the configuration for each Worker.
Contains the configuration for each Worker. Created when Workers are spawned by the WorkerManager. Notice - currently the worker config cannot contain the MetricSystem, because workers are created as a part of creating the MetricSystem
The IOSystem to which this Worker belongs
This Worker's unique id amongst its peers.
A WorkerItem is anything that can be bound to worker to receive both events and external messages.
A WorkerItem is anything that can be bound to worker to receive both events and external messages. WorkerItems are expected to be single-threaded and non-blocking. Once a WorkerItem is bound to a worker, all of its methods are executed in the event-loop thread of the bound worker.
Represents the binding of an item to a worker
Represents the binding of an item to a worker
the id used to reference the worker item
the worker the item is bound to
This keeps track of all the bound worker items, and properly handles added/removing them
This is a Worker's public interface.
This is a Worker's public interface. This is what can be used to communicate with a Worker, as it wraps the Worker's ActorRef, as well as providing some additional information which can be made public.
The Worker's id.
The Metrics associated with this Worker
The ActorRef of the Worker
The IOSystem to which this Worker belongs
This is passed to handlers to give them a way to synchronously write to the connection.
This is passed to handlers to give them a way to synchronously write to the connection. Services wrap this
Servers can be thought of as applications, as they provide Delegators and ConnectionHandlers which contain application logic.
Servers can be thought of as applications, as they provide Delegators and ConnectionHandlers which contain application logic. Servers are the objects that are directly interface with the Workers and provide them with the Delegators and Handlers. A Server will be "registered" with the Workers, and after a successful registration, it will then bind to the specified ports and be ready to accept incoming requests.
Also this includes all of the messages that Server will respond to. Some of these can cause actions, others are for when some internal event happens and the Server is notified.
Like the server actor, it is critical that instances of this actor get their own thread, since they block when waiting for events.
Like the server actor, it is critical that instances of this actor get their own thread, since they block when waiting for events.
Workers are the "engine" of Colossus. They are the components which receive and operate on Connections, respond to java NIO select loop events and execute the corresponding reactors in the Delegator and ConnectionHandlers.
These are the messages to which a Worker will respond.
Convenience implementation of ConnectionHandler which provides implementations for all of the necessary functions. This allows for a devloper to extend this trait and only provide definitions for the functions they require.