Explorer

definy.read-snapshot-events

description
(en) acc followed by the accepted project snapshot events from offset in the order of the store (newest first, 500 at a time), without their bytes
type
Fn(
  offset: Number,
  acc: List<@definy.stored-event>,
  then: Fn(events: List<@definy.stored-event>) -> @definy.service-io
) -> @definy.service-io
expression
fn(offset$0, acc$1, then$2) =>
  @definy.store-read-events-page-of(
    event_type: #some("project_commit"),
    limit: 500,
    offset: $0,
    bytes: false,
    then: fn(events$3) =>
      let acc$4 = @core.list-concat(left: $1, right: $3);
      match @core.less-than(left: @core.list-length(value: $3), right: 500) {
        true =>
          $2(events: $4),
        false =>
          @definy.read-snapshot-events(
            offset: @core.plus(left: $0, right: 500),
            acc: $4,
            then: fn(events$5) =>
              $2(events: $5)
          )
      }
  )
visibility
public
definy.read-snapshot-events (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: uwGzBMwPDZi9zCJ08GyRloCYx7tUab39ugS772H--Cs
content hash: 412pJ3wuIWxZ22RdHEMdW8OUT2TWmvf8fzFFyXhNzjs