feat(boss): Chief of Staff Boss + spun-crow registry with cap (#42)
This commit is contained in:
1 parent
ccb0e503c5
commit
663c8a19d8
10 files changed
+329
-20
No files matched your search
@@ -153,6 +153,20 @@ func (l *Ledger) Judge(crows []string, taskType string, ok bool, promoteAfter in
|
||||
return changes
|
||||
}
|
||||
|
||||
// SetStart gives a new crow its starting trust record, used when the Boss
|
||||
// spins up a crow. It never raises a level above the record's own; and the
|
||||
// Boss path only ever passes Stranger or Regular (earned trust can't be
|
||||
// minted). Saves through the real path so a restart keeps the record.
|
||||
func (l *Ledger) SetStart(crow, taskType string, level int) error {
|
||||
l.mu.Lock()
|
||||
r := get(l.Crows, crow+"|"+taskType)
|
||||
if level > r.Level {
|
||||
r.Level = level
|
||||
}
|
||||
l.mu.Unlock()
|
||||
return l.Save()
|
||||
}
|
||||
|
||||
// MarshalSnapshot returns the ledger as JSON, safe to call while lists are flying.
|
||||
func (l *Ledger) MarshalSnapshot() ([]byte, error) {
|
||||
l.mu.Lock()
|
||||
|
||||
Reference in new issue
Block a user