objective categorical abstract machine language personal data server

Move repository to pegasus, remove unused deps

futur.blue 810318e2 26c09897

verified
+54 -38
+11 -10
dune-project
··· 15 15 (synopsis "An atproto Personal Data Server implementation") 16 16 (description "Eventually") 17 17 (allow_empty) 18 - (depends ocaml dune)) 18 + (depends 19 + ocaml 20 + dune 21 + lwt 22 + (re (>= 1.13.2)) 23 + (yojson (>= 3.0.0)) 24 + (lwt_ppx (>= 5.9.1)) 25 + (ppx_deriving_yojson (>= 3.9.1)) 26 + (alcotest :with-test))) 19 27 20 28 (package 21 29 (name mist) ··· 24 32 (depends 25 33 ocaml 26 34 dune 35 + lwt 27 36 (core_unix (>= 0.17.1)) 28 - (cborl (>= 0.1.0)) 29 - (cid (>= 0.1.0)) 30 - (hacl-star (>= 0.7.2)) 31 - lwt 32 - (mtime (>= 2.1.0)) 33 - (multihash (>= 0.1.0)) 34 37 (re (>= 1.13.2)) 35 38 (yojson (>= 3.0.0)) 36 39 (lwt_ppx (>= 5.9.1)) ··· 45 48 (depends 46 49 ocaml 47 50 dune 48 - (base64 (>= 3.5.1)) 49 - (digestif (>= 1.2.0)) 50 51 lwt 51 - (multibase (>= 0.1.0)) 52 + (digestif (>= 1.2.0)) 52 53 (yojson (>= 3.0.0)) 53 54 (lwt_ppx (>= 5.9.1)) 54 55 (alcotest :with-test)))
-2
ipld.opam
··· 10 10 depends: [ 11 11 "ocaml" 12 12 "dune" {>= "3.14"} 13 - "base64" {>= "3.5.1"} 14 13 "digestif" {>= "1.2.0"} 15 14 "lwt" 16 - "multibase" {>= "0.1.0"} 17 15 "yojson" {>= "3.0.0"} 18 16 "lwt_ppx" {>= "5.9.1"} 19 17 "alcotest" {with-test}
+1 -1
ipld/lib/dune
··· 1 1 (library 2 2 (name ipld) 3 3 (wrapped false) 4 - (libraries base64 digestif lwt multibase yojson lwt_ppx) 4 + (libraries digestif lwt multibase yojson lwt_ppx) 5 5 (preprocess 6 6 (pps lwt_ppx ppx_deriving_yojson)))
-5
mist.opam
··· 10 10 "ocaml" 11 11 "dune" {>= "3.14"} 12 12 "core_unix" {>= "0.17.1"} 13 - "cborl" {>= "0.1.0"} 14 - "cid" {>= "0.1.0"} 15 - "hacl-star" {>= "0.7.2"} 16 13 "lwt" 17 - "mtime" {>= "2.1.0"} 18 - "multihash" {>= "0.1.0"} 19 14 "re" {>= "1.13.2"} 20 15 "yojson" {>= "3.0.0"} 21 16 "lwt_ppx" {>= "5.9.1"}
-3
mist/lib/dune
··· 4 4 core_unix.time_stamp_counter 5 5 core_unix.time_ns_unix 6 6 digestif 7 - hacl-star 8 7 ipld 9 8 lwt 10 9 lwt.unix 11 - mtime.clock 12 - multihash 13 10 re 14 11 str 15 12 yojson
+3 -9
mist/lib/repository.ml pegasus/lib/repository.ml
··· 1 + open Mist 2 + 1 3 type commit = 2 4 { did: string 3 5 ; version: int (* always 3 *) ··· 36 38 type signing_key = P256 of bytes | K256 of bytes 37 39 38 40 module Make (Store : Storage.Writable_blockstore) = struct 39 - type store = Store.t 40 - 41 - let read_commit store cid : (signed_commit, string) Lwt_result.t = 42 - let%lwt bytes = Store.get_bytes store cid in 43 - match bytes with 44 - | Some b -> 45 - b |> Dag_cbor.decode_to_yojson |> signed_commit_of_yojson |> Lwt.return 46 - | None -> 47 - Lwt.return_error ("commit not found in blockstore: " ^ Cid.to_string cid) 41 + type t = {store: Store.t; key: signing_key} 48 42 end
+18 -7
mist/test/test_mst.ml
··· 1 1 open Mist 2 2 open Lwt.Infix 3 3 module MemMst = Mst.Make (Storage.Memory_blockstore) 4 - module MemRepo = Repository.Make (Storage.Memory_blockstore) 5 4 module StringMap = Dag_cbor.StringMap 6 5 7 6 let cid_of_string_exn s = ··· 826 825 in 827 826 let store = Storage.Memory_blockstore.create ~blocks:bm () in 828 827 let%lwt commit = 829 - MemRepo.read_commit store root 830 - >|= function Ok commit -> commit | Error msg -> failwith msg 828 + match%lwt Storage.Memory_blockstore.get_bytes store root with 829 + | Some b -> ( 830 + match Dag_cbor.decode b with 831 + | `Map commit -> 832 + Lwt.return commit 833 + | _ -> 834 + failwith "non-object commit" ) 835 + | None -> 836 + failwith "root not found in blockstore" 831 837 in 832 - let mst = MemMst.create store commit.data in 838 + let mst = 839 + MemMst.create store 840 + ( match StringMap.find "data" commit with 841 + | `Link cid -> 842 + cid 843 + | _ -> 844 + failwith "non-cid data in commit" ) 845 + in 833 846 Lwt.return (commit, mst) 834 847 in 835 848 let%lwt ic = Lwt_io.open_file ~mode:Lwt_io.input "sample.car" in ··· 837 850 let%lwt () = Lwt_io.close ic in 838 851 let%lwt commit, mst = mst_of_car_bytes car in 839 852 let mst_stream = MemMst.to_blocks_stream mst in 840 - let commit_bytes = 841 - Dag_cbor.encode_yojson (Repository.signed_commit_to_yojson commit) 842 - in 853 + let commit_bytes = Dag_cbor.encode (`Map commit) in 843 854 let commit_cid = Cid.create Dcbor commit_bytes in 844 855 let%lwt car' = 845 856 Car.blocks_to_car (Some commit_cid)
+6
pegasus.opam
··· 10 10 depends: [ 11 11 "ocaml" 12 12 "dune" {>= "3.14"} 13 + "lwt" 14 + "re" {>= "1.13.2"} 15 + "yojson" {>= "3.0.0"} 16 + "lwt_ppx" {>= "5.9.1"} 17 + "ppx_deriving_yojson" {>= "3.9.1"} 18 + "alcotest" {with-test} 13 19 "odoc" {with-doc} 14 20 ] 15 21 build: [
+15 -1
pegasus/lib/dune
··· 1 1 (library 2 - (name pegasus)) 2 + (name pegasus) 3 + (libraries 4 + ipld 5 + lwt 6 + lwt.unix 7 + mist 8 + re 9 + str 10 + yojson 11 + lwt_ppx 12 + ppx_deriving_yojson.runtime) 13 + (preprocess 14 + (pps lwt_ppx ppx_deriving_yojson))) 15 + 16 + (include_subdirs qualified)