Giter Club home page Giter Club logo

strategies's Introduction

neume-network-strategies

purpose

The goal of this repository and the overall idea of separating neume-network-core's source from its strategies, is to allow any type of music platform to quickly define their on-chain schema - allowing them to re-use neume-network-core to index and distribute their and other platform's music ecosystem.

installation and contributing

Unless you want to run this repository's unit tests, for now, this repository can't run by itself. Instead, we recommend you run it as a submodule of neume-network/core. Please follow its installation instructions.

work-in-progress

WARNING: This repository is under active development and APIs aren't stable.

implementing new strategies

high-level checklist for implementation

  • Any external request message passed to @neume-network/extraction-worker must result in an idempotent response (aka. if the request is repeated the same result must be returned).
  • Extraction of information from external requests must not be coupled to e.g. transformation of responses. It must be possible to run transformation independently from e.g. extraction.
  • Request patterns should be scoped through e.g. time or block periods.

To implement a strategy with maximum efficiency, we recommend doing all on-chain and off-chain requests using the extraction Worker API.

extractor strategy interface definition

An extractor strategy must implement the following interface:

interface Extractor {
  name: String;
  props: Object;
  init(args...): Object<messages:  Message[], write: String>;
  update(message: Message): Object<messages: Message[], write: String>;
}

Where Message is defined as any JSON object compliant to the definitions in neume-network/message-schema.

A neume-network extraction message is layed out similarly to a react.js component in that foundamentally, it is a component implementing lifecycle methods.

  • A component has props as in "properties" that can be defined before instantiation of the component.
  • The init function is called when the component is mounted into the core process.
  • Upon completion of the init task, update is called until update's returned messages list is empty.

Below is a visual overview of a neume-network extractor component's lifecycle.

transformer strategy interface definition

A transformer strategy must implement the following interface:

interface Transformer {
  name: String;
  onLine(line: String): Object<messages:  Message[], write: String>;
  onError(error: Error): any;
  onClose(): Object<messages:  Message[], write: String>;
}

Where Message is defined as any JSON object compliant to the definitions in neume-network/message-schema.

strategies's People

Contributors

il3ven avatar mount-blanc avatar reimertz avatar timdaub avatar

Watchers

 avatar

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.