commmailbox

package
v0.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package commmailbox contains shared bounded content-storage helpers for the host-authoritative soul comm mailbox.

Index

Constants

View Source
const (
	// ContentKeyPrefix is the lifecycle-bound S3 prefix used by CDK.
	ContentKeyPrefix = "mailbox/v1/"
	// ContentStorageS3 marks mailbox content pointers backed by S3.
	ContentStorageS3 = "s3"
)

Variables

This section is empty.

Functions

func ContentKey

func ContentKey(instanceSlug string, agentID string, deliveryID string) string

ContentKey returns the S3 object key for a mailbox delivery body.

func DefaultContentType

func DefaultContentType(channelType string) string

DefaultContentType returns the content type used when a provider does not supply one.

Types

type ContentInput

type ContentInput struct {
	DeliveryID      string
	InstanceSlug    string
	AgentID         string
	MessageID       string
	Direction       string
	ChannelType     string
	Body            string
	ContentMimeType string
}

ContentInput is the body payload stored for one canonical mailbox delivery.

type ContentOutput

type ContentOutput struct {
	Body        []byte
	ContentType string
	SHA256      string
	Bytes       int64
}

ContentOutput is explicit mailbox body content fetched from bounded storage.

type ContentPointer

type ContentPointer struct {
	Storage     string
	Bucket      string
	Key         string
	SHA256      string
	Bytes       int64
	ContentType string
}

ContentPointer identifies a lifecycle-bound encrypted content object.

type ContentStore

type ContentStore interface {
	PutContent(ctx context.Context, input ContentInput) (ContentPointer, error)
	GetContent(ctx context.Context, pointer ContentPointer, maxBytes int64) (ContentOutput, error)
}

ContentStore writes and reads bounded mailbox content.

type S3Store

type S3Store struct {
	// contains filtered or unexported fields
}

S3Store stores mailbox content in the dedicated CDK-managed mailbox bucket.

func NewS3Store

func NewS3Store(bucket string) *S3Store

NewS3Store constructs an S3-backed content store.

func NewS3StoreWithClient

func NewS3StoreWithClient(bucket string, client s3API) *S3Store

NewS3StoreWithClient constructs an S3-backed content store with an injected client.

func (*S3Store) GetContent

func (s *S3Store) GetContent(ctx context.Context, pointer ContentPointer, maxBytes int64) (ContentOutput, error)

GetContent reads a bounded mailbox content object and verifies its digest when the mailbox row carries one.

func (*S3Store) PutContent

func (s *S3Store) PutContent(ctx context.Context, input ContentInput) (ContentPointer, error)

PutContent writes content to the configured mailbox bucket and returns a pointer + digest. The bucket enforces encryption at rest and lifecycle expiry.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL