Nats Native Behaviors + Peer is Stateless
This commit is contained in:
@@ -8,22 +8,6 @@ import (
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
)
|
||||
|
||||
// now write a go enum for the state partner with self, blacklist, partner
|
||||
type PeerState int
|
||||
|
||||
const (
|
||||
OFFLINE PeerState = iota
|
||||
ONLINE
|
||||
)
|
||||
|
||||
func (m PeerState) String() string {
|
||||
return [...]string{"NONE", "SELF", "PARTNER", "BLACKLIST"}[m]
|
||||
}
|
||||
|
||||
func (m PeerState) EnumIndex() int {
|
||||
return int(m)
|
||||
}
|
||||
|
||||
type PeerRelation int
|
||||
|
||||
const (
|
||||
@@ -69,7 +53,6 @@ type Peer struct {
|
||||
NATSAddress string `json:"nats_address" bson:"nats_address" validate:"required"`
|
||||
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"`
|
||||
Relation PeerRelation `json:"relation" bson:"relation" 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
|
||||
|
||||
@@ -61,9 +61,6 @@ func (a *peerMongoAccessor) GetObjectFilters(search string) *dbs.Filters {
|
||||
search = ""
|
||||
}
|
||||
return &dbs.Filters{
|
||||
And: map[string][]dbs.Filter{ // search by name if no filters are provided
|
||||
"state": {{Operator: dbs.EQUAL.String(), Value: ONLINE.EnumIndex()}},
|
||||
},
|
||||
Or: map[string][]dbs.Filter{ // search by name if no filters are provided
|
||||
"abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"url": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
|
||||
Reference in New Issue
Block a user