sacks

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package sacks holds the Sack interface, the Brief project's abstraction of a collection of messages.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchMessage = errors.New("no such message")

Functions

This section is empty.

Types

type Sack

type Sack interface {
	Query(*bql.Query) ([]msgs.MessageId, error)

	Lookup(msgs.MessageId) (*msgs.Message, error)

	// SetDocket sets the docket k's entry to v, timestamped at t.
	// v MUST NOT be retained.
	//
	// Implementations are free to discard t and replace it with the timestamp
	// when a SetDocket request came in. Implementations that provide a certain
	// internal monotonicity may decide to do this.
	//
	// Commonly called with t=time.Now().
	SetDocket(id msgs.MessageId, t time.Time, k string, v []byte) error

	// Sack sacks a raw byte slice.
	// Sack MUST fail if the given message is not structurally valid in the
	// RFC 822 sense, or does not have exactly one Message-Id.
	// Sack MAY fail if the Message-Id is already taken in the Sack. It MAY
	// also change the Message-Id and create an alternate representation for an
	// already present message.
	// Docket may be nil.
	// Sack may fail for other reasons such add read-only status or
	// out-of-space conditions in the underlying storage medium.
	//
	// NOTE: Sack by design does have a bare []byte parameter and *not* e.g.
	// dockets.Undocketed since the latter is a sacks/fssacks-specific concept.
	Sack(msgs.Docket, []byte) (msgs.MessageId, error)
}

Sack represents a postbag: an unordered collection of mail messages, indexed by their Message-Id. A Sack is safe for concurrent use. A Sack's operations are atomic.

Directories

Path Synopsis
Package fssacks implements a sacks.Sack on top of a POSIX-like directory.
Package fssacks implements a sacks.Sack on top of a POSIX-like directory.

Jump to

Keyboard shortcuts

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