mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-04 18:13:44 +00:00
change comment style
This commit is contained in:
parent
559643b034
commit
af2fd8bd7e
@ -1,28 +1,26 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
/*
|
||||
Package tsconsensus implements a consensus algorithm for a group of tsnet.Servers
|
||||
|
||||
The Raft consensus algorithm relies on you implementing a state machine that will give the same
|
||||
result to a give command as long as the same logs have been applied in the same order.
|
||||
|
||||
tsconsensus uses the hashicorp/raft library to implement leader elections and log application.
|
||||
|
||||
tsconsensus provides:
|
||||
- cluster peer discovery based on tailscale tags
|
||||
- executing a command on the leader
|
||||
- communication between cluster peers over tailscale using tsnet
|
||||
|
||||
Users implement a state machine that satisfies the raft.FSM interface, with the business logic they desire.
|
||||
When changes to state are needed any node may
|
||||
- create a Command instance with serialized Args.
|
||||
- call ExecuteCommand with the Command instance
|
||||
this will propagate the command to the leader,
|
||||
and then from the reader to every node via raft.
|
||||
- the state machine then can implement raft.Apply, and dispatch commands via the Command.Name
|
||||
returning a CommandResult with an Err or a serialized Result.
|
||||
*/
|
||||
// Package tsconsensus implements a consensus algorithm for a group of tsnet.Servers
|
||||
//
|
||||
// The Raft consensus algorithm relies on you implementing a state machine that will give the same
|
||||
// result to a give command as long as the same logs have been applied in the same order.
|
||||
//
|
||||
// tsconsensus uses the hashicorp/raft library to implement leader elections and log application.
|
||||
//
|
||||
// tsconsensus provides:
|
||||
// - cluster peer discovery based on tailscale tags
|
||||
// - executing a command on the leader
|
||||
// - communication between cluster peers over tailscale using tsnet
|
||||
//
|
||||
// Users implement a state machine that satisfies the raft.FSM interface, with the business logic they desire.
|
||||
// When changes to state are needed any node may
|
||||
// - create a Command instance with serialized Args.
|
||||
// - call ExecuteCommand with the Command instance
|
||||
// this will propagate the command to the leader,
|
||||
// and then from the reader to every node via raft.
|
||||
// - the state machine then can implement raft.Apply, and dispatch commands via the Command.Name
|
||||
// returning a CommandResult with an Err or a serialized Result.
|
||||
package tsconsensus
|
||||
|
||||
import (
|
||||
@ -395,7 +393,7 @@ func (c *Consensus) executeCommandLocally(cmd Command) (CommandResult, error) {
|
||||
if err != nil {
|
||||
return CommandResult{}, err
|
||||
}
|
||||
f := c.raft.Apply(b, 10*time.Second)
|
||||
f := c.raft.Apply(b, 10*time.Second) // TODO hardcoded timeout
|
||||
err = f.Error()
|
||||
result := f.Response()
|
||||
if errors.Is(err, raft.ErrNotLeader) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user