<commit_before>package justin.db

import java.util.UUID

import justin.consistent_hashing.NodeId
import justin.db.replication.{R, W}

object StorageNodeActorProtocol {

  // read part
  sealed trait StorageNodeReadData
  object StorageNodeReadData {
    case class Local(id: UUID)            extends StorageNodeReadData
    case class Replicated(r: R, id: UUID) extends StorageNodeReadData
  }

  sealed trait StorageNodeReadingResult
  object StorageNodeReadingResult {
    case class Found(data: Data)           extends StorageNodeReadingResult
    case class Conflicts(data: List[Data]) extends StorageNodeReadingResult
    case object NotFound                   extends StorageNodeReadingResult
    case object FailedRead                 extends StorageNodeReadingResult
  }

  // write part
  sealed trait StorageNodeWriteData
  object StorageNodeWriteData {
    case class Local(data: Data)           extends StorageNodeWriteData
    case class Replicate(w: W, data: Data) extends StorageNodeWriteData
  }

  sealed trait StorageNodeWritingResult
  object StorageNodeWritingResult {
    case object SuccessfulWrite                              extends StorageNodeWritingResult
    case object FailedWrite                                  extends StorageNodeWritingResult
    case class ConflictedWrite(oldData: Data, newData: Data) extends StorageNodeWritingResult
  }

  // cluster part
  case class RegisterNode(nodeId: NodeId)
}<commit_msg>better comments<commit_after>package justin.db

import java.util.UUID

import justin.consistent_hashing.NodeId
import justin.db.replication.{R, W}

object StorageNodeActorProtocol {

  // ----- READ PART ----
  // INPUT
  sealed trait StorageNodeReadData
  object StorageNodeReadData {
    case class Local(id: UUID)            extends StorageNodeReadData
    case class Replicated(r: R, id: UUID) extends StorageNodeReadData
  }
  // OUTPUT
  sealed trait StorageNodeReadingResult
  object StorageNodeReadingResult {
    case class Found(data: Data)           extends StorageNodeReadingResult
    case class Conflicts(data: List[Data]) extends StorageNodeReadingResult
    case object NotFound                   extends StorageNodeReadingResult
    case object FailedRead                 extends StorageNodeReadingResult
  }
  // ------

  // ----- WRITE PART ----
  // INPUT
  sealed trait StorageNodeWriteData
  object StorageNodeWriteData {
    case class Local(data: Data)           extends StorageNodeWriteData
    case class Replicate(w: W, data: Data) extends StorageNodeWriteData
  }
  // OUTPUT
  sealed trait StorageNodeWritingResult
  object StorageNodeWritingResult {
    case object SuccessfulWrite                              extends StorageNodeWritingResult
    case object FailedWrite                                  extends StorageNodeWritingResult
    case class ConflictedWrite(oldData: Data, newData: Data) extends StorageNodeWritingResult
  }
  // ------

  // ----- CLUSTER PART ----
  case class RegisterNode(nodeId: NodeId)
}
{'fraction_non_alphanumeric': 0.0583138953682106, 'fraction_numerical': 0.0, 'mean_word_length': 2.8835705045278135, 'pattern_counts': {'":': 0, '<': 3, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6346429', 'n_tokens_mistral': 779, 'n_tokens_neox': 751, 'n_words': 223}