<commit_before>package unicredit.oram
package sync

import java.util.Random

import transport.Remote
import client._
import storage._


trait AbstractLocalPathORAM[K, V, Id <: K, Doc <: V] extends PathORAM[K, V, Id, Doc] {
  var position = Map.empty[K, Path]

  override def getPosition(id: K) = position.getOrElse(id, Path.random(L))

  override def putPosition(id: K, path: Path) = {
    position += (id -> path)
  }
}

class LocalPathORAM[K, V, Id <: K : Pointed, Doc <: V : Pointed](
  val client: StandardClient[(K, V)],
  val stash: Stash[K, V],
  val rng: Random,
  val L: Int,
  val Z: Int
) extends AbstractLocalPathORAM[K, V, Id, Doc] {
  val empty = implicitly[Pointed[Doc]].empty
  val emptyID = implicitly[Pointed[Id]].empty
}

object LocalPathORAM {
  import boopickle.Default._
  import java.security.SecureRandom

  implicit val pint = Pointed(-1)
  implicit val pstring = Pointed("")

  def apply[K, V, Id <: K : Pointed, Doc <: V : Pointed](
    remote: Remote,
    passPhrase: String,
    L: Int,
    Z: Int
  )(implicit picker: Pickler[(K, V)]) =
    new LocalPathORAM(
      StandardClient[(K, V)](remote, passPhrase),
      MapStash.empty[K, V],
      new SecureRandom,
      L,
      Z)

  def default(remote: Remote, passPhrase: String, L: Int = 8, Z: Int = 4) =
    apply[Int, String, Int, String](remote, passPhrase, L, Z)
}<commit_msg>Minor<commit_after>package unicredit.oram
package sync

import java.util.Random

import transport.Remote
import client._
import storage._


trait AbstractLocalPathORAM[K, V, Id <: K, Doc <: V] extends PathORAM[K, V, Id, Doc] {
  var position = Map.empty[K, Path]

  override def getPosition(id: K) = position.getOrElse(id, Path.random(L))

  override def putPosition(id: K, path: Path) = {
    position += (id -> path)
  }
}

class LocalPathORAM[K, V, Id <: K : Pointed, Doc <: V : Pointed](
  val client: StandardClient[(K, V)],
  val stash: Stash[K, V],
  val rng: Random,
  val L: Int,
  val Z: Int
) extends AbstractLocalPathORAM[K, V, Id, Doc] {
  val empty = implicitly[Pointed[Doc]].empty
  val emptyID = implicitly[Pointed[Id]].empty
}

object LocalPathORAM {
  import boopickle.Default._
  import java.security.SecureRandom

  implicit val pint = Pointed(-1)
  implicit val pstring = Pointed("")

  def apply[K: Pickler, V: Pickler, Id <: K : Pointed, Doc <: V : Pointed](
    remote: Remote,
    passPhrase: String,
    L: Int,
    Z: Int
  ) = new LocalPathORAM(
    StandardClient[(K, V)](remote, passPhrase),
    MapStash.empty[K, V],
    new SecureRandom,
    L,
    Z)

  def default(remote: Remote, passPhrase: String, L: Int = 8, Z: Int = 4) =
    apply[Int, String, Int, String](remote, passPhrase, L, Z)
}
{'fraction_non_alphanumeric': 0.1377513030528667, 'fraction_numerical': 0.0022338049143708115, 'mean_word_length': 3.6168384879725086, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 5, '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': '1563059', 'n_tokens_mistral': 1006, 'n_tokens_neox': 973, 'n_words': 286}