changelog shortlog graph tags branches files raw help

Mercurial > demo / changeset: obj updates

changeset 11: d8f806f1d327
parent 10: 79737134254d
child 12: c520966de7fa
author: ellis <ellis@rwest.io>
date: Sun, 14 May 2023 21:27:04 -0400
files: Cargo.toml demo.lisp fig/Cargo.toml fig/src/lib.rs obj/Cargo.toml obj/proc_macros/Cargo.toml obj/proc_macros/src/derive.rs obj/proc_macros/src/lib.rs obj/src/auth.rs obj/src/database.rs obj/src/hash.rs obj/src/id.rs obj/src/lib.rs obj/src/network.rs obj/src/types.rs proc_macros/Cargo.toml proc_macros/src/derive.rs proc_macros/src/lib.rs
description: obj updates
     1.1--- a/Cargo.toml	Fri May 12 22:58:05 2023 -0400
     1.2+++ b/Cargo.toml	Sun May 14 21:27:04 2023 -0400
     1.3@@ -4,9 +4,9 @@
     1.4 build = "build.rs"
     1.5 [lib]
     1.6 path = "lib.rs"
     1.7-crate-type = ["cdylib"]
     1.8+crate-type = ["lib","cdylib","staticlib"]
     1.9 [workspace]
    1.10-members = ["obj","fig","proc_macros"]
    1.11+members = ["obj","fig"]
    1.12 [dependencies]
    1.13 libc = "0.2"
    1.14 obj = {version = "0.1.0",path = "obj"}
     2.1--- a/demo.lisp	Fri May 12 22:58:05 2023 -0400
     2.2+++ b/demo.lisp	Sun May 14 21:27:04 2023 -0400
     2.3@@ -15,7 +15,14 @@
     2.4     :long-name "app"
     2.5     :initial-value "client"
     2.6     :env-vars '("DEMO_APP")
     2.7-    :key :app)))
     2.8+    :key :app)
     2.9+   (cli:make-option
    2.10+    :string
    2.11+    :description "path to config"
    2.12+    :short-name #\c
    2.13+    :long-name "config"
    2.14+    :initial-value "$DEMO_PATH/.fig"
    2.15+    :env-vars '("DEMO_CONFIG"))))
    2.16 
    2.17 (defun cli-handler (cmd)
    2.18   "Handler for the `demo' command."
     3.1--- a/fig/Cargo.toml	Fri May 12 22:58:05 2023 -0400
     3.2+++ b/fig/Cargo.toml	Sun May 14 21:27:04 2023 -0400
     3.3@@ -4,4 +4,5 @@
     3.4 edition = "2021"
     3.5 [dependencies]
     3.6 obj = {version = "0.1.0",path = "../obj"}
     3.7+serde = "1.0.163"
     3.8 serde_dhall = "0.12.1"
     4.1--- a/fig/src/lib.rs	Fri May 12 22:58:05 2023 -0400
     4.2+++ b/fig/src/lib.rs	Sun May 14 21:27:04 2023 -0400
     4.3@@ -1,3 +1,51 @@
     4.4 //! fig/src/lib.rs --- Configuration types
     4.5+use serde::{Serialize, Deserialize};
     4.6+use obj::Objective;
     4.7+use std::collections::HashMap as M;
     4.8+use std::path::PathBuf;
     4.9+use std::string::String as S;
    4.10+use std::error::Error as E;
    4.11+use std::boxed::Box as B;
    4.12+type R<X> = std::result::Result<X,B<dyn E>>;
    4.13+
    4.14+/// common trait for all config modules. This trait provides functions
    4.15+/// for de/serializing to/from RON, updating fields, and formatting.
    4.16+pub trait Configure: Objective {
    4.17+  fn update(&self) -> R<()> {
    4.18+    Ok(())
    4.19+  }
    4.20+}
    4.21+
    4.22+#[derive(Serialize, Deserialize, Debug, Default)]
    4.23+pub struct ShellConfig {
    4.24+  pub env: M<S,S>,
    4.25+  pub cmds: M<S,S>,
    4.26+  pub shell: ShellType,
    4.27+}
    4.28+impl Objective for ShellConfig {}
    4.29+
    4.30+#[derive(Serialize, Deserialize, Debug, Hash, Default)]
    4.31+pub enum ShellType {
    4.32+  #[default]
    4.33+  Bash,
    4.34+  Zsh,
    4.35+  Sh,
    4.36+}
    4.37+
    4.38+#[derive(Serialize, Deserialize, Debug, Default)]
    4.39+pub enum EditorType {
    4.40+  #[default]
    4.41+  Emacs,
    4.42+  Vi,
    4.43+  Nano,
    4.44+}
    4.45+
    4.46+#[derive(Serialize, Deserialize, Debug, Default)]
    4.47+pub struct EditorConfig {
    4.48+  pub editor: EditorType,
    4.49+  pub cmds: M<S,S>,
    4.50+  pub init_file: PathBuf,
    4.51+}
    4.52+
    4.53 #[cfg(test)]
    4.54 mod tests;
     5.1--- a/obj/Cargo.toml	Fri May 12 22:58:05 2023 -0400
     5.2+++ b/obj/Cargo.toml	Sun May 14 21:27:04 2023 -0400
     5.3@@ -2,15 +2,26 @@
     5.4 name = "obj"
     5.5 version = "0.1.0"
     5.6 edition = "2021"
     5.7+[features]
     5.8+oauth = ["yup-oauth2"]
     5.9+
    5.10 [dependencies]
    5.11 ron = "0.7.0"
    5.12 bincode = "1.3.3"
    5.13 serde_json = "1.0.68"
    5.14 serde = { version = "1.0.130", features = ["derive"] }
    5.15 chrono = { version = "0.4.19", features = ["serde"] }
    5.16-# mime = "0.3.16"
    5.17+mime = "0.3.16"
    5.18 regex = "1.5.4"
    5.19-# rusty_ulid = "0.11.0"
    5.20+rusty_ulid = "0.11.0"
    5.21 uuid = { version = "0.8", features = ["serde"] }
    5.22+yup-oauth2 = { version = "5.1.0", optional = true }
    5.23+blake3 = "1.0.0"
    5.24+hashbrown = "0.11.2"
    5.25+rand = "0.8.0"
    5.26+sha2 = "0.9.5"
    5.27+hex = "0.4.3"
    5.28+ulid = "1.0.0"
    5.29+
    5.30 [target.'cfg(target_arch = "wasm32")'.dependencies]
    5.31 uuid = { version = "0.8", features = ["wasm-bindgen"] }
     6.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2+++ b/obj/proc_macros/Cargo.toml	Sun May 14 21:27:04 2023 -0400
     6.3@@ -0,0 +1,10 @@
     6.4+[package]
     6.5+name = "proc_macros"
     6.6+version = "0.1.0"
     6.7+edition = "2021"
     6.8+[lib]
     6.9+proc-macro = true
    6.10+[dependencies]
    6.11+quote = "1.0"
    6.12+proc-macro2 = "1.0"
    6.13+syn = "1.0"
    6.14\ No newline at end of file
     7.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2+++ b/obj/proc_macros/src/derive.rs	Sun May 14 21:27:04 2023 -0400
     7.3@@ -0,0 +1,5 @@
     7.4+mod derive;
     7.5+use proc_macro::TokenStream;
     7.6+pub fn derive_static_type(input: TokenStream) -> TokenStream {
     7.7+    derive::derive_static_type(input)
     7.8+}
     8.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2+++ b/obj/proc_macros/src/lib.rs	Sun May 14 21:27:04 2023 -0400
     8.3@@ -0,0 +1,1 @@
     8.4+
     9.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2+++ b/obj/src/auth.rs	Sun May 14 21:27:04 2023 -0400
     9.3@@ -0,0 +1,72 @@
     9.4+//! Auth Configs
     9.5+use serde::{Deserialize, Serialize};
     9.6+
     9.7+#[cfg(feature = "oauth")]
     9.8+use yup_oauth2::ApplicationSecret;
     9.9+
    9.10+#[derive(Serialize, Deserialize, Debug, Default, Hash)]
    9.11+pub struct AuthConfig {
    9.12+  pub provider: String,
    9.13+  #[cfg(feature = "oauth")]
    9.14+  pub oauth: Option<Oauth2Config>,
    9.15+  pub ssh: Option<SshConfig>,
    9.16+  pub pw: Option<PasswordConfig>,
    9.17+}
    9.18+
    9.19+#[derive(Serialize, Deserialize, Default, Debug, Hash)]
    9.20+pub struct PasswordConfig(String, String);
    9.21+
    9.22+#[cfg(feature = "oauth")]
    9.23+#[derive(Serialize, Deserialize, Hash, Debug, PartialEq, Clone, Default)]
    9.24+pub struct Oauth2Config {
    9.25+  pub client_id: String,
    9.26+  pub client_secret: String,
    9.27+  pub redirect_uris: Vec<String>,
    9.28+  pub auth_uri: String,
    9.29+  pub token_uri: String,
    9.30+  pub project_id: Option<String>, //for apptoken
    9.31+  pub client_email: Option<String>,
    9.32+  /// The URL of the public x509 certificate, used to verify the signature on
    9.33+  /// JWTs, such as ID tokens, signed by the authentication provider.
    9.34+  pub auth_provider_x509_cert_url: Option<String>,
    9.35+  ///  The URL of the public x509 certificate, used to verify JWTs signed by the
    9.36+  /// client.
    9.37+  pub client_x509_cert_url: Option<String>,
    9.38+}
    9.39+
    9.40+#[cfg(feature = "oauth")]
    9.41+impl From<ApplicationSecret> for Oauth2Config {
    9.42+  fn from(shh: ApplicationSecret) -> Self {
    9.43+    Oauth2Config {
    9.44+      client_id: shh.client_id,
    9.45+      client_secret: shh.client_secret,
    9.46+      redirect_uris: shh.redirect_uris,
    9.47+      auth_uri: shh.auth_uri,
    9.48+      token_uri: shh.token_uri,
    9.49+      project_id: shh.project_id,
    9.50+      client_email: shh.client_email,
    9.51+      auth_provider_x509_cert_url: shh.auth_provider_x509_cert_url,
    9.52+      client_x509_cert_url: shh.client_x509_cert_url,
    9.53+    }
    9.54+  }
    9.55+}
    9.56+
    9.57+#[cfg(feature = "oauth")]
    9.58+impl From<Oauth2Config> for ApplicationSecret {
    9.59+  fn from(cfg: Oauth2Config) -> Self {
    9.60+    ApplicationSecret {
    9.61+      client_id: cfg.client_id,
    9.62+      client_secret: cfg.client_secret,
    9.63+      redirect_uris: cfg.redirect_uris,
    9.64+      auth_uri: cfg.auth_uri,
    9.65+      token_uri: cfg.token_uri,
    9.66+      project_id: cfg.project_id,
    9.67+      client_email: cfg.client_email,
    9.68+      auth_provider_x509_cert_url: cfg.auth_provider_x509_cert_url,
    9.69+      client_x509_cert_url: cfg.client_x509_cert_url,
    9.70+    }
    9.71+  }
    9.72+}
    9.73+
    9.74+#[derive(Serialize, Deserialize, Hash, Debug, PartialEq, Clone, Default)]
    9.75+pub struct SshConfig {}
    10.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2+++ b/obj/src/database.rs	Sun May 14 21:27:04 2023 -0400
    10.3@@ -0,0 +1,18 @@
    10.4+//! cfg::config::database
    10.5+//!
    10.6+//! Database configuration primitives
    10.7+use serde::{Deserialize, Serialize};
    10.8+
    10.9+#[derive(Serialize, Deserialize, Debug, Hash, PartialEq, Eq)]
   10.10+pub struct DatabaseConfig {
   10.11+  engine: DatabaseType,
   10.12+  path: String,
   10.13+  cfs: Vec<String>,
   10.14+}
   10.15+
   10.16+#[derive(Serialize, Deserialize, Debug, Hash, PartialEq, Eq)]
   10.17+pub enum DatabaseType {
   10.18+  RocksDB,
   10.19+  Postgres,
   10.20+  Alch,
   10.21+}
    11.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2+++ b/obj/src/hash.rs	Sun May 14 21:27:04 2023 -0400
    11.3@@ -0,0 +1,51 @@
    11.4+//! hash - wrapper for hash algorithms and types
    11.5+
    11.6+pub use blake3::{derive_key, hash, keyed_hash, Hash as B3Hash, Hasher as B3Hasher, OutputReader};
    11.7+pub use hex;
    11.8+pub use sha2::Sha512;
    11.9+
   11.10+pub use std::hash::{Hash, Hasher};
   11.11+
   11.12+pub const KEY_LEN: usize = 32;
   11.13+pub const OUT_LEN: usize = 32;
   11.14+pub const OUT_LEN_HEX: usize = OUT_LEN * 2;
   11.15+
   11.16+#[cfg(test)]
   11.17+mod tests {
   11.18+  use crate::*;
   11.19+  use super::*;
   11.20+  #[test]
   11.21+  fn id_state_hash() {
   11.22+    let id = id::Id(vec![0; KEY_LEN]);
   11.23+    let hash = id.state_hash(&mut B3Hasher::new());
   11.24+    assert_eq!(hash, id.state_hash(&mut B3Hasher::new()));
   11.25+  }
   11.26+
   11.27+  #[test]
   11.28+  fn id_hex() {
   11.29+    let id = id::Id(vec![255; KEY_LEN]);
   11.30+
   11.31+    assert_eq!(
   11.32+      hex::decode("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap(),
   11.33+      id.0
   11.34+    );
   11.35+  }
   11.36+
   11.37+  #[test]
   11.38+  fn rand_id() {
   11.39+    let id = id::Id::rand();
   11.40+    let hash = id.state_hash(&mut B3Hasher::new());
   11.41+    assert_eq!(hash, id.state_hash(&mut B3Hasher::new()));
   11.42+  }
   11.43+
   11.44+  #[test]
   11.45+  fn random_demon_id_is_valid() {
   11.46+    use id::PeerId;
   11.47+    for _ in 0..5000 {
   11.48+      let did = PeerId::rand();
   11.49+      let did2 = PeerId::rand();
   11.50+      assert_eq!(did, did);
   11.51+      assert_ne!(did, did2);
   11.52+    }
   11.53+  }
   11.54+}
    12.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2+++ b/obj/src/id.rs	Sun May 14 21:27:04 2023 -0400
    12.3@@ -0,0 +1,120 @@
    12.4+use std::{fmt, str::FromStr};
    12.5+use serde::{Serialize, Deserialize};
    12.6+pub use uuid::Uuid;
    12.7+pub use ulid::Ulid;
    12.8+use rand::Rng;
    12.9+use crate::hash::{KEY_LEN,OUT_LEN,B3Hasher};
   12.10+/// a simple Id abstraction
   12.11+#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Serialize, Deserialize, Hash)]
   12.12+pub struct Id(pub Vec<u8>);
   12.13+
   12.14+impl Id {
   12.15+  pub fn rand() -> Self {
   12.16+    let mut rng = rand::thread_rng();
   12.17+    let vals: Vec<u8> = (0..KEY_LEN).map(|_| rng.gen_range(0..u8::MAX)).collect();
   12.18+    Id(vals)
   12.19+  }
   12.20+
   12.21+  pub fn state_hash(&self, state: &mut B3Hasher) -> Self {
   12.22+    let mut output = vec![0; OUT_LEN];
   12.23+    state.update(&self.0);
   12.24+    let mut res = state.finalize_xof();
   12.25+    res.fill(&mut output);
   12.26+    Id(output)
   12.27+  }
   12.28+
   12.29+  pub fn to_hex(&self) -> String {
   12.30+    hex::encode(&self.0)
   12.31+  }
   12.32+}
   12.33+
   12.34+/// PeerId
   12.35+///
   12.36+/// identifies a unique Peer
   12.37+#[derive(Clone, Eq, Hash, Ord, PartialEq, PartialOrd, Debug)]
   12.38+pub struct PeerId {
   12.39+  id: [u8; 32],
   12.40+}
   12.41+
   12.42+impl PeerId {
   12.43+  pub fn new() -> Self {
   12.44+    Self::default()
   12.45+  }
   12.46+
   12.47+  pub fn rand() -> Self {
   12.48+    let pd = rand::thread_rng().gen::<[u8; 32]>();
   12.49+    Self { id: pd }
   12.50+  }
   12.51+
   12.52+  pub fn from_bytes(data: &[u8]) -> Self {
   12.53+    let pd = blake3::hash(data);
   12.54+    let hash = pd.as_bytes();
   12.55+    Self { id: *hash }
   12.56+  }
   12.57+}
   12.58+
   12.59+impl Default for PeerId {
   12.60+  fn default() -> Self {
   12.61+    PeerId { id: [0; 32] }
   12.62+  }
   12.63+}
   12.64+
   12.65+/// Identity trait
   12.66+///
   12.67+/// Defines Identity-related behaviors
   12.68+pub trait Identity: Sized {
   12.69+  /// return the hashed bytes of an ObjectId
   12.70+  fn id(&self) -> Id;
   12.71+}
   12.72+
   12.73+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
   12.74+pub struct ObjectId(u128);
   12.75+
   12.76+pub struct NameSpace {
   12.77+  pub prefix: Option<String>,
   12.78+  pub capacity: u64,
   12.79+  pub route: Vec<Id>,
   12.80+  pub key: Option<Id>,
   12.81+}
   12.82+
   12.83+pub struct Domain {
   12.84+  pub ns: NameSpace,
   12.85+  pub id: Id,
   12.86+}
   12.87+
   12.88+impl From<Uuid> for ObjectId {
   12.89+  fn from(uuid: Uuid) -> Self {
   12.90+    ObjectId(uuid.as_u128())
   12.91+  }
   12.92+}
   12.93+
   12.94+impl From<Ulid> for ObjectId {
   12.95+  fn from(ulid: Ulid) -> Self {
   12.96+    ObjectId(u128::from(ulid))
   12.97+  }
   12.98+}
   12.99+
  12.100+impl From<u128> for ObjectId {
  12.101+  fn from(src: u128) -> Self {
  12.102+    ObjectId(src)
  12.103+  }
  12.104+}
  12.105+
  12.106+impl FromStr for ObjectId {
  12.107+  type Err = ();
  12.108+  fn from_str(input: &str) -> std::result::Result<ObjectId, Self::Err> {
  12.109+    match input {
  12.110+      i => Ok(ObjectId(u128::from(Ulid::from_str(i).unwrap()))),
  12.111+    }
  12.112+  }
  12.113+}
  12.114+
  12.115+impl fmt::Display for ObjectId {
  12.116+  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  12.117+    match *self {
  12.118+      ObjectId(i) => {
  12.119+        write!(f, "{}", Ulid::from(i))
  12.120+      }
  12.121+    }
  12.122+  }
  12.123+}
    13.1--- a/obj/src/lib.rs	Fri May 12 22:58:05 2023 -0400
    13.2+++ b/obj/src/lib.rs	Sun May 14 21:27:04 2023 -0400
    13.3@@ -4,7 +4,11 @@
    13.4 pub use err::{Error, Result};
    13.5 mod types;
    13.6 pub use types::*;
    13.7-
    13.8+pub mod id;
    13.9+pub mod auth;
   13.10+pub mod hash;
   13.11+pub mod network;
   13.12+pub mod database;
   13.13 pub use bincode;
   13.14 pub use ron;
   13.15 use ron::extensions::Extensions;
   13.16@@ -13,14 +17,6 @@
   13.17 use std::collections::{BTreeMap, HashMap};
   13.18 use std::io;
   13.19 
   13.20-/// common trait for all config modules. This trait provides functions
   13.21-/// for de/serializing to/from RON, updating fields, and formatting.
   13.22-pub trait Configure: Objective {
   13.23-  fn update(&self) -> Result<()> {
   13.24-    Ok(())
   13.25-  }
   13.26-}
   13.27-
   13.28 /// Objective trait
   13.29 /// Define Object behaviors, implemented by Objects
   13.30 pub trait Objective {
   13.31@@ -132,3 +128,22 @@
   13.32 impl<T> Objective for Vec<T> {}
   13.33 impl<K, V> Objective for HashMap<K, V> {}
   13.34 impl<K, V> Objective for BTreeMap<K, V> {}
   13.35+impl Objective for std::path::PathBuf {}
   13.36+impl Objective for std::path::Path {}
   13.37+impl Objective for std::string::String {}
   13.38+impl Objective for std::any::TypeId {}
   13.39+impl Objective for u8 {}
   13.40+impl Objective for u16 {}
   13.41+impl Objective for u32 {}
   13.42+impl Objective for u64 {}
   13.43+impl Objective for u128 {}
   13.44+impl Objective for i8 {}
   13.45+impl Objective for i16 {}
   13.46+impl Objective for i32 {}
   13.47+impl Objective for i64 {}
   13.48+impl Objective for i128 {}
   13.49+impl Objective for isize {}
   13.50+impl Objective for usize {}
   13.51+impl Objective for f32 {}
   13.52+impl Objective for f64 {}
   13.53+
    14.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2+++ b/obj/src/network.rs	Sun May 14 21:27:04 2023 -0400
    14.3@@ -0,0 +1,59 @@
    14.4+//! cfg::config::network
    14.5+//!
    14.6+//! Network configuration primitives
    14.7+use serde::{Deserialize, Serialize};
    14.8+use std::{fmt, net::SocketAddr};
    14.9+
   14.10+/// Network configuration
   14.11+#[derive(Serialize, Deserialize, Hash, Debug, PartialEq, Clone)]
   14.12+pub struct NetworkConfig {
   14.13+  /// a socket to bind
   14.14+  pub socket: SocketAddr,
   14.15+  /// a proxy to forward packets from
   14.16+  pub proxy: Option<SocketAddr>,
   14.17+  /// tunnel to use
   14.18+  pub tunnel: Option<String>,
   14.19+  /// network engine to attach
   14.20+  pub engine: EngineType,
   14.21+  /// peers to register AOT
   14.22+  pub peers: Option<Vec<SocketAddr>>,
   14.23+}
   14.24+
   14.25+impl Default for NetworkConfig {
   14.26+  fn default() -> Self {
   14.27+    NetworkConfig {
   14.28+      socket: "127.0.0.1:0".parse().unwrap(),
   14.29+      proxy: None,
   14.30+      tunnel: None,
   14.31+      engine: EngineType::default(),
   14.32+      peers: None,
   14.33+    }
   14.34+  }
   14.35+}
   14.36+
   14.37+#[derive(Serialize, Deserialize, Hash, Debug, PartialEq, Clone)]
   14.38+pub enum EngineType {
   14.39+  Quic,
   14.40+  Http,
   14.41+  Dns,
   14.42+  Ssh,
   14.43+  Uds,
   14.44+}
   14.45+
   14.46+impl Default for EngineType {
   14.47+  fn default() -> Self {
   14.48+    Self::Http
   14.49+  }
   14.50+}
   14.51+
   14.52+impl std::fmt::Display for EngineType {
   14.53+  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
   14.54+    match self {
   14.55+      EngineType::Quic => write!(f, "quic"),
   14.56+      EngineType::Http => write!(f, "http"),
   14.57+      EngineType::Dns => write!(f, "dns"),
   14.58+      EngineType::Ssh => write!(f, "ssh"),
   14.59+      EngineType::Uds => write!(f, "uds"),
   14.60+    }
   14.61+  }
   14.62+}
    15.1--- a/obj/src/types.rs	Fri May 12 22:58:05 2023 -0400
    15.2+++ b/obj/src/types.rs	Sun May 14 21:27:04 2023 -0400
    15.3@@ -1,13 +1,16 @@
    15.4 //! obj/src/types.rs --- OBJ type descriptions used by our demo
    15.5 use crate::{Deserialize, Objective, Result, Serialize};
    15.6+use std::collections::HashMap;
    15.7+
    15.8 /// APPLICATION TYPES
    15.9-#[derive(Serialize, Deserialize)]
   15.10+#[derive(Serialize,Deserialize,Default)]
   15.11 pub enum Service {
   15.12   Weather,
   15.13   Stocks,
   15.14   Dynamic(Vec<Service>),
   15.15   Custom(CustomService),
   15.16-  Test,
   15.17+  #[default]
   15.18+  Bench,
   15.19 }
   15.20 
   15.21 impl Objective for Service {}
   15.22@@ -17,7 +20,7 @@
   15.23     match value {
   15.24       "weather" => Service::Weather,
   15.25       "stocks" => Service::Stocks,
   15.26-      "test" => Service::Test,
   15.27+      "bench" => Service::Bench,
   15.28       s => {
   15.29         if s.contains(",") {
   15.30           let x = s.split(",");
   15.31@@ -33,10 +36,12 @@
   15.32   }
   15.33 }
   15.34 
   15.35-#[derive(Serialize, Deserialize)]
   15.36+#[derive(Serialize,Deserialize,Default)]
   15.37 pub struct CustomService {
   15.38   name: String,
   15.39+  registry: HashMap<String,Vec<u8>>,
   15.40 }
   15.41+
   15.42 impl Objective for CustomService {}
   15.43 impl From<CustomService> for Service {
   15.44   fn from(value: CustomService) -> Self {
   15.45@@ -46,14 +51,16 @@
   15.46 impl From<&str> for CustomService {
   15.47   fn from(value: &str) -> Self {
   15.48     let name = value.to_owned();
   15.49-    CustomService { name }
   15.50+    let registry = HashMap::new();
   15.51+    CustomService { name, registry }
   15.52   }
   15.53 }
   15.54 
   15.55-#[derive(Serialize, Deserialize)]
   15.56+#[derive(Serialize, Deserialize,Default)]
   15.57 pub struct Complex<X: Objective> {
   15.58   data: X,
   15.59-  state: Vec<u8>,
   15.60+  stack: Vec<u8>,
   15.61+  registry: HashMap<String,Vec<u8>>,
   15.62 }
   15.63 
   15.64 impl Objective for Complex<Service> {}
    16.1--- a/proc_macros/Cargo.toml	Fri May 12 22:58:05 2023 -0400
    16.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3@@ -1,10 +0,0 @@
    16.4-[package]
    16.5-name = "proc_macros"
    16.6-version = "0.1.0"
    16.7-edition = "2021"
    16.8-[lib]
    16.9-proc-macro = true
   16.10-[dependencies]
   16.11-quote = "1.0"
   16.12-proc-macro2 = "1.0"
   16.13-syn = "1.0"
   16.14\ No newline at end of file
    17.1--- a/proc_macros/src/derive.rs	Fri May 12 22:58:05 2023 -0400
    17.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3@@ -1,5 +0,0 @@
    17.4-mod derive;
    17.5-use proc_macro::TokenStream;
    17.6-pub fn derive_static_type(input: TokenStream) -> TokenStream {
    17.7-    derive::derive_static_type(input)
    17.8-}
    18.1--- a/proc_macros/src/lib.rs	Fri May 12 22:58:05 2023 -0400
    18.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3@@ -1,1 +0,0 @@
    18.4-