Home > Engineering > Mycelium > Git

Git

In Mycelium, Git is the slow-heartbeat engine: checkpoints and commits, at the pace of commits rather than of records. It is about state: the repository as it stands now, and as it stood before. State moves on a commit at a time, and each commit is a checkpoint: an atomic step from one consistent state to the next, its integrity carried in the hashes. Data in motion is Kafka’s; Git keeps what the data has come to. For Git on its own terms, see the Git subject.

Layers as branches

An mrepo, a repository that runs, keeps its state in layers, and each layer is a branch. Layering is separation of concerns: main holds the data, the other layers its metadata, each concern a layer of its own.

Some layers are static: main, the protocols, the packages the mrepo is made of, the types it knows in avro. They change at Git’s slow heartbeat, not with each request. Others are dynamic: the inbox and the outbox, the request layers, the execute branches, where requests pass through. Several of these are topics, and the execute branches live only as long as their request. The dynamic layers are where Git and Kafka meet, in one repository.

The rules are few:

A request on branches of its own

A request is the unit of change, and Git gives it its transaction. It is worked on branches of its own, made from the head of each layer it writes to. When it is done, each branch that moved becomes one commit on its target; what the request did step by step stays out of the target’s history. A failed request’s branches are discarded and nothing reaches the target. The record of the request itself, what was asked and what happened, is kept apart, as a record in a topic.

One repository, several engines

The repository rules sit over a contract that more than one Git engine meets: native Git, and p2p-git, our own, which runs on the filesystem or on a peer-to-peer store. The same repository runs on any of them.

The direction: only main goes on the peer-to-peer store, as the repository’s external state, replicated to peers. The other layers stay on the peer, not replicated, as its internal state. From outside, none of them shows: an mrepo presents main, its data.

The documentation as built is in base-docs-package, and the direction in base-docs-vision.