-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plugins Host: Implementing Bytesource & Refactoring
- Move plugins types to their own modules in sessions lib - Basic types and methods for byte source - Fix typos in directory name
- Loading branch information
1 parent
77134ab
commit 6e1387b
Showing
12 changed files
with
127 additions
and
49 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
28 changes: 28 additions & 0 deletions
28
application/apps/indexer/plugins_host/src/bytesource_shared/mod.rs
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,28 @@ | ||
//TODO AAZ: Suppress warnings while developing | ||
#![allow(dead_code, unused_imports, unused)] | ||
|
||
use std::path::{Path, PathBuf}; | ||
|
||
use sources::plugins::{ByteSourceInput, PluginByteSourceGeneralSetttings}; | ||
|
||
use crate::{v0_1_0, PluginHostInitError}; | ||
|
||
const BYTESOURCE_INTERFACE_NAME: &str = "chipmunk:plugin/byte-source"; | ||
|
||
/// Path of input file directory that will presented to the plugins. | ||
pub(crate) const INPUT_DIR_PATH: &str = "./input"; | ||
|
||
pub enum PluginByteSource { | ||
Ver010(v0_1_0::bytesource::PluginByteSource), | ||
} | ||
|
||
impl PluginByteSource { | ||
pub fn create( | ||
plugin_path: impl AsRef<Path>, | ||
input: ByteSourceInput, | ||
general_config: &PluginByteSourceGeneralSetttings, | ||
config_path: Option<impl AsRef<Path>>, | ||
) -> Result<Self, PluginHostInitError> { | ||
todo!() | ||
} | ||
} |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pub mod bytesoruce; | ||
pub mod bytesource; | ||
pub mod parser; |
2 changes: 1 addition & 1 deletion
2
application/apps/indexer/plugins_host/src/v0_1_0/parser/bindings.rs
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
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,79 @@ | ||
use std::path::PathBuf; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub struct PluginParserSettings { | ||
pub plugin_path: PathBuf, | ||
pub general_settings: PluginParserGeneralSetttings, | ||
pub custom_config_path: Option<PathBuf>, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
/// General settings for all parsers as plugins | ||
pub struct PluginParserGeneralSetttings { | ||
pub placeholder: String, | ||
} | ||
|
||
impl PluginParserSettings { | ||
/// Implementation needed during prototyping only | ||
pub fn prototyping(plugin_path: PathBuf) -> Self { | ||
Self { | ||
plugin_path, | ||
general_settings: PluginParserGeneralSetttings { | ||
placeholder: Default::default(), | ||
}, | ||
custom_config_path: None, | ||
} | ||
} | ||
|
||
/// Default implementation needed during prototyping only | ||
pub fn default_prototyping() -> Self { | ||
Self::prototyping(PathBuf::default()) | ||
} | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct PluginByteSourceSettings { | ||
pub plugin_path: PathBuf, | ||
pub source_input: ByteSourceInput, | ||
pub general_settings: PluginByteSourceGeneralSetttings, | ||
pub custom_config_path: Option<PathBuf>, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
/// Represents The input source for byte source to read from | ||
pub enum ByteSourceInput { | ||
/// File input source with its path | ||
File(PathBuf), | ||
/// Socket Connection, identified with IP address and port | ||
Socket { ip: String, port: u16 }, | ||
/// Network source identified with URL | ||
Url(String), | ||
/// Connection String for a Database | ||
DbConnectionString(String), | ||
/// In-Memory bytes buffer | ||
Memory(Vec<u8>), | ||
/// Other types of input sources can be added here. | ||
Other(String), | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
/// General settings for all parsers as plugins | ||
pub struct PluginByteSourceGeneralSetttings { | ||
pub placeholder: String, | ||
} | ||
|
||
impl PluginByteSourceSettings { | ||
/// Implementation needed during prototyping only | ||
pub fn prototyping(plugin_path: PathBuf, source_input: ByteSourceInput) -> Self { | ||
Self { | ||
plugin_path, | ||
source_input, | ||
general_settings: PluginByteSourceGeneralSetttings { | ||
placeholder: Default::default(), | ||
}, | ||
custom_config_path: None, | ||
} | ||
} | ||
} |