Explorer

definy.merge-ancestors

description
The snapshots from queue[index] and their ancestors (parents and merged snapshots), nearest first (breadth first). Start with queue: [hash], index: 0, result: []
type
Fn(
  queue: List<String>,
  index: Number,
  result: List<String>,
  then: Fn(ancestors: List<String>) -> @definy.service-io
) -> @definy.service-io
expression
fn(queue$0, index$1, result$2, then$3) =>
  match @core.list-get(list: $0, index: $1) {
    #none(_) =>
      $3(ancestors: $2),
    #some(hash$4) =>
      @definy.read-snapshot-content(
        event_hash: $4,
        then: fn(commit$5) =>
          match $5 {
            #none(_) =>
              @definy.merge-ancestors(
                queue: $0,
                index: @core.plus(left: $1, right: 1),
                result: $2,
                then: fn(ancestors$8) =>
                  $3(ancestors: $8)
              ),
            #some(content$6) =>
              @definy.merge-ancestors(
                queue: @definy.merge-push-hash(list: @definy.merge-push-hash(list: $0, hash: $6.parent_commit_hash), hash: $6.merged_commit_hash),
                index: @core.plus(left: $1, right: 1),
                result: @core.list-append(list: $2, item: $4),
                then: fn(ancestors$7) =>
                  $3(ancestors: $7)
              )
          }
      )
  }
visibility
public
definy.merge-ancestors (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: hdb_EGv3nznZiV_Mx1TLWM8qkkyy6JtKbOcEJ54he1w
content hash: VxVYUOLir-W_uiaySRX1mAQH0iNlEnDA3kdJyslzqX4