hyperledger-labs / fabric-token-sdk

The Fabric Token SDK is a set of API and services that lets developers create token-based distributed application on Hyperledger Fabric.
Apache License 2.0
86 stars 60 forks source link

Shared token selector #633

Open alexandrosfilios opened 5 months ago

alexandrosfilios commented 5 months ago

The current token-selector implementation does not support node replication, as it assumes that only one FSC node accesses the tokens of a specific wallet/currency combination. This leads to the following problems:

A possible solution would be to assign each user to a specific replica (sticky sessions). However:

A desired solution would:

For this, we can use a shared lock table with the following fields:

Each replica keeps a cache (queue) of tokens. At the beginning this queue may be empty or half filled by a previous selection. We note down that more tokens may be available if we query the database (but we do not query yet, as we may already have enough tokens in our cache).

Notes:

Further optimisations

adecaro commented 5 months ago

@alexandrosfilios , is this done?