@dxos/echo
    Preparing search index...

    Function history

    • Returns the items reachable from a head by following lineage — a feed's git log --first-parent.

      Walks backwards from the head: an item with an explicit lineage parent jumps to that item, leaving everything appended in between unreachable; an item without one steps to its predecessor. So a feed appended as M1, M2, M3, M4, M5(M3) yields M1, M2, M3, M5, with M4 unreachable but still present in the log — the log is the object store, this function is what HEAD reaches.

      items must be in append order — the walk is positional, and pre-sorting by a wall-clock field such as created would corrupt it. Lineage is resolved over exactly the list passed in, so a parent excluded by the caller's filter reads as absent (shallow), same as one that has not replicated yet or whose stored id does not parse.

      Type Parameters

      Parameters

      Returns History<T>

      const messages = yield* Feed.query(feed, Filter.type(Message.Message)).run;
      const { items, shallow } = Feed.history(messages);

      O(n) in items; one pass to index ids and one backwards walk.