<commit_before><?php

namespace fijma\Mu;

/**
 * Defines the api for Mu data repositories.
 *
 * Records are arrays of the following form:
 *     [     'id' => integer,            // unique id
 *         'type' => string,             // the record type
 *      'version' => string,             // version id (for optimistic locking)
 *      'deleted' => boolean,            // flags whether record is deleted (no hard deletes)
 *         'data' => ['key' => value...] // array of key/value pairs of record properties
 *     ]
 *
 * Note that implementing classes are permitted to add additional key/value pairs for their
 * own purposes, but this minimal definition will be validated by the Mu api.
 * 
 * Field type arrays are of the following form:
 *     ['fieldtype_name' => 'implementing_class', ...]
 *
 */
abstract class Store
{

    /**
     * Creates a new record of given type with given data and returns a record array.
     * This function must throw an Exception on failure.
     */
    abstract public function create($type, Array $data);

    /**
     * Returns the record for the given id, or null if id not found.
     */
    abstract public function get($id);

    /**
     * Flags the given record as deleted in the repository.
     * Returns the deleted record.
     * This function must throw an Exception on failure.<commit_msg>Tweaked a note. Not worth a commit but I'm OCD.<commit_after><?php

namespace fijma\Mu;

/**
 * Defines the api for Mu data repositories.
 *
 * Records are arrays of the following form:
 *     [     'id' => integer,            // unique id
 *         'type' => string,             // the record type
 *      'version' => string,             // version id (for optimistic locking and version history)
 *      'deleted' => boolean,            // flags whether record is deleted (no hard deletes)
 *         'data' => ['key' => value...] // array of key/value pairs of record properties
 *     ]
 *
 * Note that implementing classes are permitted to add additional key/value pairs for their
 * own purposes, but this minimal definition will be validated by the Mu api.
 * 
 * Field type arrays are of the following form:
 *     ['fieldtype_name' => 'implementing_class', ...]
 *
 */
abstract class Store
{

    /**
     * Creates a new record of given type with given data and returns a record array.
     * This function must throw an Exception on failure.
     */
    abstract public function create($type, Array $data);

    /**
     * Returns the record for the given id, or null if id not found.
     */
    abstract public function get($id);

    /**
     * Flags the given record as deleted in the repository.
     * Returns the deleted record.
     * This function must throw an Exception on failure.
{'fraction_non_alphanumeric': 0.09760522496371553, 'fraction_numerical': 0.0, 'mean_word_length': 2.3176895306859207, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '1944898', 'n_tokens_mistral': 712, 'n_tokens_neox': 697, 'n_words': 329}