diff options
| author | Paul Buetow <paul@buetow.org> | 2023-05-20 00:19:53 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-05-20 00:19:53 +0300 |
| commit | 22c04663bf832506b14fa1d2ab5a88d519bbd659 (patch) | |
| tree | e95c7cf0bbcba28463dfe0660a84268e4bd28888 /internal/quorum.go | |
| parent | ca585bde1c27777917b9454fe1d9c3d736de143d (diff) | |
votes can expire
Diffstat (limited to 'internal/quorum.go')
| -rw-r--r-- | internal/quorum.go | 27 |
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 } |
