Skip to content

About

A small cache for wazero

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

17 Commits

Folders and files

Repository files navigation

Small Cache

A wazero host module, ABI and guest SDK providing a small cache 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-small-cache/host-wazero"
)

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

    module := wazero_small_cache.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-small-cache/sdk-go"
)

const (
	SMALL_CACHE_TEST = iota
)

var c *small_cache.Local

func main() {
    c = small_cache.NewLocal(SMALL_CACHE_TEST)
}

//export test
func test() {
    n.Put([]byte(`a`), []byte(`1`))
    println(n.Get([]byte(`a`))) // 1
}

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

A small cache for wazero

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages