git.delta.rocks / jrsonnet / refs/commits / d70668683ed2

difftreelog

source

crates/fleet-base/src/primops.rs947 Bsourcehistory
1use std::collections::HashMap;2use std::sync::{Arc, Mutex};34use nix_eval::{NativeFn, Value};5use tracing::info;67use crate::fleetdata::{FleetData, FleetSecrets};89#[derive(thiserror::Error, Debug)]10enum Error {}1112struct Parts {13	encrypted: Vec<String>,14	public: Vec<String>,15}1617trait SecretsBackend {18	fn has_shared(&self, name: &str);19	fn has_host(&self, host: &str, name: &str);20	fn shared_parts(&self, name: &str) -> Parts;21	fn host_parts(&self, host: &str, name: &str) -> Parts;22}2324struct FsSecretsBackend {}2526pub fn init_primops(secrets: Arc<Mutex<FleetData>>) {27	info!("initializing primops");28	NativeFn::new(29		c"__fleetEnsureHostSecret",30		c"Ensure secret existence for a host, regenerating it in case of some mismatch",31		[c"host", c"secret", c"generator"],32		|[host, secret, generator]| {33			todo!("ensure secret");34			Ok(Value::new_attrs(HashMap::from_iter([(35				"raw",36				Value::new_str("rawData"),37			)])))38		},39	)40	.register();41}