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 cats.implicits._
23 import akka.actor.ClassicActorSystemProvider
24 import akka.persistence.cassandra.cleanup.{Cleanup, CleanupSettings}
25 import com.typesafe.config.ConfigValueFactory
26 import org.make.core.StringValue
27 
28 import scala.concurrent.Future
29 
30 object MakePersistentActor extends ShortenedNames {
31   def delete[ID <: StringValue](
32     id: ID,
33     plugin: String
34   )(implicit ec: EC, provider: ClassicActorSystemProvider): Future[Unit] = {
35     new Cleanup(
36       provider,
37       new CleanupSettings(
38         provider.classicSystem.settings.config
39           .getConfig("akka.persistence.cassandra.cleanup")
40           .withValue("plugin-location", ConfigValueFactory.fromAnyRef(plugin.dropRight(".journal".length)))
41       )
42     ).deleteAll(persistenceId = id.value, neverUsePersistenceIdAgain = true).void
43   }
44 }
Line Stmt Id Pos Tree Symbol Tests Code
37 337 1259 - 1501 Apply akka.persistence.cassandra.cleanup.CleanupSettings.<init> new akka.persistence.cassandra.cleanup.CleanupSettings(provider.classicSystem.settings.config.getConfig("akka.persistence.cassandra.cleanup").withValue("plugin-location", com.typesafe.config.ConfigValueFactory.fromAnyRef(scala.Predef.augmentString(plugin).dropRight(".journal".length()))))
39 342 1348 - 1384 Literal <nosymbol> "akka.persistence.cassandra.cleanup"
40 387 1426 - 1492 Apply com.typesafe.config.ConfigValueFactory.fromAnyRef com.typesafe.config.ConfigValueFactory.fromAnyRef(scala.Predef.augmentString(plugin).dropRight(".journal".length()))
40 363 1288 - 1493 Apply com.typesafe.config.Config.withValue provider.classicSystem.settings.config.getConfig("akka.persistence.cassandra.cleanup").withValue("plugin-location", com.typesafe.config.ConfigValueFactory.fromAnyRef(scala.Predef.augmentString(plugin).dropRight(".journal".length())))
40 357 1473 - 1490 Apply java.lang.String.length ".journal".length()
40 332 1456 - 1491 Apply scala.collection.StringOps.dropRight scala.Predef.augmentString(plugin).dropRight(".journal".length())
40 380 1407 - 1424 Literal <nosymbol> "plugin-location"
42 343 1224 - 1578 Apply akka.persistence.cassandra.cleanup.Cleanup.deleteAll new akka.persistence.cassandra.cleanup.Cleanup(provider, new akka.persistence.cassandra.cleanup.CleanupSettings(provider.classicSystem.settings.config.getConfig("akka.persistence.cassandra.cleanup").withValue("plugin-location", com.typesafe.config.ConfigValueFactory.fromAnyRef(scala.Predef.augmentString(plugin).dropRight(".journal".length()))))).deleteAll(id.value, true)
42 352 1224 - 1583 Select cats.Functor.Ops.void cats.implicits.toFunctorOps[scala.concurrent.Future, akka.Done](new akka.persistence.cassandra.cleanup.Cleanup(provider, new akka.persistence.cassandra.cleanup.CleanupSettings(provider.classicSystem.settings.config.getConfig("akka.persistence.cassandra.cleanup").withValue("plugin-location", com.typesafe.config.ConfigValueFactory.fromAnyRef(scala.Predef.augmentString(plugin).dropRight(".journal".length()))))).deleteAll(id.value, true))(cats.implicits.catsStdInstancesForFuture(ec)).void
42 381 1517 - 1517 ApplyToImplicitArgs cats.instances.FutureInstances.catsStdInstancesForFuture cats.implicits.catsStdInstancesForFuture(ec)
42 372 1534 - 1542 Select org.make.core.StringValue.value id.value
42 365 1573 - 1577 Literal <nosymbol> true