Skip to content

Commit

Permalink
Removed some of the wrappers to simplify the client
Browse files Browse the repository at this point in the history
  • Loading branch information
simlay committed Jan 8, 2021
1 parent 7102fe2 commit cdf1396
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 151 deletions.
139 changes: 46 additions & 93 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ crate-type = ["cdylib"]
test = false

[dependencies]
log = "0.4.8"
log = "0.4.12"
serde = { version = "1.0.110", features = ["derive"] }
serde_json = "1.0.53"
node-bindgen = "4.1.0"
fluvio = { version = "0.3.1", features = ["admin"] }
fluvio = { version = "0.3.2", features = ["admin"] }
fluvio-future = { version = "0.1.13", features = ["tls", "task", "io"] }

[build-dependencies]
Expand Down
14 changes: 7 additions & 7 deletions src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ const RESOLUTION_KEY: &str = "resolution";
const LSR_KEY: &str = "lsr";
const REPLICAS_KEY: &str = "replicas";

pub struct FluvioAdminWrapper(FluvioAdmin);

impl FluvioAdminWrapper {
pub fn new(client: FluvioAdmin) -> Self {
Self(client)
impl From<FluvioAdmin> for FluvioAdminJS {
fn from(inner: FluvioAdmin) -> Self {
Self { inner: Some(inner) }
}
}

impl TryIntoJs for FluvioAdminWrapper {
impl TryIntoJs for FluvioAdminJS {
fn try_to_js(self, js_env: &JsEnv) -> Result<napi_value, NjError> {
debug!("converting FluvioWrapper to js");
let new_instance = FluvioAdminJS::new_instance(js_env, vec![])?;
debug!("instance created");
FluvioAdminJS::unwrap_mut(js_env, new_instance)?.set_client(self.0);
if let Some(inner) = self.inner {
FluvioAdminJS::unwrap_mut(js_env, new_instance)?.set_client(inner);
}
Ok(new_instance)
}
}
Expand Down
Loading

0 comments on commit cdf1396

Please sign in to comment.