0.9.3 • Published 6 years ago

primea-hypervisor v0.9.3

Weekly downloads
2
License
MPL-2.0
Repository
github
Last release
6 years ago

SYNOPSIS

NPM Package Build Status Coverage Status

js-standard-style

A JavaScript Implementation of Primea HyperVisor

INSTALL

clone and run npm install

USAGE

const Hypervisor = require('primea-hypervisor')
const {Message, FunctionRef} = require('primea-objects')
const WasmContainer = require('primea-wasm-container')

// setup presistant state
const level = require('level-browserify')
const RadixTree = require('dfinity-radix-tree')
const db = level(`${__dirname}/db`)
const tree = new RadixTree({db})

const hypervisor = new Hypervisor({tree, containers: [WasmContainer]})

const wasm // a webassembly binary with an exported function named "main"

// create an actor with a webassembly container
const {module} = hypervisor.createActor(WasmContainer.typeId, wasm)

// create message to send to the actor that was just created
const message = new Message({
  funcRef: module.getFuncRef('main'),
  funcArguments: [new FunctionRef({
    actorId: egress.id,
    params: ['data']
  })]
}).on('execution:error', e => console.error(e))

hypervisor.send(message)

// write everything to the db can create a merkle tree with a single state root
const sr = await hypervisor.createStateRoot()
console.log('state root:', sr.toString('hex'))

API

./docs

DESIGN

Primea is an actor based system with capabilities. Its high level goals are

  • Performant IPC
  • Extensible, allowing for upgrades and customization
  • Interoperability with existing codebases
  • Deterministic execution

SPONSORED BY

npm.io

LICENSE

MPL-2.0

0.9.3

6 years ago

0.9.2

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.8.1

6 years ago

0.8.0

6 years ago

0.7.2

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.5

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago