peers logic
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
"cloud.o-forge.io/core/oc-lib/static"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
@@ -14,6 +15,15 @@ type Peer struct {
|
||||
PublicKey string `json:"public_key,omitempty" bson:"public_key,omitempty"`
|
||||
}
|
||||
|
||||
func (ao *Peer) IsMySelf() bool {
|
||||
id, _ := static.GetMyLocalJsonPeer()
|
||||
return ao.UUID == id
|
||||
}
|
||||
|
||||
func (p *Peer) LaunchPeerExecution(peerID string, dataID string, url string, dt utils.DataType, method tools.METHOD, body map[string]interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) {
|
||||
return (&PeerCache{}).LaunchPeerExecution(peerID, dataID, url, dt, method, body, caller)
|
||||
}
|
||||
|
||||
func (ao *Peer) GetID() string {
|
||||
return ao.UUID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user