mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
add -profile flag
This commit is contained in:
@@ -19,12 +19,14 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func createSerfAgentConfig(name, bindAddr, rpcAddr string) *agent.Config {
|
func createSerfAgentConfig(name, bindAddr, rpcAddr, profile string) *agent.Config {
|
||||||
config := agent.DefaultConfig()
|
config := agent.DefaultConfig()
|
||||||
config.NodeName = name
|
config.NodeName = name
|
||||||
config.BindAddr = bindAddr
|
config.BindAddr = bindAddr
|
||||||
config.RPCAddr = rpcAddr
|
config.RPCAddr = rpcAddr
|
||||||
|
config.Profile = profile
|
||||||
|
// TODO: configure logging for serf and memberlist to slog.
|
||||||
|
// check: https://github.com/hashicorp/serf/issues/512
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +121,8 @@ func main() {
|
|||||||
bindAddr := flag.String("bind", "0.0.0.0:7946", "Bind address")
|
bindAddr := flag.String("bind", "0.0.0.0:7946", "Bind address")
|
||||||
rpcAddr := flag.String("rpc-addr", "127.0.0.1:7373", "RPC address")
|
rpcAddr := flag.String("rpc-addr", "127.0.0.1:7373", "RPC address")
|
||||||
storeDir := flag.String("store-dir", "./store", "Store directory path")
|
storeDir := flag.String("store-dir", "./store", "Store directory path")
|
||||||
|
profile := flag.String("profile", "lan",
|
||||||
|
"Timing profile for Serf. The supported choices are \"wan\", \"lan\", and \"local\".")
|
||||||
runTick := flag.Bool("tick", false, "Periodically update /tick value")
|
runTick := flag.Bool("tick", false, "Periodically update /tick value")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
@@ -135,7 +139,7 @@ func main() {
|
|||||||
// A channel to signal that shutdown is done.
|
// A channel to signal that shutdown is done.
|
||||||
done := make(chan bool, 1)
|
done := make(chan bool, 1)
|
||||||
|
|
||||||
config := createSerfAgentConfig(*name, *bindAddr, *rpcAddr)
|
config := createSerfAgentConfig(*name, *bindAddr, *rpcAddr, *profile)
|
||||||
serfAgent, err := createSerfAgent(config)
|
serfAgent, err := createSerfAgent(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@@ -161,8 +165,8 @@ func main() {
|
|||||||
opts := crdt.DefaultOptions()
|
opts := crdt.DefaultOptions()
|
||||||
opts.Logger = newIPFSLogger(logger)
|
opts.Logger = newIPFSLogger(logger)
|
||||||
//opts.MultiHeadProcessing = true
|
//opts.MultiHeadProcessing = true
|
||||||
// TODO: debug why the heads count may grow on the receiving side if the backlog is huge and perhaps when the node
|
// TODO: debug why the heads count may grow on the receiving side if the event backlog is huge and the processing
|
||||||
// is shutdowned before processing all the backlog.
|
// is slow.
|
||||||
store, err := crdt.New(localStore, ds.NewKey("/"), syncer, broadcaster, opts)
|
store, err := crdt.New(localStore, ds.NewKey("/"), syncer, broadcaster, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user