fssacks

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: 30 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

View Source
var ErrDesync = errors.New("desync")
View Source
var ErrExile = errors.New("exile")
View Source
var ErrNonAtomicOperation = errors.New("non-atomic operation: might have introduced inconsistencies")
View Source
var ErrUnexilable = errors.New("unexilable")

Functions

func Sack

func Sack(fsys vfs.FS, c *Cacher) (*fsSack, error)

Sack attaches a sacks.Sack to a filesystem. Cacher may be nil.

Types

type Cache

type Cache map[string]Cached

indexed by Cached.LazyMessage.FileName

type Cached

type Cached struct {
	Valid bool
	// NOTE: encoding/gob does not support struct embedding
	LazyMessage *LazyMessage
}

func (*Cached) Validate

func (cached *Cached) Validate(fsys vfs.FS, name string) (ok bool)

type Cacher

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

func CacheAt

func CacheAt(fsys vfs.FS, name string) *Cacher

CacheAt returns a Cacher caching on the filesystem at the specified location.

func (*Cacher) D

func (c *Cacher) D() error

func (*Cacher) R

func (c *Cacher) R() (io.ReadCloser, error)

func (*Cacher) W

func (c *Cacher) W() (io.WriteCloser, error)

type LazyMessage

type LazyMessage struct {
	// File* fields pertain to properties of a file on disk.
	FileName    string
	FileSize    int64
	FileModtime time.Time

	Docket      msgs.Docket
	MessageId   msgs.MessageId
	QuickHeader QuickHeader
}

func (*LazyMessage) Message

func (lm *LazyMessage) Message(fsys vfs.FS) (*msgs.Message, error)

Message returns a non-retained, freshly cloned msgs.Message.

func (*LazyMessage) Queryable

func (lm *LazyMessage) Queryable(fsys vfs.FS) *queryable

func (*LazyMessage) View

func (lm *LazyMessage) View(fsys vfs.FS) *MessageView

type MessageView

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

func (*MessageView) DocketTKV

func (view *MessageView) DocketTKV(k string) (msgs.TKV, error)

DocketTKV returns the most recent docket TKV with this key TODO replace LazyMessage's Docket with a QuickDocket which holds less information

func (*MessageView) DocketTKVs

func (view *MessageView) DocketTKVs(k string) ([]msgs.TKV, error)

func (*MessageView) Values

func (view *MessageView) Values(k string) ([]string, error)

type QuickHeader

type QuickHeader struct {
	MessageId []string
	Date      []string
	From      []string
	Sender    []string
	To        []string
	Cc        []string
	Bcc       []string
	Subject   []string
	XBrief    []string // [2023-12-07, jfrech] TODO Does this do anything?

	// Valid is a safety mechanism: a QuickHeader has to be consciously
	// set to be valid to dampen the dangers introduced by QuickHeader
	// being constructable anywhere.
	Valid bool
}

A QuickHeader MUST contain all headers of the names in the struct, i.e. if requesting a net/textproto.MIMEHeader.Values(...), it must aid. TODO make private?

func (QuickHeader) FieldNames

func (_ QuickHeader) FieldNames() []string

func (QuickHeader) UniqueMessageId

func (qh QuickHeader) UniqueMessageId() (msgs.MessageId, error)

func (QuickHeader) Values

func (qh QuickHeader) Values(k string) ([]string, bool)

type QuickHeaderBuilder

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

func (*QuickHeaderBuilder) Add

func (qhb *QuickHeaderBuilder) Add(rawfield mailx.RawField) error

func (*QuickHeaderBuilder) QuickHeader

func (qhb *QuickHeaderBuilder) QuickHeader() (QuickHeader, error)

type Shell

type Shell struct {
	Stdout io.Writer
	// contains filtered or unexported fields
}

func Unerase

func Unerase(sack sacks.Sack) (*Shell, bool)

perform a type assertion

func (*Shell) Fsck

func (shell *Shell) Fsck() error

TODO

func (*Shell) FsckSortByFilepath

func (shell *Shell) FsckSortByFilepath(noop bool) error

func (*Shell) FsckSortByMailbox

func (shell *Shell) FsckSortByMailbox(noop bool) error

Jump to

Keyboard shortcuts

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