Package

colossus

controller

Permalink

package controller

Visibility
  1. Public
  2. All

Type Members

  1. sealed trait AliveOutputState extends OutputState

    Permalink
  2. abstract class Controller[Input, Output] extends CoreHandler with InputController[Input, Output] with OutputController[Input, Output]

    Permalink

    A Controller is a Connection handler that is designed to work with connections involving decoding raw bytes into input messages and encoding output messages into bytes.

    A Controller is a Connection handler that is designed to work with connections involving decoding raw bytes into input messages and encoding output messages into bytes.

    Unlike a service, which pairs an input "request" message with an output "response" message, the controller make no such pairing. Thus a controller can be thought of as a duplex stream of messages.

  3. case class ControllerConfig(outputBufferSize: Int, sendTimeout: Duration, inputMaxSize: DataSize = 1.MB, flushBufferOnClose: Boolean = true, metricsEnabled: Boolean = true) extends Product with Serializable

    Permalink

    Configuration for the controller

    Configuration for the controller

    outputBufferSize

    the maximum number of outbound messages that can be queued for sending at once

    sendTimeout

    if a queued outbound message becomes older than this it will be cancelled

    inputMaxSize

    maximum allowed input size (in bytes)

  4. class DataQueue extends AnyRef

    Permalink

    The DataQueue is used only when processing a stream.

    The DataQueue is used only when processing a stream. It is used to buffer data in between when the stream produces it and when it is ready to write to the output buffer. It also ensures that we don't pull too much data from a stream, for example if a stream is infinite

  5. class DisconnectingException extends Exception

    Permalink
  6. class DualSource[T] extends Source[T]

    Permalink

    Wraps 2 sinks and will automatically begin reading from the second only when the first is empty.

    Wraps 2 sinks and will automatically begin reading from the second only when the first is empty. The None from the first sink is never exposed. The first error reported from either sink is propagated.

  7. class FiniteBytePipe extends InfinitePipe[DataBuffer]

    Permalink

    A pipe designed to accept a fixed number of bytes

    A pipe designed to accept a fixed number of bytes

    BE AWARE: when pushing buffers into this pipe, if the pipe completes, the buffer may still contain unread data meant for another consumer

  8. abstract class Generator[T] extends Source[T]

    Permalink
  9. class InfinitePipe[T] extends Pipe[T, T]

    Permalink
  10. trait InputController[Input, Output] extends WorkerItem with MasterController[Input, Output]

    Permalink

    The InputController maintains all state dealing with reading in messages in a controller.

    The InputController maintains all state dealing with reading in messages in a controller. It handles decoding messages and properly routing data into stream

    When pushing data into a stream, the controller has some very specific behavior regarding the PushResult from the stream. - Terminating the stream at any point kills the connection - Closing a stream outside of a pull callback will kill the connection without logging the error - Closing a stream inside of a pull callback will complete the stream and the controller will resset

  11. sealed trait InputState extends AnyRef

    Permalink
  12. class InvalidInputStateException extends Exception

    Permalink
  13. class InvalidOutputStateException extends Exception

    Permalink

    This is thrown anytime we hit a state that shouldn't be possible.

    This is thrown anytime we hit a state that shouldn't be possible. If this is ever thrown, there is a bug!

  14. class IteratorGenerator[T] extends Generator[T]

    Permalink
  15. trait MasterController[Input, Output] extends WorkerItem with ConnectionHandler with IdleCheck

    Permalink

    The base trait inherited by both InputController and OutputController and ultimately implemented by Controller.

    The base trait inherited by both InputController and OutputController and ultimately implemented by Controller. This merely contains methods needed by both input and output controller

  16. class MessageQueue[T] extends AnyRef

    Permalink
  17. trait OutputController[Input, Output] extends WorkerItem with MasterController[Input, Output]

    Permalink

    The OutputController maintains all state dealing with writing messages in a controller.

    The OutputController maintains all state dealing with writing messages in a controller. It maintains a queue of messages pending write and properly handles writing both regular messages as well as streams.

  18. sealed trait OutputError extends OutputResult

    Permalink
  19. sealed trait OutputResult extends AnyRef

    Permalink

    An ADT representing the result of a pushing a message to write

  20. sealed trait OutputState extends AnyRef

    Permalink
  21. trait Pipe[T, U] extends Sink[T] with Source[U]

    Permalink

    A Pipe is a callback-based data transport abstraction meant for handling streams.

    A Pipe is a callback-based data transport abstraction meant for handling streams. It provides backpressure feedback for both the write and read ends.

  22. class PipeCancelledException extends Exception with PipeException

    Permalink

    This is a special exception that Input/Output controllers look for when error handling pipes.

    This is a special exception that Input/Output controllers look for when error handling pipes. In most cases they will log the error that terminated the pipe, but for this one exception, the failure will be silent. This is basically for situations where a certain amount of data is expected but for some reason the receiver decides to cancel for some business-logic reason.

  23. sealed trait PipeException extends Throwable

    Permalink
  24. class PipeStateException extends Exception with PipeException

    Permalink
  25. class PipeTerminatedException extends Exception with PipeException

    Permalink
  26. sealed trait PushResult extends AnyRef

    Permalink
  27. case class QueuedItem[T](item: T, postWrite: PostWrite, creationTimeMillis: Long) extends Product with Serializable

    Permalink
  28. trait Sink[T] extends Transport

    Permalink

    A Sink is the write side of a pipe.

    A Sink is the write side of a pipe. It allows you to push items to it, and will return whether or not it can accept more data. In the case where the pipe is full, the Sink will return a mutable Trigger and you can attach a callback to for when the pipe can receive more items

  29. trait Source[T] extends Transport

    Permalink

    A Source is the read side of a pipe.

    A Source is the read side of a pipe. You provide a handler for when an item is ready and the Source will call it. Note that if the underlying pipe has multiple items ready, onReady will only be called once. This is so that the consumer of the sink can implicitly apply backpressure by only pulling when it is able to

  30. trait Transport extends AnyRef

    Permalink
  31. class Trigger extends AnyRef

    Permalink

    When a user attempts to push a value into a pipe, and the pipe either fills or was already full, a Trigger is returned in the PushResult.

    When a user attempts to push a value into a pipe, and the pipe either fills or was already full, a Trigger is returned in the PushResult. This is essentially just a fillable callback function that is called when the pipe either becomes empty or is closed or terminated

    Notice that when the trigger is executed we don't include any information about the state of the pipe. The handler can just try pushing again to determine if the pipe is dead or not.

Value Members

  1. object InputState

    Permalink
  2. object OutputResult

    Permalink
  3. object OutputState

    Permalink
  4. object PipeCombinator

    Permalink
  5. object PushResult

    Permalink
  6. object QueuedItem extends Serializable

    Permalink
  7. object Source

    Permalink

Ungrouped