Explorer

definy.summary-snapshots-of

description
The light summaries (definy.snapshot-cache-entry-summary) of the events found in entries, in the order of events. Looks them up in a hash index (core.list-hash-index)
type
Fn(events: List<@definy.stored-event>, entries: List<@definy.snapshot-cache-entry>) -> List<@definy.event-snapshot>
expression
fn(events$0, entries$1) =>
  let index$2 = @core.list-hash-index(list: $1, field: "event_hash");
  @core.list-fold(
    T: @definy.stored-event,
    A: List<@definy.event-snapshot>,
    reducer: fn(acc$3, item$4) =>
      match @core.list-hash-index-find(index: $2, field: "event_hash", value: @definy.snapshot-summary-key(event_hash: $4.event_hash)) {
        #some(entry$5) =>
          match $5.commit {
            #some(commit$6) =>
              @core.list-append(list: $3, item: {event_hash: $4.event_hash, commit: $6}),
            #none(_) =>
              $3
          },
        #none(_) =>
          $3
      },
    init: [],
    xs: $0
  )
visibility
public
definy.summary-snapshots-of (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: nKlqeZQy59f_x5JhSrvRlg1Ai3Zz6VDl6-fz0Dfaaho
content hash: NdyN00I3drOnTEeFeP_Wc6eAEbwDSjYMis20_bkOUQw