Machi: a small village of replicated files

About This EDoc Documentation

This EDoc-style documentation will concern itself only with Erlang function APIs and function & data types. Higher-level design and commentary will remain outside of the Erlang EDoc system; please see the "Pointers to Other Machi Documentation" section below for more details.

Readers should beware that this documentation may be out-of-sync with the source code. When in doubt, use the make edoc command to regenerate all HTML pages.

It is the developer's responsibility to re-generate the documentation periodically and commit it to the Git repo.

Machi Code Overview

Chain Manager

The Chain Manager is responsible for managing the state of Machi's "Chain Replication" state. This role is roughly analogous to the "Riak Core" application inside of Riak, which takes care of coordinating replica placement and replica repair.

For each primitive data server in the cluster, a Machi FLU, there is a Chain Manager process that manages its FLU's role within the Machi cluster's Chain Replication scheme. Each Chain Manager process executes locally and independently to manage the distributed state of a single Machi Chain Replication chain.

FLU

The FLU is the basic storage server for Machi.

For each FLU, there are three independent tasks that are implemented using three different Erlang processes:

From the perspective of failure detection, it is very convenient that all three FLU-related services (file server, sequencer server, and projection server) are accessed using the same single TCP port.

Projection (data structure)

The projection is a data structure that specifies the current state of the Machi cluster: all FLUs, which FLUS are considered up/running or down/crashed/stopped, which FLUs are actively participants in the Chain Replication protocol, and which FLUs are under "repair" (i.e., having their data resyncronized when newly-added to a cluster or when restarting after a crash).

Projection Store (server)

The projection store is a storage service that is implemented by an Erlang/OTP gen_server process that is associated with each FLU. Conceptually, the projection store is an array of write-once registers. For each projection store register, the key is a 2-tuple of an epoch number (non_neg_integer() type) and a projection type (public or private type); the value is a projection data structure (projection_v1() type).

Client and Proxy Client

Machi is intentionally avoiding using distributed Erlang for Machi's communication. This design decision makes Erlang-side code more difficult & complex but allows us the freedom of implementing parts of Machi in other languages without major protocol&API&glue code changes later in the product's lifetime.

There are two layers of interface for Machi clients.

The types for both modules ought to be the same. However, due to rapid code churn, some differences might exist. Any major difference is (almost by definition) a bug: please open a GitHub issue to request a correction.

TODO notes

Any use of the string "TODO" in upper/lower/mixed case, anywhere in the code, is a reminder signal of unfinished work.

Pointers to Other Machi Documentation


Generated by EDoc, May 20 2015, 11:11:34.