announcements

package
v1.55.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PubSubPrototypes struct {
		Announcement schema.TypedPrototype
	}
)

Functions

This section is empty.

Types

type Announcement

type Announcement struct {
	Version string
	Type    AnnouncementType
	Addrs   []string
}

func (*Announcement) GetAddrs

func (a *Announcement) GetAddrs() ([]multiaddr.Multiaddr, error)

func (*Announcement) MarshalBinary

func (a *Announcement) MarshalBinary() ([]byte, error)

func (*Announcement) SetAddrs

func (a *Announcement) SetAddrs(ma ...multiaddr.Multiaddr)

func (*Announcement) UnmarshalBinary

func (a *Announcement) UnmarshalBinary(b []byte) error

type AnnouncementType

type AnnouncementType int
const (
	UnknownAnnouncementType AnnouncementType = iota
	IExistAnnouncementType
	PoolJoinRequestAnnouncementType
	PoolJoinApproveAnnouncementType
	NewManifestAnnouncementType
)

type Announcements

type Announcements interface {
	HandleAnnouncements(context.Context)
	AnnounceIExistPeriodically(context.Context)
	AnnounceJoinPoolRequestPeriodically(context.Context)
	ValidateAnnouncement(context.Context, peer.ID, *pubsub.Message, common.MemberStatus, bool) bool
	StopJoinPoolRequestAnnouncements()
	Shutdown(context.Context) error
}

type FxAnnouncements

type FxAnnouncements struct {
	PoolJoinRequestHandler PoolJoinRequestHandler
	// contains filtered or unexported fields
}

func NewFxAnnouncements

func NewFxAnnouncements(h host.Host, o ...Option) (*FxAnnouncements, error)

func (*FxAnnouncements) AnnounceIExistPeriodically

func (an *FxAnnouncements) AnnounceIExistPeriodically(ctx context.Context)

func (*FxAnnouncements) AnnounceJoinPoolRequestPeriodically

func (an *FxAnnouncements) AnnounceJoinPoolRequestPeriodically(ctx context.Context)

func (*FxAnnouncements) HandleAnnouncements

func (an *FxAnnouncements) HandleAnnouncements(ctx context.Context)

func (*FxAnnouncements) SetPoolJoinRequestHandler

func (an *FxAnnouncements) SetPoolJoinRequestHandler(handler PoolJoinRequestHandler)

In the announcements package, add this to your concrete type that implements the Announcements interface.

func (*FxAnnouncements) Shutdown

func (an *FxAnnouncements) Shutdown(ctx context.Context) error

func (*FxAnnouncements) Start

func (an *FxAnnouncements) Start(ctx context.Context, validator pubsub.Validator) error

func (*FxAnnouncements) StopJoinPoolRequestAnnouncements

func (an *FxAnnouncements) StopJoinPoolRequestAnnouncements()

func (*FxAnnouncements) ValidateAnnouncement

func (an *FxAnnouncements) ValidateAnnouncement(ctx context.Context, id peer.ID, msg *pubsub.Message, status common.MemberStatus, exists bool) bool

type Option

type Option func(*options) error

func WithAnnounceInterval

func WithAnnounceInterval(t int) Option

func WithRelays

func WithRelays(r []string) Option

func WithTimeout

func WithTimeout(to int) Option

func WithTopicName

func WithTopicName(n string) Option

func WithWg

func WithWg(wg *sync.WaitGroup) Option

type PoolJoinRequestHandler

type PoolJoinRequestHandler interface {
	HandlePoolJoinRequest(context.Context, peer.ID, string, string, bool) error
}

PoolJoinRequestHandler is the interface that will be called by the blockchain package.

Jump to

Keyboard shortcuts

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