2018-05-03 07:35:58 +00:00
|
|
|
package signal
|
|
|
|
|
2018-06-15 15:12:31 +00:00
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
)
|
2018-05-03 07:35:58 +00:00
|
|
|
|
|
|
|
const (
|
|
|
|
// EventEnvelopeSent is triggered when envelope was sent at least to a one peer.
|
|
|
|
EventEnvelopeSent = "envelope.sent"
|
|
|
|
|
|
|
|
// EventEnvelopeExpired is triggered when envelop was dropped by a whisper without being sent
|
|
|
|
// to any peer
|
|
|
|
EventEnvelopeExpired = "envelope.expired"
|
2018-06-15 15:12:31 +00:00
|
|
|
|
|
|
|
// EventMailServerRequestCompleted is triggered when whisper receives a message ack from the mailserver
|
|
|
|
EventMailServerRequestCompleted = "mailserver.request.completed"
|
|
|
|
|
|
|
|
// EventMailServerRequestExpired is triggered when request TTL ends
|
|
|
|
EventMailServerRequestExpired = "mailserver.request.expired"
|
2018-05-03 07:35:58 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// EnvelopeSignal includes hash of the envelope.
|
|
|
|
type EnvelopeSignal struct {
|
|
|
|
Hash common.Hash `json:"hash"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// SendEnvelopeSent triggered when envelope delivered at least to 1 peer.
|
|
|
|
func SendEnvelopeSent(hash common.Hash) {
|
|
|
|
send(EventEnvelopeSent, EnvelopeSignal{hash})
|
|
|
|
}
|
|
|
|
|
|
|
|
// SendEnvelopeExpired triggered when envelope delivered at least to 1 peer.
|
|
|
|
func SendEnvelopeExpired(hash common.Hash) {
|
|
|
|
send(EventEnvelopeExpired, EnvelopeSignal{hash})
|
|
|
|
}
|
2018-06-15 15:12:31 +00:00
|
|
|
|
|
|
|
// SendMailServerRequestCompleted triggered when mail server response has been received
|
|
|
|
func SendMailServerRequestCompleted(hash common.Hash) {
|
|
|
|
send(EventMailServerRequestCompleted, EnvelopeSignal{hash})
|
|
|
|
}
|
|
|
|
|
|
|
|
// SendMailServerRequestExpired triggered when mail server request expires
|
|
|
|
func SendMailServerRequestExpired(hash common.Hash) {
|
|
|
|
send(EventMailServerRequestExpired, EnvelopeSignal{hash})
|
|
|
|
}
|