Peer Manipulation
This commit is contained in:
@@ -57,24 +57,6 @@ func (m PeerRelation) 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
|
||||
@@ -120,16 +102,6 @@ func (ao *Peer) RemoveExecution(exec PeerExecution) {
|
||||
ao.FailedExecution = new
|
||||
}
|
||||
|
||||
// IsMySelf checks if the peer is the local peer
|
||||
func (p *Peer) IsMySelf() (bool, string) {
|
||||
d, code, err := NewAccessor(nil).Search(nil, SELF.String(), p.IsDraft)
|
||||
if code != 200 || err != nil || len(d) == 0 {
|
||||
return false, ""
|
||||
}
|
||||
id := d[0].GetID()
|
||||
return p.UUID == id, id
|
||||
}
|
||||
|
||||
// LaunchPeerExecution launches an execution on a peer
|
||||
func (p *Peer) LaunchPeerExecution(peerID string, dataID string, dt tools.DataType, method tools.METHOD, body interface{}, caller *tools.HTTPCaller) (map[string]interface{}, error) {
|
||||
p.UUID = peerID
|
||||
|
||||
Reference in New Issue
Block a user