<commit_before>package io.vamp.core.persistence.actor

import akka.actor.Props
import akka.util.Timeout
import com.typesafe.config.ConfigFactory
import io.vamp.common.akka._
import io.vamp.core.model.artifact.Artifact
import io.vamp.core.persistence.actor.PersistenceActor.PersistenceMessages
import io.vamp.core.persistence.notification.UnsupportedPersistenceRequest
import io.vamp.core.persistence.store.{InMemoryStoreProvider, JdbcStoreProvider}

import scala.concurrent.duration._
import scala.language.existentials

object PersistenceActor extends ActorDescription {

  lazy val timeout = Timeout(ConfigFactory.load().getInt("persistence.response.timeout").seconds)

  def props(args: Any*): Props = Props[PersistenceActor]

  trait PersistenceMessages

  case class All(`type`: Class[_ <: Artifact]) extends PersistenceMessages

  case class Create(artifact: Artifact, ignoreIfExists: Boolean = true) extends PersistenceMessages

  case class Read(name: String, `type`: Class[_ <: Artifact]) extends PersistenceMessages

  case class Update(artifact: Artifact, create: Boolean = false) extends PersistenceMessages

  case class Delete(name: String, `type`: Class[_ <: Artifact]) extends PersistenceMessages

  case class ReadExpanded(name: String, `type`: Class[_ <: Artifact]) extends PersistenceMessages

}

class PersistenceActor extends PersistingActor with InMemoryStoreProvider /* JdbcStoreProvider */ {

  override protected def requestType: Class[_] = classOf[PersistenceMessages]

  override protected def errorRequest(request: Any): RequestError = UnsupportedPersistenceRequest(request)

  override def createDefaultArtifact(artifact: Artifact, ignoreIfExists: Boolean): Artifact = store.create(artifact, ignoreIfExists)

  override def getAllDefaultArtifacts(ofType: Class[_ <: Artifact]): List[_ <: Artifact] = store.all(ofType)

  override def updateDefaultArtifact(artifact: Artifact, create: Boolean): Artifact = store.update(artifact, create)

  override def deleteDefaultArtifact(name: String, ofType: Class[_ <: Artifact]): Artifact = store.delete(name, ofType)

  override def readDefaultArtifact(name: String, ofType: Class[_ <: Artifact]): Option[Artifact] = store.read(name, ofType)
}<commit_msg>pulse client update<commit_after>package io.vamp.core.persistence.actor

import akka.actor.Props
import akka.util.Timeout
import com.typesafe.config.ConfigFactory
import io.vamp.common.akka._
import io.vamp.core.model.artifact.Artifact
import io.vamp.core.persistence.actor.PersistenceActor.PersistenceMessages
import io.vamp.core.persistence.notification.UnsupportedPersistenceRequest
import io.vamp.core.persistence.store.{InMemoryStoreProvider, JdbcStoreProvider}

import scala.concurrent.duration._
import scala.language.existentials

object PersistenceActor extends ActorDescription {

  lazy val timeout = Timeout(ConfigFactory.load().getInt("persistence.response.timeout").seconds)

  def props(args: Any*): Props = Props[PersistenceActor]

  trait PersistenceMessages

  case class All(`type`: Class[_ <: Artifact]) extends PersistenceMessages

  case class Create(artifact: Artifact, ignoreIfExists: Boolean = true) extends PersistenceMessages

  case class Read(name: String, `type`: Class[_ <: Artifact]) extends PersistenceMessages

  case class Update(artifact: Artifact, create: Boolean = false) extends PersistenceMessages

  case class Delete(name: String, `type`: Class[_ <: Artifact]) extends PersistenceMessages

  case class ReadExpanded(name: String, `type`: Class[_ <: Artifact]) extends PersistenceMessages

}

class PersistenceActor extends PersistingActor with JdbcStoreProvider {

  override protected def requestType: Class[_] = classOf[PersistenceMessages]

  override protected def errorRequest(request: Any): RequestError = UnsupportedPersistenceRequest(request)

  override def createDefaultArtifact(artifact: Artifact, ignoreIfExists: Boolean): Artifact = store.create(artifact, ignoreIfExists)

  override def getAllDefaultArtifacts(ofType: Class[_ <: Artifact]): List[_ <: Artifact] = store.all(ofType)

  override def updateDefaultArtifact(artifact: Artifact, create: Boolean): Artifact = store.update(artifact, create)

  override def deleteDefaultArtifact(name: String, ofType: Class[_ <: Artifact]): Artifact = store.delete(name, ofType)

  override def readDefaultArtifact(name: String, ofType: Class[_ <: Artifact]): Option[Artifact] = store.read(name, ofType)
}
{'fraction_non_alphanumeric': 0.09579755987347492, 'fraction_numerical': 0.0, 'mean_word_length': 6.766666666666667, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1089318', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1195, 'n_words': 313}