haydnv / tinychain

A next-gen database + SaaS framework for rapid development and integration of enterprise services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

haydnv opened this issue · comments

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

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:

  • a PUT request to /service/<name> with a key of <version number> creates a new Version (see https://github.com/haydnv/tinychain/blob/v0.17/host/server/src/cluster/service.rs#L63) with a schema specified by the value of the request
  • a GET request to /service/<name>/<version number> with a key of <attr name> should return the Chain of the attribute value
  • any request to /service/<service name>/<version number>/<attr name>.. should be routed to the specified Attr

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.