Documentation
¶
Index ¶
- func Identifier(evt types.RetrievalEvent) string
- type BlockReceivedEvent
- type CandidatesFilteredEvent
- func (e CandidatesFilteredEvent) Candidates() []types.RetrievalCandidate
- func (e CandidatesFilteredEvent) Code() types.EventCode
- func (e CandidatesFilteredEvent) Protocols() []multicodec.Code
- func (r CandidatesFilteredEvent) RetrievalId() types.RetrievalID
- func (r CandidatesFilteredEvent) RootCid() cid.Cid
- func (e CandidatesFilteredEvent) String() string
- func (r CandidatesFilteredEvent) Time() time.Time
- type CandidatesFoundEvent
- func (e CandidatesFoundEvent) Candidates() []types.RetrievalCandidate
- func (e CandidatesFoundEvent) Code() types.EventCode
- func (r CandidatesFoundEvent) RetrievalId() types.RetrievalID
- func (r CandidatesFoundEvent) RootCid() cid.Cid
- func (e CandidatesFoundEvent) String() string
- func (r CandidatesFoundEvent) Time() time.Time
- type ConnectedToProviderEvent
- type EventManager
- type EventWithCandidates
- type EventWithEndpoint
- type EventWithErrorMessage
- type EventWithProtocol
- type EventWithProtocols
- type ExtractionStartedEvent
- type ExtractionSucceededEvent
- func (e ExtractionSucceededEvent) BlocksExtracted() uint64
- func (e ExtractionSucceededEvent) BytesExtracted() uint64
- func (e ExtractionSucceededEvent) Code() types.EventCode
- func (e ExtractionSucceededEvent) Duration() time.Duration
- func (e ExtractionSucceededEvent) Endpoint() string
- func (e ExtractionSucceededEvent) String() string
- type FailedEvent
- type FailedRetrievalEvent
- type FinishedEvent
- type FirstByteEvent
- type StartedFetchEvent
- func (e StartedFetchEvent) Code() types.EventCode
- func (e StartedFetchEvent) Protocols() []multicodec.Code
- func (r StartedFetchEvent) RetrievalId() types.RetrievalID
- func (r StartedFetchEvent) RootCid() cid.Cid
- func (e StartedFetchEvent) String() string
- func (r StartedFetchEvent) Time() time.Time
- func (e StartedFetchEvent) UrlPath() string
- type StartedFindingCandidatesEvent
- func (e StartedFindingCandidatesEvent) Code() types.EventCode
- func (r StartedFindingCandidatesEvent) RetrievalId() types.RetrievalID
- func (r StartedFindingCandidatesEvent) RootCid() cid.Cid
- func (e StartedFindingCandidatesEvent) String() string
- func (r StartedFindingCandidatesEvent) Time() time.Time
- type StartedRetrievalEvent
- type SucceededEvent
- func (e SucceededEvent) Code() types.EventCode
- func (e SucceededEvent) Duration() time.Duration
- func (e SucceededEvent) Endpoint() string
- func (e SucceededEvent) Protocol() multicodec.Code
- func (e SucceededEvent) ReceivedBytesSize() uint64
- func (e SucceededEvent) ReceivedCidsCount() uint64
- func (e SucceededEvent) String() string
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 (e BlockReceivedEvent) Code() types.EventCode
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 (e CandidatesFilteredEvent) Candidates() []types.RetrievalCandidate
func (CandidatesFilteredEvent) Code ¶
func (e CandidatesFilteredEvent) Code() types.EventCode
func (CandidatesFilteredEvent) Protocols ¶
func (e CandidatesFilteredEvent) Protocols() []multicodec.Code
func (CandidatesFilteredEvent) RetrievalId ¶
func (r CandidatesFilteredEvent) RetrievalId() types.RetrievalID
func (CandidatesFilteredEvent) String ¶
func (e CandidatesFilteredEvent) String() string
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 (e CandidatesFoundEvent) Candidates() []types.RetrievalCandidate
func (CandidatesFoundEvent) Code ¶
func (e CandidatesFoundEvent) Code() types.EventCode
func (CandidatesFoundEvent) RetrievalId ¶
func (r CandidatesFoundEvent) RetrievalId() types.RetrievalID
func (CandidatesFoundEvent) String ¶
func (e CandidatesFoundEvent) String() string
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 (e ConnectedToProviderEvent) Code() types.EventCode
func (ConnectedToProviderEvent) Endpoint ¶ added in v1.0.0
func (e ConnectedToProviderEvent) Endpoint() string
func (ConnectedToProviderEvent) Protocol ¶
func (e ConnectedToProviderEvent) Protocol() multicodec.Code
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 (ExtractionStartedEvent) Code ¶ added in v1.0.0
func (e ExtractionStartedEvent) Code() types.EventCode
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 (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 (e ExtractionSucceededEvent) Code() types.EventCode
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) String ¶
func (e FailedEvent) String() string
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 (e FailedRetrievalEvent) Code() types.EventCode
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) 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) 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 (e StartedFetchEvent) Code() types.EventCode
func (StartedFetchEvent) Protocols ¶
func (e StartedFetchEvent) Protocols() []multicodec.Code
func (StartedFetchEvent) RetrievalId ¶
func (r StartedFetchEvent) RetrievalId() types.RetrievalID
func (StartedFetchEvent) String ¶
func (e StartedFetchEvent) String() string
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 (e StartedFindingCandidatesEvent) Code() types.EventCode
func (StartedFindingCandidatesEvent) RetrievalId ¶
func (r StartedFindingCandidatesEvent) RetrievalId() types.RetrievalID
func (StartedFindingCandidatesEvent) String ¶
func (e StartedFindingCandidatesEvent) String() string
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 (e StartedRetrievalEvent) Code() types.EventCode
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) 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