diff options
author | hoijui <hoijui.quaero@gmail.com> | 2019-10-28 16:32:51 +0100 |
---|---|---|
committer | hoijui <hoijui.quaero@gmail.com> | 2019-10-28 16:32:51 +0100 |
commit | 98792a029b1f869986f1d670787a53dd2eaebbc0 (patch) | |
tree | 91e2fef1f0daabbaabb88a4b7ea4752601c424d7 /doc | |
parent | 61d9430531193376e789af103ec4b6c442cb7a23 (diff) | |
download | git-bug-98792a029b1f869986f1d670787a53dd2eaebbc0.tar.gz |
model: try to describe the `OperationPack` format more clearly
Diffstat (limited to 'doc')
-rw-r--r-- | doc/model.md | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/doc/model.md b/doc/model.md index ad5e6ce9..e60a2fa8 100644 --- a/doc/model.md +++ b/doc/model.md @@ -8,23 +8,33 @@ The biggest problem when creating a distributed bug tracker is that there is no To deal with this problem, you need a way to merge these changes in a meaningful way. -Instead of storing directly the final bug data, we store a series of edit `Operation`s. One such operation could looks like this: +Instead of storing the final bug data directly, we store a series of edit `Operation`s. + +Note: In git-bug internally it is a golang struct, but in the git repo it is stored as JSON, as seen later. + +These `Operation`s are aggregated in an `OperationPack`, a simple array. An `OperationPack` represents an edit session of a bug. We store this pack in git as a git `Blob`; that consists of a string containing a JSON array of operations. One such pack -- here with two operations -- might look like this: ```json -{ - "type": "SET_TITLE", - "author": { - "id": "5034cd36acf1a2dadb52b2db17f620cc050eb65c" +[ + { + "type": "SET_TITLE", + "author": { + "id": "5034cd36acf1a2dadb52b2db17f620cc050eb65c" + }, + "timestamp": 1533640589, + "title": "This title is better" }, - "timestamp": 1533640589, - "title": "This title is better" -} + { + "type": "ADD_COMMENT", + "author": { + "id": "5034cd36acf1a2dadb52b2db17f620cc050eb65c" + }, + "timestamp": 1533640589, + "title": "This title is better" + } +] ``` -Note: Json provided for readability. Internally it's a golang struct. - -These `Operation`s are aggregated in an `OperationPack`, a simple array. An `OperationPack` represents an edit session of a bug. We store this pack in git as a git `Blob`; that is arbitrary serialized data. - To reference our `OperationPack`, we create a git `Tree`; it references our `OperationPack` `Blob` under `"\ops"`. If any edit operation includes a media (for instance in a message), we can store that media as a `Blob` and reference it here under `"/media"`. To complete the picture, we create a git `Commit` that references our `Tree`. Each time we add more `Operation`s to our bug, we add a new `Commit` with the same data-structure to form a chain of `Commit`s. |