forked from ucan-wg/rs-ucan
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I think mainly done moving modules around
- Loading branch information
Showing
37 changed files
with
200 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
// FIXME feature flag each? | ||
pub mod crud; | ||
pub mod msg; | ||
pub mod ucan; | ||
pub mod wasm; | ||
|
||
pub mod arguments; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
use super::arguments::Arguments; | ||
use crate::{ability::command::Command, delegate::Delegatable, promise::Promise}; | ||
use libipld_core::ipld::Ipld; | ||
use serde::{Deserialize, Serialize}; | ||
use std::fmt::Debug; | ||
|
||
// NOTE This one is primarily for enabling delegated recipets | ||
|
||
// FIXME | ||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] | ||
struct Generic<Args> { | ||
pub cmd: String, | ||
pub args: Args, // FIXME Does this have specific fields? | ||
} | ||
|
||
pub type Resolved = Generic<Arguments>; | ||
pub type Builder = Generic<Option<Arguments>>; | ||
pub type Promised = Generic<Promise<Arguments>>; | ||
|
||
impl<Args> Command for Generic<Args> { | ||
const COMMAND: &'static str = "ucan/proxy"; | ||
} | ||
|
||
impl Delegatable for Resolved { | ||
type Builder = Builder; | ||
} | ||
|
||
impl From<Resolved> for Builder { | ||
fn from(resolved: Resolved) -> Builder { | ||
Builder { | ||
cmd: resolved.cmd, | ||
args: Some(resolved.args), | ||
} | ||
} | ||
} | ||
|
||
impl TryFrom<Builder> for Resolved { | ||
type Error = (); // FIXME | ||
|
||
fn try_from(b: Builder) -> Result<Self, Self::Error> { | ||
Ok(Resolved { | ||
cmd: b.cmd, | ||
args: b.args.ok_or(())?, | ||
}) | ||
} | ||
} | ||
|
||
impl From<Builder> for Arguments { | ||
fn from(b: Builder) -> Arguments { | ||
let mut args = b.args.unwrap_or_default(); | ||
args.insert("cmd".into(), Ipld::String(b.cmd)); | ||
args | ||
} | ||
} | ||
|
||
// // FIXME hmmm | ||
// #[derive(Debug, Clone, PartialEq)] | ||
// pub struct ProxyExecuteBuilder { | ||
// pub command: Option<String>, | ||
// pub args: BTreeMap<String, Ipld>, | ||
// } | ||
// | ||
// | ||
// impl From<ProxyExecute> for ProxyExecuteBuilder { | ||
// fn from(proxy: ProxyExecute) -> Self { | ||
// ProxyExecuteBuilder { | ||
// command: Some(ProxyExecute::COMMAND.into()), | ||
// args: proxy.args.clone(), | ||
// } | ||
// } | ||
// } | ||
// | ||
// impl TryFrom<ProxyExecuteBuilder> for ProxyExecute { | ||
// type Error = (); // FIXME | ||
// | ||
// fn try_from(ProxyExecuteBuilder { command, args }: ProxyExecuteBuilder) -> Result<Self, ()> { | ||
// match command { | ||
// None => Err(()), | ||
// Some(command) => Ok(Self { command, args }), | ||
// } | ||
// } | ||
// } |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
pub mod payload; | ||
pub mod resolvable; | ||
mod payload; | ||
mod resolvable; | ||
mod serializer; | ||
|
||
pub use payload::Payload; | ||
pub use resolvable::Resolvable; | ||
|
||
use crate::signature; | ||
|
||
pub type Invocation<B> = signature::Envelope<payload::Payload<B>>; |
File renamed without changes.
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
mod payload; | ||
mod responds; | ||
|
||
pub use payload::Payload; | ||
pub use responds::Responds; | ||
|
||
use crate::signature; | ||
|
||
pub type Receipt<T> = signature::Envelope<Payload<T>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.