The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

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

Add type annotations to tests

+50 -47
+5 -3
vendor/opam/uring/README.md
··· 39 39 ~resolve:Uring.Resolve.beneath 40 40 "test.log" 41 41 `Open_log;; 42 - val open_file : _[> `Open_log ] Uring.job option = Some <abstr> 42 + val open_file : ([> `Open_log ] as '_weak2) Uring.job option = Some <abstr> 43 43 ``` 44 44 45 45 `submit` returns `None` if the submission queue is full. ··· 117 117 118 118 ```ocaml 119 119 # Uring.close uring fd `Close_log;; 120 - - : _[> `Close_log | `Open_log | `Write_all ] Uring.job option = Some <abstr> 120 + - : ([> `Close_log | `Open_log | `Write_all ] as '_weak3) Uring.job option = 121 + Some <abstr> 121 122 122 123 # Uring.submit uring;; 123 124 - : int = 1 124 125 125 126 # wait_with_retry uring;; 126 - - : int * _[> `Close_log | `Open_log | `Write_all ] = (0, `Close_log) 127 + - : int * ([> `Close_log | `Open_log | `Write_all ] as '_weak3) = 128 + (0, `Close_log) 127 129 ``` 128 130 129 131 The file has now been written:
+1
vendor/opam/uring/dune
··· 1 1 (mdx 2 2 (deps (package uring)) 3 + (enabled_if (>= %{ocaml_version} 5.1.0)) 3 4 (files README.md))
+44 -44
vendor/opam/uring/tests/main.md
··· 68 68 # let queue_depth = 5;; 69 69 val queue_depth : int = 5 70 70 71 - # let t = Uring.create ~queue_depth ();; 72 - val t : '_weak1 Uring.t = <abstr> 71 + # let t : int Uring.t = Uring.create ~queue_depth ();; 72 + val t : int Uring.t = <abstr> 73 73 74 74 # Fmt.pr "%a@." Uring.Stats.pp (Uring.get_debug_stats t);; 75 75 SQEs ready: 0 ··· 121 121 ## Open 122 122 123 123 ```ocaml 124 - # let t = Uring.create ~queue_depth:1 ();; 125 - val t : '_weak2 Uring.t = <abstr> 124 + # let t : [ `Open ] Uring.t = Uring.create ~queue_depth:1 ();; 125 + val t : [ `Open ] Uring.t = <abstr> 126 126 # Uring.openat2 t 127 127 ~access:`R 128 128 ~flags:Uring.Open_flags.empty ··· 130 130 ~resolve:Uring.Resolve.empty 131 131 "/dev/null" 132 132 `Open;; 133 - - : _[> `Open ] Uring.job option = Some <abstr> 133 + - : [ `Open ] Uring.job option = Some <abstr> 134 134 # Uring.submit t;;; 135 135 - : int = 1 136 136 ··· 138 138 let token, fd = consume t in 139 139 assert (fd >= 0); 140 140 token, (Obj.magic fd : Unix.file_descr);; 141 - val token : _[> `Open ] = `Open 141 + val token : [ `Open ] = `Open 142 142 val fd : Unix.file_descr = <abstr> 143 143 144 144 # Unix.read fd (Bytes.create 5) 0 5;; ··· 154 154 ## Create 155 155 156 156 ```ocaml 157 - # let t = Uring.create ~queue_depth:1 ();; 158 - val t : '_weak3 Uring.t = <abstr> 157 + # let t : [ `Create ] Uring.t = Uring.create ~queue_depth:1 ();; 158 + val t : [ `Create ] Uring.t = <abstr> 159 159 # ignore @@ Unix.umask 0o077;; 160 160 - : unit = () 161 161 # Uring.openat2 t ··· 165 165 ~resolve:Uring.Resolve.empty 166 166 "test-openat" 167 167 `Create;; 168 - - : _[> `Create ] Uring.job option = Some <abstr> 168 + - : [ `Create ] Uring.job option = Some <abstr> 169 169 170 170 # Uring.submit t;; 171 171 - : int = 1 ··· 174 174 let token, fd = consume t in 175 175 assert (fd >= 0); 176 176 token, (Obj.magic fd : Unix.file_descr);; 177 - val token : _[> `Create ] = `Create 177 + val token : [ `Create ] = `Create 178 178 val fd : Unix.file_descr = <abstr> 179 179 180 180 # Unix.write fd (Bytes.of_string "Test") 0 4;; ··· 192 192 ## Resolve 193 193 194 194 ```ocaml 195 - # let t = Uring.create ~queue_depth:1 ();; 196 - val t : '_weak4 Uring.t = <abstr> 195 + # let t : [ `Get_path ] Uring.t = Uring.create ~queue_depth:1 ();; 196 + val t : [ `Get_path ] Uring.t = <abstr> 197 197 # let get ~resolve path = 198 198 assert (Option.is_some (Uring.openat2 t 199 199 ~access:`R ··· 246 246 ``` 247 247 248 248 ```ocaml 249 - # let t = Uring.create ~queue_depth:1 ();; 250 - val t : '_weak5 Uring.t = <abstr> 249 + # let t : [ `Read ] Uring.t = Uring.create ~queue_depth:1 ();; 250 + val t : [ `Read ] Uring.t = <abstr> 251 251 # let fbuf = set_fixed_buffer t 1024;; 252 252 val fbuf : 253 253 (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t = ··· 260 260 val fd : Unix.file_descr = <abstr> 261 261 # let file_offset = Int63.of_int 2 in 262 262 Uring.read_fixed t ~file_offset fd ~off ~len `Read;; 263 - - : _[> `Read ] Uring.job option = Some <abstr> 263 + - : [ `Read ] Uring.job option = Some <abstr> 264 264 # Uring.submit t;; 265 265 - : int = 1 266 266 # consume t;; 267 - - : _[> `Read ] * int = (`Read, 5) 267 + - : [ `Read ] * int = (`Read, 5) 268 268 # Cstruct.of_bigarray fbuf ~off ~len |> Cstruct.to_string;; 269 269 - : string = "test " 270 270 ··· 354 354 Reading with readv: 355 355 356 356 ```ocaml 357 - # let t = Uring.create ~queue_depth:1 ();; 358 - val t : '_weak6 Uring.t = <abstr> 357 + # let t : [ `Readv ] Uring.t = Uring.create ~queue_depth:1 ();; 358 + val t : [ `Readv ] Uring.t = <abstr> 359 359 360 360 # let fd = Unix.openfile Test_data.path [ O_RDONLY ] 0;; 361 361 val fd : Unix.file_descr = <abstr> ··· 367 367 val b2 : Cstruct.t = {Cstruct.buffer = <abstr>; off = 0; len = 7} 368 368 # let iov = [b1; b2] in 369 369 Uring.readv t fd iov `Readv ~file_offset:Int63.zero;; 370 - - : _[> `Readv ] Uring.job option = Some <abstr> 370 + - : [ `Readv ] Uring.job option = Some <abstr> 371 371 372 372 # Uring.submit t;; 373 373 - : int = 1 ··· 410 410 ## Regions 411 411 412 412 ```ocaml 413 - # let t = Uring.create ~queue_depth:1 ();; 414 - val t : '_weak7 Uring.t = <abstr> 413 + # let t : [ `Read ] Uring.t = Uring.create ~queue_depth:1 ();; 414 + val t : [ `Read ] Uring.t = <abstr> 415 415 416 416 # let fbuf = set_fixed_buffer t 64;; 417 417 val fbuf : ··· 425 425 # let fd = Unix.openfile Test_data.path [ O_RDONLY ] 0;; 426 426 val fd : Unix.file_descr = <abstr> 427 427 # Uring.read_chunk t fd chunk `Read ~file_offset:Int63.zero;; 428 - - : _[> `Read ] Uring.job option = Some <abstr> 428 + - : [ `Read ] Uring.job option = Some <abstr> 429 429 # let `Read, read = consume t;; 430 430 val read : int = 11 431 431 # Uring.Region.to_string ~len:read chunk;; ··· 457 457 # exception Multiple of Unix.error list;; 458 458 exception Multiple of Unix.error list 459 459 460 - # let t = Uring.create ~queue_depth:5 ();; 461 - val t : '_weak8 Uring.t = <abstr> 460 + # let t : [ `Cancel | `Read ] Uring.t = Uring.create ~queue_depth:5 ();; 461 + val t : [ `Cancel | `Read ] Uring.t = <abstr> 462 462 463 463 # set_fixed_buffer t 1024;; 464 464 - : (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t = ··· 467 467 val r : Unix.file_descr = <abstr> 468 468 val w : Unix.file_descr = <abstr> 469 469 # let read = Uring.read_fixed t ~file_offset:Int63.zero r ~off:0 ~len:1 `Read |> Option.get;; 470 - val read : _[> `Read ] Uring.job = <abstr> 470 + val read : [ `Cancel | `Read ] Uring.job = <abstr> 471 471 472 472 # Uring.cancel t read `Cancel;; 473 - - : _[> `Cancel | `Read ] Uring.job option = Some <abstr> 473 + - : [ `Cancel | `Read ] Uring.job option = Some <abstr> 474 474 # Uring.submit t;; 475 475 - : int = 2 476 476 # let t1, r1 = consume t in ··· 502 502 By the time we cancel, the request has already succeeded (we just didn't process the reply yet): 503 503 504 504 ```ocaml 505 - # let t = Uring.create ~queue_depth:5 ();; 506 - val t : '_weak9 Uring.t = <abstr> 505 + # let t : [ `Read | `Cancel ] Uring.t = Uring.create ~queue_depth:5 ();; 506 + val t : [ `Cancel | `Read ] Uring.t = <abstr> 507 507 # set_fixed_buffer t 102;; 508 508 - : (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t = 509 509 <abstr> 510 510 # let r = Unix.openfile "/dev/zero" Unix.[O_RDONLY] 0;; 511 511 val r : Unix.file_descr = <abstr> 512 512 # let read = Uring.read_fixed t ~file_offset:Int63.zero r ~off:0 ~len:1 `Read |> Option.get;; 513 - val read : _[> `Read ] Uring.job = <abstr> 513 + val read : [ `Cancel | `Read ] Uring.job = <abstr> 514 514 # Uring.submit t;; 515 515 - : int = 1 516 516 # Unix.sleepf 0.001;; 517 517 - : unit = () 518 518 # Uring.cancel t read `Cancel;; 519 - - : _[> `Cancel | `Read ] Uring.job option = Some <abstr> 519 + - : [ `Cancel | `Read ] Uring.job option = Some <abstr> 520 520 # Uring.submit t;; 521 521 - : int = 1 522 522 # let t1, r1 = consume t in ··· 549 549 By the time we cancel, we already knew the operation was over: 550 550 551 551 ```ocaml 552 - # let t = Uring.create ~queue_depth:5 ();; 553 - val t : '_weak10 Uring.t = <abstr> 552 + # let t : [ `Read | `Cancel ] Uring.t = Uring.create ~queue_depth:5 ();; 553 + val t : [ `Cancel | `Read ] Uring.t = <abstr> 554 554 # set_fixed_buffer t 1024;; 555 555 - : (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t = 556 556 <abstr> 557 557 # let r = Unix.openfile "/dev/zero" Unix.[O_RDONLY] 0;; 558 558 val r : Unix.file_descr = <abstr> 559 559 # let read = Uring.read_fixed t ~file_offset:Int63.zero r ~off:0 ~len:1 `Read |> Option.get;; 560 - val read : _[> `Read ] Uring.job = <abstr> 560 + val read : [ `Cancel | `Read ] Uring.job = <abstr> 561 561 # let token, r_read = consume t;; 562 - val token : _[> `Read ] = `Read 562 + val token : [ `Cancel | `Read ] = `Read 563 563 val r_read : int = 1 564 564 # let r : unit = Unix.close r;; 565 565 val r : unit = () ··· 579 579 We can't exit the ring while an operation is still pending: 580 580 581 581 ```ocaml 582 - # let t = Uring.create ~queue_depth:1 ();; 583 - val t : '_weak11 Uring.t = <abstr> 582 + # let t : [ `Read | `Mkdir ] Uring.t = Uring.create ~queue_depth:1 ();; 583 + val t : [ `Mkdir | `Read ] Uring.t = <abstr> 584 584 # set_fixed_buffer t 1024;; 585 585 - : (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t = 586 586 <abstr> ··· 588 588 val r : Unix.file_descr = <abstr> 589 589 val w : Unix.file_descr = <abstr> 590 590 # Uring.read_fixed t ~file_offset:Int63.minus_one r ~off:0 ~len:1 `Read;; 591 - - : _[> `Read ] Uring.job option = Some <abstr> 591 + - : [ `Mkdir | `Read ] Uring.job option = Some <abstr> 592 592 # Uring.submit t;; 593 593 - : int = 1 594 594 # Uring.exit t;; ··· 601 601 # let w : unit = Unix.close w;; 602 602 val w : unit = () 603 603 # consume t;; 604 - - : _[> `Read ] * int = (`Read, 0) 604 + - : [ `Mkdir | `Read ] * int = (`Read, 0) 605 605 # Uring.exit t;; 606 606 - : unit = () 607 607 # let r : unit = Unix.close r;; ··· 642 642 # let r, w = Unix.pipe ();; 643 643 val r : Unix.file_descr = <abstr> 644 644 val w : Unix.file_descr = <abstr> 645 - # let t = Uring.create ~queue_depth:2 ();; 646 - val t : '_weak12 Uring.t = <abstr> 645 + # let t : [ `Recv | `Send ] Uring.t= Uring.create ~queue_depth:2 ();; 646 + val t : [ `Recv | `Send ] Uring.t = <abstr> 647 647 # let a, b = Unix.(socketpair PF_UNIX SOCK_STREAM 0);; 648 648 val a : Unix.file_descr = <abstr> 649 649 val b : Unix.file_descr = <abstr> 650 650 # let bufs = [Cstruct.of_string "hi"];; 651 651 val bufs : Cstruct.t list = [{Cstruct.buffer = <abstr>; off = 0; len = 2}] 652 652 # Uring.send_msg t a ~fds:[r; w] bufs `Send;; 653 - - : _[> `Send ] Uring.job option = Some <abstr> 653 + - : [ `Recv | `Send ] Uring.job option = Some <abstr> 654 654 # Uring.submit t;; 655 655 - : int = 1 656 656 # consume t;; 657 - - : _[> `Send ] * int = (`Send, 2) 657 + - : [ `Recv | `Send ] * int = (`Send, 2) 658 658 # let recv_buf = Cstruct.of_string "XX";; 659 659 val recv_buf : Cstruct.t = {Cstruct.buffer = <abstr>; off = 0; len = 2} 660 660 # let recv = Uring.Msghdr.create ~n_fds:2 [recv_buf];; ··· 662 662 # List.length (Uring.Msghdr.get_fds recv);; 663 663 - : int = 0 664 664 # Uring.recv_msg t b recv `Recv;; 665 - - : _[> `Recv | `Send ] Uring.job option = Some <abstr> 665 + - : [ `Recv | `Send ] Uring.job option = Some <abstr> 666 666 # Uring.submit t;; 667 667 - : int = 1 668 668 # consume t;; 669 - - : _[> `Recv | `Send ] * int = (`Recv, 2) 669 + - : [ `Recv | `Send ] * int = (`Recv, 2) 670 670 # Cstruct.to_string recv_buf;; 671 671 - : string = "hi" 672 672 # let r2, w2 =