charslaw / Pando

Pando serializes and tracks the history of a state tree
MIT License
2 stars 0 forks source link

Add Sequence Diagram illustrating the internal process of saving a snapshot to a `PandoRepository` #44

Open schultzcole opened 2 years ago

schultzcole commented 2 years ago

https://mermaid-js.github.io/ is a good choice for creating the diagram. Github supports mermaid natively so we shouldn't even need to export it

sequenceDiagram
    actor Client
    participant ActorA as Repository
    participant ActorB as Serializer
    participant ActorC as sub-Serializer
    participant ActorD as IO
    Note over ActorA: High level API for saving a snapshot of the state tree
    Note over ActorB,ActorC: Converts state tree to binary representation and sends it to IO
    Note over ActorD: Writes to and retreives binary data to persistence source
    Client->>+ActorA: save snapshot
    ActorA->>+ActorB: serialize node
    loop Each child
        ActorB->>+ActorC: serialize child
        ActorC->>+ActorD: add node
        ActorD->>-ActorC: node hash
        ActorC->>-ActorB: child node hash
        Note over ActorB,ActorD: performed recursively over the depth of the state tree
    end
    ActorB->>+ActorD: add node
    ActorD->>-ActorB: node hash
    ActorB->>-ActorA: node hash
    ActorA->>+ActorD: add snapshot
    ActorD->>-ActorA: snapshot hash
    ActorA->>ActorA: update snapshot tree
    ActorA->>-Client: snapshot hash