enforcer

package
v0.8.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2024 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentInfo added in v0.5.17

type ComponentInfo struct {
	Decentralized []*DecentralizedWorkerInfo `json:"decentralized"`
	RSS           *RSSWorkerInfo             `json:"rss"`
	Federated     []*FederatedInfo           `json:"federated"`
}

type DecentralizedWorkerInfo added in v0.5.17

type DecentralizedWorkerInfo struct {
	WorkerInfo
	Worker   decentralized.Worker   `json:"worker"`
	Platform decentralized.Platform `json:"platform"`
}

type EndpointCache added in v0.6.0

type EndpointCache struct {
	Endpoint    string
	AccessToken string
}

type Enforcer

type Enforcer interface {
	VerifyResponses(ctx context.Context, responses []*model.DataResponse, verify bool) error
	VerifyPartialResponses(ctx context.Context, epochID uint64, responses []*model.DataResponse)
	MaintainReliabilityScore(ctx context.Context) error
	MaintainEpochData(ctx context.Context, epoch int64) error
	ChallengeStates(ctx context.Context) error
	RetrieveQualifiedNodes(ctx context.Context, key string) ([]*model.NodeEndpointCache, error)
}

type FederatedInfo added in v0.5.17

type FederatedInfo struct {
	WorkerInfo
	Worker federated.Worker `json:"worker"`
}

type InfoResponse added in v0.7.0

type InfoResponse struct {
	Data struct {
		Version struct {
			Tag    string `json:"tag"`
			Commit string `json:"commit"`
		} `json:"version"`
	} `json:"data"`
}

type RSSWorkerInfo added in v0.5.17

type RSSWorkerInfo struct {
	//WorkerInfo
	//Worker rss.Worker `json:"worker"`
	Platform rss.Platform  `json:"platform"`
	Status   worker.Status `json:"status"`
}

type ScoreMaintainer added in v0.4.13

type ScoreMaintainer struct {
	// contains filtered or unexported fields
}

ScoreMaintainer is a structure used to maintain a sorted set and a quick lookup map. It uses Redis to keep a sorted set based on node scores, and a map in memory for fast access to each node endpoint's cached data. This structure helps in quickly and efficiently updating and retrieving scores and statuses of nodes in distributed systems.

type SimpleEnforcer

type SimpleEnforcer struct {
	// contains filtered or unexported fields
}

func NewSimpleEnforcer

func NewSimpleEnforcer(ctx context.Context, databaseClient database.Client, cacheClient cache.Client, stakingContract *l2.StakingV2MulticallClient, networkParamsContract *l2.NetworkParams, httpClient httputil.Client, txManager *txmgr.SimpleTxManager, settlerConfig *config.Settler, chainID *big.Int, initCacheData bool) (*SimpleEnforcer, error)

func (*SimpleEnforcer) ChallengeStates

func (e *SimpleEnforcer) ChallengeStates(_ context.Context) error

func (*SimpleEnforcer) MaintainEpochData added in v0.5.17

func (e *SimpleEnforcer) MaintainEpochData(ctx context.Context, epoch int64) error

MaintainEpochData maintains the data for the new epoch. The data includes the range of data that all nodes can support and status of nodes in a new epoch.

func (*SimpleEnforcer) MaintainNodeStatus added in v0.7.0

func (e *SimpleEnforcer) MaintainNodeStatus(ctx context.Context) error

func (*SimpleEnforcer) MaintainReliabilityScore

func (e *SimpleEnforcer) MaintainReliabilityScore(ctx context.Context) error

MaintainReliabilityScore maintains the Reliability Score σ for all Nodes. σ is used to determine the probability of a Node receiving a request on DSL.

func (*SimpleEnforcer) RetrieveQualifiedNodes added in v0.4.13

func (e *SimpleEnforcer) RetrieveQualifiedNodes(ctx context.Context, key string) ([]*model.NodeEndpointCache, error)

RetrieveQualifiedNodes retrieves the qualified Nodes from the sorted set.

func (*SimpleEnforcer) VerifyPartialResponses

func (e *SimpleEnforcer) VerifyPartialResponses(ctx context.Context, epochID uint64, responses []*model.DataResponse)

VerifyPartialResponses performs a partial verification of the responses from the Nodes.

func (*SimpleEnforcer) VerifyResponses

func (e *SimpleEnforcer) VerifyResponses(ctx context.Context, responses []*model.DataResponse, verify bool) error

VerifyResponses verifies the responses from the Nodes.

type WorkerInfo added in v0.5.17

type WorkerInfo struct {
	Network network.Network `json:"network"`
	Tags    []tag.Tag       `json:"tags"`
	Status  worker.Status   `json:"status"`
}

type WorkersStatusResponse added in v0.7.0

type WorkersStatusResponse struct {
	Data *ComponentInfo `json:"data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL