2017 © Pedro Peláez
 

library storage

image

boyhagemann/storage

  • Friday, April 7, 2017
  • by boyhagemann
  • Repository
  • 1 Watchers
  • 0 Stars
  • 23 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Immutable Data Storage

This is a proof of concept of an immutable data storage system. No data will ever get mutated. Every change for both the data schema and the data itself is versioned., (*1)

This package can be used in any API framework., (*2)

Testing

Run vendor/bin/phpunit to run all tests., (*3)

Quick Start

  1. Setup the Entity and a Record
    $pdo = new PDO( ... );
    $entity = new MysqlEntity($pdo);
    $record = new MysqlRecord($pdo);
  1. Create a new entity, (*4)

  2. Insert a record, (*5)

Drivers

By default, it ships with a Mysql driver. But you can make your own driver, as long as it follows the interfaces. The drivers must have a test file that extends the AbstractTest.php., (*6)

Entities and Records

The package is divided in two concepts: 1. Entities 2. Records, (*7)

Entity

An Entity reflects a table in MySQL. It holds the structure of the data. An Entity has many Fields that defines the structure. This is what happens of something changes in an Entity or a Field: * If an Entity changes, the version of the Entity increments with 1. * If a Field changes, the version of the Field and its Entity increments with 1., (*8)

Record

A Record reflects a table row in MySQL. Each Records has a unique _id and holds the actual data. A Record has many Values that makes up the data. This is what happens of something changes in a Record: * If the changes of the Record differ from the last version, then the version of the Record increments with 1. * If a provided Value differs from the last version of this Value, the version for this Value increments with 1., (*9)

The Versions

07/04 2017