项目作者: jusbrasil

项目描述 :
Proof of concept lib for creating finagle-like composable Services/Filters in node.
高级语言: JavaScript
项目地址: git://github.com/jusbrasil/node-finagle.git
创建时间: 2016-07-26T15:15:42Z
项目社区:https://github.com/jusbrasil/node-finagle

开源协议:

下载


node-finagle

Proof of concept lib of a finagle-like composable Service/Filter in node.

A Service is basically a function (input) => Promise<output>

The idea is provide composable wrappers to create smart Services on top of
very simple ones.

Things to support in mind:

  • Circuit breaking
  • Batchcing
  • Batch fork-join
  • Retry
  • Hedging requests (more info)

Ideally it should be built on top of proved libraries like dataloader, bluebird and generic-pool

Idea:

  1. val filterStack = (
  2. FilterStack
  3. .prepare()
  4. .andThen(circuitBreaker(/* options */)),
  5. .andThen(caching(/* options */))
  6. .andThen(batching(/* options */))
  7. .andThen(dedup(/* options */))
  8. .andThen(forkJoin(/* options */)),
  9. .andThen(hedgeRequest(/* options */)),
  10. );
  11. val loader = filterStack.build((req) => client.loadMany(req.ids));
  12. const x = loader(1);
  13. const y = loader(2);