mirror of
https://github.com/fluencelabs/marine.git
synced 2025-06-17 17:01:30 +00:00
feat!: decouple wasmer from Marine, replace it with generic backend interface (#219)
This commit is contained in:
@ -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