final case class Exchange[I, W](read: Process[Task, I], write: Sink[Task, W]) extends Product with Serializable
Exchange represents interconnection between two systems.
So called remote is resource from which program receives messages of type I
and can send to it messages of type O.
Typically this can be sort of connection to external system, like for example tcp connection to internet server.
Exchange allows combining this pattern with Processes and allows to use different combinators to specify the Exchange behaviour.
Exchange is currently specialized to scalaz.concurrent.Task
- I
values read from remote system
- W
values written to remote system
- read
Process reading values from remote system
- write
Process writing values to remote system
- Self Type
- Exchange[I, W]
- Source
- Exchange.scala
- Alphabetic
- By Inheritance
- Exchange
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (Exchange[I, W], B)
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- def ensuring(cond: (Exchange[I, W]) ⇒ Boolean, msg: ⇒ Any): Exchange[I, W]
- def ensuring(cond: (Exchange[I, W]) ⇒ Boolean): Exchange[I, W]
- def ensuring(cond: Boolean, msg: ⇒ Any): Exchange[I, W]
- def ensuring(cond: Boolean): Exchange[I, W]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flow[I2, W2](y: WyeW[W, \/[Int, I], W2, I2])(implicit S: Strategy): Exchange[I2, W2]
Transform this Exchange to another Exchange where queueing, flow control and transformation of this
IandWis controlled by supplied WyeW.Transform this Exchange to another Exchange where queueing, flow control and transformation of this
IandWis controlled by supplied WyeW.Note this allows for fine-grained flow-control of written
Wto server based on Int passed to left side of supplied WyeW that contains actual size of queued values to be written to server.- y
WyeW to control queueing, flow control and transformation
- def formatted(fmtstr: String): String
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
mapO[I2](f: (I) ⇒ I2): Exchange[I2, W]
uses provided function
fto be applied on anyIreceived -
def
mapW[W2](f: (W2) ⇒ W): Exchange[I, W2]
applies provided function to any
W2that has to be written to provide anW -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
pipeBoth[I2, W2](r: Process1[I, I2], w: Process1[W2, W]): Exchange[I2, W2]
Creates new exchange, that will pipe read values through supplied
rand write values throughwCreates new exchange, that will pipe read values through supplied
rand write values throughw- r
Process1 to use on all read values
- w
Process1 to use on all written values
-
def
pipeO[I2](p1: Process1[I, I2]): Exchange[I2, W]
Creates exchange that
pipereadIvalues through supplied p1.Creates exchange that
pipereadIvalues through supplied p1.- p1
Process1 to be used when reading values
-
def
pipeW[W2](p1: Process1[W2, W]): Exchange[I, W2]
Creates new exchange, that pipes all values to be sent through supplied
p1 -
val
read: Process[Task, I]
Process reading values from remote system
-
def
readThrough[I2](w: Writer1[W, I, I2])(implicit S: Strategy): Exchange[I2, W]
Transforms this exchange to another exchange, that for every received
Iwill consult supplied Writer1 and eventually transformsItoI2or toWthat is sent to remote system.Transforms this exchange to another exchange, that for every received
Iwill consult supplied Writer1 and eventually transformsItoI2or toWthat is sent to remote system.Please note that if external system is slow on reading
Wthis can lead to excessive heap usage. If you want to avoid for this to happen, please useflowinstead.- w
Writer that processes received
Iand either echoesI2or writesWto external system
-
def
run(p: Process[Task, W] = halt, terminateOn: Request = Request.L)(implicit S: Strategy): Process[Task, I]
Runs supplied Process of
Wvalues by sending them to remote system.Runs supplied Process of
Wvalues by sending them to remote system. Any replies from remote system are received asIvalues of the resulting process.Please note this will terminate by default after Left side (receive) terminates. If you want to terminate after Right side (W) terminates, supply terminateOn with
Request.RorRequest.Bothto terminate on Right or Any side respectively- p
Process of
Wvalues to send- terminateOn
Terminate on Left side (receive), Right side (W) or Any side terminates
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
through[I2](ch: Channel[Task, I, Process[Task, I2]]): Exchange[I2, W]
Creates Exchange that runs read
Ithrough supplied effect channel.Creates Exchange that runs read
Ithrough supplied effect channel.- ch
Channel producing process of
I2for eachIreceived
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
val
write: Sink[Task, W]
Process writing values to remote system
-
def
wye[I2, W2](y: WyeW[W, I, W2, I2])(implicit S: Strategy): Exchange[I2, W2]
Transform this Exchange to another Exchange where queueing, and transformation of this
IandWis controlled by supplied WyeW.Transform this Exchange to another Exchange where queueing, and transformation of this
IandWis controlled by supplied WyeW.Please note the
Wqueue of values to be sent to server is unbounded any may cause excessive heap usage, if the remote system will readWtoo slow. If you want to control this flow, use ratherflow.- y
WyeW to control queueing and transformation
- def →[B](y: B): (Exchange[I, W], B)