mirror of
https://github.com/fluencelabs/marine.git
synced 2025-06-23 11:41:38 +00:00
feat!: decouple wasmer from Marine, replace it with generic backend interface (#219)
This commit is contained in:
@ -4,7 +4,7 @@ description = "Fluence Marine module interface"
|
||||
version = "0.6.1"
|
||||
authors = ["Fluence Labs"]
|
||||
license = "Apache-2.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "marine_module_interface"
|
||||
@ -15,8 +15,8 @@ marine-it-interfaces = { path = "../it-interfaces", version = "0.7.3" }
|
||||
|
||||
anyhow = "1.0.66"
|
||||
walrus = "0.19.0"
|
||||
wasmer-it = { package = "wasmer-interface-types-fl", version = "0.24.1" }
|
||||
nom = "5.1"
|
||||
wasmer-it = { workspace = true }
|
||||
nom = "7.1.3"
|
||||
|
||||
itertools = "0.10.5"
|
||||
semver = "1.0.14"
|
||||
|
@ -22,6 +22,6 @@ pub enum InterfaceError {
|
||||
#[error("record type with type id {0} not found")]
|
||||
NotFoundRecordTypeId(u64),
|
||||
|
||||
#[error("{0}")]
|
||||
#[error(transparent)]
|
||||
ITInterfaceError(#[from] ITInterfaceError),
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ use wasmer_it::IRecordType;
|
||||
use wasmer_it::IType;
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use itertools::Itertools;
|
||||
|
||||
pub(crate) struct RecordsTransformer {
|
||||
@ -60,7 +60,7 @@ impl RecordsTransformer {
|
||||
fn dfs(
|
||||
&mut self,
|
||||
record_id: u64,
|
||||
record: &Rc<IRecordType>,
|
||||
record: &Arc<IRecordType>,
|
||||
exported_records: &IRecordTypes,
|
||||
) -> InterfaceResult<()> {
|
||||
if !self.used.insert(record_id) {
|
||||
@ -107,7 +107,7 @@ impl RecordsTransformer {
|
||||
|
||||
fn convert_record(
|
||||
id: u64,
|
||||
record: &Rc<IRecordType>,
|
||||
record: &Arc<IRecordType>,
|
||||
record_types: &IRecordTypes,
|
||||
) -> RecordType {
|
||||
use super::itype_text_view;
|
||||
|
@ -28,6 +28,6 @@ pub enum ITInterfaceError {
|
||||
#[error("mailformed module: a record contains more recursion level then allowed")]
|
||||
TooManyRecursionLevels,
|
||||
|
||||
#[error("{0}")]
|
||||
#[error(transparent)]
|
||||
MITInterfacesError(#[from] MITInterfacesError),
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ use super::RIResult;
|
||||
|
||||
use marine_it_interfaces::MITInterfaces;
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct ITExportFuncDescriptor<'n> {
|
||||
pub adapter_function_type: u32,
|
||||
@ -69,7 +69,7 @@ pub fn get_export_funcs(mit: &MITInterfaces<'_>) -> RIResult<Vec<IFunctionSignat
|
||||
output_types,
|
||||
} => {
|
||||
let signature = IFunctionSignature {
|
||||
name: Rc::new(descriptor.name.to_string()),
|
||||
name: Arc::new(descriptor.name.to_string()),
|
||||
arguments: arguments.clone(),
|
||||
outputs: output_types.clone(),
|
||||
adapter_function_type: descriptor.adapter_function_type,
|
||||
|
@ -22,16 +22,16 @@ use serde::Serialize;
|
||||
use serde::Deserialize;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub type IRecordTypes = HashMap<u64, Rc<IRecordType>>;
|
||||
pub type IRecordTypes = HashMap<u64, Arc<IRecordType>>;
|
||||
|
||||
/// Represent a function type inside Marine module.
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Hash, Serialize, Deserialize)]
|
||||
pub struct IFunctionSignature {
|
||||
pub name: Rc<String>,
|
||||
pub arguments: Rc<Vec<IFunctionArg>>,
|
||||
pub outputs: Rc<Vec<IType>>,
|
||||
pub name: Arc<String>,
|
||||
pub arguments: Arc<Vec<IFunctionArg>>,
|
||||
pub outputs: Arc<Vec<IType>>,
|
||||
pub adapter_function_type: u32,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user