Skip to content

Commit

Permalink
- redunt store manipulating
Browse files Browse the repository at this point in the history
  • Loading branch information
oluceps committed Nov 26, 2024
1 parent e6f55b8 commit 4cc5b9b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 88 deletions.
18 changes: 9 additions & 9 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cargo-features = ["edition2024"]

[package]
name = "vaultix"
version = "0.1.4"
version = "0.1.6"
edition = "2024"

[lib]
Expand Down
20 changes: 2 additions & 18 deletions src/cmd/renc.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use crate::{
interop::add_to_store,
parser::identity::{ParsedIdentity, RawIdentity},
profile::Profile,
util::secmap::{RencBuilder, RencCtx},
};
use eyre::{Result, bail};
use log::{error, info};
use log::error;
use std::{fs, path::PathBuf};

pub struct CompleteProfile<'a>(pub Vec<&'a Profile>);
Expand Down Expand Up @@ -61,21 +60,6 @@ impl<'a> CompleteProfile<'a> {

let ctx = RencCtx::create(&self);

raw_instance
.build_instance()
.makeup(&ctx, identity)?
.iter()
.try_for_each(|p| {
let cache = p.canonicalize()?;
info!("storing cache: {}", cache.display());
let o = add_to_store(cache)?;
if !o.status.success() {
error!("Command executed with failing error code");
// Another side, calculate with nix `builtins.path` and pass to when deploy as `storage`
info!("path added to store: {}", String::from_utf8(o.stdout)?);
bail!("unexpected error");
}
Ok(())
})
raw_instance.build_instance().makeup(&ctx, identity)
}
}
41 changes: 0 additions & 41 deletions src/interop/mod.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ mod util {
pub mod secmap;
pub mod set_owner_group;
}
mod interop;
mod parser;
mod profile;

Expand Down
21 changes: 3 additions & 18 deletions src/util/makeup.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
collections::HashSet,
iter,
path::PathBuf,
rc::Rc,
Expand All @@ -26,14 +25,10 @@ use super::{
secmap::{RencCtx, RencInstance},
};

use eyre::{eyre, Context, ContextCompat, Result};
use eyre::{Context, ContextCompat, Result, eyre};

impl<'a> RencInstance<'a> {
pub fn makeup(
self,
ctx_agenc: &RencCtx<'a, AgeEnc>,
ident: Box<dyn Identity>,
) -> Result<HashSet<PathBuf>> {
pub fn makeup(self, ctx_agenc: &RencCtx<'a, AgeEnc>, ident: Box<dyn Identity>) -> Result<()> {
let key: Rc<dyn Identity> = Rc::from(ident);

let material = &self.inner().into_read_only();
Expand Down Expand Up @@ -176,16 +171,6 @@ impl<'a> RencInstance<'a> {
}
});

Ok(last_res
.iter()
.filter(|i| i.is_ok())
.map(|i| {
if let Ok(o) = i {
o.clone()
} else {
unreachable!()
}
})
.collect())
Ok(())
}
}

0 comments on commit 4cc5b9b

Please sign in to comment.