Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
irmin: update README to 2.0 interface
- Loading branch information
Showing
4 changed files
with
38 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
examples/readme.ml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
(executables | ||
(names trees sync process deploy irmin_git_store custom_merge push) | ||
(names readme trees sync process deploy irmin_git_store custom_merge push) | ||
(libraries checkseum.c digestif.c irmin irmin-unix)) | ||
|
||
(alias | ||
(name examples) | ||
(deps trees.exe sync.exe process.exe deploy.exe push.exe | ||
(deps readme.exe trees.exe sync.exe process.exe deploy.exe push.exe | ||
irmin_git_store.exe custom_merge.exe)) | ||
|
||
(alias | ||
(name runtest) | ||
(package irmin-unix) | ||
(deps trees.exe sync.exe process.exe deploy.exe push.exe | ||
(deps readme.exe trees.exe sync.exe process.exe deploy.exe push.exe | ||
irmin_git_store.exe custom_merge.exe)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
open Lwt.Infix | ||
|
||
(* Irmin store with string contents *) | ||
module Store = Irmin_unix.Git.FS.KV(Irmin.Contents.String) | ||
|
||
(* Database configuration *) | ||
let config = Irmin_git.config ~bare:true "/tmp/irmin/test" | ||
|
||
(* Commit author *) | ||
let author = "Example <example@example.com>" | ||
|
||
(* Commit information *) | ||
let info fmt = Irmin_unix.info ~author fmt | ||
|
||
let main = | ||
(* Open the repo *) | ||
Store.Repo.v config >>= | ||
|
||
(* Load the master branch *) | ||
Store.master >>= fun t -> | ||
|
||
(* Set key "foo/bar" to "testing 123" *) | ||
Store.set_exn t ~info:(info "Updating foo/bar") ["foo"; "bar"] "testing 123" >>= fun () -> | ||
|
||
(* Get key "foo/bar" and print it to stdout *) | ||
Store.get t ["foo"; "bar"] >|= fun x -> | ||
Printf.printf "foo/bar => '%s'\n" x | ||
|
||
(* Run the program *) | ||
let () = Lwt_main.run main |