<commit_before>use std::collections::BTreeMap;


pub struct Store<'a> {
  max_offset: u64,
  data: &'a BTreeMap<String, Box<BTreeMap<u64, &'a [u8]>>>
}

impl<'a> Store<'a> {
  pub fn new<'b>() -> Store<'b> {
    Store {
      max_offset: 0,
      data: &'b BTreeMap::new()
    }
  }

  pub fn add(&'a mut self, key: String, value: &'a [u8]) {
    self.max_offset += 1;
    match self.data.get_mut(&key) {
      Some(version_tree) => {
        if version_tree.insert(self.max_offset, value).is_none() {
          panic!("Invariant violation; duplicate offset detected");
        }
      },
      None => {
        let mut new_version_tree = Box::new(BTreeMap::new());
        new_version_tree.insert(self.max_offset, value);
        if self.data.insert(key, new_version_tree).is_none() {
          panic!("Invariant violation; duplicate offset detected");
        }
      }<commit_msg>Apply the parmesan.<commit_after>use std::collections::BTreeMap;


pub struct Store<'a> {
  max_offset: u64,
  data: Box<BTreeMap<&'a str, Box<BTreeMap<u64, &'a [u8]>>>>
}

impl<'a> Store<'a> {
  pub fn new<'b>() -> Store<'b> {
    Store {
      max_offset: 0,
      data: Box::new(BTreeMap::new())
    }
  }

  pub fn add(&'a mut self, key: &'a str, value: &'a [u8]) {
    self.max_offset += 1;
    if self.data.get_mut(&key).is_none() {
        if self.data.insert(key, Box::new(BTreeMap::new())).is_none() {
            panic!("Invariant violation; duplicate offset detected");
        }
    }

    if self.data.get_mut(&key).unwrap().insert(self.max_offset, value).is_none() {
      panic!("Invariant violation; duplicate offset detected");
{'fraction_non_alphanumeric': 0.1762899262899263, 'fraction_numerical': 0.009828009828009828, 'mean_word_length': 3.0522388059701493, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 24, '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': '7504871', 'n_tokens_mistral': 595, 'n_tokens_neox': 594, 'n_words': 120}