From 5d55e60789fcec6abdcc50df10f0038274972806 Mon Sep 17 00:00:00 2001 From: Christopher Joel <240083+cdata@users.noreply.github.com> Date: Tue, 28 Mar 2023 10:58:52 -0700 Subject: [PATCH] feat!: Sphere traversal C FFI (#292) * feat!: Sphere traversal C FFI * docs: Update formatting for better Doxygen output --- c/example/main.c | 12 +-- .../src/worker/syndication.rs | 2 +- rust/noosphere/src/ffi/{fs.rs => context.rs} | 88 +++++++++++++----- rust/noosphere/src/ffi/mod.rs | 4 +- .../SwiftNoosphereTests/NoosphereTests.swift | 90 +++++++++---------- 5 files changed, 118 insertions(+), 78 deletions(-) rename rust/noosphere/src/ffi/{fs.rs => context.rs} (80%) diff --git a/c/example/main.c b/c/example/main.c index be99c43c0..b9cf9a745 100644 --- a/c/example/main.c +++ b/c/example/main.c @@ -33,7 +33,7 @@ void test_noosphere() setbuf(stdout, NULL); const char *hello_message = "Hello, Subconscious"; - ns_noosphere_context_t *noosphere = + ns_noosphere_t *noosphere = ns_initialize("/tmp/foo", "/tmp/bar", NULL, NULL); ns_key_create(noosphere, "bob", NULL); @@ -44,15 +44,15 @@ void test_noosphere() // printf("Sphere identity: %s\n", sphere_identity); // printf("Recovery code: %s\n", sphere_mnemonic); - ns_sphere_fs_t *sphere_fs = ns_sphere_fs_open(noosphere, sphere_identity, NULL); + ns_sphere_t *sphere = ns_sphere_open(noosphere, sphere_identity, NULL); slice_ref_uint8_t data = str_to_buffer(hello_message); - ns_sphere_fs_write(noosphere, sphere_fs, "hello", "text/subtext", data, NULL, + ns_sphere_content_write(noosphere, sphere, "hello", "text/subtext", data, NULL, NULL); - ns_sphere_fs_save(noosphere, sphere_fs, NULL, NULL); + ns_sphere_save(noosphere, sphere, NULL, NULL); ns_sphere_file_t *file = - ns_sphere_fs_read(noosphere, sphere_fs, "/hello", NULL); + ns_sphere_content_read(noosphere, sphere, "/hello", NULL); slice_boxed_char_ptr_t headers = ns_sphere_file_header_values_read(file, "Content-Type"); @@ -73,7 +73,7 @@ void test_noosphere() ns_string_array_free(headers); ns_bytes_free(contents); ns_sphere_file_free(file); - ns_sphere_fs_free(sphere_fs); + ns_sphere_free(sphere); ns_string_free(sphere_identity); ns_string_free(sphere_mnemonic); ns_sphere_receipt_free(sphere_receipt); diff --git a/rust/noosphere-gateway/src/worker/syndication.rs b/rust/noosphere-gateway/src/worker/syndication.rs index fd36c6095..8583160ed 100644 --- a/rust/noosphere-gateway/src/worker/syndication.rs +++ b/rust/noosphere-gateway/src/worker/syndication.rs @@ -24,7 +24,7 @@ use ucan::crypto::KeyMaterial; use url::Url; use noosphere_car::{CarHeader, CarWriter}; -use wnfs::private::BloomFilter; +use wnfs::private::namefilter::BloomFilter; /// A [SyndicationJob] is a request to syndicate the blocks of a _counterpart_ /// sphere to the broader IPFS network. diff --git a/rust/noosphere/src/ffi/fs.rs b/rust/noosphere/src/ffi/context.rs similarity index 80% rename from rust/noosphere/src/ffi/fs.rs rename to rust/noosphere/src/ffi/context.rs index 8b9c89cfd..57e5e4597 100644 --- a/rust/noosphere/src/ffi/fs.rs +++ b/rust/noosphere/src/ffi/context.rs @@ -78,12 +78,12 @@ impl NsSphereFile { } #[ffi_export] -/// Initialize an instance of a [NsSphere] that is a read/write view into +/// Initialize an instance of a `ns_sphere_t` that is a read/write view into /// the contents (as addressed by the slug namespace) of the identitifed sphere /// This will fail if it is not possible to initialize a sphere with the given /// identity (which implies that no such sphere was ever created or joined on /// this device). -pub fn ns_sphere_fs_open( +pub fn ns_sphere_open( noosphere: &NsNoosphere, sphere_identity: char_p::Ref<'_>, error_out: Option>>, @@ -105,21 +105,61 @@ pub fn ns_sphere_fs_open( } #[ffi_export] -/// De-allocate an [NsSphere] instance -pub fn ns_sphere_fs_free(sphere: repr_c::Box) { +/// Access another sphere by a petname. +/// +/// The petname should be one that has been assigned to the sphere's identity +/// using `ns_sphere_petname_set()`. If any of the data required to access the +/// target sphere is not available locally, it will be replicated from the +/// network through a the configured Noosphere Gateway. If no such gateway is +/// configured and the data is not available locally, this call will fail. The +/// returned `NsSphere` pointer can be used to access the content, petnames, +/// revision history and other features of the target sphere with the same APIs +/// used to access the local user's sphere, except that any operations that +/// attempt to modify the sphere will be rejected. Note that since this function +/// has a reasonable likelihood to call out to the network, it is possible that +/// it may block for a significant amount of time when network conditions are +/// poor. +pub fn ns_sphere_traverse_by_petname( + noosphere: &NsNoosphere, + sphere: &mut NsSphere, + petname: char_p::Ref<'_>, + error_out: Option>>, +) -> Option> { + error_out.try_or_initialize(|| { + let sphere = noosphere.async_runtime().block_on(async { + let sphere_context = sphere.inner_mut(); + let next_sphere_context = sphere_context + .sphere_context_mut() + .await? + .traverse_by_petname(petname.to_str()) + .await?; + + Ok(Box::new(NsSphere { + inner: SphereCursor::latest(Arc::new(Mutex::new(next_sphere_context))), + }) + .into()) as Result<_, anyhow::Error> + })?; + + Ok(sphere) + }) +} + +#[ffi_export] +/// De-allocate an `ns_sphere_t` +pub fn ns_sphere_free(sphere: repr_c::Box) { drop(sphere) } #[ffi_export] -/// Read a [NsSphereFile] from a [NsSphere] instance by slashlink. Note that -/// although this function will eventually support slashlinks that include the -/// pet name of a peer, at this time only slashlinks with slugs referencing the -/// slug namespace of the local sphere are allowed. +/// Read a `ns_sphere_file_t` from a `ns_sphere_t` instance by slashlink. Note +/// that although this function will eventually support slashlinks that include +/// the pet name of a peer, at this time only slashlinks with slugs referencing +/// the slug namespace of the local sphere are allowed. /// /// This function will return a null pointer if the slug does not have a file /// associated with it at the revision of the sphere that is referred to by the -/// [NsSphere] being read from. -pub fn ns_sphere_fs_read( +/// `ns_sphere_t` being read from. +pub fn ns_sphere_content_read( noosphere: &NsNoosphere, sphere: &NsSphere, slashlink: char_p::Ref<'_>, @@ -168,16 +208,16 @@ pub fn ns_sphere_fs_read( } #[ffi_export] -/// Write a byte buffer to a slug in the given [NsSphere] instance, assigning +/// Write a byte buffer to a slug in the given `ns_sphere_t` instance, assigning /// its content-type header to the specified value. If additional headers are /// specified, they will be appended to the list of headers in the memo that is /// created for the content. If some content already exists at the specified /// slug, it will be assigned to be the previous historical revision of the new /// content. /// -/// Note that you must invoke [ns_sphere_fs_save] to commit one or more writes -/// to the sphere. -pub fn ns_sphere_fs_write( +/// Note that you must invoke `ns_sphere_save()` to commit one or more writes to +/// the sphere. +pub fn ns_sphere_content_write( noosphere: &NsNoosphere, sphere: &mut NsSphere, slug: char_p::Ref<'_>, @@ -219,7 +259,7 @@ pub fn ns_sphere_fs_write( /// slug, because they will still be available at an earlier revision of the /// sphere. In order to commit the change, you must save. Note that this call is /// a no-op if there is no matching slug linked in the sphere. -pub fn ns_sphere_fs_remove( +pub fn ns_sphere_content_remove( noosphere: &NsNoosphere, sphere: &mut NsSphere, slug: char_p::Ref<'_>, @@ -234,13 +274,13 @@ pub fn ns_sphere_fs_remove( } #[ffi_export] -/// Save any writes performed on the [NsSphere] instance. If additional +/// Save any writes performed on the `ns_sphere_t` instance. If additional /// headers are specified, they will be appended to the headers in the memo that /// is created to wrap the latest sphere revision. /// /// This will fail if both no writes have been performed and no additional /// headers were specified (in other words: no actual changes were made). -pub fn ns_sphere_fs_save( +pub fn ns_sphere_save( noosphere: &NsNoosphere, sphere: &mut NsSphere, additional_headers: Option<&NsHeaders>, @@ -261,7 +301,7 @@ pub fn ns_sphere_fs_save( #[ffi_export] /// Get an array of all of the slugs in a sphere at the current version. -pub fn ns_sphere_fs_list( +pub fn ns_sphere_content_list( noosphere: &NsNoosphere, sphere: &NsSphere, error_out: Option>>, @@ -300,7 +340,7 @@ pub fn ns_sphere_fs_list( /// Note that a slug change may mean the slug was added, updated or removed. /// Also note that multiple changes to the same slug will be reduced to a /// single entry in the array that is returned. -pub fn ns_sphere_fs_changes( +pub fn ns_sphere_content_changes( noosphere: &NsNoosphere, sphere: &NsSphere, since_cid: Option>, @@ -340,16 +380,16 @@ pub fn ns_sphere_fs_changes( } #[ffi_export] -/// De-allocate an [NsSphereFile] instance +/// De-allocate an `ns_sphere_file_t` pub fn ns_sphere_file_free(sphere_file: repr_c::Box) { drop(sphere_file) } #[ffi_export] -/// Read the contents of an [NsSphereFile] as a byte array. Note that the -/// [NsSphereFile] is lazy and stateful: it doesn't read any bytes from disk +/// Read the contents of an `ns_sphere_file_t` as a byte array. Note that the +/// `ns_sphere_file_t` is lazy and stateful: it doesn't read any bytes from disk /// until this function is invoked, and once the bytes have been read from the -/// file you must create a new [NsSphereFile] instance to read them again. +/// file you must create a new `ns_sphere_file_t` instance to read them again. pub fn ns_sphere_file_contents_read( noosphere: &NsNoosphere, sphere_file: &mut NsSphereFile, @@ -424,7 +464,7 @@ pub fn ns_sphere_file_header_names_read(sphere_file: &NsSphereFile) -> c_slice:: #[ffi_export] /// Get the base64-encoded CID v1 string for the memo that refers to the content -/// of this [SphereFile]. +/// of this `ns_sphere_file_t`. pub fn ns_sphere_file_version_get( sphere_file: &NsSphereFile, error_out: Option>>, diff --git a/rust/noosphere/src/ffi/mod.rs b/rust/noosphere/src/ffi/mod.rs index 2f9a762b8..d0dbdfac0 100644 --- a/rust/noosphere/src/ffi/mod.rs +++ b/rust/noosphere/src/ffi/mod.rs @@ -1,5 +1,5 @@ +mod context; mod error; -mod fs; mod headers; mod key; mod noosphere; @@ -7,8 +7,8 @@ mod petname; mod sphere; pub use crate::ffi::noosphere::*; +pub use context::*; pub use error::*; -pub use fs::*; pub use headers::*; pub use key::*; pub use petname::*; diff --git a/swift/Tests/SwiftNoosphereTests/NoosphereTests.swift b/swift/Tests/SwiftNoosphereTests/NoosphereTests.swift index 8367a864a..aac3634ea 100644 --- a/swift/Tests/SwiftNoosphereTests/NoosphereTests.swift +++ b/swift/Tests/SwiftNoosphereTests/NoosphereTests.swift @@ -1,11 +1,11 @@ import XCTest + @testable import SwiftNoosphere final class NoosphereTests: XCTestCase { func testInitializeNoosphereThenWriteAFileThenSaveThenReadItBack() throws { // This is a basic integration test to ensure that file writing and // reading from swift works as intended - let noosphere = ns_initialize("/tmp/foo", "/tmp/bar", nil, nil) ns_key_create(noosphere, "bob", nil) @@ -21,7 +21,7 @@ final class NoosphereTests: XCTestCase { print("Sphere identity:", sphere_identity) print("Recovery code:", sphere_mnemonic) - let sphere_fs = ns_sphere_fs_open(noosphere, sphere_identity_ptr, nil) + let sphere = ns_sphere_open(noosphere, sphere_identity_ptr, nil) let file_bytes = "Hello, Subconscious".data(using: .utf8)! @@ -31,12 +31,12 @@ final class NoosphereTests: XCTestCase { let bodyRaw = slice_ref_uint8( ptr: pointer, len: file_bytes.count ) - ns_sphere_fs_write(noosphere, sphere_fs, "hello", "text/subtext", bodyRaw, nil, nil) + ns_sphere_content_write(noosphere, sphere, "hello", "text/subtext", bodyRaw, nil, nil) }) - ns_sphere_fs_save(noosphere, sphere_fs, nil, nil) + ns_sphere_save(noosphere, sphere, nil, nil) - let file = ns_sphere_fs_read(noosphere, sphere_fs, "/hello", nil) + let file = ns_sphere_content_read(noosphere, sphere, "/hello", nil) let content_type_values = ns_sphere_file_header_values_read(file, "Content-Type") let content_type = String.init(cString: content_type_values.ptr.pointee!) @@ -52,7 +52,7 @@ final class NoosphereTests: XCTestCase { ns_string_array_free(content_type_values) ns_bytes_free(contents) ns_sphere_file_free(file) - ns_sphere_fs_free(sphere_fs) + ns_sphere_free(sphere) ns_string_free(sphere_identity_ptr) ns_string_free(sphere_mnemonic_ptr) ns_sphere_receipt_free(sphere_receipt) @@ -71,7 +71,7 @@ final class NoosphereTests: XCTestCase { let sphere_identity_ptr = ns_sphere_receipt_identity(sphere_receipt, nil) let sphere_mnemonic_ptr = ns_sphere_receipt_mnemonic(sphere_receipt, nil) - let sphere_fs = ns_sphere_fs_open(noosphere, sphere_identity_ptr, nil) + let sphere = ns_sphere_open(noosphere, sphere_identity_ptr, nil) let file_bytes = "Hello, Subconscious".data(using: .utf8)! let file_headers_in = ns_headers_create() @@ -86,12 +86,12 @@ final class NoosphereTests: XCTestCase { let bodyRaw = slice_ref_uint8( ptr: pointer, len: file_bytes.count ) - ns_sphere_fs_write(noosphere, sphere_fs, "hello", "text/subtext", bodyRaw, file_headers_in, nil) + ns_sphere_content_write(noosphere, sphere, "hello", "text/subtext", bodyRaw, file_headers_in, nil) }) - ns_sphere_fs_save(noosphere, sphere_fs, nil, nil) + ns_sphere_save(noosphere, sphere, nil, nil) - let file = ns_sphere_fs_read(noosphere, sphere_fs, "/hello", nil) + let file = ns_sphere_content_read(noosphere, sphere, "/hello", nil) let file_header_names = ns_sphere_file_header_names_read(file) @@ -126,7 +126,7 @@ final class NoosphereTests: XCTestCase { ns_string_array_free(file_header_names) ns_headers_free(file_headers_in) ns_sphere_file_free(file) - ns_sphere_fs_free(sphere_fs) + ns_sphere_free(sphere) ns_string_free(sphere_identity_ptr) ns_string_free(sphere_mnemonic_ptr) ns_sphere_receipt_free(sphere_receipt) @@ -141,9 +141,9 @@ final class NoosphereTests: XCTestCase { let bad_sphere_identity = "doesnotexist" let maybe_error = UnsafeMutablePointer.allocate(capacity: 1) - let sphere_fs = ns_sphere_fs_open(noosphere, bad_sphere_identity, maybe_error) + let sphere = ns_sphere_open(noosphere, bad_sphere_identity, maybe_error) - assert(sphere_fs == nil) + assert(sphere == nil) assert(maybe_error.pointee != nil) let error_message_ptr = ns_error_string(maybe_error.pointee) @@ -166,7 +166,7 @@ final class NoosphereTests: XCTestCase { let sphere_identity_ptr = ns_sphere_receipt_identity(sphere_receipt, nil) - let sphere_fs = ns_sphere_fs_open(noosphere, sphere_identity_ptr, nil) + let sphere = ns_sphere_open(noosphere, sphere_identity_ptr, nil) let changes_to_make = [ [ @@ -200,9 +200,9 @@ final class NoosphereTests: XCTestCase { ptr: pointer, len: file_bytes.count ) - ns_sphere_fs_write( + ns_sphere_content_write( noosphere, - sphere_fs, + sphere, operation[1], "text/subtext", bodyRaw, @@ -211,20 +211,20 @@ final class NoosphereTests: XCTestCase { ) }) case "remove": - ns_sphere_fs_remove(noosphere, sphere_fs, operation[1], nil) + ns_sphere_content_remove(noosphere, sphere, operation[1], nil) default: assert(false) } } - ns_sphere_fs_save(noosphere, sphere_fs, nil, nil) + ns_sphere_save(noosphere, sphere, nil, nil) let sphere_version_ptr = ns_sphere_version_get(noosphere, sphere_identity_ptr, nil) sphere_versions.append(String.init(cString: sphere_version_ptr!)) ns_string_free(sphere_version_ptr) } - let slugs = ns_sphere_fs_list(noosphere, sphere_fs, nil) + let slugs = ns_sphere_content_list(noosphere, sphere, nil) let expected_slugs = [ "bijaz", "fizz", @@ -249,7 +249,7 @@ final class NoosphereTests: XCTestCase { ns_string_array_free(slugs) ns_string_free(sphere_identity_ptr) ns_sphere_receipt_free(sphere_receipt) - ns_sphere_fs_free(sphere_fs) + ns_sphere_free(sphere) ns_free(noosphere) } @@ -262,7 +262,7 @@ final class NoosphereTests: XCTestCase { let sphere_identity_ptr = ns_sphere_receipt_identity(sphere_receipt, nil) - let sphere_fs = ns_sphere_fs_open(noosphere, sphere_identity_ptr, nil) + let sphere = ns_sphere_open(noosphere, sphere_identity_ptr, nil) let changes_to_make = [ [ @@ -297,9 +297,9 @@ final class NoosphereTests: XCTestCase { ptr: pointer, len: file_bytes.count ) - ns_sphere_fs_write( + ns_sphere_content_write( noosphere, - sphere_fs, + sphere, operation[1], "text/subtext", bodyRaw, @@ -308,19 +308,19 @@ final class NoosphereTests: XCTestCase { ) }) case "remove": - ns_sphere_fs_remove(noosphere, sphere_fs, operation[1], nil) + ns_sphere_content_remove(noosphere, sphere, operation[1], nil) default: assert(false) } } - ns_sphere_fs_save(noosphere, sphere_fs, nil, nil) + ns_sphere_save(noosphere, sphere, nil, nil) let sphere_version_ptr = ns_sphere_version_get(noosphere, sphere_identity_ptr, nil) sphere_versions.append(String.init(cString: sphere_version_ptr!)) ns_string_free(sphere_version_ptr) } - let changes = ns_sphere_fs_changes(noosphere, sphere_fs, sphere_versions[0], nil) + let changes = ns_sphere_content_changes(noosphere, sphere, sphere_versions[0], nil) let expected_changes = [ "bijaz", "fizz", @@ -346,7 +346,7 @@ final class NoosphereTests: XCTestCase { ns_string_array_free(changes) ns_string_free(sphere_identity_ptr) ns_sphere_receipt_free(sphere_receipt) - ns_sphere_fs_free(sphere_fs) + ns_sphere_free(sphere) ns_free(noosphere) } @@ -358,7 +358,7 @@ final class NoosphereTests: XCTestCase { let sphere_receipt = ns_sphere_create(noosphere, "bob", nil) let sphere_identity_ptr = ns_sphere_receipt_identity(sphere_receipt, nil) - let sphere_fs = ns_sphere_fs_open(noosphere, sphere_identity_ptr, nil) + let sphere = ns_sphere_open(noosphere, sphere_identity_ptr, nil) ns_string_free(sphere_identity_ptr) ns_sphere_receipt_free(sphere_receipt) @@ -371,12 +371,12 @@ final class NoosphereTests: XCTestCase { let bodyRaw = slice_ref_uint8( ptr: pointer, len: file_bytes.count ) - ns_sphere_fs_write(noosphere, sphere_fs, "hello", "text/subtext", bodyRaw, nil, nil) + ns_sphere_content_write(noosphere, sphere, "hello", "text/subtext", bodyRaw, nil, nil) }) - ns_sphere_fs_save(noosphere, sphere_fs, nil, nil) + ns_sphere_save(noosphere, sphere, nil, nil) - var file = ns_sphere_fs_read(noosphere, sphere_fs, "/hello", nil) + var file = ns_sphere_content_read(noosphere, sphere, "/hello", nil) var version_ptr = ns_sphere_file_version_get(file, nil) let version_one = String.init(cString: version_ptr!) @@ -391,12 +391,12 @@ final class NoosphereTests: XCTestCase { let bodyRaw = slice_ref_uint8( ptr: pointer, len: file_bytes.count ) - ns_sphere_fs_write(noosphere, sphere_fs, "hello", "text/subtext", bodyRaw, nil, nil) + ns_sphere_content_write(noosphere, sphere, "hello", "text/subtext", bodyRaw, nil, nil) }) - ns_sphere_fs_save(noosphere, sphere_fs, nil, nil) + ns_sphere_save(noosphere, sphere, nil, nil) - file = ns_sphere_fs_read(noosphere, sphere_fs, "/hello", nil) + file = ns_sphere_content_read(noosphere, sphere, "/hello", nil) version_ptr = ns_sphere_file_version_get(file, nil) let version_two = String.init(cString: version_ptr!) @@ -404,7 +404,7 @@ final class NoosphereTests: XCTestCase { assert(version_one != version_two) - ns_sphere_fs_free(sphere_fs) + ns_sphere_free(sphere) ns_free(noosphere) } @@ -416,13 +416,13 @@ final class NoosphereTests: XCTestCase { let sphere_receipt = ns_sphere_create(noosphere, "bob", nil) let sphere_identity_ptr = ns_sphere_receipt_identity(sphere_receipt, nil) - let sphere = ns_sphere_fs_open(noosphere, sphere_identity_ptr, nil) + let sphere = ns_sphere_open(noosphere, sphere_identity_ptr, nil) ns_string_free(sphere_identity_ptr) ns_sphere_receipt_free(sphere_receipt) ns_sphere_petname_set(noosphere, sphere, "alice", "did:key:alice", nil) - ns_sphere_fs_save(noosphere, sphere, nil, nil) + ns_sphere_save(noosphere, sphere, nil, nil) let has_alice = ns_sphere_petname_is_set(noosphere, sphere, "alice", nil) == 1 @@ -435,13 +435,13 @@ final class NoosphereTests: XCTestCase { // Unassign the petname alice ns_sphere_petname_set(noosphere, sphere, "alice", nil, nil) - ns_sphere_fs_save(noosphere, sphere, nil, nil) + ns_sphere_save(noosphere, sphere, nil, nil) let has_alice_after_unassign = ns_sphere_petname_is_set(noosphere, sphere, "alice", nil) == 1 assert(!has_alice_after_unassign) ns_string_free(identity_ptr) - ns_sphere_fs_free(sphere) + ns_sphere_free(sphere) ns_free(noosphere) } @@ -454,7 +454,7 @@ final class NoosphereTests: XCTestCase { let sphere_identity_ptr = ns_sphere_receipt_identity(sphere_receipt, nil) - let sphere = ns_sphere_fs_open(noosphere, sphere_identity_ptr, nil) + let sphere = ns_sphere_open(noosphere, sphere_identity_ptr, nil) let changes_to_make = [ [ @@ -488,7 +488,7 @@ final class NoosphereTests: XCTestCase { } } - ns_sphere_fs_save(noosphere, sphere, nil, nil) + ns_sphere_save(noosphere, sphere, nil, nil) let sphere_version_ptr = ns_sphere_version_get(noosphere, sphere_identity_ptr, nil) sphere_versions.append(String.init(cString: sphere_version_ptr!)) @@ -520,7 +520,7 @@ final class NoosphereTests: XCTestCase { ns_string_array_free(petnames) ns_string_free(sphere_identity_ptr) ns_sphere_receipt_free(sphere_receipt) - ns_sphere_fs_free(sphere) + ns_sphere_free(sphere) ns_free(noosphere) } @@ -533,7 +533,7 @@ final class NoosphereTests: XCTestCase { let sphere_identity_ptr = ns_sphere_receipt_identity(sphere_receipt, nil) - let sphere = ns_sphere_fs_open(noosphere, sphere_identity_ptr, nil) + let sphere = ns_sphere_open(noosphere, sphere_identity_ptr, nil) let changes_to_make = [ [ @@ -567,7 +567,7 @@ final class NoosphereTests: XCTestCase { } } - ns_sphere_fs_save(noosphere, sphere, nil, nil) + ns_sphere_save(noosphere, sphere, nil, nil) let sphere_version_ptr = ns_sphere_version_get(noosphere, sphere_identity_ptr, nil) sphere_versions.append(String.init(cString: sphere_version_ptr!)) @@ -600,7 +600,7 @@ final class NoosphereTests: XCTestCase { ns_string_array_free(changes) ns_string_free(sphere_identity_ptr) ns_sphere_receipt_free(sphere_receipt) - ns_sphere_fs_free(sphere) + ns_sphere_free(sphere) ns_free(noosphere) } }