HelloZeroNet / HelloZeroNet/ZeroNet

Use DAG for version control

Offen
#1,284 12 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
18.8k
Forks
2.3k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hey, ZeroNet dev!

Doing version control? Consider the following _Directed Acyclic Graph_.

```
(3) (4)
↙ ↙
(0) ← (1) ← (2) ← (5)
```

Suppose these are your ZeroMe posts. Each file contains several posts. Each file is a _vertex_. You started with file `(0)`. You wrote a lot and file `(0)` exploded. You decided to make a new file `(1)` and continue writing. Weeks later, file `(1)` became full and you made another new file `(2)`.

Then you decided to edit one of your old posts and expand it a little bit. It is contained in file `(0)`. Unfortunately, your edit cannot be saved in file `(0)` because the file hit its size limit. Using a DAG, what you need to do is to

a) make a new file `(3)` and put your edited post there;
b) delete the old post from file `(0)`;
c) draw an arrow from file `(3)` to file `(0)`.

Each _vertex_ has multiple arrows going in (_in degree_), but only 1 arrow going out (_out degree_).

The earliest file is a _sink_, it has no "out" arrow. Newer files point to older files, letting you to go back in time.

You may ask, "what about file name conflict?" Short answer: This is how file systems work. To keep multiple versions of the same file, all you need to do is to name them properly.

```
fsfs-1.pdf Free Software, Free Society (first edition)
fsfs-2.pdf Free Software, Free Society (second edition)
fsfs-3.pdf Free Software, Free Society (third edition)
```

Good luck hacking DAGs and keeping manifest files small!

References:
[Git for Computer Scientists](http://eagain.net/articles/git-for-computer-scientists/)
[Git - Basic Branching and Merging](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.