Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Build the document journal (history chain)

Open TrueDoctor opened this issue 3 years ago • 2 comments

~~Generate inverse operation for a given operation and store both in the document. This will be used to implement the history feature~~

Store a chain of history events and add the ability to navigate in it.

Should be done after: #134

Complexity: 5 Involves: Document (Rust)

TrueDoctor avatar May 10 '21 13:05 TrueDoctor

We could consider adding unique hashes to each operation/unoperation combination to be able to uniquely some history event special attention has to be payed to keep paths/indices consistent

TrueDoctor avatar May 10 '21 13:05 TrueDoctor

Generate inverse operation for a given operation and store both in the document.

So every operation must be defined in two ways: its forward and inverse direction? An inverse operation would be like a regular operation but its action makes changes to the graph which undoes its previous (forward) operation?

This will be used to implement the history feature

I assume you mean the history chain (perhaps we should call it the Ledger). Why do we need the concept of an "inverse operation" when we could instead just roll back to the previous state of the world one ledger entry ago?

We could consider adding unique hashes to each operation/unoperation combination to be able to uniquely some history event

Is an index in the ledger (starting at 0 from the first event) not sufficient? I don't think there would ever be references to future points in history, so if you undo enough to invalidate a reference to another point in history (using an index number), that reference shouldn't exist anymore and it wouldn't be a problem. The only problem I see with using indices is that we might someday implement a history collapse feature which would consolidate the journal history by removing redundant events (like those which were later deleted but didn't have an effect on later points in history).

Keavon avatar May 11 '21 05:05 Keavon