refactor `Cluster` to support peer discovery and allow a multi-stage joining process for a new replica
haydnv opened this issue · comments
This includes:
- support providing a symmetric key as an environment variable
- support peer discovery on the local network & grouping by netmask
- decouple the host's peer list from the active replica set of the clusters that it hosts
- decouple the "replicate state" step from the "join active replica set" step of the host initialization process
- 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 newVersion
(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 theChain
of the attribute value - any request to
/service/<service name>/<version number>/<attr name>..
should be routed to the specifiedAttr
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.