summaryrefslogtreecommitdiff
path: root/internal/quorum.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-05-20 00:19:53 +0300
committerPaul Buetow <paul@buetow.org>2023-05-20 00:19:53 +0300
commit22c04663bf832506b14fa1d2ab5a88d519bbd659 (patch)
treee95c7cf0bbcba28463dfe0660a84268e4bd28888 /internal/quorum.go
parentca585bde1c27777917b9454fe1d9c3d736de143d (diff)
votes can expire
Diffstat (limited to 'internal/quorum.go')
-rw-r--r--internal/quorum.go27
1 files changed, 20 insertions, 7 deletions
diff --git a/internal/quorum.go b/internal/quorum.go
index 1307f20..1c8e451 100644
--- a/internal/quorum.go
+++ b/internal/quorum.go
@@ -2,17 +2,30 @@ package internal
import (
"log"
- "time"
)
-type quorum struct {
- ID string
- Age time.Duration
- Votes int
-}
+type quorumMap map[string]vote
-type quorumMap map[string]quorum
+type score struct {
+ id string
+ score int
+}
func (q quorumMap) vote(v vote) {
log.Printf("Adding vote %v", v)
+ q[v.from] = v
+}
+
+func (q quorumMap) score() (scores []score) {
+ /*
+ scoreMap := make(map[string]int)
+ var expired []string
+
+ for from, vote := range q {
+
+ for _, id := range vote.ids {
+ }
+ }
+ */
+ return
}