Documentation
¶
Index ¶
- func NewAccessor(request *tools.APIRequest) *peerMongoAccessor
- func NewShallowAccessor() *peerMongoAccessor
- type Peer
- func (ao *Peer) AddExecution(exec PeerExecution)
- func (r *Peer) CanDelete() bool
- func (d *Peer) GetAccessor(request *tools.APIRequest) utils.Accessor
- func (p *Peer) IsMySelf() (bool, string)
- func (p *Peer) LaunchPeerExecution(peerID string, dataID string, dt tools.DataType, method tools.METHOD, ...) (map[string]interface{}, error)
- func (ao *Peer) RemoveExecution(exec PeerExecution)
- func (ao *Peer) VerifyAuth(request *tools.APIRequest) bool
- type PeerCache
- type PeerExecution
- type PeerState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAccessor ¶
func NewAccessor(request *tools.APIRequest) *peerMongoAccessor
func NewShallowAccessor ¶
func NewShallowAccessor() *peerMongoAccessor
New creates a new instance of the peerMongoAccessor
Types ¶
type Peer ¶
type Peer struct {
utils.AbstractObject
Url string `json:"url" bson:"url" validate:"required"` // Url is the URL of the peer (base64url)
WalletAddress string `json:"wallet_address" bson:"wallet_address" validate:"required"` // WalletAddress is the wallet address of the peer
PublicKey string `json:"public_key" bson:"public_key" validate:"required"` // PublicKey is the public key of the peer
State PeerState `json:"state" bson:"state" default:"0"`
ServicesState map[string]int `json:"services_state,omitempty" bson:"services_state,omitempty"`
FailedExecution []PeerExecution `json:"failed_execution" bson:"failed_execution"` // FailedExecution is the list of failed executions, to be retried
}
Peer is a struct that represents a peer
func (*Peer) AddExecution ¶
func (ao *Peer) AddExecution(exec PeerExecution)
AddExecution adds an execution to the list of failed executions
func (*Peer) GetAccessor ¶
func (d *Peer) GetAccessor(request *tools.APIRequest) utils.Accessor
func (*Peer) LaunchPeerExecution ¶
func (p *Peer) LaunchPeerExecution(peerID string, dataID string, dt tools.DataType, method tools.METHOD, body interface{}, caller *tools.HTTPCaller) (map[string]interface{}, error)
LaunchPeerExecution launches an execution on a peer
func (*Peer) RemoveExecution ¶
func (ao *Peer) RemoveExecution(exec PeerExecution)
RemoveExecution removes an execution from the list of failed executions
func (*Peer) VerifyAuth ¶
func (ao *Peer) VerifyAuth(request *tools.APIRequest) bool
type PeerCache ¶
type PeerCache struct {
Executions []*PeerExecution
}
PeerCache is a struct that represents a peer cache
func (*PeerCache) Exec ¶
func (p *PeerCache) Exec(url string, method tools.METHOD, body interface{}, caller tools.HTTPCallerITF) (map[string]interface{}, error)
exec executes the method on the peer
func (*PeerCache) LaunchPeerExecution ¶
func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string, dt tools.DataType, method tools.METHOD, body interface{}, caller tools.HTTPCallerITF) (map[string]interface{}, error)
LaunchPeerExecution launches an execution on a peer The method contacts the path described by : peer.Url + datatype path (from enums) + replacement of id by dataID
type PeerExecution ¶
type PeerExecution struct {
Method string `json:"method" bson:"method"`
Url string `json:"url" bson:"url"`
Body interface{} `json:"body" bson:"body"`
DataType int `json:"data_type" bson:"data_type"`
DataID string `json:"data_id" bson:"data_id"`
}
* PeerExecution is a struct that represents an execution on a peer * it defines the execution data
Click to show internal directories.
Click to hide internal directories.