events

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Identifier

func Identifier(evt types.RetrievalEvent) string

Identifier returns the HTTP endpoint of the storage provider

Types

type BlockReceivedEvent

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

BlockReceivedEvent records new data received from a provider. It is used to track how much is downloaded from each peer in a retrieval

func BlockReceived

func BlockReceived(at time.Time, retrievalId types.RetrievalID, candidate types.RetrievalCandidate, protocol multicodec.Code, byteCount uint64) BlockReceivedEvent

func (BlockReceivedEvent) ByteCount

func (e BlockReceivedEvent) ByteCount() uint64

func (BlockReceivedEvent) Code

func (BlockReceivedEvent) Endpoint added in v1.0.0

func (e BlockReceivedEvent) Endpoint() string

func (BlockReceivedEvent) Protocol

func (e BlockReceivedEvent) Protocol() multicodec.Code

func (BlockReceivedEvent) String

func (e BlockReceivedEvent) String() string

type CandidatesFilteredEvent

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

func CandidatesFiltered

func CandidatesFiltered(at time.Time, retrievalId types.RetrievalID, rootCid cid.Cid, candidates []types.RetrievalCandidate) CandidatesFilteredEvent

func (CandidatesFilteredEvent) Candidates

func (CandidatesFilteredEvent) Code

func (CandidatesFilteredEvent) Protocols

func (e CandidatesFilteredEvent) Protocols() []multicodec.Code

func (CandidatesFilteredEvent) RetrievalId

func (r CandidatesFilteredEvent) RetrievalId() types.RetrievalID

func (CandidatesFilteredEvent) RootCid

func (r CandidatesFilteredEvent) RootCid() cid.Cid

func (CandidatesFilteredEvent) String

func (e CandidatesFilteredEvent) String() string

func (CandidatesFilteredEvent) Time

func (r CandidatesFilteredEvent) Time() time.Time

type CandidatesFoundEvent

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

func CandidatesFound

func CandidatesFound(at time.Time, retrievalId types.RetrievalID, rootCid cid.Cid, candidates []types.RetrievalCandidate) CandidatesFoundEvent

func (CandidatesFoundEvent) Candidates

func (CandidatesFoundEvent) Code

func (CandidatesFoundEvent) RetrievalId

func (r CandidatesFoundEvent) RetrievalId() types.RetrievalID

func (CandidatesFoundEvent) RootCid

func (r CandidatesFoundEvent) RootCid() cid.Cid

func (CandidatesFoundEvent) String

func (e CandidatesFoundEvent) String() string

func (CandidatesFoundEvent) Time

func (r CandidatesFoundEvent) Time() time.Time

type ConnectedToProviderEvent

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

func ConnectedToProvider

func ConnectedToProvider(at time.Time, retrievalId types.RetrievalID, candidate types.RetrievalCandidate, protocol multicodec.Code) ConnectedToProviderEvent

func (ConnectedToProviderEvent) Code

func (ConnectedToProviderEvent) Endpoint added in v1.0.0

func (e ConnectedToProviderEvent) Endpoint() string

func (ConnectedToProviderEvent) Protocol

func (ConnectedToProviderEvent) String

func (e ConnectedToProviderEvent) String() string

type EventManager

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

EventManager is responsible for dispatching events to registered subscribers. Events are dispatched asynchronously, so subscribers should not assume that events are received within the window of a blocking retriever.Retrieve() call.

func NewEventManager

func NewEventManager(ctx context.Context) *EventManager

NewEventManager creates a new EventManager. Start() must be called to start the event loop.

func (*EventManager) DispatchEvent

func (em *EventManager) DispatchEvent(event types.RetrievalEvent)

DispatchEvent queues the event to be dispatched to all event subscribers. Calling the subscriber functions happens on a separate goroutine dedicated to this function.

func (*EventManager) IsStarted

func (em *EventManager) IsStarted() bool

IsStarted returns true if the event loop has been started.

func (*EventManager) RegisterSubscriber

func (em *EventManager) RegisterSubscriber(subscriber types.RetrievalEventSubscriber) func()

RegisterSubscriber registers a subscriber to receive events. The returned function can be called to unregister the subscriber.

func (*EventManager) Start

func (em *EventManager) Start()

Start starts the event loop. Start() must be called before any events can be dispatched.

func (*EventManager) Stop

func (em *EventManager) Stop() chan struct{}

Stop stops the event loop. A channel is returned that will receive a single value when the event loop has stopped.

type EventWithCandidates

type EventWithCandidates interface {
	types.RetrievalEvent
	Candidates() []types.RetrievalCandidate
}

type EventWithEndpoint added in v1.0.0

type EventWithEndpoint interface {
	types.RetrievalEvent
	Endpoint() string
}

type EventWithErrorMessage

type EventWithErrorMessage interface {
	types.RetrievalEvent
	ErrorMessage() string
}

type EventWithProtocol

type EventWithProtocol interface {
	types.RetrievalEvent
	Protocol() multicodec.Code
}

type EventWithProtocols

type EventWithProtocols interface {
	types.RetrievalEvent
	Protocols() []multicodec.Code
}

type ExtractionStartedEvent added in v1.0.0

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

ExtractionStartedEvent signals the start of a streaming extraction.

func ExtractionStarted added in v1.0.0

func ExtractionStarted(at time.Time, rootCid cid.Cid, endpoint string) ExtractionStartedEvent

func (ExtractionStartedEvent) Code added in v1.0.0

func (ExtractionStartedEvent) Endpoint added in v1.0.0

func (e ExtractionStartedEvent) Endpoint() string

func (ExtractionStartedEvent) String added in v1.0.0

func (e ExtractionStartedEvent) String() string

type ExtractionSucceededEvent added in v1.0.0

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

ExtractionSucceededEvent signals successful completion of a streaming extraction.

func ExtractionSucceeded added in v1.0.0

func ExtractionSucceeded(at time.Time, rootCid cid.Cid, endpoint string, bytes, blocks uint64, duration time.Duration) ExtractionSucceededEvent

func (ExtractionSucceededEvent) BlocksExtracted added in v1.0.0

func (e ExtractionSucceededEvent) BlocksExtracted() uint64

func (ExtractionSucceededEvent) BytesExtracted added in v1.0.0

func (e ExtractionSucceededEvent) BytesExtracted() uint64

func (ExtractionSucceededEvent) Code added in v1.0.0

func (ExtractionSucceededEvent) Duration added in v1.0.0

func (e ExtractionSucceededEvent) Duration() time.Duration

func (ExtractionSucceededEvent) Endpoint added in v1.0.0

func (e ExtractionSucceededEvent) Endpoint() string

func (ExtractionSucceededEvent) String added in v1.0.0

func (e ExtractionSucceededEvent) String() string

type FailedEvent

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

func Failed

func Failed(at time.Time, retrievalId types.RetrievalID, candidate types.RetrievalCandidate, errorMessage string) FailedEvent

func (FailedEvent) Code

func (e FailedEvent) Code() types.EventCode

func (FailedEvent) ErrorMessage

func (e FailedEvent) ErrorMessage() string

func (FailedEvent) RetrievalId

func (r FailedEvent) RetrievalId() types.RetrievalID

func (FailedEvent) RootCid

func (r FailedEvent) RootCid() cid.Cid

func (FailedEvent) String

func (e FailedEvent) String() string

func (FailedEvent) Time

func (r FailedEvent) Time() time.Time

type FailedRetrievalEvent

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

func FailedRetrieval

func FailedRetrieval(at time.Time, retrievalId types.RetrievalID, candidate types.RetrievalCandidate, protocol multicodec.Code, errorMessage string) FailedRetrievalEvent

func (FailedRetrievalEvent) Code

func (FailedRetrievalEvent) Endpoint added in v1.0.0

func (e FailedRetrievalEvent) Endpoint() string

func (FailedRetrievalEvent) ErrorMessage

func (e FailedRetrievalEvent) ErrorMessage() string

func (FailedRetrievalEvent) Protocol

func (e FailedRetrievalEvent) Protocol() multicodec.Code

func (FailedRetrievalEvent) String

func (e FailedRetrievalEvent) String() string

type FinishedEvent

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

func Finished

func Finished(at time.Time, retrievalId types.RetrievalID, candidate types.RetrievalCandidate) FinishedEvent

func (FinishedEvent) Code

func (e FinishedEvent) Code() types.EventCode

func (FinishedEvent) Endpoint added in v1.0.0

func (e FinishedEvent) Endpoint() string

func (FinishedEvent) String

func (e FinishedEvent) String() string

type FirstByteEvent

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

func FirstByte

func FirstByte(at time.Time, retrievalId types.RetrievalID, candidate types.RetrievalCandidate, duration time.Duration, protocol multicodec.Code) FirstByteEvent

func (FirstByteEvent) Code

func (e FirstByteEvent) Code() types.EventCode

func (FirstByteEvent) Duration

func (e FirstByteEvent) Duration() time.Duration

func (FirstByteEvent) Endpoint added in v1.0.0

func (e FirstByteEvent) Endpoint() string

func (FirstByteEvent) Protocol

func (e FirstByteEvent) Protocol() multicodec.Code

func (FirstByteEvent) String

func (e FirstByteEvent) String() string

type StartedFetchEvent

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

StartedFetchEvent signals the start of a Lassie fetch. It is emitted when a fetch is started.

func StartedFetch

func StartedFetch(at time.Time, retrievalId types.RetrievalID, rootCid cid.Cid, urlPath string, supportedProtocols ...multicodec.Code) StartedFetchEvent

func (StartedFetchEvent) Code

func (StartedFetchEvent) Protocols

func (e StartedFetchEvent) Protocols() []multicodec.Code

func (StartedFetchEvent) RetrievalId

func (r StartedFetchEvent) RetrievalId() types.RetrievalID

func (StartedFetchEvent) RootCid

func (r StartedFetchEvent) RootCid() cid.Cid

func (StartedFetchEvent) String

func (e StartedFetchEvent) String() string

func (StartedFetchEvent) Time

func (r StartedFetchEvent) Time() time.Time

func (StartedFetchEvent) UrlPath

func (e StartedFetchEvent) UrlPath() string

type StartedFindingCandidatesEvent

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

StartedFindingCandidatesEvent signals the start of finding candidates for a fetch.

func StartedFindingCandidates

func StartedFindingCandidates(at time.Time, retrievalId types.RetrievalID, rootCid cid.Cid) StartedFindingCandidatesEvent

func (StartedFindingCandidatesEvent) Code

func (StartedFindingCandidatesEvent) RetrievalId

func (r StartedFindingCandidatesEvent) RetrievalId() types.RetrievalID

func (StartedFindingCandidatesEvent) RootCid

func (r StartedFindingCandidatesEvent) RootCid() cid.Cid

func (StartedFindingCandidatesEvent) String

func (StartedFindingCandidatesEvent) Time

func (r StartedFindingCandidatesEvent) Time() time.Time

type StartedRetrievalEvent

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

StartedRetrievalEvent signals the start of a retrieval from a storage provider. It is emitted when the retrieval is started.

func StartedRetrieval

func StartedRetrieval(at time.Time, retrievalId types.RetrievalID, candidate types.RetrievalCandidate, protocol multicodec.Code) StartedRetrievalEvent

func (StartedRetrievalEvent) Code

func (StartedRetrievalEvent) Endpoint added in v1.0.0

func (e StartedRetrievalEvent) Endpoint() string

func (StartedRetrievalEvent) Protocol

func (e StartedRetrievalEvent) Protocol() multicodec.Code

func (StartedRetrievalEvent) String

func (e StartedRetrievalEvent) String() string

type SucceededEvent

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

func Success

func Success(at time.Time, retrievalId types.RetrievalID, candidate types.RetrievalCandidate, receivedBytesSize uint64, receivedCidsCount uint64, duration time.Duration, protocol multicodec.Code) SucceededEvent

func (SucceededEvent) Code

func (e SucceededEvent) Code() types.EventCode

func (SucceededEvent) Duration

func (e SucceededEvent) Duration() time.Duration

func (SucceededEvent) Endpoint added in v1.0.0

func (e SucceededEvent) Endpoint() string

func (SucceededEvent) Protocol

func (e SucceededEvent) Protocol() multicodec.Code

func (SucceededEvent) ReceivedBytesSize

func (e SucceededEvent) ReceivedBytesSize() uint64

func (SucceededEvent) ReceivedCidsCount

func (e SucceededEvent) ReceivedCidsCount() uint64

func (SucceededEvent) String

func (e SucceededEvent) String() string

Jump to

Keyboard shortcuts

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