Documentation ¶
Index ¶
- type EventManager
- type EventWithCandidates
- type RetrievalEventAccepted
- type RetrievalEventCandidatesFiltered
- func (r RetrievalEventCandidatesFiltered) Candidates() []types.RetrievalCandidate
- func (r RetrievalEventCandidatesFiltered) Code() types.EventCode
- func (r RetrievalEventCandidatesFiltered) Phase() types.Phase
- func (r RetrievalEventCandidatesFiltered) StorageProviderId() peer.ID
- func (r RetrievalEventCandidatesFiltered) String() string
- type RetrievalEventCandidatesFound
- func (r RetrievalEventCandidatesFound) Candidates() []types.RetrievalCandidate
- func (r RetrievalEventCandidatesFound) Code() types.EventCode
- func (r RetrievalEventCandidatesFound) Phase() types.Phase
- func (r RetrievalEventCandidatesFound) StorageProviderId() peer.ID
- func (r RetrievalEventCandidatesFound) String() string
- type RetrievalEventConnected
- type RetrievalEventFailed
- type RetrievalEventFinished
- type RetrievalEventFirstByte
- type RetrievalEventProposed
- type RetrievalEventStarted
- type RetrievalEventSuccess
- func (r RetrievalEventSuccess) Code() types.EventCode
- func (r RetrievalEventSuccess) Duration() time.Duration
- func (r RetrievalEventSuccess) Phase() types.Phase
- func (r RetrievalEventSuccess) ReceivedCids() uint64
- func (r RetrievalEventSuccess) ReceivedSize() uint64
- func (r RetrievalEventSuccess) StorageProviderId() peer.ID
- func (r RetrievalEventSuccess) String() string
- func (r RetrievalEventSuccess) TotalPayment() big.Int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 RetrievalEventAccepted ¶
type RetrievalEventAccepted struct {
// contains filtered or unexported fields
}
RetrievalEventFirstByte describes when the first byte of data was received during the RetrievalPhase
func Accepted ¶
func Accepted(at time.Time, retrievalId types.RetrievalID, phaseStartTime time.Time, candidate types.RetrievalCandidate) RetrievalEventAccepted
func (RetrievalEventAccepted) Code ¶
func (r RetrievalEventAccepted) Code() types.EventCode
func (RetrievalEventAccepted) Phase ¶
func (r RetrievalEventAccepted) Phase() types.Phase
func (RetrievalEventAccepted) StorageProviderId ¶
func (RetrievalEventAccepted) String ¶
func (r RetrievalEventAccepted) String() string
type RetrievalEventCandidatesFiltered ¶
type RetrievalEventCandidatesFiltered struct {
// contains filtered or unexported fields
}
func CandidatesFiltered ¶
func CandidatesFiltered(at time.Time, retrievalId types.RetrievalID, phaseStartTime time.Time, payloadCid cid.Cid, candidates []types.RetrievalCandidate) RetrievalEventCandidatesFiltered
func (RetrievalEventCandidatesFiltered) Candidates ¶
func (r RetrievalEventCandidatesFiltered) Candidates() []types.RetrievalCandidate
func (RetrievalEventCandidatesFiltered) Code ¶
func (r RetrievalEventCandidatesFiltered) Code() types.EventCode
func (RetrievalEventCandidatesFiltered) Phase ¶
func (r RetrievalEventCandidatesFiltered) Phase() types.Phase
func (RetrievalEventCandidatesFiltered) StorageProviderId ¶
func (RetrievalEventCandidatesFiltered) String ¶
func (r RetrievalEventCandidatesFiltered) String() string
type RetrievalEventCandidatesFound ¶
type RetrievalEventCandidatesFound struct {
// contains filtered or unexported fields
}
func CandidatesFound ¶
func CandidatesFound(at time.Time, retrievalId types.RetrievalID, phaseStartTime time.Time, payloadCid cid.Cid, candidates []types.RetrievalCandidate) RetrievalEventCandidatesFound
func (RetrievalEventCandidatesFound) Candidates ¶
func (r RetrievalEventCandidatesFound) Candidates() []types.RetrievalCandidate
func (RetrievalEventCandidatesFound) Code ¶
func (r RetrievalEventCandidatesFound) Code() types.EventCode
func (RetrievalEventCandidatesFound) Phase ¶
func (r RetrievalEventCandidatesFound) Phase() types.Phase
func (RetrievalEventCandidatesFound) StorageProviderId ¶
func (RetrievalEventCandidatesFound) String ¶
func (r RetrievalEventCandidatesFound) String() string
type RetrievalEventConnected ¶
type RetrievalEventConnected struct {
// contains filtered or unexported fields
}
func Connected ¶
func Connected(at time.Time, retrievalId types.RetrievalID, phaseStartTime time.Time, phase types.Phase, candidate types.RetrievalCandidate) RetrievalEventConnected
func (RetrievalEventConnected) Code ¶
func (r RetrievalEventConnected) Code() types.EventCode
func (RetrievalEventConnected) Phase ¶
func (r RetrievalEventConnected) Phase() types.Phase
func (RetrievalEventConnected) StorageProviderId ¶
func (RetrievalEventConnected) String ¶
func (r RetrievalEventConnected) String() string
type RetrievalEventFailed ¶
type RetrievalEventFailed struct {
// contains filtered or unexported fields
}
RetrievalEventFailed describes a phase agnostic failure
func Failed ¶
func Failed(at time.Time, retrievalId types.RetrievalID, phaseStartTime time.Time, phase types.Phase, candidate types.RetrievalCandidate, errorMessage string) RetrievalEventFailed
func (RetrievalEventFailed) Code ¶
func (r RetrievalEventFailed) Code() types.EventCode
func (RetrievalEventFailed) ErrorMessage ¶
func (r RetrievalEventFailed) ErrorMessage() string
ErrorMessage returns a string form of the error that caused the retrieval failure
func (RetrievalEventFailed) Phase ¶
func (r RetrievalEventFailed) Phase() types.Phase
func (RetrievalEventFailed) StorageProviderId ¶
func (RetrievalEventFailed) String ¶
func (r RetrievalEventFailed) String() string
type RetrievalEventFinished ¶ added in v0.6.6
type RetrievalEventFinished struct {
// contains filtered or unexported fields
}
RetrievalEventFinished describes when an entire fetch finishes
func Finished ¶ added in v0.6.6
func Finished(at time.Time, retrievalId types.RetrievalID, phaseStartTime time.Time, candidate types.RetrievalCandidate) RetrievalEventFinished
func (RetrievalEventFinished) Code ¶ added in v0.6.6
func (r RetrievalEventFinished) Code() types.EventCode
func (RetrievalEventFinished) Phase ¶ added in v0.6.6
func (r RetrievalEventFinished) Phase() types.Phase
func (RetrievalEventFinished) StorageProviderId ¶ added in v0.6.6
func (RetrievalEventFinished) String ¶ added in v0.6.6
func (r RetrievalEventFinished) String() string
type RetrievalEventFirstByte ¶
type RetrievalEventFirstByte struct {
// contains filtered or unexported fields
}
RetrievalEventFirstByte describes when the first byte of data was received during the RetrievalPhase
func FirstByte ¶
func FirstByte(at time.Time, retrievalId types.RetrievalID, phaseStartTime time.Time, candidate types.RetrievalCandidate) RetrievalEventFirstByte
func (RetrievalEventFirstByte) Code ¶
func (r RetrievalEventFirstByte) Code() types.EventCode
func (RetrievalEventFirstByte) Phase ¶
func (r RetrievalEventFirstByte) Phase() types.Phase
func (RetrievalEventFirstByte) StorageProviderId ¶
func (RetrievalEventFirstByte) String ¶
func (r RetrievalEventFirstByte) String() string
type RetrievalEventProposed ¶
type RetrievalEventProposed struct {
// contains filtered or unexported fields
}
RetrievalEventProposed describes when the proposal took place during the RetrievalPhase
func Proposed ¶
func Proposed(at time.Time, retrievalId types.RetrievalID, phaseStartTime time.Time, candidate types.RetrievalCandidate) RetrievalEventProposed
func (RetrievalEventProposed) Code ¶
func (r RetrievalEventProposed) Code() types.EventCode
func (RetrievalEventProposed) Phase ¶
func (r RetrievalEventProposed) Phase() types.Phase
func (RetrievalEventProposed) StorageProviderId ¶
func (RetrievalEventProposed) String ¶
func (r RetrievalEventProposed) String() string
type RetrievalEventStarted ¶
type RetrievalEventStarted struct {
// contains filtered or unexported fields
}
RetrievalEventStarted describes when a phase starts
func Started ¶
func Started(at time.Time, retrievalId types.RetrievalID, phaseStartTime time.Time, phase types.Phase, candidate types.RetrievalCandidate) RetrievalEventStarted
func (RetrievalEventStarted) Code ¶
func (r RetrievalEventStarted) Code() types.EventCode
func (RetrievalEventStarted) Phase ¶
func (r RetrievalEventStarted) Phase() types.Phase
func (RetrievalEventStarted) StorageProviderId ¶
func (RetrievalEventStarted) String ¶
func (r RetrievalEventStarted) String() string
type RetrievalEventSuccess ¶
type RetrievalEventSuccess struct {
// contains filtered or unexported fields
}
RetrievalEventSuccess describes a successful retrieval of data during the RetrievalPhase
func Success ¶
func Success(at time.Time, retrievalId types.RetrievalID, phaseStartTime time.Time, candidate types.RetrievalCandidate, receivedSize uint64, receivedCids uint64, duration time.Duration, totalPayment big.Int) RetrievalEventSuccess
func (RetrievalEventSuccess) Code ¶
func (r RetrievalEventSuccess) Code() types.EventCode
func (RetrievalEventSuccess) Duration ¶
func (r RetrievalEventSuccess) Duration() time.Duration
func (RetrievalEventSuccess) Phase ¶
func (r RetrievalEventSuccess) Phase() types.Phase
func (RetrievalEventSuccess) ReceivedCids ¶
func (r RetrievalEventSuccess) ReceivedCids() uint64
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) StorageProviderId ¶
func (RetrievalEventSuccess) String ¶
func (r RetrievalEventSuccess) String() string
func (RetrievalEventSuccess) TotalPayment ¶
func (r RetrievalEventSuccess) TotalPayment() big.Int