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

Formatting README_LIBIRMING #2340

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
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
28 changes: 14 additions & 14 deletions README_LIBIRMIN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# libirmin
# `libirmin`

`libirmin` provides C bindings to the irmin API.
`libirmin` provides C bindings to the Irmin API.

## Installation

Expand All @@ -10,8 +10,8 @@ To install from the root of this repo:
$ opam pin add libirmin .
```

After installing `libirmin.so` can be found in `$OPAM_SWITCH_PREFIX/libirmin/lib`
and `irmin.h` will be in `$OPAM_SWITCH_PREFIX/libirmin/include`
After installing, `libirmin.so` can be found in `$OPAM_SWITCH_PREFIX/libirmin/lib`,
and `irmin.h` will be in `$OPAM_SWITCH_PREFIX/libirmin/include`.

This means when compiling programs that use `libirmin` you will need to include those
directories:
Expand All @@ -22,9 +22,9 @@ $ export IRMIN_LDFLAGS=-L$OPAM_SWITCH_PREFIX/libirmin/lib -lirmin
$ cc $IRMIN_CFLAGS my-program.c -o my-program $IRMIN_LDFLAGS
```

## Usage examples
## Usage Examples

### Opening a store
### Opening a Store

The first thing you will need to do is configure a backend:

Expand All @@ -40,7 +40,7 @@ if (config == NULL){
}
```

When using `irmin-mem`, `irmin-fs` or `irmin-pack` you can specify the hash type
When using `irmin-mem`, `irmin-fs`, or `irmin-pack`, you can specify the hash type
in addition to the content type:

```c
Expand All @@ -50,8 +50,8 @@ IrminConfig *config = irmin_config_mem("sha256", "string");
Available backends: `irmin_config_mem`, `irmin_config_git`, `irmin_config_git_mem`, `irmin_config_fs`,
`irmin_config_pack`, `irmin_config_tezos`

If `NULL` is passed for the content parameter then `string` will be used by default and
when `NULL` is passed for the hash argument `blake2b` is used.
If `NULL` is passed for the content parameter, then `string` will be used by default; and
when `NULL` is passed for the hash argument, `blake2b` is used.

Available content types: `string`, `json` (JSON objects), `json-value` (any JSON value)
Available hash types: `blake2b`, `blake2s`, `rmd160`, `sha1`, `sha224`, `sha256`, `sha384`,
Expand All @@ -65,7 +65,7 @@ When using a backend that stores information on disk, you will probably want to
assert(irmin_config_set_root(config, "path/to/store"));
```

Next you can initialize the repo:
Next you can initialise the repo:

```c
IrminRepo *repo = irmin_repo_new(config);
Expand Down Expand Up @@ -96,7 +96,7 @@ irmin_repo_free(repo);
irmin_config_free(config);
```

### Setting values
### Setting Values

Setting a value when using string contents:

Expand All @@ -111,8 +111,8 @@ irmin_string_free(value);
```

The `-1` argument to `irmin_string_new` is used to pass the length of
the string. If it ends with a NULL byte then passing `-1` will auto-
matically detect the string length. This also shows that `IrminString`
the string. If it ends with a `NULL` byte, then passing `-1` will automatically
detect the string length. This also shows that `IrminString`
can be cast to `IrminContents` safely when using `string` contents.

When using `json` contents:
Expand All @@ -129,7 +129,7 @@ irmin_contents_free(value);
irmin_type_free(t);
```

### Getting values
### Getting Values

The following will get the value associated with a path and print its string
representation to stdout:
Expand Down