Documentation
¶
Index ¶
- Constants
- type Engine
- type Moderator
- func (m *Moderator) AuditStanding(peerID string) audit.Standing
- func (m *Moderator) Broadcast(v vote.Event) error
- func (m *Moderator) ChallengeHandler() warpnet.WarpHandlerFunc
- func (m *Moderator) Close()
- func (m *Moderator) Decided(rep event.ReportEvent, outcome vote.Event, votes []event.VerdictVote)
- func (m *Moderator) Event() <-chan warpnet.PeerEvent
- func (m *Moderator) Start() error
- func (m *Moderator) Vote(reportID string, rep event.ReportEvent) (vote.Event, bool, error)
- type ModeratorNode
- type Publisher
- type ReportSubscriber
- type VoteExchange
Constants ¶
const ( ErrModeratorInitFailed warpnet.WarpError = "moderator: failed to init engine" ErrFetchFailed warpnet.WarpError = "moderator: fetch failed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Moderator ¶
type Moderator struct {
// contains filtered or unexported fields
}
Moderator runs entirely report-driven: there is no peer-scanning loop. Every report opens a vote round shared by all moderators listening on ReportsTopic. The Moderator owns the side effects — running the engine, gossip, reporter notification, isolation — and hands the protocol itself (who votes, when, who finalizes) to the rounds it opens; it implements roundHost so a round can reach back for exactly those effects and nothing else.
func NewModerator ¶ added in v0.5.21
func NewModerator( ctx context.Context, node ModeratorNode, pub Publisher, sub ReportSubscriber, votes VoteExchange, privKey ed25519.PrivateKey, ) (*Moderator, error)
func (*Moderator) AuditStanding ¶ added in v0.8.77
AuditStanding reports what this node's own spot-checks make of a peer. Nothing consults it yet — see the audit package docs on why a single auditor must not be allowed to disqualify anyone on its own.
func (*Moderator) ChallengeHandler ¶ added in v0.8.77
func (m *Moderator) ChallengeHandler() warpnet.WarpHandlerFunc
ChallengeHandler answers audit spot-checks from other moderators: it runs the local engine over the challenged text and signs the answer with this node's key. Register it under audit.ChallengeRoute.
func (*Moderator) Decided ¶ added in v0.8.77
func (m *Moderator) Decided(rep event.ReportEvent, outcome vote.Event, votes []event.VerdictVote)
Decided implements round.Participant: it delivers the agreed verdict to the reporter and, on FAIL, runs the isolation broadcast. Shadow-ban: only bad verdicts go on the followers broadcast. Called by the round that picked this node to carry the decision — as chair, or as the backup that took over.
func (*Moderator) Event ¶ added in v0.8.77
Event is what this moderator concluded about its peers: the verdicts it carried, and what the audit made of the other moderators.
type ModeratorNode ¶
type ReportSubscriber ¶ added in v0.7.59
type ReportSubscriber interface {
SubscribeReports(h func(ev event.ReportEvent) error) error
}
ReportSubscriber is the slice of the moderator pubsub the Moderator needs. It hands out one ReportEvent per gossip message.