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

com.teambytes.inflatable.raft.model.RaftSnapshot.scala Maven / Gradle / Ivy

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

import com.teambytes.inflatable.raft.ClusterConfiguration

private[inflatable] case class RaftSnapshot(meta: RaftSnapshotMetadata, data: Any) {

  // todo quite hacky... invent a way to nicely store different things in log
  def toEntry[T] =
    (new Entry(this, meta.lastIncludedTerm, meta.lastIncludedIndex) with SnapshotEntry).asInstanceOf[Entry[T]]

  def toEntrySingleList[T] = List(
    (new Entry(this, meta.lastIncludedTerm, meta.lastIncludedIndex) with SnapshotEntry).asInstanceOf[Entry[T]]
  )
}

/** Metadata describing a raft's state machine snapshot */
private[inflatable] case class RaftSnapshotMetadata(lastIncludedTerm: Term, lastIncludedIndex: Int, clusterConfiguration: ClusterConfiguration)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy