colossus

core

package core

Visibility
  1. Public
  2. All

Type Members

  1. trait BasicSyncHandler extends ConnectionHandler

    Convenience implementation of ConnectionHandler which provides implementations for all of the necessary functions.

    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.

  2. trait ClientConnectionHandler extends ConnectionHandler

    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.

  3. trait ConnectionHandler extends WorkerItem

    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.

  4. trait ConnectionInfo extends AnyRef

    A trait encapsulating live information about a connection.

    A trait encapsulating live information about a connection. This should only contain read-only fields

  5. case class ConnectionSnapshot(domain: String, host: InetAddress, port: Int, id: Long, timeOpen: Long = 0, readIdle: Long = 0, writeIdle: Long = 0, bytesSent: Long = 0, bytesReceived: Long = 0) extends Product with Serializable

    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.

    domain

    The domain of this Connection

    host

    The host of this Connection

    port

    The port of this Connection

    id

    The id of this Connection

    timeOpen

    The amount of time this Connection has been open

    readIdle

    milliseconds since the last read activity on the connection

    writeIdle

    milliseconds since the last write activity on the connection

    bytesSent

    The amount of bytes that this Connection has sent

    bytesReceived

    The amount of bytes that this Connection has received

  6. sealed trait ConnectionStatus extends AnyRef

    Represent the connection state.

    Represent the connection state. NotConnected, Connected or Connecting.

  7. sealed trait ConnectionVolumeState extends AnyRef

    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.

  8. case class DataBuffer(data: ByteBuffer) extends DataReader with Product with Serializable

    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.

  9. sealed trait DataReader extends AnyRef

    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.

  10. case class DataStream(source: Source[DataBuffer]) extends DataReader with Product with Serializable

  11. abstract class Delegator extends AnyRef

    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.

  12. sealed trait DelegatorCommand extends AnyRef

    Currently unused; but will eventually be for async delegators, if we decide to allow them

  13. sealed trait DisconnectCause extends RootDisconnectCause

    Messages representing why a disconnect occurred.

    Messages representing why a disconnect occurred. These can be either normal disconnects or error cases

  14. sealed trait DisconnectError extends DisconnectCause

    Subset of DisconnectCause which represent errors which resulted in a disconnect.

  15. trait KeyInterestManager extends AnyRef

  16. trait ManualUnbindHandler extends ClientConnectionHandler

    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

  17. case class PollingDuration(interval: FiniteDuration, maximumTries: Option[Long]) extends Product with Serializable

    Simple class which contains parameters for configuring a polling operation

    Simple class which contains parameters for configuring a polling operation

    interval

    The interval of the poll

    maximumTries

    The number of times to execute the poll

  18. case class ServerConfig(name: MetricAddress, delegatorFactory: Factory, settings: ServerSettings) extends Product with Serializable

    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

    Name of the Server, all reported metrics are prefixed using this name

    delegatorFactory

    Factory to generate colossus.core.Delegators for each Worker

    settings

    lower-level server configuration settings

  19. trait ServerConnectionHandler extends ConnectionHandler

    Mixin containing events just for server connection handlers

  20. case class ServerRef(config: ServerConfig, server: ActorRef, system: IOSystem, serverStateAgent: Agent[ServerState]) extends Product with Serializable

    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.

    config

    The ServerConfig used to create this Server

    server

    The ActorRef of the Server

    system

    The IOSystem to which this Server belongs

    serverStateAgent

    The current state of the Server.

  21. case class ServerSettings(port: Int, maxConnections: Int = 1000, maxIdleTime: Duration = Duration.Inf, lowWatermarkPercentage: Double = 0.75, highWatermarkPercentage: Double = 0.85, highWaterMaxIdleTime: FiniteDuration = 100.milliseconds, tcpBacklogSize: Option[Int] = None, bindingAttemptDuration: PollingDuration = ..., delegatorCreationDuration: PollingDuration = ..., shutdownTimeout: FiniteDuration = 100.milliseconds) extends Product with Serializable

    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

    Port on which this Server will accept connections

    maxConnections

    Max number of simultaneous live connections

    maxIdleTime

    Maximum idle time for connections when in non high water conditions

    lowWatermarkPercentage

    Percentage of live/max connections which represent a normal state

    highWatermarkPercentage

    Percentage of live/max connections which represent a high water state.

    highWaterMaxIdleTime

    Max idle time for connections when in high water conditions.

    tcpBacklogSize

    Set the max number of simultaneous connections awaiting accepting, or None for NIO default

    bindingAttemptDuration

    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.

    delegatorCreationDuration

    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

    shutdownTimeout

    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.

  22. case class ServerState(connectionVolumeState: ConnectionVolumeState, serverStatus: ServerStatus) extends Product with Serializable

    Represents the current state of a Server.

    Represents the current state of a Server.

    connectionVolumeState

    Represents if the a Server's connections are normal or in highwater

    serverStatus

    Represents the Server's current status

  23. sealed trait ServerStatus extends AnyRef

    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

  24. trait WatchedHandler extends ConnectionHandler

    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

  25. sealed trait WorkerCommand extends AnyRef

    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

  26. case class WorkerConfig(io: IOSystem, workerId: Int) extends Product with Serializable

    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

    io

    The IOSystem to which this Worker belongs

    workerId

    This Worker's unique id amongst its peers.

  27. trait WorkerItem extends AnyRef

    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.

  28. case class WorkerItemBinding(id: Long, worker: WorkerRef) extends Product with Serializable

    Represents the binding of an item to a worker

    Represents the binding of an item to a worker

    id

    the id used to reference the worker item

    worker

    the worker the item is bound to

  29. class WorkerItemException extends Exception

  30. class WorkerItemManager extends AnyRef

    This keeps track of all the bound worker items, and properly handles added/removing them

  31. case class WorkerRef(id: Int, metrics: LocalCollection, worker: ActorRef, system: IOSystem) extends Product with Serializable

    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.

    id

    The Worker's id.

    metrics

    The Metrics associated with this Worker

    worker

    The ActorRef of the Worker

    system

    The IOSystem to which this Worker belongs

  32. trait WriteEndpoint extends ConnectionInfo

    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

  33. sealed trait WriteStatus extends AnyRef

Value Members

  1. object ConnectionSnapshot extends Serializable

  2. object ConnectionStatus

  3. object ConnectionVolumeState

  4. object DataBuffer extends Serializable

  5. object Delegator

  6. object DelegatorCommand

  7. object DisconnectCause

  8. object PollingDuration extends Serializable

  9. object Server

    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.

  10. object ServerStatus

  11. object Worker

    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.

  12. object WorkerCommand

  13. object WriteStatus

Ungrouped