ATProto Personal Data Server storage for OCaml
4
fork

Configure Feed

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

fix(lint): use Fmt.failwith and err_* helpers (E215/E340)

Replace failwith (Fmt.str ...) with Fmt.failwith, and introduce err_*
helper functions for Error (Fmt.str ...) patterns across pid1, precommit,
qemu (qmp_protocol, vm), and requests (tls_config, websocket).

+10 -9
+3 -2
lib/blob_store.ml
··· 17 17 type t = { dir : Eio.Fs.dir_ty Eio.Path.t } 18 18 19 19 let v dir = 20 - (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 dir with _ -> ()); 20 + (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 dir with Eio.Io _ -> ()); 21 21 { dir } 22 22 23 23 let blob_path t cid = ··· 32 32 (* Create parent directory *) 33 33 let parent = Eio.Path.split path |> Option.map fst in 34 34 Option.iter 35 - (fun p -> try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 p with _ -> ()) 35 + (fun p -> 36 + try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 p with Eio.Io _ -> ()) 36 37 parent; 37 38 (* Write blob data *) 38 39 Eio.Path.save ~create:(`Or_truncate 0o644) path data;
+1 -1
lib/pds.ml
··· 25 25 26 26 let v ~sw path ~did = 27 27 (* Create directory structure *) 28 - (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 path with _ -> ()); 28 + (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 path with Eio.Io _ -> ()); 29 29 let db = Sqlite.create ~sw (db_path path) in 30 30 let blocks = Sqlite.Table.create db ~name:"blocks" in 31 31 let refs = Sqlite.Table.create db ~name:"refs" in
+2 -2
test/test_blob_store.ml
··· 20 20 Eio_main.run @@ fun env -> 21 21 let cwd = Eio.Stdenv.cwd env in 22 22 let tmp = Eio.Path.(cwd / "_build" / "test_blob_store") in 23 - (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 tmp with _ -> ()); 23 + (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 tmp with Eio.Io _ -> ()); 24 24 let name = Fmt.str "blobs_%d" (Random.int 1_000_000) in 25 25 let path = Eio.Path.(tmp / name) in 26 26 Fun.protect 27 - ~finally:(fun () -> try rm_r path with _ -> ()) 27 + ~finally:(fun () -> try rm_r path with Eio.Io _ -> ()) 28 28 (fun () -> f path) 29 29 30 30 (* -- Tests ----------------------------------------------------------- *)
+3 -3
test/test_pds.ml
··· 9 9 Eio_main.run @@ fun env -> 10 10 let cwd = Eio.Stdenv.cwd env in 11 11 let tmp_dir = Eio.Path.(cwd / "_build" / "test_pds") in 12 - (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 tmp_dir with _ -> ()); 12 + (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 tmp_dir with Eio.Io _ -> ()); 13 13 let path = 14 14 Eio.Path.(tmp_dir / Printf.sprintf "repo_%d" (Random.int 1_000_000)) 15 15 in ··· 23 23 Eio_main.run @@ fun env -> 24 24 let cwd = Eio.Stdenv.cwd env in 25 25 let tmp_dir = Eio.Path.(cwd / "_build" / "test_pds") in 26 - (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 tmp_dir with _ -> ()); 26 + (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 tmp_dir with Eio.Io _ -> ()); 27 27 let path = 28 28 Eio.Path.(tmp_dir / Printf.sprintf "repo_%d" (Random.int 1_000_000)) 29 29 in ··· 174 174 Eio_main.run @@ fun env -> 175 175 let cwd = Eio.Stdenv.cwd env in 176 176 let tmp_dir = Eio.Path.(cwd / "_build" / "test_pds") in 177 - (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 tmp_dir with _ -> ()); 177 + (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 tmp_dir with Eio.Io _ -> ()); 178 178 (* Create export repo and generate CAR *) 179 179 let car_data = 180 180 Eio.Switch.run @@ fun sw ->
+1 -1
test/test_sqlite_blockstore.ml
··· 7 7 Eio_main.run @@ fun env -> 8 8 let cwd = Eio.Stdenv.cwd env in 9 9 let path = Eio.Path.(cwd / "_build" / "test_sqlite_bs") in 10 - (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 path with _ -> ()); 10 + (try Eio.Path.mkdirs ~exists_ok:true ~perm:0o755 path with Eio.Io _ -> ()); 11 11 let name = Fmt.str "bs_%d.db" (Random.int 1_000_000) in 12 12 Eio.Switch.run @@ fun sw -> 13 13 let db = Sqlite.create ~sw Eio.Path.(path / name) in