Documentation
¶
Index ¶
- Constants
- Variables
- type CursorQuery
- type DB
- type DBKey
- type Iterator
- type LevelDB
- type LevelDBIterator
- type MessagesRequestPayload
- type PostgresDB
- type WMailServer
- func (s *WMailServer) Archive(env *whisper.Envelope)
- func (s *WMailServer) Close()
- func (s *WMailServer) Deliver(peer *whisper.Peer, r whisper.MessagesRequest)
- func (s *WMailServer) DeliverMail(peer *whisper.Peer, request *whisper.Envelope)
- func (s *WMailServer) Init(shh *whisper.Whisper, config *params.WhisperConfig) error
- func (s *WMailServer) SyncMail(peer *whisper.Peer, request whisper.SyncMailRequest) error
Constants ¶
View Source
const ( // DBKeyLength is a size of the envelope key. DBKeyLength = protocol.HashLength + timestampLength + whispertypes.TopicLength CursorLength = protocol.HashLength + timestampLength )
Variables ¶
View Source
var ( // ErrInvalidByteSize is returned when DBKey can't be created // from a byte slice because it has invalid length. ErrInvalidByteSize = errors.New("byte slice has invalid length") )
Functions ¶
This section is empty.
Types ¶
type CursorQuery ¶ added in v0.35.0
type CursorQuery struct {
// contains filtered or unexported fields
}
type DB ¶ added in v0.35.0
type DB interface { Close() error // SaveEnvelope stores an envelope SaveEnvelope(*whisper.Envelope) error // TODO: Migrate to whispertypes.Envelope // GetEnvelope returns an rlp encoded envelope from the datastore GetEnvelope(*DBKey) ([]byte, error) // Prune removes envelopes older than time Prune(time.Time, int) (int, error) // BuildIterator returns an iterator over envelopes BuildIterator(query CursorQuery) (Iterator, error) }
DB is an interface to abstract interactions with the db so that the mailserver is agnostic to the underlaying technology used
type DBKey ¶
type DBKey struct {
// contains filtered or unexported fields
}
DBKey key to be stored in a db.
func (*DBKey) EnvelopeHash ¶ added in v0.35.0
func (*DBKey) Topic ¶ added in v0.35.0
func (k *DBKey) Topic() whispertypes.TopicType
type LevelDB ¶ added in v0.35.0
type LevelDB struct {
// contains filtered or unexported fields
}
func NewLevelDB ¶ added in v0.35.0
func NewLevelDB(config *params.WhisperConfig) (*LevelDB, error)
func (*LevelDB) BuildIterator ¶ added in v0.35.0
func (db *LevelDB) BuildIterator(query CursorQuery) (Iterator, error)
Build iterator returns an iterator given a start/end and a cursor
func (*LevelDB) GetEnvelope ¶ added in v0.35.0
GetEnvelope get an envelope by its key
type LevelDBIterator ¶ added in v0.35.0
func (*LevelDBIterator) DBKey ¶ added in v0.35.0
func (i *LevelDBIterator) DBKey() (*DBKey, error)
func (*LevelDBIterator) GetEnvelope ¶ added in v0.35.0
func (i *LevelDBIterator) GetEnvelope(bloom []byte) ([]byte, error)
type MessagesRequestPayload ¶ added in v0.35.0
type MessagesRequestPayload struct { // Lower is a lower bound of time range for which messages are requested. Lower uint32 // Upper is a lower bound of time range for which messages are requested. Upper uint32 // Bloom is a bloom filter to filter envelopes. Bloom []byte // Limit is the max number of envelopes to return. Limit uint32 // Cursor is used for pagination of the results. Cursor []byte // Batch set to true indicates that the client supports batched response. Batch bool }
MessagesRequestPayload is a payload sent to the Mail Server.
type PostgresDB ¶ added in v0.35.0
type PostgresDB struct {
// contains filtered or unexported fields
}
func NewPostgresDB ¶ added in v0.35.0
func NewPostgresDB(config *params.WhisperConfig) (*PostgresDB, error)
func (*PostgresDB) BuildIterator ¶ added in v0.35.0
func (i *PostgresDB) BuildIterator(query CursorQuery) (Iterator, error)
func (*PostgresDB) Close ¶ added in v0.35.0
func (i *PostgresDB) Close() error
func (*PostgresDB) GetEnvelope ¶ added in v0.35.0
func (i *PostgresDB) GetEnvelope(key *DBKey) ([]byte, error)
func (*PostgresDB) SaveEnvelope ¶ added in v0.35.0
func (i *PostgresDB) SaveEnvelope(env *whisper.Envelope) error
type WMailServer ¶
type WMailServer struct {
// contains filtered or unexported fields
}
WMailServer whisper mailserver.
func (*WMailServer) Archive ¶
func (s *WMailServer) Archive(env *whisper.Envelope)
Archive a whisper envelope.
func (*WMailServer) Close ¶
func (s *WMailServer) Close()
Close the mailserver and its associated db connection.
func (*WMailServer) Deliver ¶ added in v0.35.0
func (s *WMailServer) Deliver(peer *whisper.Peer, r whisper.MessagesRequest)
func (*WMailServer) DeliverMail ¶
func (s *WMailServer) DeliverMail(peer *whisper.Peer, request *whisper.Envelope)
DeliverMail sends mail to specified whisper peer.
func (*WMailServer) Init ¶
func (s *WMailServer) Init(shh *whisper.Whisper, config *params.WhisperConfig) error
Init initializes mailServer.
func (*WMailServer) SyncMail ¶ added in v0.35.0
func (s *WMailServer) SyncMail(peer *whisper.Peer, request whisper.SyncMailRequest) error
SyncMail syncs mail servers between two Mail Servers.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.