Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type CursorQuery
- type DB
- type DBKey
- type Iterator
- type LevelDB
- type LevelDBIterator
- type MessagesRequestPayload
- type PostgresDB
- type WakuMailServer
- func (s *WakuMailServer) Archive(env *waku.Envelope)
- func (s *WakuMailServer) Close()
- func (s *WakuMailServer) Deliver(peerID []byte, req waku.MessagesRequest)
- func (s *WakuMailServer) DeliverMail(peerID []byte, req *waku.Envelope)
- func (s *WakuMailServer) Init(waku *waku.Waku, cfg *params.WakuConfig) error
- type WhisperMailServer
- func (s *WhisperMailServer) Archive(env *whisper.Envelope)
- func (s *WhisperMailServer) Close()
- func (s *WhisperMailServer) Deliver(peerID []byte, req whisper.MessagesRequest)
- func (s *WhisperMailServer) DeliverMail(peerID []byte, req *whisper.Envelope)
- func (s *WhisperMailServer) Init(shh *whisper.Whisper, cfg *params.WhisperConfig) error
- func (s *WhisperMailServer) SyncMail(peerID []byte, req whisper.SyncMailRequest) error
Constants ¶
View Source
const ( // DBKeyLength is a size of the envelope key. DBKeyLength = types.HashLength + timestampLength + types.TopicLength CursorLength = types.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 Config ¶ added in v0.39.0
type Config struct { // DataDir points to a directory where mailserver's data is stored. DataDir string // Password is used to create a symmetric key to decrypt requests. Password string // AsymKey is an asymmetric key to decrypt requests. AsymKey string // MininumPoW is a minimum PoW for requests. MinimumPoW float64 // RateLimit is a maximum number of requests per second from a peer. RateLimit int // DataRetention specifies a number of days an envelope should be stored for. DataRetention int PostgresEnabled bool PostgresURI string }
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(types.Envelope) error // 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 underlying 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
type LevelDB ¶ added in v0.35.0
type LevelDB struct {
// contains filtered or unexported fields
}
func NewLevelDB ¶ added in v0.35.0
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)
func (*LevelDBIterator) Release ¶ added in v0.39.10
func (i *LevelDBIterator) Release() 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 // Topics is a list of topics to filter envelopes. Topics [][]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.
func (*MessagesRequestPayload) SetDefaults ¶ added in v0.39.0
func (r *MessagesRequestPayload) SetDefaults()
func (MessagesRequestPayload) Validate ¶ added in v0.39.0
func (r MessagesRequestPayload) Validate() error
type PostgresDB ¶ added in v0.35.0
type PostgresDB struct {
// contains filtered or unexported fields
}
func NewPostgresDB ¶ added in v0.35.0
func NewPostgresDB(uri string) (*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 types.Envelope) error
type WakuMailServer ¶ added in v0.39.0
type WakuMailServer struct {
// contains filtered or unexported fields
}
func (*WakuMailServer) Archive ¶ added in v0.39.0
func (s *WakuMailServer) Archive(env *waku.Envelope)
func (*WakuMailServer) Close ¶ added in v0.39.0
func (s *WakuMailServer) Close()
func (*WakuMailServer) Deliver ¶ added in v0.39.0
func (s *WakuMailServer) Deliver(peerID []byte, req waku.MessagesRequest)
func (*WakuMailServer) DeliverMail ¶ added in v0.39.0
func (s *WakuMailServer) DeliverMail(peerID []byte, req *waku.Envelope)
DEPRECATED; user Deliver instead
func (*WakuMailServer) Init ¶ added in v0.39.0
func (s *WakuMailServer) Init(waku *waku.Waku, cfg *params.WakuConfig) error
type WhisperMailServer ¶ added in v0.39.0
type WhisperMailServer struct {
// contains filtered or unexported fields
}
func (*WhisperMailServer) Archive ¶ added in v0.39.0
func (s *WhisperMailServer) Archive(env *whisper.Envelope)
func (*WhisperMailServer) Close ¶ added in v0.39.0
func (s *WhisperMailServer) Close()
func (*WhisperMailServer) Deliver ¶ added in v0.39.0
func (s *WhisperMailServer) Deliver(peerID []byte, req whisper.MessagesRequest)
func (*WhisperMailServer) DeliverMail ¶ added in v0.39.0
func (s *WhisperMailServer) DeliverMail(peerID []byte, req *whisper.Envelope)
DEPRECATED; user Deliver instead
func (*WhisperMailServer) Init ¶ added in v0.39.0
func (s *WhisperMailServer) Init(shh *whisper.Whisper, cfg *params.WhisperConfig) error
func (*WhisperMailServer) SyncMail ¶ added in v0.39.0
func (s *WhisperMailServer) SyncMail(peerID []byte, req whisper.SyncMailRequest) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.