Skip to content

About

Atomics for Wazero

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

Atomic

WebAssembly host module, ABI and guest SDK providing atomic data structures suitable for sharing data between concurrent WASI modules.

Host Module

Go Reference Go Report Card Go Coverage

First register the host module with the runtime

import (
    "github.com/tetratelabs/wazero"
    "github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"

    "github.com/pantopic/ext-atomic/host-wazero"
)

func main() {
    ctx := context.Background()
    r := wazero.NewRuntimeWithConfig(ctx, wazero.NewRuntimeConfig())
    wasi_snapshot_preview1.MustInstantiate(ctx, r)

    module := wazero_atomic.New()
    module.Register(ctx, r)

    // ...
}

Guest SDK (Go)

Go Reference Go Report Card

Then you can import the guest SDK into your WASI module to send messages from one WASI module to another.

package main

import (
    "github.com/pantopic/ext-atomic/sdk-go"
)

var n *atomic.Uint64

func main() {
    n = atomic.NewUint64()
}

//export test
func test() {
    println(n.Add(1)) // 1
    println(n.Add(2)) // 3
}

Roadmap

This project is in alpha. Breaking API changes should be expected until Beta.

  • v0.0.x - Alpha
    • Stabilize API
  • v0.x.x - Beta
    • Finalize API
    • Test in production
  • v1.x.x - General Availability
    • Proven long term stability in production

About

Atomics for Wazero

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages