feat(divergence): Jev noul restatement check -> harness review nudge (#25)
This commit is contained in:
1 parent
b04aace26b
commit
dfe50da320
3 files changed
+121
No files matched your search
+26
@@ -132,6 +132,32 @@ func (s *MessageStore) FirstClaim(nestID, referentID string) (string, bool) {
|
||||
return "", false
|
||||
}
|
||||
|
||||
// EarlierDelivers returns the texts of deliver messages answering the same
|
||||
// referent, oldest first, excluding the one with id excludeID.
|
||||
func (s *MessageStore) EarlierDelivers(nestID, referentID string, excludeID int) []string {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
var out []string
|
||||
for _, m := range s.log[nestID] {
|
||||
if m.Kind == "deliver" && m.RefersTo == referentID && m.ID != excludeID {
|
||||
out = append(out, m.Text)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// NudgeFor reports whether a nudge already references a given message.
|
||||
func (s *MessageStore) NudgeFor(nestID, targetMsgID string) (Message, bool) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
for _, m := range s.log[nestID] {
|
||||
if m.Kind == "nudge" && m.RefersTo == targetMsgID {
|
||||
return m, true
|
||||
}
|
||||
}
|
||||
return Message{}, false
|
||||
}
|
||||
|
||||
func (s *MessageStore) save(nestID string) error {
|
||||
if err := os.MkdirAll(s.dir, 0o755); err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user