This repository has been archived by the owner on Nov 22, 2023. It is now read-only.
/
events.go
177 lines (136 loc) · 7.16 KB
/
events.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
package client
// Retrieval events as implemented by Lotus
// Event is an event that occurs in a deal lifecycle on the client
type Event uint64
const (
// EventOpen indicates a deal was initiated
EventOpen Event = iota
// EventWriteDealProposalErrored means a network error writing a deal proposal
EventWriteDealProposalErrored
// EventDealProposed means a deal was successfully sent to a miner
EventDealProposed
// EventDealRejected means a deal was rejected by the provider
EventDealRejected
// EventDealNotFound means a provider could not find a piece for a deal
EventDealNotFound
// EventDealAccepted means a provider accepted a deal
EventDealAccepted
// EventProviderCancelled means a provider has sent a message to cancel a deal
EventProviderCancelled
// EventUnknownResponseReceived means a client received a response it doesn't
// understand from the provider
EventUnknownResponseReceived
// EventPaymentChannelErrored means there was a failure creating a payment channel
EventPaymentChannelErrored
// EventAllocateLaneErrored means there was a failure creating a lane in a payment channel
EventAllocateLaneErrored
// EventPaymentChannelCreateInitiated means we are waiting for a message to
// create a payment channel to appear on chain
EventPaymentChannelCreateInitiated
// EventPaymentChannelReady means the newly created payment channel is ready for the
// deal to resume
EventPaymentChannelReady
// EventPaymentChannelSkip means we can skip payment channel because the deal price is 0
EventPaymentChannelSkip
// EventPaymentChannelAddingFunds mean we are waiting for funds to be
// added to a payment channel
EventPaymentChannelAddingFunds
// EventPaymentChannelAddFundsErrored means that adding funds to the payment channel
// failed
EventPaymentChannelAddFundsErrored
// EventLastPaymentRequested indicates the provider requested a final payment
EventLastPaymentRequested
// EventAllBlocksReceived indicates the provider has sent all blocks
EventAllBlocksReceived
// EventPaymentRequested indicates the provider requested a payment
EventPaymentRequested
// EventPaymentNotSent indicates that payment was requested, but no
// payment was actually due, so a voucher was not sent to the provider
EventPaymentNotSent
// EventUnsealPaymentRequested indicates the provider requested a payment for unsealing the sector
EventUnsealPaymentRequested
// EventBlocksReceived indicates the provider has sent blocks
EventBlocksReceived
// EventSendFunds emits when we reach the threshold to send the next payment
EventSendFunds
// EventFundsExpended indicates a deal has run out of funds in the payment channel
// forcing the client to add more funds to continue the deal
EventFundsExpended // when totalFunds is expended
// EventBadPaymentRequested indicates the provider asked for funds
// in a way that does not match the terms of the deal
EventBadPaymentRequested
// EventCreateVoucherFailed indicates an error happened creating a payment voucher
EventCreateVoucherFailed
// EventWriteDealPaymentErrored indicates a network error trying to write a payment
EventWriteDealPaymentErrored
// EventPaymentSent indicates a payment was sent to the provider
EventPaymentSent
// EventComplete indicates a deal has completed
EventComplete
// EventDataTransferError emits when something go wrong at the data transfer level
EventDataTransferError
// EventCancelComplete happens when a deal cancellation is transmitted to the provider
EventCancelComplete
// EventEarlyTermination indications a provider send a deal complete without sending all data
EventEarlyTermination
// EventCompleteVerified means that a provider completed without requesting a final payment but
// we verified we received all data
EventCompleteVerified
// EventLaneAllocated is called when a lane is allocated
EventLaneAllocated
// EventVoucherShortfall means we tried to create a voucher but did not have enough funds in channel
// to create it
EventVoucherShortfall
// EventRecheckFunds runs when an external caller indicates there may be new funds in a payment channel
EventRecheckFunds
// EventCancel runs when a user cancels a deal
EventCancel
// EventWaitForLastBlocks is fired when the provider has told
// the client that all blocks were sent for the deal, and the client is
// waiting for the last blocks to arrive
EventWaitForLastBlocks
// EventProviderErrored happens when we receive a status in response voucher
// telling us something went wrong on the provider side but they don't know what (500)
EventProviderErrored
)
// Events is a human readable map of client event name -> event description
var Events = map[Event]string{
EventOpen: "ClientEventOpen",
EventPaymentChannelErrored: "ClientEventPaymentChannelErrored",
EventDealProposed: "ClientEventDealProposed",
EventAllocateLaneErrored: "ClientEventAllocateLaneErrored",
EventPaymentChannelCreateInitiated: "ClientEventPaymentChannelCreateInitiated",
EventPaymentChannelReady: "ClientEventPaymentChannelReady",
EventPaymentChannelAddingFunds: "ClientEventPaymentChannelAddingFunds",
EventPaymentChannelAddFundsErrored: "ClientEventPaymentChannelAddFundsErrored",
EventPaymentChannelSkip: "ClientEventPaymentChannelSkip",
EventWriteDealProposalErrored: "ClientEventWriteDealProposalErrored",
EventDealRejected: "ClientEventDealRejected",
EventDealNotFound: "ClientEventDealNotFound",
EventDealAccepted: "ClientEventDealAccepted",
EventProviderCancelled: "ClientEventProviderCancelled",
EventUnknownResponseReceived: "ClientEventUnknownResponseReceived",
EventLastPaymentRequested: "ClientEventLastPaymentRequested",
EventAllBlocksReceived: "ClientEventAllBlocksReceived",
EventPaymentRequested: "ClientEventPaymentRequested",
EventUnsealPaymentRequested: "ClientEventUnsealPaymentRequested",
EventBlocksReceived: "ClientEventBlocksReceived",
EventSendFunds: "ClientEventSendFunds",
EventFundsExpended: "ClientEventFundsExpended",
EventBadPaymentRequested: "ClientEventBadPaymentRequested",
EventCreateVoucherFailed: "ClientEventCreateVoucherFailed",
EventWriteDealPaymentErrored: "ClientEventWriteDealPaymentErrored",
EventPaymentSent: "ClientEventPaymentSent",
EventPaymentNotSent: "ClientEventPaymentNotSent",
EventDataTransferError: "ClientEventDataTransferError",
EventComplete: "ClientEventComplete",
EventCancelComplete: "ClientEventCancelComplete",
EventEarlyTermination: "ClientEventEarlyTermination",
EventCompleteVerified: "ClientEventCompleteVerified",
EventLaneAllocated: "ClientEventLaneAllocated",
EventVoucherShortfall: "ClientEventVoucherShortfall",
EventRecheckFunds: "ClientEventRecheckFunds",
EventCancel: "ClientEventCancel",
EventWaitForLastBlocks: "ClientEventWaitForLastBlocks",
EventProviderErrored: "ClientEventProviderErrored",
}