add event base intelligency

This commit is contained in:
mr
2026-01-13 16:04:31 +01:00
parent c35b06e0bc
commit 6d745fe922
46 changed files with 859 additions and 455 deletions

View File

@@ -26,6 +26,24 @@ func (m PeerState) EnumIndex() int {
return int(m)
}
func GetSelf() (utils.ShallowDBObject, string) {
d, code, err := NewAccessor(nil).Search(nil, SELF.String(), false)
if code != 200 || err != nil || len(d) == 0 {
return nil, ""
}
id := d[0].GetID()
return d[0], id
}
func IsMySelf(peerID string) (bool, string) {
d, code, err := NewAccessor(nil).Search(nil, SELF.String(), false)
if code != 200 || err != nil || len(d) == 0 {
return false, ""
}
id := d[0].GetID()
return peerID == id, id
}
// Peer is a struct that represents a peer
type Peer struct {
utils.AbstractObject
@@ -37,7 +55,7 @@ type Peer struct {
FailedExecution []PeerExecution `json:"failed_execution" bson:"failed_execution"` // FailedExecution is the list of failed executions, to be retried
}
func (ao *Peer) VerifyAuth(request *tools.APIRequest) bool {
func (ao *Peer) VerifyAuth(callName string, request *tools.APIRequest) bool {
return true
}