package octez-l2-libs
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
    
    
  sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
    
    
  doc/octez-l2-libs.smart-rollup/Octez_smart_rollup/Inbox/Skip_list/Lwt/index.html
Module Skip_list.LwtSource
This module contains functions in the Lwt monad.
val find : 
  deref:('ptr -> ('content, 'ptr) cell option Lwt.t) ->
  cell_ptr:'ptr ->
  target_index:Z.t ->
  ('content, 'ptr) cell option Lwt.tfind ~deref ~cell_ptr ~target_index returns Some cell where cell is the cell at position target_index. This is done by dereferencing the last pointer of the path returned by back_path.
val back_path : 
  deref:('ptr -> ('content, 'ptr) cell option Lwt.t) ->
  cell_ptr:'ptr ->
  target_index:Z.t ->
  'ptr list option Lwt.tback_path ~deref ~cell_ptr ~target_index returns Some path where path is a sequence of back pointers to traverse to go from cell_ptr to the cell at position target_index in the sequence denoted by (deref, cell_ptr).
val valid_back_path : 
  equal_ptr:('ptr -> 'ptr -> bool) ->
  deref:('ptr -> ('content, 'ptr) cell option Lwt.t) ->
  cell_ptr:'ptr ->
  target_ptr:'ptr ->
  'ptr list ->
  bool Lwt.tvalid_back_path ~equal_ptr ~deref ~cell_ptr ~target_ptr path returns true iff path is a valid and minimal path from cell_ptr to target_ptr in the skip list denoted by (deref, cell_ptr).
val search : 
  deref:('ptr -> ('content, 'ptr) cell option Lwt.t) ->
  compare:('content -> int) ->
  cell:('content, 'ptr) cell ->
  ('content, 'ptr) search_result Lwt.tsearch ~deref ~compare ~cell allows to find a cell of the skip list according to its content. This function assumes that the content of the cells is in increasing order according to the ordering defined by the function compare. In other words, this function assumes that compare is a function that returns a negative integer for cells before the target and a positive integer for cells after the target. The value returned by this function is {rev_path; last_cell} such that.
- rev_path = []if and only if- compare (content cell) > 0
- For all the cases below, if there is a path from cell Ato cellB,rev_pathcontains the list of cells to go fromBtoA. Consequently, the first element ofrev_pathisB. Except forNearest_lower, this path is a minimal path.
- last_pointer = Deref_returned_noneif- dereffails to associate a cell to a pointer during the search. In that case,- rev_pathis a path from- cellto- candidatewhere- candidateis the last cell for which candidate did not fail and such that- compare (content (candidate)) > 0.
- last_pointer = No_exact_or_lower_ptrif for all cell of the skip list,- compare (content cell) > 0. In that case,- rev_pathis a path from- cellto the genesis cell.
- last_pointer = Found targetif there is a cell- targetsuch that- compare (content target) = 0and a path from- cellto- target. In that case,- rev_pathis the minimal path from- cellto- target.
- last_pointer = Nearest_lower {lower;upper}if there is no cell in the skip list such that- compare (content cell) = 0. In that case- loweris the unique cell such that- compare (content lower) < 0and for all other cells- candidatesuch that- compare (content candidate) < 0then there is a path from- lowerto- candidate.- upper, if it exists is the successor cell to- lower, i.e.- deref ((back_pointer upper) 0) = Some lower. In that case,- rev_pathis a path from- cellto- lower. This path is *NOT* minimal but almost. The path is minimal from- cellto- upper=Some up. By minimality, the path is logarithmic. Consequently, since there is a direct pointer from- upto- lower, the passe to- loweris also logarithmic.
If a target cell target_cell exists, i.e. there is a cell such that compare target_cell = 0, then it is not necessary for deref to return Some cell for all cell such that compare cell < 0. If a target_cell does not exist, the lowest bound for which deref must return Some cell is unknown.