haydnv / tinychain

A next-gen database + SaaS framework for rapid development and integration of enterprise services
Apache License 2.0
46 stars 10 forks source link

refactor `Cluster` to support peer discovery and allow a multi-stage joining process for a new replica #287

Open haydnv opened 5 months ago

haydnv commented 5 months ago

This includes:

  1. support providing a symmetric key as an environment variable
  2. support peer discovery on the local network & grouping by netmask
  3. decouple the host's peer list from the active replica set of the clusters that it hosts
  4. decouple the "replicate state" step from the "join active replica set" step of the host initialization process
  5. maintain a list of active replica public keys; don't require sharing a single private key between multiple hosts
haydnv commented 1 month ago

This is mostly done in the v0.17 branch but replicating a stateful service at startup time still needs to be re-implemented and tested: https://github.com/haydnv/tinychain/blob/v0.17/host/server/src/kernel.rs#L278

This requires implementing routing for Service here: https://github.com/haydnv/tinychain/blob/v0.17/host/server/src/cluster/public/service.rs

such that:

Then, iterating over and replicating each stateful attribute of each version of each service at startup time should be straightforward. The existing tests in the tests/tctest/services directory should not require any significant changes to cover this new implementation.