whisper/whisperv6/events.go

53 lines
2.2 KiB
Go
Raw Normal View History

2018-09-25 09:21:09 +03:00
package whisperv6
import (
2018-09-25 09:35:03 +03:00
"github.com/ethereum/go-ethereum/common"
2018-11-12 10:03:57 +01:00
"github.com/ethereum/go-ethereum/p2p/enode"
2018-09-25 09:21:09 +03:00
)
// EventType used to define known envelope events.
type EventType string
const (
2018-09-25 09:35:03 +03:00
// EventEnvelopeSent fires when envelope was sent to a peer.
EventEnvelopeSent EventType = "envelope.sent"
// EventEnvelopeExpired fires when envelop expired
EventEnvelopeExpired EventType = "envelope.expired"
// EventEnvelopeReceived is sent once envelope was received from a peer.
// EventEnvelopeReceived must be sent to the feed even if envelope was previously in the cache.
// And event, ideally, should contain information about peer that sent envelope to us.
EventEnvelopeReceived EventType = "envelope.received"
// EventBatchAcknowledged is sent when batch of envelopes was acknowleged by a peer.
EventBatchAcknowledged EventType = "batch.acknowleged"
2018-09-25 09:38:44 +03:00
// EventEnvelopeAvailable fires when envelop is available for filters
EventEnvelopeAvailable EventType = "envelope.available"
// EventMailServerRequestSent fires when such request is sent.
EventMailServerRequestSent EventType = "mailserver.request.sent"
2018-09-25 09:35:03 +03:00
// EventMailServerRequestCompleted fires after mailserver sends all the requested messages
EventMailServerRequestCompleted EventType = "mailserver.request.completed"
// EventMailServerRequestExpired fires after mailserver the request TTL ends.
// This event is independent and concurrent to EventMailServerRequestCompleted.
// Request should be considered as expired only if expiry event was received first.
2018-09-25 09:35:03 +03:00
EventMailServerRequestExpired EventType = "mailserver.request.expired"
2018-09-25 09:38:44 +03:00
// EventMailServerEnvelopeArchived fires after an envelope has been archived
EventMailServerEnvelopeArchived EventType = "mailserver.envelope.archived"
// EventMailServerSyncFinished fires when the sync of messages is finished.
EventMailServerSyncFinished EventType = "mailserver.sync.finished"
2018-09-25 09:21:09 +03:00
)
// EnvelopeEvent used for envelopes events.
type EnvelopeEvent struct {
2018-09-25 09:35:03 +03:00
Event EventType
Hash common.Hash
Batch common.Hash
2018-11-12 10:03:57 +01:00
Peer enode.ID
2018-09-25 09:38:44 +03:00
Data interface{}
2018-09-25 09:21:09 +03:00
}
// SyncEventResponse is a response from the Mail Server
// form which the peer received envelopes.
type SyncEventResponse struct {
Cursor []byte
Error string
}