-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into toplevel_printers
- Loading branch information
Showing
165 changed files
with
6,841 additions
and
2,784 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,2 @@ | ||
# Upgrade to OCamlformat 0.26.0 | ||
faab08a7dd9c275111cae51651a78fd62ac3e031 |
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,4 +1,4 @@ | ||
version = 0.24.1 | ||
version = 0.26.0 | ||
profile = conventional | ||
|
||
ocaml-version = 4.08.0 | ||
|
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Code of Conduct | ||
|
||
This project has adopted the [OCaml Code of Conduct](https://github.com/ocaml/code-of-conduct/blob/main/CODE_OF_CONDUCT.md). | ||
|
||
# Enforcement | ||
|
||
This project follows the OCaml Code of Conduct [enforcement policy](https://github.com/ocaml/code-of-conduct/blob/main/CODE_OF_CONDUCT.md#enforcement). | ||
|
||
To report any violations, please contact: | ||
Thomas Gazagnaire <thomas [at] tarides [dot] com> | ||
Arthur Wendling <arthur [at] tarides [dot] com> | ||
Kevin Smith <kevin [at] tarides [dot] com> | ||
Gwenaëlle Lecat <gwenaelle [at] tarides [dot] com> | ||
Vincent Balat <vincent.balat [at] tarides [dot] com> |
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Version History | ||
|
||
Summary of the data versions of `irmin-pack` and key changes for the entries in the pack file. | ||
|
||
## Data versions | ||
|
||
See `irmin-pack/version.ml`. | ||
|
||
| Version | Description | | ||
| -------- | -------- | | ||
| V1 | Original version of `irmin-pack` | | ||
| V2 | Introduced V2 version of objects/keys. [Irmin 3.0.0](https://github.com/mirage/irmin/releases/tag/3.0.0) via [PR#1655](https://github.com/mirage/irmin/pull/1655) | | ||
| V3 | Introduced control file. [Irmin 3.3.0](https://github.com/mirage/irmin/releases/tag/3.3.0) via [PR#1865](https://github.com/mirage/irmin/pull/1865) | | ||
| V4 | Introduced chunked suffix. [Irmin 3.5.0](https://github.com/mirage/irmin/releases/tag/3.5.0) via [PR#2110](https://github.com/mirage/irmin/pull/2110) | | ||
| V5 | Introduced lower layer + volumes. [Irmin 3.7.0](https://github.com/mirage/irmin/releases/tag/3.7.0) via [PR#2184](https://github.com/mirage/irmin/pull/2184) and [PR#2180](https://github.com/mirage/irmin/pull/2180) | | ||
|
||
Prior to `V3`, `irmin-pack` stored version information in headers of files but now stores it only in a header of the control file. | ||
|
||
## Pack store entries | ||
|
||
See `irmin-pack/pack_value.ml` and `irmin-pack/inode.ml` for how `irmin-pack` represents `irmin`'s core types of contents, nodes, and commits. | ||
|
||
### Contents | ||
|
||
| Version | Description | | ||
| -------- | -------- | | ||
| V1 | The first and only format for contents entries. | | ||
|
||
`Contents` objects only have one version, but a user-defined contents length header [configuration](https://github.com/mirage/irmin/blob/1f046ddaedf3532bb236f7d19510182c5948b9d6/src/irmin-pack/conf.mli#L34-L45) was added in [Irmin 3.0.0](https://github.com/mirage/irmin/releases/tag/3.0.0) via [PR#1644](https://github.com/mirage/irmin/pull/1644). | ||
|
||
💡 Since Tezos' contents type is [bytes](https://github.com/mirage/irmin/blob/1f046ddaedf3532bb236f7d19510182c5948b9d6/src/irmin-tezos/schema.ml#L146) and `repr` stores [bytes](https://github.com/mirage/repr/blob/2b260367d8073a421e38be4e564d2c1931d15ee0/src/repr/type_intf.ml#L10-L11) with a [length prefix](https://github.com/mirage/repr/blob/2b260367d8073a421e38be4e564d2c1931d15ee0/src/repr/binary.ml#L307-L312) that is [LEB128-encoded](https://github.com/mirage/repr/blob/2b260367d8073a421e38be4e564d2c1931d15ee0/src/repr/binary.ml#L104-L112), its contents type automatically supports `Varint` for `contents_length_header`. | ||
|
||
### Inodes | ||
|
||
| Version | Description | | ||
| -------- | -------- | | ||
| V1 | Original data. Corresponds with V1 keys. | | ||
| V2 | Introduces length prefix. Corresponds with V2 keys. | | ||
|
||
|
||
V1 added an [explicit length prefix](https://github.com/mirage/irmin/blob/1f046ddaedf3532bb236f7d19510182c5948b9d6/src/irmin-pack/inode.ml#L400) to support minimal indexing. | ||
|
||
### Commits | ||
|
||
| Version | Description | | ||
| -------- | -------- | | ||
| V1 | Original data. Corresponds with V1 keys. | | ||
| V2 | Introduces length prefix. Corresponds with V2 keys. | | ||
|
||
V2 added an [explicit length prefix](https://github.com/mirage/irmin/blob/1f046ddaedf3532bb236f7d19510182c5948b9d6/src/irmin-pack/pack_value.ml#L193) to support minimal indexing. | ||
|
||
## Keys | ||
|
||
See `irmin-pack/unix/pack_key.ml`. | ||
|
||
| Version | Name | Description | | ||
| -------- | -------- | -------- | | ||
| V1 | Hash | Original "keys". Relied on index for all object offsets in pack file. | | ||
| V2 | Structured | [Irmin 3.0.0](https://github.com/mirage/irmin/releases/tag/3.0.0) via [PR#1659](https://github.com/mirage/irmin/pull/1659). Supports existing `V0` through `Pack_key.Indexed`. All new keys are written as `Pack_key.Direct`. | | ||
|
||
Keys do not have versions in the code, but versions are indicated here to correspond to data version. | ||
|
||
## Indexing Strategies | ||
|
||
| Type | Data Indexed | Description | | ||
| -------- | -------- | -------- | | ||
| Non-minimal | All: Contents, Inodes, Commits | Original strategy | | ||
| Minimal | Commits | [Irmin 3.0.0](https://github.com/mirage/irmin/releases/tag/3.0.0) via [PR#1664](https://github.com/mirage/irmin/pull/1664) | | ||
|
||
## Release Dates | ||
|
||
Dates of release are a lower bounds on when we can expect different versions of data in stores, but the actual date is later due to delays of when clients ship their updates. | ||
|
||
- [Irmin 3.0.0](https://github.com/mirage/irmin/releases/tag/3.0.0) on Feb 14, 2022. | ||
- [Irmin 3.3.0](https://github.com/mirage/irmin/releases/tag/3.3.0) on Jun 20, 2022. | ||
- [Irmin 3.5.0](https://github.com/mirage/irmin/releases/tag/3.5.0) on Dec 14, 2022. | ||
- [Irmin 3.7.0](https://github.com/mirage/irmin/releases/tag/3.5.0) on Apr 26, 2023. |
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,47 @@ | ||
(* | ||
* Copyright (c) 2018-2022 Tarides <[email protected]> | ||
* | ||
* Permission to use, copy, modify, and distribute this software for any | ||
* purpose with or without fee is hereby granted, provided that the above | ||
* copyright notice and this permission notice appear in all copies. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
*) | ||
|
||
open Lwt.Syntax | ||
open Lwt.Infix | ||
module Store = Irmin_mem.KV.Make (Irmin.Contents.String) | ||
module Client = Irmin_client_unix.Make (Store) | ||
module Error = Irmin_client.Error | ||
|
||
let main = | ||
let info () = Client.Info.empty in | ||
let uri = Uri.of_string Sys.argv.(1) in | ||
let* client = Client.connect uri in | ||
|
||
let* main = Client.main client in | ||
let* () = Client.set_exn ~info main [ "testing" ] "testing" in | ||
let* head = Client.Branch.get client Client.Branch.main in | ||
let* tree = | ||
Client.Batch.Tree.of_commit client (Client.Commit.hash head) >|= Option.get | ||
in | ||
let* tree = Client.Batch.Tree.add client tree [ "b"; "c" ] "123" in | ||
let* tree = Client.Batch.Tree.add_tree client tree [ "a" ] tree in | ||
let* tree = Client.Batch.Tree.remove client tree [ "testing" ] in | ||
let* commit = Client.Batch.commit ~parents:[ head ] ~info client tree in | ||
let* () = Client.Branch.set client Client.Branch.main commit in | ||
let* foo = Client.get main [ "foo" ] in | ||
let* abc = Client.get main [ "a"; "b"; "c" ] in | ||
let* testing = Client.find main [ "testing" ] in | ||
assert (foo = "bar"); | ||
assert (abc = "123"); | ||
assert (Option.is_none testing); | ||
Lwt_io.printlf "foo => %s\na/b/c => %s" foo abc | ||
|
||
let () = Lwt_main.run main |
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
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,3 +1,19 @@ | ||
(* | ||
* Copyright (c) 2018-2022 Tarides <[email protected]> | ||
* | ||
* Permission to use, copy, modify, and distribute this software for any | ||
* purpose with or without fee is hereby granted, provided that the above | ||
* copyright notice and this permission notice appear in all copies. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
*) | ||
|
||
open Irmin_cli | ||
|
||
(* Adding a new content type *) | ||
|
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,40 @@ | ||
(* | ||
* Copyright (c) 2018-2022 Tarides <[email protected]> | ||
* | ||
* Permission to use, copy, modify, and distribute this software for any | ||
* purpose with or without fee is hereby granted, provided that the above | ||
* copyright notice and this permission notice appear in all copies. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
*) | ||
|
||
open Lwt.Syntax | ||
module Store = Irmin_mem.KV.Make (Irmin.Contents.String) | ||
module Server = Irmin_server_unix.Make (Store) | ||
|
||
let info () = Irmin.Info.Default.empty | ||
|
||
let init () = | ||
let* repo = Store.Repo.v (Irmin_mem.config ()) in | ||
let* main = Store.main repo in | ||
let+ () = Store.set_exn ~info main [ "foo" ] "bar" in | ||
() | ||
|
||
let main () = | ||
let uri = Uri.of_string Sys.argv.(1) in | ||
let config = Irmin_mem.config () in | ||
let dashboard = `TCP (`Port 1234) in | ||
let* server = Server.v ~uri ~dashboard config in | ||
let () = Format.printf "Listening on %a@." Uri.pp uri in | ||
Server.serve server | ||
|
||
let () = | ||
Lwt_main.run | ||
@@ let* () = init () in | ||
main () |
Oops, something went wrong.