Commit Graph

20 Commits

Author SHA1 Message Date
Steve Fan c9afa9f5ef add initial advertise(Addr|Port) support
(cherry picked from commit 2a0b4f335eb54caa19ad908cdc441d73b57d68ca)
2022-02-11 16:08:56 +01:00
kaiyou 62d9c44c11 Refactor cluster.Join to prepare for rejoin
Now cluster.Join will resolve hostnames itself, then
will avoid trying to join hosts that
are already cluster members.
2020-06-16 10:46:52 +02:00
kaiyou 129291e848 Use interface name instead of cluster name
The cluster name option is not required anymore and
removed, the interface name is used to name the cluster
directly. For backward compatibility, the old path for storing
cluster state is tried as a fallback when loading.
2020-05-27 23:26:29 +02:00
kaiyou adc7a807df Expose ClusterName instead of Banner/StatePath 2020-05-27 23:26:29 +02:00
kaiyou 404b332e6a Fix the state tests using custom statePath 2020-05-27 23:26:29 +02:00
kaiyou 31b8263e96 Use the StatePath to config when loading the state 2020-05-27 23:26:29 +02:00
kaiyou 49c0d7f802 Make statePath a variable (temporary)
This is a temporary fix until the state path is made
configurable.
2020-05-13 13:52:54 +02:00
kaiyou 66b0321bf7 Fail more explicitely in cluster state tests
Co-authored-by: Leo Antunes <leo@costela.net>
2020-05-13 13:52:54 +02:00
kaiyou e9b9239eae Reinstante cluster.LocalNode
This makes for more straightforward calls. Also, generate
the localNode directly in wg.New.
2020-05-13 13:52:54 +02:00
kaiyou 32a300ffeb Rename node.Decode and node.Encode
EncodeMeta and DecodeMeta are more explicit.
2020-05-13 13:52:54 +02:00
kaiyou 078946dbdd Use localNode to store the local node name
Also rename setupDelegate to SetLocalNode, so that
main can call SetLocalNode then Update().
2020-05-13 13:52:54 +02:00
kaiyou 28a31efc1f Rename saveState to state.save 2020-05-13 13:52:54 +02:00
kaiyou d85fb84398 Unexport state from the cluster package 2020-05-13 13:52:54 +02:00
kaiyou 9ddcbb7914 Apply suggestions from code review
Review suggestions in the documentation

Co-authored-by: Leo Antunes <leo@costela.net>
2020-05-13 13:52:54 +02:00
kaiyou faf1c35d96 Implement the delegate interface on Node
Implementing on Node makes a bit more sense than implementing on Cluster
even if the difference in code is insignificant.
2020-05-13 13:52:54 +02:00
kaiyou 5d1acc1fab Add documentation to public functions and types 2020-05-13 13:52:54 +02:00
kaiyou 0162f9da2c Add unit tests for state functions
Currently unit tests only succeed if the state path
is writeable, since it is hardcoded.
2020-05-13 13:52:54 +02:00
kaiyou 13e1515f7d Split cluster into multiple files 2020-05-13 13:52:54 +02:00
kaiyou 46da51b7aa Implement node function as type functions
This means nodeMeta can be private again, and also makes it
easier to pass a Node object to the cluster for local meta,
instead of a generic byte[] function.

For later updating, that node is passed using Update() instead
of New().
2020-05-13 13:52:54 +02:00
kaiyou dadfbee083 Split the application into modules
Splitting into modules will help keep concerns separate,
at the cost of a slightly more verbose code.
2020-05-13 13:52:54 +02:00