-
Notifications
You must be signed in to change notification settings - Fork 37
feat(noosphere): Introduce noosphere
crate
#123
Conversation
The `noosphere` crate is the highest level entrypoint into Noosphere APIs that we offer. It re-exports the functionality of most of our other crates, and offers FFI interfaces for C and JS/WASM consumers. In addition to the `noosphere` crate, this change introduces some major improvements to our Github Actions workflows. Workflows now let you build associated artifacts on demand, and are also assembled into a larger release orchestration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start on the FFI work!
#[ffi_export] | ||
pub fn noosphere_set_global_storage_path(path: char_p::Ref<'_>) { | ||
unsafe { | ||
GLOBAL_STORAGE_PATH = Some(path.to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet relevant for the scope of the FFI interface, but are rust's mutable statics thread safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not on their own, you need to use a Mutex
or something with effectively the same guarantees.
rust/noosphere/src/lib.rs
Outdated
// noosphere_ | ||
|
||
// #[no_mangle] | ||
// pub unsafe extern "C" fn create_key() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra comments
}, | ||
Offline, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀 excited to see where this interface goes
@@ -2,3 +2,4 @@ target | |||
optimized_wasm | |||
dist | |||
.DS_Store | |||
noosphere.h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't mind vendoring the header file once a ffi helper (safer-ffi, cbindgen, uniffi) if at least to link to the C API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make it trivial to generate it locally. I'm not opposed to checking it in, but it really should never be modified by hand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
module Noosphere { | ||
header "noosphere.h" | ||
export * | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for swift? How is this used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is for XCode packaging ceremony. It is required for... reasons I don't fully understand, TBH. You need it to exist at the .xcframework
generation step.
The
noosphere
crate is the highest level entrypoint into Noosphere APIs that we offer. It re-exports the functionality of most of our other crates, and offers FFI interfaces for C and JS/WASM consumers.In addition to the
noosphere
crate, this change introduces some major improvements to our Github Actions workflows. Workflows now let you build associated artifacts on demand, and are also assembled into a larger release orchestration.NOTE: The
noosphere
crate is currently barebones because we just needed to get it to a point where we could compile it for different Apple targets and expose a trivial FFI. The focus of this change is on establishing our automation workflow for these kinds of artifacts.