service

package
v0.0.0-...-817dee4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPService

type HTTPService interface {
	GetHttpRouter(inject map[string]jape.Handler) *httprouter.Router
	Service
}

type NodeVotes

type NodeVotes interface {
	msgpack.CustomEncoder
	msgpack.CustomDecoder
	Good() int
	Bad() int
	Upvote()
	Downvote()
}

func NewNodeVotes

func NewNodeVotes() NodeVotes

type NodeVotesImpl

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

func (*NodeVotesImpl) Bad

func (n *NodeVotesImpl) Bad() int

func (*NodeVotesImpl) DecodeMsgpack

func (n *NodeVotesImpl) DecodeMsgpack(dec *msgpack.Decoder) error

func (*NodeVotesImpl) Downvote

func (n *NodeVotesImpl) Downvote()

func (NodeVotesImpl) EncodeMsgpack

func (n NodeVotesImpl) EncodeMsgpack(enc *msgpack.Encoder) error

func (*NodeVotesImpl) Good

func (n *NodeVotesImpl) Good() int

func (*NodeVotesImpl) Upvote

func (n *NodeVotesImpl) Upvote()

type P2PService

type P2PService interface {
	SelfConnectionUris() []*url.URL
	Peers() structs.Map
	ConnectToNode(connectionUris []*url.URL, retry uint, fromPeer net.Peer) error
	OnNewPeer(peer net.Peer, verifyId bool) error
	GetNodeScore(nodeId *encoding.NodeId) (float64, error)
	SortNodesByScore(nodes []*encoding.NodeId) ([]*encoding.NodeId, error)
	SignMessageSimple(message []byte) ([]byte, error)
	AddPeer(peer net.Peer) error
	SendPublicPeersToPeer(peer net.Peer, peersToSend []net.Peer) error
	SendHashRequest(hash *encoding.Multihash, kinds []types.StorageLocationType) error
	UpVote(nodeId *encoding.NodeId) error
	DownVote(nodeId *encoding.NodeId) error
	NodeId() *encoding.NodeId
	WaitOnConnectedPeers()
	ConnectionTracker() *sync.WaitGroup
	NetworkId() string
	HashQueryRoutingTable() structs.Map
	Service
}

type RegistryService

type RegistryService interface {
	Set(sre protocol.SignedRegistryEntry, trusted bool, receivedFrom net.Peer) error
	BroadcastEntry(sre protocol.SignedRegistryEntry, receivedFrom net.Peer) error
	SendRegistryRequest(pk []byte) error
	Get(pk []byte) (protocol.SignedRegistryEntry, error)
	Listen(pk []byte, cb func(sre protocol.SignedRegistryEntry)) (func(), error)
	Service
}

type Service

type Service interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	Init(ctx context.Context) error
	Logger() *zap.Logger
	Config() *config.NodeConfig
	Db() db.KVStore
	ServicesSetter
}

type ServiceBase

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

func NewServiceBase

func NewServiceBase(logger *zap.Logger, config *config.NodeConfig, db db.KVStore) ServiceBase

func (*ServiceBase) Config

func (s *ServiceBase) Config() *config.NodeConfig

func (*ServiceBase) Db

func (s *ServiceBase) Db() db.KVStore

func (*ServiceBase) Logger

func (s *ServiceBase) Logger() *zap.Logger

func (*ServiceBase) Services

func (s *ServiceBase) Services() Services

func (*ServiceBase) SetServices

func (s *ServiceBase) SetServices(services Services)

type ServiceParams

type ServiceParams struct {
	Logger *zap.Logger
	Config *config.NodeConfig
	Db     db.KVStore
}

type Services

type Services interface {
	P2P() P2PService
	Registry() RegistryService
	HTTP() HTTPService
	Storage() StorageService
	All() []Service
	Init(ctx context.Context) error
	IsStarted() bool
	IsStarting() bool
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
}

type ServicesSetter

type ServicesSetter interface {
	SetServices(services Services)
}

type StorageService

type StorageService interface {
	SetProviderStore(store storage.ProviderStore)
	ProviderStore() storage.ProviderStore
	GetCachedStorageLocations(hash *encoding.Multihash, kinds []types.StorageLocationType, local bool) (map[string]storage.StorageLocation, error)
	AddStorageLocation(hash *encoding.Multihash, nodeId *encoding.NodeId, location storage.StorageLocation, message []byte) error
	DownloadBytesByHash(hash *encoding.Multihash) ([]byte, error)
	DownloadBytesByCID(cid *encoding.CID) ([]byte, error)
	GetMetadataByCID(cid *encoding.CID) (metadata.Metadata, error)
	ParseMetadata(bytes []byte, cid *encoding.CID) (metadata.Metadata, error)
	Service
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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