Documentation ¶
Index ¶
Constants ¶
View Source
const ( // SizeSingle is the length of a byte. SizeSingle = 1 // SizeKilobyte is the length of a kilobyte. SizeKilobyte = 1 << (10 * 1) // SizeMegabyte is the length of a megabyte. SizeMegabyte = 1 << (10 * 2) // SizeGigabyte is the length of a gigabyte. SizeGigabyte = 1 << (10 * 3) // SizeTerabyte is the length of a terabyte. SizeTerabyte = 1 << (10 * 4) )
Variables ¶
This section is empty.
Functions ¶
func GetMessage ¶
GetMessage get the message contents from the location and perform location hash check
func IsNotFoundError ¶
IsNotFoundError checks if the error supplied is an not found error. It checks against known errors from supported stores, S3, etc.
Types ¶
type Cache ¶ added in v0.0.60
type Cache interface { GetMessage(location string) ([]byte, error) SetMessage(location string, msg []byte) error }
Cache allows you to cache the message for a certain of time.
type Header ¶ added in v0.0.69
type Header struct { // When the message was created, this can be different to the transaction data of the message. // example: 12 Mar 19 20:23 UTC Date time.Time `json:"date"` // The sender of the message // example: Charlotte <5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761@ropsten.ethereum> From string `json:"from"` // The recipient of the message // To: <4cb0a77b76667dac586c40cc9523ace73b5d772bd503c63ed0ca596eae1658b2@ropsten.ethereum> To string `json:"to"` // Reply to if the reply address is different to the from address. ReplyTo string `json:"reply-to,omitempty"` // RekeyTo the address to use when responding. RekeyTo string `json:"rekey-to,omitempty"` // Unique identifier of the message // example: 47eca011e32b52c71005ad8a8f75e1b44c92c99fd12e43bccfe571e3c2d13d2e9a826a550f5ff63b247af471@mailchain MessageID string `json:"message-id"` // The content type and the encoding of the message body // example: text/plain; charset=\"UTF-8\", // text/html; charset=\"UTF-8\" ContentType string `json:"content-type"` }
type Message ¶ added in v0.0.69
type Message struct { // Headers Headers Header `json:"headers"` // Body of the mail message // example: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur maximus metus ante, sit amet ullamcorper dui hendrerit ac. // Sed vestibulum dui lectus, quis eleifend urna mollis eu. Integer dictum metus ut sem rutrum aliquet. Body string `json:"body,omitempty"` // Subject of the mail message // example: Hello world Subject string `json:"subject,omitempty"` Status string `json:"status"` StatusCode string `json:"status-code"` // Read status of the message // example: true Read bool `json:"read"` // Transaction's block number BlockID string `json:"block-id,omitempty"` // Transaction's block number encoding type used by the specific protocol BlockIDEncoding string `json:"block-id-encoding,omitempty"` // Transaction's hash TransactionHash string `json:"transaction-hash,omitempty"` // Transaction's hash encoding type used by the specific protocol TransactionHashEncoding string `json:"transaction-hash-encoding,omitempty"` }
type PutResponse ¶ added in v0.0.51
type PutResponse struct {
// contains filtered or unexported fields
}
type Sent ¶
type Sent interface { // PutMessage should write the message contents to the underlying storage service. Return the final location information or any error. // Returns: // + address - url of the stored message. E.g. for https://mcx.mx/QmeEYqAaK7UpsffH9fDyPCwB9YH5jf36zDYgeqxhuCvHhh it is `https://mcx.mx/QmeEYqAaK7UpsffH9fDyPCwB9YH5jf36zDYgeqxhuCvHhh` // + resource - name of the stored message. E.g. for https://mcx.mx/QmeEYqAaK7UpsffH9fDyPCwB9YH5jf36zDYgeqxhuCvHhh it is `QmeEYqAaK7UpsffH9fDyPCwB9YH5jf36zDYgeqxhuCvHhh` // + mli - ID linked to the protocol + domain name, see `internal/envelope/mli.go`. E.g. for https://mcx.mx/QmeEYqAaK7UpsffH9fDyPCwB9YH5jf36zDYgeqxhuCvHhh is 1 PutMessage(messageID mail.ID, contentsHash, msg []byte, headers map[string]string) (address, resource string, mli uint64, err error) Key(messageID mail.ID, contentsHash, msg []byte) string }
The Sent saves the message. This should not be used directly but as the first argument of storing.PutMessage.
type SentStore ¶ added in v0.0.12
type SentStore struct {
// contains filtered or unexported fields
}
SentStore type for storing sent Mailchain messages.
func NewSentStore ¶ added in v0.0.12
func NewSentStore() *SentStore
NewSentStore create Mailchain sent store.
type State ¶
type State interface { DeleteMessageRead(messageID mail.ID) error PutMessageRead(messageID mail.ID) error GetReadStatus(messageID mail.ID) (bool, error) PutTransaction(protocol, network string, address []byte, tx Transaction) error GetTransactions(protocol, network string, address []byte, skip, limit int32) ([]Transaction, error) }
State stores all the actions that support mailbox functionality
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package statemock is a generated GoMock package.
|
Package statemock is a generated GoMock package. |
Package storestest is a generated GoMock package.
|
Package storestest is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.