GithubHelp home page GithubHelp logo

stan's Introduction

README

A modern, modular and extensible ERP

Introduction

An ERP built as Wasm components which run durably on Golem Cloud. Each component exports exactly one functionality which other components can import. Components are written in Rust.

Currently it's just the backend API without the frontend. Currently, interacting with the API can be done through the Golem CLI or Golem REST API.

Usage

  • install dependencies
rustup target add wasm32-wasi
brew install protobuf
cargo install cargo-component
  • build
cargo component build --workspace --release
  • test
cargo test --workspace -- --test-threads=1
  • create Golem template
golem-cli template add -t foo -p stan target/wasm32-wasi/release/foo.wasm
# or if already exists
golem-cli template update -t foo -p stan target/wasm32-wasi/release/foo.wasm
  • create Golem worker
golem-cli worker add -w foo-1 -t foo -p stan
# or if already exists
golem-cli worker delete -w foo-1 -t foo -p stan
golem-cli worker add -w foo-1 -t foo -p stan

stan's People

Contributors

vwkd avatar

Watchers

 avatar

stan's Issues

How to identify resources?

Currently we identify resources using an ID which we pass across components and the API boundary. Is there a better way?

Having to maintain an ID is painful. We need to resolve the ID to the resource each time we cross a boundary.

Should we instead pass a resource handle? Currently this seems to be a Rust reference &. Does this introduce lifetime issues? Also, what if a smart pointers like Arc would be better suited than a reference? For example, a state component could export a delete function to delete an item which drops the Arc, but any dependency components can still use as long as needed.

But we'll ultimately need some sort of ID when leaving the component cloud and pass the API boundary to the frontend.

Currently we use a increasing u64 and use it as index into a Vec. The advantage over a string is to have a natural order, not worry about generating a unique one without conflicts, and to not need to allocate every time we cross a boundary. The disadvantage is that Vec wants a platform-dependent usize which Wasm doesn't support, so using a u64 limits us to 64-bit and we panic if we run anywhere else. Also, we need to worry about never remove an item from the Vec or otherwise mutate the sequence which would change the IDs. Since we can't really delete, we can at most store an Option and replace the value with None, at the cost of complicating error handling.

Maybe some sort of hybrid between the two? Resource handles for internal cross-component boundaries, IDs for the API boundary?

How to store state?

Currently we use global variables to store state in a library crate. Is there a better way?

The Golem Cloud apparently uses a single thread1 but if we use tests we have to worry about multiple threads.

We currently use an immutable global variable with a Mutex while the Golem Cloud documentation uses a mutable global variable with unsafe.

Footnotes

  1. "When running a Golem component you don’t have to care about concurrent access of global state - each worker based on the template runs completely separated." golem.cloud

How to access past state?

How do we access past state? How do we access direct state or accumulated state, for a certain point in time or a duration in time?

Golem likely stores the sequence of input/output calls of a component since time 0 to be able to restore its present state by replaying them. To access direct state for a certain point in time, Golem could offer an API to create a new temporary component with replayed component state until time t that can then be called. But doing this for every point in time over a duration seems to be inefficient. Also, for accumulated state we would need to push the calculation to the client which could be error prone. For example, calculate the total incoming/outgoing cash flow over a duration by summing the cash account balance at each point in time over the duration.

This would work for state components that store the state internally. But what for workflow components where state are the executions itself? For example, the number of fulfilled orders is the number of successful executions of the order component. Golem likely doesn't store this history directly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.