1 /*
2  *  Make.org Core API
3  *  Copyright (C) 2018 Make.org
4  *
5  * This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU Affero General Public License as
7  *  published by the Free Software Foundation, either version 3 of the
8  *  License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Affero General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Affero General Public License
16  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17  *
18  */
19 
20 package org.make.api.userhistory
21 
22 import akka.actor.typed.{ActorRef, ActorSystem}
23 import akka.actor.typed.receptionist.ServiceKey
24 import akka.cluster.sharding.typed.scaladsl.{ClusterSharding, Entity, EntityTypeKey}
25 import org.make.api.technical.ShardingNoEnvelopeMessageExtractor
26 
27 object UserHistoryCoordinator {
28 
29   val name: String = "user-history-coordinator"
30 
31   val TypeKey: EntityTypeKey[UserHistoryCommand] =
32     EntityTypeKey[UserHistoryCommand]("user-history")
33 
34   val Key: ServiceKey[UserHistoryCommand] = ServiceKey(name)
35 
36   def apply(system: ActorSystem[_]): ActorRef[UserHistoryCommand] = {
37     ClusterSharding(system).init(
38       Entity(TypeKey)(_ => UserHistoryActor())
39         .withMessageExtractor(ShardingNoEnvelopeMessageExtractor[UserHistoryCommand](numberOfShards = 128))
40     )
41   }
42 }
Line Stmt Id Pos Tree Symbol Tests Code
29 12095 1080 - 1106 Literal <nosymbol> org.make.api.userhistory.userhistoryactortest "user-history-coordinator"
32 14610 1163 - 1212 ApplyToImplicitArgs akka.cluster.sharding.typed.scaladsl.EntityTypeKey.apply org.make.api.userhistory.userhistoryactortest akka.cluster.sharding.typed.scaladsl.EntityTypeKey.apply[org.make.api.userhistory.UserHistoryCommand]("user-history")((ClassTag.apply[org.make.api.userhistory.UserHistoryCommand](classOf[org.make.api.userhistory.UserHistoryCommand]): scala.reflect.ClassTag[org.make.api.userhistory.UserHistoryCommand]))
32 18387 1197 - 1211 Literal <nosymbol> org.make.api.userhistory.userhistoryactortest "user-history"
34 8959 1258 - 1274 ApplyToImplicitArgs akka.actor.typed.receptionist.ServiceKey.apply org.make.api.userhistory.userhistoryactortest akka.actor.typed.receptionist.ServiceKey.apply[org.make.api.userhistory.UserHistoryCommand](UserHistoryCoordinator.this.name)((ClassTag.apply[org.make.api.userhistory.UserHistoryCommand](classOf[org.make.api.userhistory.UserHistoryCommand]): scala.reflect.ClassTag[org.make.api.userhistory.UserHistoryCommand]))
34 13060 1269 - 1273 Select org.make.api.userhistory.UserHistoryCoordinator.name org.make.api.userhistory.userhistoryactortest UserHistoryCoordinator.this.name
37 11977 1350 - 1540 Apply akka.cluster.sharding.typed.scaladsl.ClusterSharding.init org.make.api.userhistory.userhistoryactortest akka.cluster.sharding.typed.scaladsl.ClusterSharding.apply(system).init[org.make.api.userhistory.UserHistoryCommand, org.make.api.userhistory.UserHistoryCommand](akka.cluster.sharding.typed.scaladsl.Entity.apply[org.make.api.userhistory.UserHistoryCommand](UserHistoryCoordinator.this.TypeKey)(((x$1: akka.cluster.sharding.typed.scaladsl.EntityContext[org.make.api.userhistory.UserHistoryCommand]) => UserHistoryActor.apply())).withMessageExtractor[org.make.api.userhistory.UserHistoryCommand](org.make.api.technical.ShardingNoEnvelopeMessageExtractor.apply[org.make.api.userhistory.UserHistoryCommand](128)))
38 11833 1407 - 1425 Apply org.make.api.userhistory.UserHistoryActor.apply UserHistoryActor.apply()
38 15112 1393 - 1400 Select org.make.api.userhistory.UserHistoryCoordinator.TypeKey org.make.api.userhistory.userhistoryactortest UserHistoryCoordinator.this.TypeKey
39 15558 1386 - 1534 Apply akka.cluster.sharding.typed.scaladsl.Entity.withMessageExtractor org.make.api.userhistory.userhistoryactortest akka.cluster.sharding.typed.scaladsl.Entity.apply[org.make.api.userhistory.UserHistoryCommand](UserHistoryCoordinator.this.TypeKey)(((x$1: akka.cluster.sharding.typed.scaladsl.EntityContext[org.make.api.userhistory.UserHistoryCommand]) => UserHistoryActor.apply())).withMessageExtractor[org.make.api.userhistory.UserHistoryCommand](org.make.api.technical.ShardingNoEnvelopeMessageExtractor.apply[org.make.api.userhistory.UserHistoryCommand](128))
39 17552 1457 - 1533 Apply org.make.api.technical.ShardingNoEnvelopeMessageExtractor.apply org.make.api.userhistory.userhistoryactortest org.make.api.technical.ShardingNoEnvelopeMessageExtractor.apply[org.make.api.userhistory.UserHistoryCommand](128)