Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
coder11 committed Dec 7, 2021
1 parent dad74d1 commit 82480b8
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
# AVM Worker common
# AVM Worker common types

[![npm](https://img.shields.io/npm/v/@fluencelabs/avm-worker-common)](https://www.npmjs.com/package/@fluencelabs/avm-worker-common)

AVM Worker is the abstraction over Aqua virtual machine (AVM) interpreter designed to allow run it in different contexts such as web workers in browsers or worker threads on nodejs.

The package provides common interface for AVM worker implementation as well as necessary TypeScript definitions.

## Getting started

The main exports of the package is the AVM worker type :

```typescript
export type AvmWorker = {
init: (logLevel: LogLevel) => Promise<void>;
terminate: () => Promise<void>;
run: (
air: string,
prevData: Uint8Array,
data: Uint8Array,
params: {
initPeerId: string;
currentPeerId: string;
},
callResults: CallResultsArray,
) => Promise<InterpreterResult>;
};
```

To make a custom AVM worker three functions has to be implemented:

* init - should allocate any resources needed for AVM worker (such as AVM interpreter memory or background worker state)
* terminate - should deallocate all the resources used by the AVM worker
* run - should pass the particle execution to actual AVM interpreter running in the context of implementation

## Available implementations:

- Single-threaded, ui-blocking: [@fluencelabs/avm-worker](https://github.com/fluencelabs/avm-worker)
- Web workers based for browsers: [@fluencelabs/avm-worker-web](https://github.com/fluencelabs/avm-worker-background/tree/main/avm-worker-node)
- Worker threads based for nodejs: [@fluencelabs/avm-worker-node](https://github.com/fluencelabs/avm-worker-background/tree/main/avm-worker-node)

## Contributing

While the project is still in the early stages of development, you are welcome to track progress and contribute. As the project is undergoing rapid changes, interested contributors should contact the team before embarking on larger pieces of work. All contributors should consult with and agree to our [basic contributing rules](CONTRIBUTING.md).

## License

[Apache 2.0](LICENSE)

0 comments on commit 82480b8

Please sign in to comment.