Skip to content

Commit 1bce490

Browse files
committed
docs: updated readme
1 parent 464e5b3 commit 1bce490

File tree

1 file changed

+39
-17
lines changed

1 file changed

+39
-17
lines changed

README.md

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,46 @@
11
# Linked Content Addressed Storage
22

3-
For projects that use large amounts of duplicate files
3+
A simple yet complex method of storing large directory structures with duplicate files
4+
5+
## Examples
6+
7+
```rust
8+
// `input_dir` is the artifact, likely produced by a build system etc. This is what we want to "transmit".
9+
let input_dir = absolute(Path::new("./example_dir")).unwrap();
10+
// `repo_dir` is the Repo's contained directory, and should be hosted on a web server, as a directory, etc.
11+
let repo_dir = absolute(Path::new("./example_repo")).unwrap();
12+
// `store_dir` is the local path for the local store, and will be where the Store is placed, and each artifact inside.
13+
let store_dir = absolute(Path::new("./example_store")).unwrap();
14+
15+
// Create an example repo and a store, *locally*
16+
create_repo(repo_dir.as_path())?;
17+
create_store(&store_dir)?;
18+
19+
// Create an example artifact
20+
fs::create_dir_all(Path::new("./example_dir/nested_dir/super_nested_dir")).unwrap();
21+
fs::write("./example_dir/a", "Wow a file").unwrap();
22+
fs::write("./example_dir/nested_dir/b", "Wow another file, shocking.").unwrap();
23+
fs::write(
24+
"./example_dir/nested_dir/super_nested_dir/c",
25+
"Nested nested nested file",
26+
)
27+
.unwrap();
28+
29+
// Compile the artifact into a manifest and chunks and store it
30+
build(
31+
input_dir.as_path(),
32+
repo_dir.as_path(),
33+
&"generic".to_string(),
34+
)
35+
.expect("Build Failure");
36+
37+
// Install the resulting manifest into an artifact in the `store_dir`
38+
install_artifact(&"generic".to_string(), store_dir.as_path(), &repo_dir);
39+
```
440

5-
## Using
41+
For further examples please check [the examples in the source tree.](https://github.com/TimelessOS/LCAS/tree/main/examples)
642

7-
### Terminology
43+
## Terminology
844

945
- Repo: The storage location of all uploaded chunks, artifacts, and manifests. Commonly used by the distributer of directories.
1046
- Store: The storage location of all downloaded chunks and manifests, alongside the built artifacts. Commonly used by the downloader of directories.
@@ -13,17 +49,3 @@ For projects that use large amounts of duplicate files
1349
- Chunk: A raw deduplicated file.
1450

1551
Please note: There is minor differences between implementation depending on whether they are in relation to the Store or Repo.
16-
17-
### Examples
18-
19-
For further examples please check [the examples in the source tree.](https://github.com/TimelessOS/LCAS/tree/main/examples)
20-
21-
## Contributing
22-
23-
### TODO
24-
25-
- [ ] Networking support for repos
26-
- [ ] Error handling (Should be propogated upwards)
27-
- [ ] Proper tests
28-
- [ ] Proper/Better documentation
29-
- [ ] Windows Support (UNIX-Like only)

0 commit comments

Comments
 (0)