Skip to content

Commit 02b35df

Browse files
committed
more specific names.
1 parent d44322e commit 02b35df

File tree

5 files changed

+49
-45
lines changed

5 files changed

+49
-45
lines changed

src/main/scala/gopher/GopherAPI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class GopherAPI(as: ActorSystem, es: ExecutionContext)
5252
.asInstanceOf[Future[ActorRef]]
5353
)
5454

55-
new ActorBackedChannel[A](futureChannelRef, this)
55+
new ActorBackedBufferedChannel[A](futureChannelRef, this)
5656
}
5757

5858
def makeEffectedInput[A](in: Input[A], threadingPolicy: ThreadingPolicy = ThreadingPolicy.Single) =

src/main/scala/gopher/channels/ActorBackedChannel.scala renamed to src/main/scala/gopher/channels/ActorBackedBufferedChannel.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import scala.language.postfixOps
1111
import scala.reflect.macros.blackbox.Context
1212
import scala.reflect.api._
1313

14-
class ActorBackedChannel[A](futureChannelRef: Future[ActorRef], override val api: GopherAPI) extends Channel[A](api)
14+
class ActorBackedBufferedChannel[A](futureChannelRef: Future[ActorRef], override val api: GopherAPI) extends Channel[A](api)
1515
{
1616

1717
def cbread[B](f: ContRead[A,B] => Option[ContRead.In[A] => Future[Continuated[B]]], flwt: FlowTermination[B] ): Unit =

src/main/scala/gopher/channels/ChannelActor.scala renamed to src/main/scala/gopher/channels/BufferedChannelActor.scala

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,11 @@ import scala.concurrent._
66
import scala.collection.immutable._
77
import gopher._
88

9-
sealed trait ChannelActorMessage
10-
11-
case object ChannelClose extends ChannelActorMessage
12-
13-
/**
14-
* this is message wich send to ChannelActor, when we
15-
* know, that channel is closed. In such case, we don't
16-
* konw: is actor stopped or not, So, we say this message
17-
* (instead read) and wait for reply. If reply is not received
18-
* within given timeout: think that channel is-dead.
19-
*/
20-
case class ClosedChannelRead(cont: ContRead[_,_]) extends ChannelActorMessage
21-
22-
/**
23-
* this message is send, when all references to
24-
* some instance of this channel are unreachable,
25-
* so if we have no other instances (i.e. remote
26-
* channel incarnation), than we must destroy channel.
27-
**/
28-
case object ChannelRefDecrement extends ChannelActorMessage
29-
30-
/**
31-
* this message is send, when we create new remote
32-
* reference to channel, backed by this actor.
33-
**/
34-
case object ChannelRefIncrement extends ChannelActorMessage
35-
36-
/**
37-
* result of CloseChannelRead, return number of elements
38-
* left to read
39-
*/
40-
case class ChannelCloseProcessed(nElements: Int) extends ChannelActorMessage
41-
42-
/**
43-
* When we decide to stop channel, do it via special message,
44-
* to process one after messages, which exists now in queue.
45-
*
46-
* Note, that channel-stop messages can be send only from ChannelActor
47-
*/
48-
case object GracefullChannelStop extends ChannelActorMessage
49-
509

5110
/**
5211
* ChannelActor - actor, which leave
5312
*/
54-
class ChannelActor[A](id:Long, capacity:Int, api: GopherAPI) extends Actor
13+
class BufferedChannelActor[A](id:Long, capacity:Int, api: GopherAPI) extends Actor
5514
{
5615

5716
def receive = {
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package gopher.channels
2+
3+
import scala.language.existentials
4+
5+
sealed trait ChannelActorMessage
6+
7+
case object ChannelClose extends ChannelActorMessage
8+
9+
/**
10+
* this is message wich send to ChannelActor, when we
11+
* know, that channel is closed. In such case, we don't
12+
* konw: is actor stopped or not, So, we say this message
13+
* (instead read) and wait for reply. If reply is not received
14+
* within given timeout: think that channel is-dead.
15+
*/
16+
case class ClosedChannelRead(cont: ContRead[_,_]) extends ChannelActorMessage
17+
18+
/**
19+
* this message is send, when all references to
20+
* some instance of this channel are unreachable,
21+
* so if we have no other instances (i.e. remote
22+
* channel incarnation), than we must destroy channel.
23+
**/
24+
case object ChannelRefDecrement extends ChannelActorMessage
25+
26+
/**
27+
* this message is send, when we create new remote
28+
* reference to channel, backed by this actor.
29+
**/
30+
case object ChannelRefIncrement extends ChannelActorMessage
31+
32+
/**
33+
* result of CloseChannelRead, return number of elements
34+
* left to read
35+
*/
36+
case class ChannelCloseProcessed(nElements: Int) extends ChannelActorMessage
37+
38+
/**
39+
* When we decide to stop channel, do it via special message,
40+
* to process one after messages, which exists now in queue.
41+
*
42+
* Note, that channel-stop messages can be send only from ChannelActor
43+
*/
44+
case object GracefullChannelStop extends ChannelActorMessage
45+

src/main/scala/gopher/channels/ChannelSupervisor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ChannelSupervisor(api: GopherAPI) extends Actor
1212

1313
def receive = {
1414
case NewChannel(id,capacity) =>
15-
val props = Props(classOf[ChannelActor[_]],id, capacity, api)
15+
val props = Props(classOf[BufferedChannelActor[_]],id, capacity, api)
1616
sender ! context.actorOf(props, name=id.toString)
1717
case CloseChannel(id) =>
1818
context.actorSelection(id.toString) ! ChannelClose

0 commit comments

Comments
 (0)