All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.teambytes.inflatable.raft.compaction.DefaultLogCompactionSupport.scala Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
package com.teambytes.inflatable.raft.compaction

import akka.actor.{ActorSystem, Extension}
import com.teambytes.inflatable.raft.model._
import akka.serialization.SerializationExtension
import com.teambytes.inflatable.raft.model.RaftSnapshot

/**
 * Simplest possible log compaction.
 * We do not store snapshots anywhere externaly, just apply the compaction to the replicated log.
 */
private[inflatable] class DefaultLogCompactionSupport(system: ActorSystem) extends LogCompactionSupport with Extension {

  val log = system.log
  val serialization = SerializationExtension(system)

  def compact[Command](replicatedLog: ReplicatedLog[Command], snapshot: RaftSnapshot): ReplicatedLog[Command] = {
    log.debug("Compacting replicated log until: {}", snapshot.meta)

    replicatedLog.compactedWith(snapshot)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy