<!-- Put the link to this slide here so people can follow --> slides: https://hackmd.io/@adin/wasm-ipld#/ --- # What we have - WAC Codec (Complete + Fitted IPLD Codec designed for moving data in/out of WASM) - Bencode WASM codec - BitTorrent File WASM ADL --- # WAC - Motivation WebAssembly Codec (better name TBD) Want to move IPLD Data Model data in/out of WASM losslessly to minimize crossing WASM/Host (e.g. Go) boundary --- # WAC - Idea - Make a simple codec that matches the IPLD Data Model - Completeness (needs to cover everything, including things like non-UTF8 map keys) - Fitted (1:1 mappings, including things like map ordering) - Inspiration taken from https://github.com/mikeal/simple-dag - Spec (https://github.com/aschmahmann/go-ipfs/blob/fun/wasm/plugin/plugins/wasmipld/spec.md) --- # WAC - WIP - Better ways to optimize encode/decode - Floats not yet specified - People seem grumpy about some aspects of the data model - We can use this as an opportunity to discuss it - The idea is to make a complete + fitted codec which IMO should be possible --- # WAC - Implementations - Go - Rust + WASM --- # WASM Codecs - Go Decode: - Allocate len(block + pointerSize) - Set the the block into the allocated memory - Call(blockPtr, blockSize, outputLenPtr) outputPtr - Extract outputBlock - Decode as WAC TBD: Encode(although similar), better calling convention, returning errors --- WASM ADLs (LargeBytes) - Encode node as WAC block - Pass block into WASM (CreateADL(inputBlkPtr, inputLen) ADLPtr) - Call functions on the ADLPtr - Read(adlPtr, bufferPtr, bufferLen) numRead - Seek(adlPtr, offset, whence) startingOffset --- Links for ongoing work: - https://github.com/aschmahmann/wasm-ipld - https://github.com/aschmahmann/go-ipfs/tree/fun/wasm ---
{"metaMigratedAt":"2023-06-16T22:59:30.663Z","metaMigratedFrom":"YAML","title":"WASM IPLD Codecs and ADLs","breaks":true,"description":"View the slide with \"Slide Mode\".","contributors":"[{\"id\":\"6c027841-8e73-4a4d-8ec7-e99a5271fad7\",\"add\":2924,\"del\":1000}]"}
    639 views