Coder Social home page Coder Social logo

nicpoyia / crdt-graph Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 25 KB

Implementation of LWW-Element-Graph in PHP

PHP 100.00%
cqrs cqrs-application cqrs-write crdt crdt-implementations crdts distributed-computing distributed-database distributed-systems lww-element-set

crdt-graph's Introduction

CRDT state-based LWW-Element-Graph implementation

Implementation

Implementation of LWW-Element-Graph is based on the implementation of LWW-Element-Set, i.e. the graph uses 2 LWW-Element-Sets internally (one for vertices and one for edges).

An additional projection/caching mechanism is used internally, in order to balance out the complexity between edits and reads, i.e. the projected state of the graph is available at anytime (according to the known/merged edits). The projected state is partially rebuilt on each merge accordingly (only the affected part).

Requirements

  • PHP 7.4 or greater

Testing approach

All layers of abstraction are tested independently:

  • Element implementation
  • Set implementation
  • Graph implementation

The "merge" operation is tested both on Set and Graph levels as follows:

  • Ensure basic functionality using simple use cases
  • Ensure edge cases are handled by simulating the appropriate scenarios
  • Ensure commutative property of merge operation
  • Ensure associative property of merge operation
  • Ensure idempotence property of merge operation

How to run automated tests

# Download Composer executable for your environment (script copied from https://getcomposer.org/download/)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
# Install dependencies
composer install
# Run automated tests with coverage
./vendor/bin/phpunit --coverage-text

crdt-graph's People

Contributors

nicpoyia avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.