Pure OCaml B-tree implementation for persistent storage
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): resolve E410 doc style issues and apply dune fmt

Add missing periods to doc comments, fix [name] format mismatches,
rename camelCase variant constructors to snake_case in hooks.ml,
and apply dune fmt formatting.

+40 -5
+8
lib/btree.mli
··· 68 68 (** [cell_pointers page header_offset header] returns cell pointer array. *) 69 69 70 70 val get_u16_be : string -> int -> int 71 + 71 72 val get_u32_be : string -> int -> int 73 + (** Read unsigned 32-bit big-endian integer. *) 74 + 72 75 val set_u16_be : bytes -> int -> int -> unit 76 + (** Write unsigned 16-bit big-endian integer. *) 77 + 73 78 val set_u32_be : bytes -> int -> int -> unit 79 + (** Write unsigned 32-bit big-endian integer. *) 74 80 end 75 81 76 82 (** {1 Cells} ··· 99 105 (** Index interior cell: child page + payload *) 100 106 101 107 val max_local : usable_size:int -> is_table:bool -> int 108 + 102 109 val min_local : usable_size:int -> int 110 + (** Minimum local payload size. *) 103 111 104 112 val parse_table_leaf : string -> int -> usable_size:int -> table_leaf * int 105 113 (** [parse_table_leaf buf off ~usable_size] parses a table leaf cell. Returns
+2
lib/cell.mli
··· 26 26 (** Index interior cell: child page + payload. *) 27 27 28 28 val max_local : usable_size:int -> is_table:bool -> int 29 + 29 30 val min_local : usable_size:int -> int 31 + (** Minimum local payload size. *) 30 32 31 33 val parse_table_leaf : string -> int -> usable_size:int -> table_leaf * int 32 34 (** [parse_table_leaf buf off ~usable_size] parses a table leaf cell. Returns
+3 -5
lib/index.ml
··· 115 115 header.Page.cell_content_start - ptr_area_end - header.Page.fragmented_bytes 116 116 117 117 (* Encode an index leaf cell - handles overflow for large payloads *) 118 - let encode_index_leaf_cell_with_overflow t ~payload = 118 + let encode_leaf_cell_overflow t ~payload = 119 119 let payload_size = String.length payload in 120 120 let usable_size = usable_size t in 121 121 let max_local = Cell.max_local ~usable_size ~is_table:false in ··· 367 367 (* Read full payload including from overflow pages *) 368 368 let full_payload = read_full_payload t page cell_off ~usable_size:usable in 369 369 (* Re-encode with overflow support *) 370 - let cell_data = 371 - encode_index_leaf_cell_with_overflow t ~payload:full_payload 372 - in 370 + let cell_data = encode_leaf_cell_overflow t ~payload:full_payload in 373 371 new_cell_content_start := 374 372 write_cell new_buf ~cell_content_start:!new_cell_content_start 375 373 ~cell:cell_data; ··· 535 533 let rec insert_into_leaf t page_num ~key ~parent_stack = 536 534 let page = Pager.read t.pager page_num in 537 535 let header = Page.parse_header page 0 in 538 - let cell = encode_index_leaf_cell_with_overflow t ~payload:key in 536 + let cell = encode_leaf_cell_overflow t ~payload:key in 539 537 let cell_len = String.length cell in 540 538 let space_needed = cell_len + 2 in 541 539 (* cell + pointer *)
+12
lib/page.mli
··· 12 12 | Leaf_table (** 0x0d *) 13 13 14 14 val pp_page_type : Format.formatter -> page_type -> unit 15 + 15 16 val page_type_of_byte : int -> page_type 17 + (** Convert byte to page type. *) 18 + 16 19 val byte_of_page_type : page_type -> int 20 + (** Convert page type to byte. *) 21 + 17 22 val is_interior : page_type -> bool 23 + (** Check if page type is interior. *) 18 24 19 25 val header_size : page_type -> int 20 26 (** [header_size typ] is 8 for leaf pages, 12 for interior pages. *) ··· 41 47 (** {1 Binary helpers} *) 42 48 43 49 val get_u16_be : string -> int -> int 50 + 44 51 val get_u32_be : string -> int -> int 52 + (** Read unsigned 32-bit big-endian integer. *) 53 + 45 54 val set_u16_be : bytes -> int -> int -> unit 55 + (** Write unsigned 16-bit big-endian integer. *) 56 + 46 57 val set_u32_be : bytes -> int -> int -> unit 58 + (** Write unsigned 32-bit big-endian integer. *) 47 59 48 60 (** {1 Cell operations} *) 49 61
+7
lib/record.mli
··· 29 29 | Vtext of string 30 30 31 31 val serial_type_of_int : int -> serial_type 32 + (** Convert integer to serial type. *) 33 + 32 34 val serial_type_of_value : value -> int * int 35 + (** Convert value to serial type and byte size. *) 36 + 33 37 val decode_int : string -> int -> int -> int64 38 + (** Decode integer from bytes at offset with given size. *) 39 + 34 40 val encode_int : bytes -> int -> int64 -> int -> unit 41 + (** Encode integer into bytes at offset with given size. *) 35 42 36 43 val decode : string -> value list 37 44 (** [decode payload] decodes a record from its payload bytes. *)
+1
test/test_btree.mli
··· 1 1 val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+1
test/test_cell.mli
··· 1 1 val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+1
test/test_index.mli
··· 1 1 val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+1
test/test_page.mli
··· 1 1 val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+1
test/test_pager.mli
··· 1 1 val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+1
test/test_record.mli
··· 1 1 val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+1
test/test_table.mli
··· 1 1 val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+1
test/test_varint.mli
··· 1 1 val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)