tangled
alpha
login
or
join now
futur.blue
/
pegasus
57
fork
atom
objective categorical abstract machine language personal data server
57
fork
atom
overview
issues
2
pulls
pipelines
Ensure repo is active in sync methods
futur.blue
6 months ago
e6a0d1a3
3a9b578d
verified
This commit was signed with the committer's
known signature
.
futur.blue
SSH Key Fingerprint:
SHA256:QHGqHWNpqYyw9bt8KmPuJIyeZX9SZewBZ0PR1COtKQ0=
+16
-6
6 changed files
expand all
collapse all
unified
split
pegasus
lib
api
sync
getBlob.ml
getBlocks.ml
getLatestCommit.ml
getRecord.ml
getRepo.ml
listBlobs.ml
+3
-1
pegasus/lib/api/sync/getBlob.ml
···
4
4
Xrpc.handler (fun ctx ->
5
5
let {did; cid} = Xrpc.parse_query ctx.req query_of_yojson in
6
6
let cid = Cid.as_cid cid in
7
7
-
let%lwt {db; _} = Repository.load did ~write:false ~ds:ctx.db in
7
7
+
let%lwt {db; _} =
8
8
+
Repository.load did ~ensure_active:true ~write:false ~ds:ctx.db
9
9
+
in
8
10
let%lwt blob =
9
11
match%lwt User_store.get_blob db cid with
10
12
| Some blob ->
+3
-1
pegasus/lib/api/sync/getBlocks.ml
···
3
3
let handler =
4
4
Xrpc.handler (fun ctx ->
5
5
let {did; cids} : query = Xrpc.parse_query ctx.req query_of_yojson in
6
6
-
let%lwt {db; commit; _} = Repository.load did ~write:false ~ds:ctx.db in
6
6
+
let%lwt {db; commit; _} =
7
7
+
Repository.load did ~ensure_active:true ~write:false ~ds:ctx.db
8
8
+
in
7
9
let commit_cid, commit_signed = Option.get commit in
8
10
let commit_block =
9
11
commit_signed |> User_store.Types.signed_commit_to_yojson
+3
-1
pegasus/lib/api/sync/getLatestCommit.ml
···
5
5
let handler =
6
6
Xrpc.handler (fun ctx ->
7
7
let {did} : query = Xrpc.parse_query ctx.req query_of_yojson in
8
8
-
match%lwt Repository.load did ~write:false ~ds:ctx.db with
8
8
+
match%lwt
9
9
+
Repository.load did ~ensure_active:true ~write:false ~ds:ctx.db
10
10
+
with
9
11
| {commit= Some (cid, {rev; _}); _} ->
10
12
let cid = Cid.to_string cid in
11
13
Dream.json @@ Yojson.Safe.to_string @@ response_to_yojson {cid; rev}
+3
-1
pegasus/lib/api/sync/getRecord.ml
···
8
8
Xrpc.parse_query ctx.req query_of_yojson
9
9
in
10
10
let path = collection ^ "/" ^ rkey in
11
11
-
let%lwt {db; commit; _} = Repository.load did ~write:false ~ds:ctx.db in
11
11
+
let%lwt {db; commit; _} =
12
12
+
Repository.load did ~ensure_active:true ~write:false ~ds:ctx.db
13
13
+
in
12
14
let commit_cid, commit_signed = Option.get commit in
13
15
let commit_block =
14
16
commit_signed |> User_store.Types.signed_commit_to_yojson
+1
-1
pegasus/lib/api/sync/getRepo.ml
···
3
3
let handler =
4
4
Xrpc.handler (fun ctx ->
5
5
let {did} : query = Xrpc.parse_query ctx.req query_of_yojson in
6
6
-
let%lwt repo = Repository.load did ~write:false in
6
6
+
let%lwt repo = Repository.load did ~ensure_active:true ~write:false in
7
7
let%lwt car_stream = Repository.export_car repo in
8
8
Dream.stream
9
9
~headers:[("Content-Type", "application/vnd.ipld.car")]
+3
-1
pegasus/lib/api/sync/listBlobs.ml
···
17
17
| _ ->
18
18
1000
19
19
in
20
20
-
let%lwt {db; _} = Repository.load did ~write:false ~ds:ctx.db in
20
20
+
let%lwt {db; _} =
21
21
+
Repository.load did ~ensure_active:true ~write:false ~ds:ctx.db
22
22
+
in
21
23
let%lwt cids = User_store.list_blobs db ~limit ~cursor ?since in
22
24
let cids = List.map Cid.to_string cids in
23
25
let cursor =