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.technical
21 
22 import akka.actor.typed.ActorSystem
23 import akka.persistence.cassandra.query.scaladsl.CassandraReadJournal
24 import akka.persistence.query.PersistenceQuery
25 import org.make.api.proposal.ProposalActor
26 import org.make.api.sessionhistory.SessionHistoryActor
27 import org.make.api.userhistory.UserHistoryActor
28 
29 trait DefaultReadJournalComponent extends BaseReadJournalComponent[CassandraReadJournal] with ReadJournalComponent {
30   self: ActorSystemComponent =>
31 
32   override def proposalJournal: CassandraReadJournal = ReadJournal.proposalJournal(actorSystem)
33   override def userJournal: CassandraReadJournal = ReadJournal.userJournal(actorSystem)
34   override def sessionJournal: CassandraReadJournal = ReadJournal.sessionJournal(actorSystem)
35 }
36 
37 object ReadJournal {
38   def proposalJournal[T](system: ActorSystem[_]): T =
39     PersistenceQuery(system = system).readJournalFor(ProposalActor.QueryJournalPluginId)
40   def userJournal[T](system: ActorSystem[_]): T =
41     PersistenceQuery(system = system).readJournalFor(UserHistoryActor.QueryJournalPluginId)
42   def sessionJournal[T](system: ActorSystem[_]): T =
43     PersistenceQuery(system = system).readJournalFor(SessionHistoryActor.QueryJournalPluginId)
44 }
Line Stmt Id Pos Tree Symbol Tests Code
32 16570 1283 - 1323 Apply org.make.api.technical.ReadJournal.proposalJournal ReadJournal.proposalJournal[Nothing](DefaultReadJournalComponent.this.actorSystem)
32 10142 1311 - 1322 Select org.make.api.technical.ActorSystemComponent.actorSystem DefaultReadJournalComponent.this.actorSystem
33 12778 1399 - 1410 Select org.make.api.technical.ActorSystemComponent.actorSystem DefaultReadJournalComponent.this.actorSystem
33 8936 1375 - 1411 Apply org.make.api.technical.ReadJournal.userJournal ReadJournal.userJournal[Nothing](DefaultReadJournalComponent.this.actorSystem)
34 16722 1493 - 1504 Select org.make.api.technical.ActorSystemComponent.actorSystem org.scalatest.testsuite DefaultReadJournalComponent.this.actorSystem
34 13625 1466 - 1505 Apply org.make.api.technical.ReadJournal.sessionJournal org.scalatest.testsuite ReadJournal.sessionJournal[Nothing](DefaultReadJournalComponent.this.actorSystem)
39 10005 1637 - 1671 Select org.make.api.proposal.ProposalActor.QueryJournalPluginId org.scalatest.testsuite org.make.api.proposal.ProposalActor.QueryJournalPluginId
39 15537 1588 - 1672 Apply akka.persistence.query.PersistenceQuery.readJournalFor org.scalatest.testsuite akka.persistence.query.PersistenceQuery.apply(system).readJournalFor[Nothing](org.make.api.proposal.ProposalActor.QueryJournalPluginId)
41 10533 1727 - 1814 Apply akka.persistence.query.PersistenceQuery.readJournalFor akka.persistence.query.PersistenceQuery.apply(system).readJournalFor[Nothing](org.make.api.userhistory.UserHistoryActor.QueryJournalPluginId)
41 11950 1776 - 1813 Select org.make.api.userhistory.UserHistoryActor.QueryJournalPluginId org.make.api.userhistory.UserHistoryActor.QueryJournalPluginId
43 16587 1921 - 1961 Select org.make.api.sessionhistory.SessionHistoryActor.QueryJournalPluginId org.scalatest.testsuite org.make.api.sessionhistory.SessionHistoryActor.QueryJournalPluginId
43 12746 1872 - 1962 Apply akka.persistence.query.PersistenceQuery.readJournalFor org.scalatest.testsuite akka.persistence.query.PersistenceQuery.apply(system).readJournalFor[Nothing](org.make.api.sessionhistory.SessionHistoryActor.QueryJournalPluginId)