-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plan for Wasming WNFS incrementally #371
Comments
Sketching out an Interface for wasm-wnfsBecause wasm-wnfs should be invokable from typescript, I'll sketch the interface in typescript: A first of sketch of the wasm-wnfs core should be just pure functions. No long-lived data structures on the wasm side. If we figure out that this is a bad idea performance-wise, we benchmark the first version and figure out a plan for an interface that allows better optimizations & performance as a second step. import { CID } from "multiformats"
// e.g. { name: "dag-pb", code: 0x70 } or { name: "raw", code: 0x55 } etc.
interface Codec {
name: string
code: number
}
interface BlockStore {
putBlock(bytes: Uint8Array, codec: Codec): Promise<CID>
getBlock(cid: CID, signal: AbortSignal): Promise<Uint8Array>
}
export async function nodeLookup(
fs: CID,
path: string[],
{ blockStore: BlockStore, signal: AbortSignal }
): Promise<{ remainingPath: string[], entry: Entry }>
type Entry = File | Directory
interface File {
metadata: Metadata
content: CID
previous?: CID
// ...
}
interface Directory {
metadata: Metadata
userland: Record<string, CID>
previous?: CID
} I think that single function |
CHANGELOG: Updated the Issue description to reflect the conversation in Talk |
@matheus23 even though I'm not the expert on this exact repo, at a quick glance that looks about right for a high level interface 👍 |
Shared this on Discord and thought it is relevant here too. I started work on the Rust WNFS implementation a few days ago and I've been planning how we can make it work both as a regular library that the Rust ecosystem can leverage, as well as make it a good candidate for compiling to WebAssembly. Rust happens to have one of the best toolchains for compiling to lean WebAssembly code and a great JavaScript-based wrapper tool, so this made my work easier although there are still some issues with the current implementation. I was able to acheive the reusability goal by:
I was originally of the impression that asynchronous calls would be a pain to implement in wasm, but I was wrong. Given how Rust represents async code in the memory, the rust-wasm team created a wasm-bindgen-futures library that introduces its own async executor. With it, it is possible to call asynchronous JavaScript functions and vice versa. This is going to make our work a lot easier on the async front. The Rust WNFS library is currently in a very early stage of development and there are a few issues I'm still trying to figure out.
|
@expede What does
|
@appcypher the keystore is where we hold symmetric (e.g. AES) keys, skip ratchet material, and other keys that we need to use for decryption. WNFS has a recursive encryption scheme, but you need to get into that first "entry" node. |
Related, but getting split out: https://github.com/fission-suite/internal/issues/15 |
A rough plan for how this will break down, and general organizational questions. As an example, I've provided an almost certainly incorrect order of operations below:
Order of Operations
Dependencies
Consider breaking out libraries as part of this work
The text was updated successfully, but these errors were encountered: