Skip to content

Instantly share code, notes, and snippets.

@samueleresca
Last active December 25, 2021 10:36
Show Gist options
  • Save samueleresca/d8d55cb34f10c8c143c0c9fccb1e0c54 to your computer and use it in GitHub Desktop.
Save samueleresca/d8d55cb34f10c8c143c0c9fccb1e0c54 to your computer and use it in GitHub Desktop.
// NewQuorumSystemWithReads defines a new quorum system given a read Expr, the write Expr is derived using DualOperator.Dual operation.
func NewQuorumSystemWithReads(reads Expr) QuorumSystem {
qs, _ := NewQuorumSystem(reads, reads.Dual())
qs.nameToNode = nameToNode{}
for node := range qs.GetNodes() {
qs.nameToNode[node.Name] = node
}
return qs
}
// NewQuorumSystemWithWrites defines a new quorum system given a write Expr, the read Expr is derived using DualOperator.Dual operation.
func NewQuorumSystemWithWrites(writes Expr) QuorumSystem {
...
}
// NewQuorumSystem defines a new quorum system given the reads Expr and the writes Expr.
func NewQuorumSystem(reads Expr, writes Expr) (QuorumSystem, error) {
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment