1
0
Fork 0
forked from External/ergo

initial persistent history implementation

This commit is contained in:
Shivaram Lingamneni 2020-02-18 19:38:42 -05:00
parent 0d5a4fd584
commit 33dac4c0ba
34 changed files with 2229 additions and 595 deletions

View file

@ -26,15 +26,33 @@ func (s *Stats) Add() {
s.mutex.Unlock()
}
// Activates a registered client, e.g., for the initial attach to a persistent client
func (s *Stats) AddRegistered(invisible, operator bool) {
s.mutex.Lock()
if invisible {
s.Invisible += 1
}
if operator {
s.Operators += 1
}
s.Total += 1
s.setMax()
s.mutex.Unlock()
}
// Transition a client from unregistered to registered
func (s *Stats) Register() {
s.mutex.Lock()
s.Unknown -= 1
s.Total += 1
s.setMax()
s.mutex.Unlock()
}
func (s *Stats) setMax() {
if s.Max < s.Total {
s.Max = s.Total
}
s.mutex.Unlock()
}
// Modify the Invisible count