package channels
Overview
- Input and Output provide callback-based interfaces for input/output facilities.
- Channel provide implementation for asynchronics channels processing inside JVM.
- SelectorBuilder is a way to create selectors.
Internals
Core entity is Continuated which provide iteratee-like structure for reading and writing. Instance of Continuated represent one step of computations and leave in queue inside ChannelProcessor or ChannelActor Selector transform Continuated to executed exclusive with each other within one selector. Also we have IdleDetector which determinate idle selectors and activer appropriative actions.
- Alphabetic
- By Inheritance
- channels
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- class ActorBackedChannel [A] extends Channel[A]
- case class AsyncErrorSelectorArgument [A](f: (ExecutionContext, FlowTermination[A], Continuated[A], Throwable) ⇒ Future[Continuated[A]]) extends ErrorSelectorArgument[A] with Product with Serializable
- case class AsyncFullReadSelectorArgument [A, B](f: (ContRead[A, B]) ⇒ Option[(In[A]) ⇒ Future[Continuated[B]]]) extends ReadSelectorArgument[A, B] with Product with Serializable
- case class AsyncFullSkipSelectorArgument [A](f: (Skip[A]) ⇒ Option[Future[Continuated[A]]]) extends SkipSelectorArgument[A] with Product with Serializable
- case class AsyncFullWriteSelectorArgument [A, B](f: (ContWrite[A, B]) ⇒ Option[(A, Future[Continuated[B]])]) extends WriteSelectorArgument[A, B] with Product with Serializable
- case class AsyncNoGenReadSelectorArgument [A, B](f: (ContRead[A, B]) ⇒ (A) ⇒ Future[Continuated[B]]) extends ReadSelectorArgument[A, B] with Product with Serializable
- case class AsyncNoOptSkipSelectorArgument [A](f: (Skip[A]) ⇒ Future[Continuated[A]]) extends SkipSelectorArgument[A] with Product with Serializable
- case class AsyncNoOptWriteSelectorArgument [A, B](f: (ContWrite[A, B]) ⇒ (A, Future[Continuated[B]])) extends WriteSelectorArgument[A, B] with Product with Serializable
- case class AsyncNoOptionReadSelectorArgument [A, B](f: (ContRead[A, B]) ⇒ (In[A]) ⇒ Future[Continuated[B]]) extends ReadSelectorArgument[A, B] with Product with Serializable
- case class AsyncPairReadSelectorArgument [A, B](f: (A, ContRead[A, B]) ⇒ Future[Continuated[B]]) extends ReadSelectorArgument[A, B] with Product with Serializable
-
abstract
class
BaseBufferedChannelActor
[A] extends ChannelActor[A]
ChannelActor - actor, which leave
-
class
BufferedChannelActor
[A] extends BaseBufferedChannelActor[A]
ChannelActor - actor, which leave
- trait Channel [A] extends InputOutput[A] with CloseableInput[A]
-
abstract
class
ChannelActor
[A] extends Actor
ChannelActor - actor, which leave
- sealed trait ChannelActorMessage extends AnyRef
-
case class
ChannelCloseCallback
[B](cr: ContRead[Unit, B]) extends Product with Serializable
add
f
to list of callbacks, called on channel close. -
case class
ChannelCloseProcessed
(nElements: Int) extends ChannelActorMessage with Product with Serializable
result of CloseChannelRead, return number of elements left to read
- class ChannelOverflowException extends RuntimeException
- class ChannelProcessor extends Actor
- class ChannelSupervisor extends Actor
- case class CloseChannel (id: Long) extends Product with Serializable
- trait CloseableInput [A] extends Input[A] with DoneProvider[Unit]
-
case class
ClosedChannelRead
(cont: ContRead[_, _]) extends ChannelActorMessage with Product with Serializable
this is message wich send to ChannelActor, when we know, that channel is closed.
this is message wich send to ChannelActor, when we know, that channel is closed. In such case, we don't konw: is actor stopped or not, So, we say this message (instead read) and wait for reply. If reply is not received within given timeout: think that channel is-dead.
-
case class
ContRead
[A, B](function: (ContRead[A, B]) ⇒ Option[(In[A]) ⇒ Future[Continuated[B]]], channel: Input[A], flowTermination: FlowTermination[B]) extends FlowContinuated[B] with Product with Serializable
read A and compute B as result.
-
case class
ContWrite
[A, B](function: (ContWrite[A, B]) ⇒ Option[(A, Future[Continuated[B]])], channel: Output[A], flowTermination: FlowTermination[B]) extends FlowContinuated[B] with Product with Serializable
write A and compute B as result
-
sealed
trait
Continuated
[+A] extends AnyRef
represent continuated computation from A to B.
- case class Done [A](result: A, flowTermination: FlowTermination[A]) extends FlowContinuated[A] with Product with Serializable
- trait DoneProvider [A] extends AnyRef
- class DuppedInput [A] extends AnyRef
- class ECSelectFactory extends SelectFactory
- trait EffectedOutput [A] extends Effected[Output[A]] with Output[A]
- sealed trait ErrorSelectorArgument [A] extends AnyRef
- sealed trait FlowContinuated [A] extends Continuated[A]
-
class
FoldSelect
[T] extends FoldSelectorBuilder[T]
Short name for use in fold signature
- abstract class FoldSelectorBuilder [T] extends SelectorBuilder[T]
- class FoldSelectorBuilderImpl extends SelectorBuilderImpl
-
trait
ForeverSelectorBuilder
extends SelectorBuilder[Unit]
Builder for 'forever' selector.
Builder for 'forever' selector. Can be obtained as
gopherApi.select.forever
. -
class
FutureInput
[A] extends Input[A]
Future[A], represented as input which produce a value when completed, after this closes.
Future[A], represented as input which produce a value when completed, after this closes. If evaluation of feature is unsuccessful (i.e. failure), than appropriative exception is thrown during reading.
Can be obtained from gopherApi.
import gopherApi._ val myInput = futureInput(future) select.forever{ case x: myInput.read => Console.println(s"we receive value from future: ${x}") implicitly[FlowTermination[Unit]].doExit(()) case x: myChannel.read => Console.println(s"value from channel: ${x}") }
Also it is possiblt to direclty read from future in case guard:
select.forever{ case x: T if (x==future.read) => Console.println(s"we receive value from future: ${x}") case x: T if (x==channel.read) => Console.println(s"value from channel: ${x}") }
- trait GopherAPIProvider extends AnyRef
-
class
GrowingBufferedChannelActor
[A] extends BaseBufferedChannelActor[A]
ChannelActor - actor, which leave
-
trait
Input
[A] extends GopherAPIProvider
Entity, from which we can read objects of type A.
- trait InputOutput [A] extends Input[A] with Output[A]
-
class
InputSelectorBuilder
[T] extends SelectorBuilder[T] with CloseableInput[T]
Builder for 'input' selector.
Builder for 'input' selector. Can be obtained as
gopherApi.select.input
. or map of forever selector. -
class
InputWithTimeouts
[A] extends AnyRef
Wrap
origin
input into input, which produce 'timeout' value intotimeouts
channel when reading from wrapped channel take more time thantimeout
.Wrap
origin
input into input, which produce 'timeout' value intotimeouts
channel when reading from wrapped channel take more time thantimeout
.- See also
InputChannel.withInputTimeouts
-
class
LazyChannel
[A] extends Input[A] with Output[A]
lazy channel, which created during first input/output operations.
lazy channel, which created during first input/output operations. (used in transputers as default value for In/Out Ports)
- class MultithreadedEffectedOutput [A] extends MultithreadedEffected[Output[A]] with EffectedOutput[A]
- case class NewChannel (id: Long, capacity: Int) extends Product with Serializable
-
trait
OnceSelectorBuilder
[T] extends SelectorBuilder[T]
Builder for 'once' selector.
Builder for 'once' selector. Can be obtained as
gopherApi.select.once
. -
class
OneTimeChannel
[T] extends Channel[T]
channel, in which only one message can be written, after which it is automatically closed
channel, in which only one message can be written, after which it is automatically closed
Writer is not waiting for reader to start.
-
class
OrInput
[A] extends Input[A]
Input, which combine two other inputs.
Input, which combine two other inputs.
can be created with '|' operator.
val x = read(x|y)
-
trait
Output
[A] extends GopherAPIProvider
Entity, where we can write objects of type A.
- class OutputWithTimeouts [A] extends AnyRef
- trait PromiseFlowTermination [A] extends FlowTermination[A]
- sealed trait ReadSelectorArgument [A, B] extends AnyRef
-
class
SelectFactory
extends AnyRef
Factory for select instantiation.
Factory for select instantiation. Can be obtained via gopherAPI
val selector = gopherApi.select.forever for(s <- selector) ...
- class Selector [A] extends PromiseFlowTermination[A]
- trait SelectorBuilder [A] extends AnyRef
- class SelectorBuilderImpl extends ASTUtilImpl
- class SinglethreadedEffectedOutput [A] extends SinglethreadedEffected[Output[A]] with EffectedOutput[A]
-
case class
Skip
[A](function: (Skip[A]) ⇒ Option[Future[Continuated[A]]], flowTermination: FlowTermination[A]) extends FlowContinuated[A] with Product with Serializable
skip (i.e.
skip (i.e. do some operation not related to reading or writing.)
- sealed trait SkipSelectorArgument [A] extends AnyRef
- case class SyncErrorSelectorArgument [A](f: (ExecutionContext, FlowTermination[A], Continuated[A], Throwable) ⇒ Continuated[A]) extends ErrorSelectorArgument[A] with Product with Serializable
- case class SyncPairReadSelectorArgument [A, B](f: (A, ContRead[A, B]) ⇒ Continuated[B]) extends ReadSelectorArgument[A, B] with Product with Serializable
- case class SyncReadSelectorArgument [A, B](f: (ContRead[A, B]) ⇒ (In[A]) ⇒ Continuated[B]) extends ReadSelectorArgument[A, B] with Product with Serializable
- case class SyncSelectorArgument [A](f: (Skip[A]) ⇒ Continuated[A]) extends SkipSelectorArgument[A] with Product with Serializable
- case class SyncWriteSelectorArgument [A, B](f: (ContWrite[A, B]) ⇒ (A, Continuated[B])) extends WriteSelectorArgument[A, B] with Product with Serializable
-
class
UnbufferedChannelActor
[A] extends ChannelActor[A]
Actor backend for channel
- sealed trait WriteSelectorArgument [A, B] extends AnyRef
- class ZippedInput [A, B] extends Input[(A, B)]
Value Members
- object Channel
- object ChannelClose extends ChannelActorMessage with Product with Serializable
-
object
ChannelRefDecrement
extends ChannelActorMessage with Product with Serializable
this message is send, when all references to some instance of this channel are unreachable, so if we have no other instances (i.e.
this message is send, when all references to some instance of this channel are unreachable, so if we have no other instances (i.e. remote channel incarnation), than we must destroy channel.
-
object
ChannelRefIncrement
extends ChannelActorMessage with Product with Serializable
this message is send, when we create new remote reference to channel, backed by this actor.
- object CloseableInput
- object ContRead extends Serializable
- object ContWrite extends Serializable
- object CurrentFlowTermination
- object EffectedOutput
-
object
GracefullChannelStop
extends ChannelActorMessage with Product with Serializable
When we decide to stop channel, do it via special message, to process one after messages, which exists now in queue.
When we decide to stop channel, do it via special message, to process one after messages, which exists now in queue.
Note, that channel-stop messages can be send only from ChannelActor
- object Input
- object InputMacro
-
object
Never
extends Continuated[Nothing] with Product with Serializable
never means the end of conversation
- object OneTimeChannel
- object Output
- object PromiseFlowTermination
- object SelectorBuilder
- object Skip extends Serializable
- object ZippedInput