Documentation ¶
Overview ¶
Package pkmail implements a schema for storing parsed e-mail messages in Perkeep.
Index ¶
- Constants
- Variables
- func PkGetMsg(ctx context.Context, src blob.Fetcher, ref blob.Ref) (*rmime.Message, error)
- func PkPutMsg(ctx context.Context, dst blobserver.BlobReceiver, msg *rmime.Message) (blob.Ref, error)
- func PkPutPart(ctx context.Context, dst blobserver.BlobReceiver, p *rmime.Part) (blob.Ref, error)
Constants ¶
const SchemaVersion = "2.2.0"
SchemaVersion is the latest schema version as a semver string.
Variables ¶
var ErrMalformed = errors.New("malformed part")
ErrMalformed is the error produced when a blob does not conform to the pkmail schema.
Functions ¶
func PkGetMsg ¶
PkGetMsg fetches the blobs from src, rooted at ref, to reconstruct an rmime.Message.
func PkPutMsg ¶
func PkPutMsg(ctx context.Context, dst blobserver.BlobReceiver, msg *rmime.Message) (blob.Ref, error)
PkPutMsg adds a message to the Perkeep server at dst. The message is added as a hierarchy of blobs with the root blob a schema blob having camliType "mime-message". See PkPutPart for other details of the root schema blob.
func PkPutPart ¶
func PkPutPart(ctx context.Context, dst blobserver.BlobReceiver, p *rmime.Part) (blob.Ref, error)
PkPutPart adds a message part to the Perkeep server at dst. The message part is added as a hierarchy of blobs with the root blob a schema blob having camliType "mime-part".
Other fields of the root schema blob:
pkmail_version: semver string for the pkmail schema version in use content_type: canonicalized content-type of the part content_disposition: canonicalized content-disposition token ("inline" or "attachment")
and optionally:
header: header of the part as a list of (name, list-of-values) pairs (if non-empty) time: parsed date of the part charset: charset for text/* parts subject: decoded subject text for message parts content_type_params content_disposition_params
Additionally, the body of the part appears as follows:
- for multipart/* parts, as the field "subparts", a list of nested "mime-part" schema blobs
- for message/delivery-status parts, {"message": fields, "recipients": [fields, ...]} as the field "delivery_status"
- for message/* parts, as the field "submessage", a nested "mime-message" schema blob
- for other parts, as the field "body", a reference to a "bytes" schema blob.
Types ¶
This section is empty.