model

package
v0.5.21 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DistributorRequestActivity               = "activity"
	DistributorRequestAccountActivities      = "activities"
	DistributorRequestBatchAccountActivities = "batch_activities"
	DistributorRequestNetworkActivities      = "network_activities"
	DistributorRequestPlatformActivities     = "platform_activities"
)

Variables

View Source
var (
	// RssNodeCacheKey is the cache key for the nodes that support the RSS network.
	RssNodeCacheKey = "nodes:rss"
	// FullNodeCacheKey is the cache key for the full nodes.
	FullNodeCacheKey = "nodes:full"

	// InvalidRequestCount is the prefix used for cache keys related to storing invalid request counts in the current epoch.
	InvalidRequestCount = "node:request:count:invalid"
	// ValidRequestCount is the prefix used for cache keys related to storing valid request counts in the current epoch.
	ValidRequestCount = "node:request:count:valid"

	// WorkerToNetworksMapKey is the cache key for the map of Workers to Networks.
	WorkerToNetworksMapKey = "map:worker_to_networks"
	// NetworkToWorkersMapKey is the cache key for the map of Networks to Workers.
	NetworkToWorkersMapKey = "map:network_to_workers"
	// PlatformToWorkersMapKey is the cache key for the map of Platforms to Workers.
	PlatformToWorkersMapKey = "map:platform_to_workers"
	// TagToWorkersMapKey is the cache key for the map of Tags to Workers.
	TagToWorkersMapKey = "map:tag_to_workers"

	// SubscribeNodeCacheKey is the cache key for the subscribed nodes that new epoch starts.
	SubscribeNodeCacheKey = "epoch"

	// RequiredQualifiedNodeCount the required number of qualified Nodes
	RequiredQualifiedNodeCount = 3
	// RequiredVerificationCount the required number of verifications before a request is considered valid
	RequiredVerificationCount = 3
	// DemotionCountBeforeSlashing the number of demotions that trigger a slashing
	DemotionCountBeforeSlashing = 4

	// MutablePlatformMap is a map of mutable platforms which should be excluded from the data comparison.
	MutablePlatformMap = map[string]struct{}{
		decentralized.PlatformFarcaster.String(): {},
	}

	// RenameWorkerMap is a map of workers to their corresponding names.
	// Dealing with some unclear expressions may lead to problems in distributing tasks to workers.
	RenameWorkerMap = map[network.Network]string{
		network.Farcaster: "farcaster",
	}

	// WorkerToNetworksMap is a map of workers to networks, filtering out the complete network types that workers support.
	WorkerToNetworksMap = make(map[string][]string, len(decentralized.WorkerValues()))
	// NetworkToWorkersMap is a map of Networks to Workers, filtering out the complete worker types that networks support.
	NetworkToWorkersMap = make(map[string][]string, len(network.NetworkValues()))
	// PlatformToWorkersMap is a map of Platforms to Workers, filtering out the complete worker types that platforms support.
	PlatformToWorkersMap = make(map[string][]string, len(decentralized.PlatformValues()))
	// TagToWorkersMap is a map of Tags to Workers, filtering out the complete worker types that tags support.
	TagToWorkersMap = make(map[string][]string, len(tag.TagValues()))
)

Functions

This section is empty.

Types

type Action

type Action struct {
	Tag         string            `json:"tag"`
	Type        string            `json:"type"`
	Platform    string            `json:"platform,omitempty"`
	From        string            `json:"from"`
	To          string            `json:"to"`
	Metadata    metadata.Metadata `json:"metadata"`
	RelatedURLs []string          `json:"related_urls,omitempty"`
}

Action represents an action within an Activity.

func (*Action) UnmarshalJSON

func (a *Action) UnmarshalJSON(bytes []byte) error

type Actions

type Actions []*Action

type ActivitiesResponse

type ActivitiesResponse struct {
	Data []*Activity `json:"data"`
	Meta *MetaCursor `json:"meta,omitempty"`
}

ActivitiesResponse represents a list of Activity in a response being returned to the requester.

type Activity

type Activity struct {
	ID       string    `json:"id"`
	Owner    string    `json:"owner,omitempty"`
	Network  string    `json:"network"`
	Index    uint      `json:"index"`
	From     string    `json:"from"`
	To       string    `json:"to"`
	Tag      string    `json:"tag"`
	Type     string    `json:"type"`
	Platform string    `json:"platform,omitempty"`
	Actions  []*Action `json:"actions"`
}

Activity represents an activity.

type ActivityResponse

type ActivityResponse struct {
	Data *Activity `json:"data"`
}

ActivityResponse represents a single Activity in a response being returned to the requester.

type DataResponse

type DataResponse struct {
	Address  common.Address
	Endpoint string
	Data     []byte
	// A valid response must be non-null and non-error
	Valid bool
	Err   error
	// ValidPoint is the points given to the response
	ValidPoint int
	// InvalidPoint is the points given to the response when it is invalid
	InvalidPoint int
}

DataResponse represents the response returned by a Node. It is also used to store the verification result.

type ErrResponse

type ErrResponse struct {
	Error     string `json:"error"`
	ErrorCode string `json:"error_code"`
}

type MetaCursor

type MetaCursor struct {
	Cursor string `json:"cursor"`
}

type NodeEndpointCache

type NodeEndpointCache struct {
	Address  string  `json:"address"`
	Endpoint string  `json:"endpoint"`
	Score    float64 `json:"score"`
}

NodeEndpointCache stores the elements in the heap.

type RequestMeta added in v0.5.19

type RequestMeta struct {
	Method   string
	Endpoint string
	Body     io.Reader
}

Jump to

Keyboard shortcuts

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