dxos-deprecated / halo

HALO
GNU Affero General Public License v3.0
0 stars 1 forks source link

Design Review #40

Open dmaretskyi opened 4 years ago

dmaretskyi commented 4 years ago

Messages

message-models

Class diagram

class-diagram Greeting responder states

richburdon commented 4 years ago

Tracing async event flows.

parties

richburdon commented 4 years ago

From a discussion between Rich/Thomas

Goal

Implementation

Simplified form of sorting K sorted arrays.

class StreamEvaluator {
  processMessage(feedKey, message) {
    // Check if feedKey has been admitted to an existing party.
    const party = getParty(feedKey);

    // If not, check if this is a genesis message and if so, create the Party (which then admits this feedKey).
    if (!party) {
      return processGenesis(feedKey, message);
    }

    if (isPartyMessage(message)) {
      return party.processMessage(feedKey, message);
    }

    // Get existing item.
    // NOTE: could delegate following logic to party-specific ItemStreamEvaluator (Index?)
    const { itemKey } = message;
    const model = getModel(itemKey);
    if (!model) {
      // Create item if valid, otherwise skip.
      return processItemGenesis(feedKey, message);
    }

    return model.processMessage(feedKey, message);
  }
}

Notes

Short-term clean-ups to consider

dmaretskyi commented 4 years ago

UML diagram sources: https://github.com/dxos/halo/tree/master/packages/party-manager/docs

dmaretskyi commented 4 years ago

image

richburdon commented 4 years ago
Screen Shot 2020-07-29 at 12 17 06 PM