add event base intelligency
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user