eventpublisher

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code string
const (
	ConnectedCode  Code = "connected"
	QueryAskedCode Code = "query-asked"
	ProposedCode   Code = "proposed"
	AcceptedCode   Code = "accepted"
	FirstByteCode  Code = "first-byte-received"
	FailureCode    Code = "failure"
	SuccessCode    Code = "success"
)

type Phase

type Phase string
const (
	// QueryPhase involves a connect, query-ask, success|failure
	QueryPhase Phase = "query"
	// RetrievalPhase involves the full data retrieval: connect, proposed, accepted, first-byte-received, success|failure
	RetrievalPhase Phase = "retrieval"
)

type RetrievalEvent

type RetrievalEvent interface {
	// Code returns the type of event this is
	Code() Code
	// Phase returns what phase of a retrieval this even occurred on
	Phase() Phase
	// PayloadCid returns the CID being requested
	PayloadCid() cid.Cid
	// StorageProviderId returns the peer ID of the storage provider if this
	// retrieval was requested via peer ID
	StorageProviderId() peer.ID
	// StorageProviderAddr returns the peer address of the storage provider if
	// this retrieval was requested via peer address
	StorageProviderAddr() address.Address
}

type RetrievalEventAccepted

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

func NewRetrievalEventAccepted

func NewRetrievalEventAccepted(phase Phase, payloadCid cid.Cid, storageProviderId peer.ID, storageProviderAddr address.Address) RetrievalEventAccepted

func (RetrievalEventAccepted) Code

func (r RetrievalEventAccepted) Code() Code

func (RetrievalEventAccepted) PayloadCid

func (r RetrievalEventAccepted) PayloadCid() cid.Cid

func (RetrievalEventAccepted) Phase

func (r RetrievalEventAccepted) Phase() Phase

func (RetrievalEventAccepted) StorageProviderAddr

func (r RetrievalEventAccepted) StorageProviderAddr() address.Address

func (RetrievalEventAccepted) StorageProviderId

func (r RetrievalEventAccepted) StorageProviderId() peer.ID

type RetrievalEventConnect

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

func NewRetrievalEventConnect

func NewRetrievalEventConnect(phase Phase, payloadCid cid.Cid, storageProviderId peer.ID, storageProviderAddr address.Address) RetrievalEventConnect

func (RetrievalEventConnect) Code

func (r RetrievalEventConnect) Code() Code

func (RetrievalEventConnect) PayloadCid

func (r RetrievalEventConnect) PayloadCid() cid.Cid

func (RetrievalEventConnect) Phase

func (r RetrievalEventConnect) Phase() Phase

func (RetrievalEventConnect) StorageProviderAddr

func (r RetrievalEventConnect) StorageProviderAddr() address.Address

func (RetrievalEventConnect) StorageProviderId

func (r RetrievalEventConnect) StorageProviderId() peer.ID

type RetrievalEventFailure

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

func NewRetrievalEventFailure

func NewRetrievalEventFailure(phase Phase, payloadCid cid.Cid, storageProviderId peer.ID, storageProviderAddr address.Address, errorMessage string) RetrievalEventFailure

func (RetrievalEventFailure) Code

func (r RetrievalEventFailure) Code() Code

func (RetrievalEventFailure) ErrorMessage

func (r RetrievalEventFailure) ErrorMessage() string

ErrorMessage returns a string form of the error that caused the retrieval failure

func (RetrievalEventFailure) PayloadCid

func (r RetrievalEventFailure) PayloadCid() cid.Cid

func (RetrievalEventFailure) Phase

func (r RetrievalEventFailure) Phase() Phase

func (RetrievalEventFailure) StorageProviderAddr

func (r RetrievalEventFailure) StorageProviderAddr() address.Address

func (RetrievalEventFailure) StorageProviderId

func (r RetrievalEventFailure) StorageProviderId() peer.ID

type RetrievalEventFirstByte

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

func NewRetrievalEventFirstByte

func NewRetrievalEventFirstByte(phase Phase, payloadCid cid.Cid, storageProviderId peer.ID, storageProviderAddr address.Address) RetrievalEventFirstByte

func (RetrievalEventFirstByte) Code

func (r RetrievalEventFirstByte) Code() Code

func (RetrievalEventFirstByte) PayloadCid

func (r RetrievalEventFirstByte) PayloadCid() cid.Cid

func (RetrievalEventFirstByte) Phase

func (r RetrievalEventFirstByte) Phase() Phase

func (RetrievalEventFirstByte) StorageProviderAddr

func (r RetrievalEventFirstByte) StorageProviderAddr() address.Address

func (RetrievalEventFirstByte) StorageProviderId

func (r RetrievalEventFirstByte) StorageProviderId() peer.ID

type RetrievalEventProposed

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

func NewRetrievalEventProposed

func NewRetrievalEventProposed(phase Phase, payloadCid cid.Cid, storageProviderId peer.ID, storageProviderAddr address.Address) RetrievalEventProposed

func (RetrievalEventProposed) Code

func (r RetrievalEventProposed) Code() Code

func (RetrievalEventProposed) PayloadCid

func (r RetrievalEventProposed) PayloadCid() cid.Cid

func (RetrievalEventProposed) Phase

func (r RetrievalEventProposed) Phase() Phase

func (RetrievalEventProposed) StorageProviderAddr

func (r RetrievalEventProposed) StorageProviderAddr() address.Address

func (RetrievalEventProposed) StorageProviderId

func (r RetrievalEventProposed) StorageProviderId() peer.ID

type RetrievalEventPublisher

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

func NewEventPublisher

func NewEventPublisher(ctx context.Context) *RetrievalEventPublisher

func (*RetrievalEventPublisher) Publish

func (ep *RetrievalEventPublisher) Publish(event RetrievalEvent)

func (*RetrievalEventPublisher) Subscribe

func (ep *RetrievalEventPublisher) Subscribe(subscriber RetrievalSubscriber) UnsubscribeFn

func (*RetrievalEventPublisher) SubscriberCount

func (ep *RetrievalEventPublisher) SubscriberCount() int

Returns the number of retrieval event subscribers

type RetrievalEventQueryAsk

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

func NewRetrievalEventQueryAsk

func NewRetrievalEventQueryAsk(phase Phase, payloadCid cid.Cid, storageProviderId peer.ID, storageProviderAddr address.Address, queryResponse retrievalmarket.QueryResponse) RetrievalEventQueryAsk

func (RetrievalEventQueryAsk) Code

func (r RetrievalEventQueryAsk) Code() Code

func (RetrievalEventQueryAsk) PayloadCid

func (r RetrievalEventQueryAsk) PayloadCid() cid.Cid

func (RetrievalEventQueryAsk) Phase

func (r RetrievalEventQueryAsk) Phase() Phase

func (RetrievalEventQueryAsk) QueryResponse

QueryResponse returns the response from a storage provider to a query-ask

func (RetrievalEventQueryAsk) StorageProviderAddr

func (r RetrievalEventQueryAsk) StorageProviderAddr() address.Address

func (RetrievalEventQueryAsk) StorageProviderId

func (r RetrievalEventQueryAsk) StorageProviderId() peer.ID

type RetrievalEventSuccess

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

func NewRetrievalEventSuccess

func NewRetrievalEventSuccess(phase Phase, payloadCid cid.Cid, storageProviderId peer.ID, storageProviderAddr address.Address, receivedSize uint64, receivedCids int64, duration time.Duration, totalPayment big.Int) RetrievalEventSuccess

func (RetrievalEventSuccess) Code

func (r RetrievalEventSuccess) Code() Code

func (RetrievalEventSuccess) Duration

func (r RetrievalEventSuccess) Duration() time.Duration

func (RetrievalEventSuccess) PayloadCid

func (r RetrievalEventSuccess) PayloadCid() cid.Cid

func (RetrievalEventSuccess) Phase

func (r RetrievalEventSuccess) Phase() Phase

func (RetrievalEventSuccess) ReceivedCids

func (r RetrievalEventSuccess) ReceivedCids() int64

ReceivedCids returns the number of (non-unique) CIDs received so far - note that a block can exist in more than one place in the DAG so this may not equal the total number of blocks transferred

func (RetrievalEventSuccess) ReceivedSize

func (r RetrievalEventSuccess) ReceivedSize() uint64

ReceivedSize returns the number of bytes received

func (RetrievalEventSuccess) StorageProviderAddr

func (r RetrievalEventSuccess) StorageProviderAddr() address.Address

func (RetrievalEventSuccess) StorageProviderId

func (r RetrievalEventSuccess) StorageProviderId() peer.ID

func (RetrievalEventSuccess) TotalPayment

func (r RetrievalEventSuccess) TotalPayment() big.Int

type RetrievalSubscriber

type RetrievalSubscriber interface {
	OnRetrievalEvent(RetrievalEvent)
}

type UnsubscribeFn

type UnsubscribeFn func()

A return function unsubscribing a subscribed Subscriber via the Subscribe() function

Jump to

Keyboard shortcuts

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