Skip to content

Commit

Permalink
Add record parameter overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
Limeth committed Jul 17, 2024
1 parent d32d447 commit 77bf9f5
Show file tree
Hide file tree
Showing 9 changed files with 395 additions and 31 deletions.
37 changes: 37 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ cmd = ["clap", "tracing-error", "tracing-subscriber"]
aes-gcm = { version = "0.10.3", features = ["std"] }
chrono = { version = "0.4", features = ["arbitrary"] }
color-eyre = "0.6.3"
derive_more = "0.99.17"
ed25519-dalek = { version = "2.1.1", features = ["rand_core", "pem"] }
futures = "0.3.30"
include_dir = { version = "0.7.4", features = ["nightly"] }
rrr = { git = "https://github.com/recursive-record-registry/rrr.git", rev = "782db4752ee74fc56199151e5b261f33b32cfbfa" }
rrr = { git = "https://github.com/recursive-record-registry/rrr.git", rev = "826ae06afaf769a64bdb215ba507e69f78fc1a0e" }
serde = { version = "1.0.203", features = ["derive"] }
serde_bytes = "0.11.14"
serde_with = "3.8.1"
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ Launch it by running the following:
# On Unix
target/release/rrr-make
```

## TODO
* [ ] Better error reporting for incomplete record parameters
* [ ] Output registry staging
* [ ] Checking whether the stored record is identical to the to-be-written one
* [ ] `published` directory
* [ ] `revisions` directory
10 changes: 5 additions & 5 deletions src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ pub enum Command {
/// Path to a source directory.
#[arg(short, long, default_value = ".")]
input_directory: PathBuf,
/// Path to a directory in which to put the RRR registry.
#[arg(short, long, default_value = "target")]
output_directory: PathBuf,
/// Force existing files to be overwritten.
#[arg(short, long, default_value = "false")]
force: bool,
/// Whether a new revision should be created in the published directory.
#[arg(long, default_value = "false")]
publish: bool,
},
}

Expand All @@ -39,13 +39,13 @@ impl Command {
}
Command::Make {
input_directory,
output_directory,
force,
publish,
} => {
let input_registry = OwnedRegistry::load(input_directory).await?;
let input_root_record = input_registry.load_root_record().await?;
let mut output_registry = Registry::create(
output_directory,
input_registry.get_staging_directory_path(),
RegistryConfig::from(&input_registry),
force,
)
Expand Down
20 changes: 14 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use futures::{future::BoxFuture, FutureExt};
use record::OwnedRecord;
use registry::OwnedRegistry;
use rrr::{
crypto::encryption::EncryptionAlgorithm,
record::{Record, RecordKey, RecordMetadata, RecordName, SuccessionNonce},
record::{
segment::SegmentEncryption, Record, RecordKey, RecordMetadata, RecordName, SuccessionNonce,
},
registry::{Registry, WriteLock},
utils::serde::BytesOrAscii,
};
Expand All @@ -13,6 +14,7 @@ use tokio::io::AsyncReadExt;
pub mod assets;
pub mod error;
pub mod owned;
pub mod util;

#[cfg(feature = "cmd")]
pub mod cmd;
Expand Down Expand Up @@ -61,10 +63,16 @@ pub fn make_recursive<'a>(
&input_registry.signing_keys,
&hashed_key,
&output_record,
0.into(), // TODO
0, // TODO
&[], // TODO
Some(&EncryptionAlgorithm::Aes256Gcm), // TODO
0.into(), // TODO
0, // TODO
&[], // TODO
input_record
.config
.parameters
.encryption
.as_ref()
.map(SegmentEncryption::from)
.as_ref(),
force,
)
.await?;
Expand Down
Loading

0 comments on commit 77bf9f5

Please sign in to comment.