Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC]: Convert to direct-style with Eio #2149

Open
wants to merge 99 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
00ee488
Convert Irmin from Lwt to direct-style with Eio
patricoferris Jun 5, 2022
6379145
Restore Test_tree.clear tree size
patricoferris Jun 5, 2022
4bc33c4
Fix map_p, filter_map_p and convert irmin-fs
patricoferris Jun 5, 2022
9bc6ab8
Add eio to opam file
patricoferris Jun 5, 2022
cfc7faf
Convert irmin-pack to direct-style
patricoferris Jun 5, 2022
4eb665f
Update to latest eio
patricoferris Sep 2, 2022
e9088a5
Working FS unix backend
patricoferris Oct 8, 2022
94233d2
Convert irmin-containers to direct-style
patricoferris Oct 8, 2022
99142a8
Remove pin-depends for eio
patricoferris Nov 29, 2022
169de7c
Fix irmin-fs file info
patricoferris Nov 29, 2022
ec6f097
Fix ignoring commit in store
patricoferris Nov 29, 2022
1a2a318
Fix generic-key tests
patricoferris Nov 29, 2022
adfa85e
Remove traceln
patricoferris Dec 9, 2022
0d484c1
Update to eio.0.7 and catch IO errors
patricoferris Jan 10, 2023
a077d36
Fix after rebase
art-w May 31, 2023
8fac611
Fix irmin-pack bench
art-w May 31, 2023
96af869
Fix irmin-pack examples
art-w May 31, 2023
536e7eb
Fix irmin-http using lwt_eio
art-w Jun 1, 2023
ed2cbd6
Fix irmin-graphql using lwt_eio
art-w Jun 2, 2023
c93a6e1
Fix irmin-git using lwt_eio
art-w Jun 2, 2023
7f4d26c
Fix irmin-cli using lwt_eio
art-w Jun 2, 2023
331095b
Fix irmin-mirage using lwt_eio
art-w Jun 2, 2023
1a5f58a
Fix examples using lwt_eio
art-w Jun 2, 2023
cee443f
Fix for libirmin
art-w Jun 5, 2023
e6da5e2
Fix opam dependencies to lwt_eio
art-w Jun 29, 2023
b30c33a
Add multicore tests
ElectreAAS Jun 5, 2023
426b76a
Add lock on branch
ElectreAAS May 30, 2023
151c25c
Fix LRU hashtable with a mutex
ElectreAAS Jun 5, 2023
2204a24
Fixed data race in stat counting
ElectreAAS Jun 5, 2023
791695a
Fixed data race in tree counters
ElectreAAS Jun 5, 2023
6afc95c
Fixed again stats, this time not in unix
ElectreAAS Jun 5, 2023
5b055c7
Update multicore testing
ElectreAAS Jun 12, 2023
2c2dffe
Added locks on unix/pack-store, in Tbl
ElectreAAS Jun 19, 2023
878983c
Added locks in irmin-pack atomic_write
ElectreAAS Jun 19, 2023
cff02a6
Added locks in control-file
ElectreAAS Jun 19, 2023
0043f79
Remove unsafe index stats in irmin-pack io
ElectreAAS Jun 19, 2023
df498e4
Added locks in store
ElectreAAS Jun 19, 2023
1a3678d
Safe pack_key promotion
art-w Jun 21, 2023
7972f9d
Optimize control file payload
art-w Jun 22, 2023
ea06897
Remove unsafe usage of Index.Stats
art-w Jun 22, 2023
c90c059
Fix Tree findv_cache
art-w Jun 23, 2023
37086e6
Fix Tree value cache
art-w Jun 23, 2023
8aeb8b8
Remove spinlock on Tree stats
art-w Jun 23, 2023
8bcd565
Fix irmin-pack inode partial_ptr
art-w Jun 23, 2023
37b211f
irmin-pack: add multicore unit tests
art-w Jul 3, 2023
ff6e5cd
Fix alcotest dependency
art-w Jul 3, 2023
d980b06
Fix irmin Tree lazy length
art-w Jul 3, 2023
55dcad5
Fix irmin Tree Contents mutables
art-w Jul 3, 2023
3607a58
Fix irmin proof
art-w Jul 3, 2023
bbaf30b
Fix irmin Tree add and remove
art-w Jul 3, 2023
c3cf319
Fix irmin-pack Append_only_file buffer length
art-w Jul 3, 2023
427a919
Fix irmin-pack Gc cancellation on close
art-w Jul 3, 2023
1a3249e
Fix irmin-pack Async Gc status handling
art-w Jul 3, 2023
f3a2c5c
Fix for append_only_file buffer length
art-w Jul 4, 2023
52969d9
Fix index-unix flushing from another thread
art-w Jul 4, 2023
c889be6
Fix irmin-pack Gc locks
art-w Jul 4, 2023
4f1b3da
Add commit unit test
art-w Jul 4, 2023
a888e7d
Fix irmin-pack batch in batch test
art-w Jul 4, 2023
1634e90
Fix irmin store mutable tree
art-w Jul 4, 2023
7b12d9f
Fix commit write lock
art-w Jul 5, 2023
c26e8eb
Fix parallel tree hash computation
art-w Jul 5, 2023
d086dad
irmin-pack: Add Store.Tree.list test
clecat Jul 5, 2023
24c3edd
irmin-pack: Add tests on commits for of_hash & parents
clecat Jul 5, 2023
dd1c41f
irmin-pack: Add Commit.v test & fix it with a lock
clecat Jul 5, 2023
17da4c8
Fix libirmin: at_exit executes outside of eio
art-w Jul 5, 2023
3d6dea1
Add half and full diamond multicore benchmarks
art-w Jul 10, 2023
5b9c002
Optimize Tree findv_cache for add/remove
art-w Jul 10, 2023
a1150e8
Fix formatting and remove old tests
art-w Jul 10, 2023
5404045
Fix irmin_fsck
art-w Jul 12, 2023
734d6e2
Fix opam dependencies
art-w Jul 12, 2023
1b959e9
eio: irmin-server using lwt_eio
art-w Aug 24, 2023
4f2d16a
irmin-pack: remove Io.Unix constraint
art-w Aug 21, 2023
dabb1fd
upgrade to eio.0.12
art-w Sep 4, 2023
5f550c7
irmin-pack: generic io lib without unix dependency
art-w Sep 6, 2023
b2f32d8
irmin-pack: extract unix Async
art-w Sep 6, 2023
a664ac8
irmin-pack: extract remaining Unix functions
art-w Sep 6, 2023
161310b
irmin-pack: fix Gc.on_finalise
art-w Sep 6, 2023
e42fb19
mirage: irmin-pack.unix is optional
art-w Sep 8, 2023
26a1497
irmin-pack.io: remove rusage dependency
art-w Sep 8, 2023
6e17751
mirage: remove dependency to fmt_tty
art-w Sep 8, 2023
ce0b76f
mirage: remove dependency to mtime.clock.os
art-w Sep 11, 2023
59deb7c
mirage: remove dependency to progress
art-w Sep 11, 2023
2fdb257
fix progress dependency injection
art-w Sep 20, 2023
62051a7
irmin-pack: use checkseum.c
art-w Oct 7, 2023
18af5b0
Update opam dependencies
art-w Sep 20, 2023
855be85
Fix irmin-client tests
art-w Feb 21, 2024
1e87714
Simplify concurrent list operations
art-w Feb 28, 2024
c7b22e3
Fix CI opam dependencies
art-w Mar 5, 2024
05a4af3
Upgrade dune and fix new warnings
art-w Mar 5, 2024
95b8a53
macos: reduce number of open files in unix-client test to avoid EMFIL…
art-w Mar 6, 2024
5905ef5
libirmin: fix compilation on ppc64
art-w Mar 6, 2024
883c706
Upgrade CI coverage to OCaml 5.1.x
clecat Feb 1, 2024
8601dce
Upgrade to Eio 1.0
art-w Mar 26, 2024
3fb0a99
Update CHANGES
art-w Apr 9, 2024
a8263db
Temporarily disable CI for specific platforms issues
art-w Apr 12, 2024
66c6144
Update opam for OCaml 5.1.0
art-w May 6, 2024
49e21c1
Update CI for OCaml 5.2
art-w Jun 25, 2024
7186af2
Fix multicore race in unit test
art-w Jun 25, 2024
aed087e
Fix Codecov CI: add secret token, disable on PRs
art-w Jul 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added locks in control-file
  • Loading branch information
ElectreAAS authored and art-w committed Feb 13, 2024
commit cff02a64d5bb619e98b8a2618f1a7689dbfd07a2
20 changes: 14 additions & 6 deletions src/irmin-pack/unix/control_file.ml
Original file line number Diff line number Diff line change
@@ -327,6 +327,7 @@ module Make (Serde : Serde.S) (Io : Io.S) = struct
mutable payload : payload;
path : string;
tmp_path : string option;
lock : Eio.Mutex.t;
}

let write io payload =
@@ -335,6 +336,7 @@ module Make (Serde : Serde.S) (Io : Io.S) = struct

let set_payload t payload =
let open Result_syntax in
Eio.Mutex.use_rw ~protect:true t.lock @@ fun () ->
if Io.readonly t.io then Error `Ro_not_allowed
else
match t.tmp_path with
@@ -354,22 +356,28 @@ module Make (Serde : Serde.S) (Io : Io.S) = struct

let create_rw ~path ~tmp_path ~overwrite (payload : payload) =
let open Result_syntax in
let lock = Eio.Mutex.create () in
let* io = Io.create ~path ~overwrite in
let+ () = write io payload in
{ io; payload; path; tmp_path }
{ io; payload; path; tmp_path; lock }

let open_ ~path ~tmp_path ~readonly =
let open Result_syntax in
let lock = Eio.Mutex.create () in
let* io = Io.open_ ~path ~readonly in
let+ payload = read io in
{ io; payload; path; tmp_path }
{ io; payload; path; tmp_path; lock }

let close t = Io.close t.io
let readonly t = Io.readonly t.io
let payload t = t.payload
let close t = Eio.Mutex.use_rw ~protect:true t.lock @@ fun () -> Io.close t.io

let readonly t =
Eio.Mutex.use_rw ~protect:true t.lock @@ fun () -> Io.readonly t.io

let payload t = Eio.Mutex.use_rw ~protect:true t.lock @@ fun () -> t.payload

let reload t =
let open Result_syntax in
Eio.Mutex.use_rw ~protect:true t.lock @@ fun () ->
if not @@ Io.readonly t.io then Error `Rw_not_allowed
else
let* () = Io.close t.io in
@@ -393,7 +401,7 @@ module Make (Serde : Serde.S) (Io : Io.S) = struct
let+ () = Io.close io in
payload

let fsync t = Io.fsync t.io
let fsync t = Eio.Mutex.use_rw ~protect:true t.lock @@ fun () -> Io.fsync t.io
end

module Upper = Make (Serde.Upper)