* prototype - working with message from the cli * prototype - pipe from the CLI to plugins * prototype - pipe from the CLI to plugins and back again * prototype - working with better cli interface * prototype - working after removing unused stuff * prototype - working with launching plugin if it is not launched, also fixed event ordering * refactor: change message to cli-message * prototype - allow plugins to send messages to each other * fix: allow cli messages to send plugin parameters (and implement backpressure) * fix: use input_pipe_id to identify cli pipes instead of their message name * fix: come cleanups and add skip_cache parameter * fix: pipe/client-server communication robustness * fix: leaking messages between plugins while loading * feat: allow plugins to specify how a new plugin instance is launched when sending messages * fix: add permissions * refactor: adjust cli api * fix: improve cli plugin loading error messages * docs: cli pipe * fix: take plugin configuration into account when messaging between plugins * refactor: pipe message protobuf interface * refactor: update(event) -> pipe * refactor - rename CliMessage to CliPipe * fix: add is_private to pipes and change some naming * refactor - cli client * refactor: various cleanups * style(fmt): rustfmt * fix(pipes): backpressure across multiple plugins * style: some cleanups * style(fmt): rustfmt * style: fix merge conflict mistake * style(wording): clarify pipe permission
52 lines
1.9 KiB
Rust
52 lines
1.9 KiB
Rust
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct PipeMessage {
|
|
#[prost(enumeration = "PipeSource", tag = "1")]
|
|
pub source: i32,
|
|
#[prost(string, optional, tag = "2")]
|
|
pub cli_source_id: ::core::option::Option<::prost::alloc::string::String>,
|
|
#[prost(uint32, optional, tag = "3")]
|
|
pub plugin_source_id: ::core::option::Option<u32>,
|
|
#[prost(string, tag = "4")]
|
|
pub name: ::prost::alloc::string::String,
|
|
#[prost(string, optional, tag = "5")]
|
|
pub payload: ::core::option::Option<::prost::alloc::string::String>,
|
|
#[prost(message, repeated, tag = "6")]
|
|
pub args: ::prost::alloc::vec::Vec<Arg>,
|
|
#[prost(bool, tag = "7")]
|
|
pub is_private: bool,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct Arg {
|
|
#[prost(string, tag = "1")]
|
|
pub key: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub value: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum PipeSource {
|
|
Cli = 0,
|
|
Plugin = 1,
|
|
}
|
|
impl PipeSource {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
PipeSource::Cli => "Cli",
|
|
PipeSource::Plugin => "Plugin",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"Cli" => Some(Self::Cli),
|
|
"Plugin" => Some(Self::Plugin),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|