add peer state
This commit is contained in:
@@ -10,13 +10,25 @@ import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// now write a go enum for the state partner with self, blacklist, partner
|
||||
|
||||
type PeerState int
|
||||
|
||||
const (
|
||||
NONE PeerState = iota
|
||||
SELF
|
||||
PARTNER
|
||||
BLACKLIST
|
||||
)
|
||||
|
||||
// Peer is a struct that represents a peer
|
||||
type Peer struct {
|
||||
utils.AbstractObject
|
||||
Url string `json:"url,omitempty" bson:"url,omitempty" validate:"required,base64url"` // Url is the URL of the peer (base64url)
|
||||
PublicKey string `json:"public_key,omitempty" bson:"public_key,omitempty"` // PublicKey is the public key of the peer
|
||||
Services map[string]int `json:"services,omitempty" bson:"services,omitempty"` // Services is the services of the peer
|
||||
FailedExecution []PeerExecution `json:"failed_execution" bson:"failed_execution"` // FailedExecution is the list of failed executions, to be retried
|
||||
Services map[string]int `json:"services,omitempty" bson:"services,omitempty"`
|
||||
State PeerState `json:"state" bson:"state" default:"0"`
|
||||
FailedExecution []PeerExecution `json:"failed_execution" bson:"failed_execution"` // FailedExecution is the list of failed executions, to be retried
|
||||
}
|
||||
|
||||
// AddExecution adds an execution to the list of failed executions
|
||||
|
Reference in New Issue
Block a user