Documentation ¶
Overview ¶
package store implements types that store message literals.
Messages may be stored either in-memory or on-disk. When stored on disk, they are stored encrypted and optionally compressed.
Index ¶
- func NewCipher(pass []byte) (cipher.AEAD, error)
- type Builder
- type Fallback
- type OnDiskStoreBuilder
- type Option
- type Semaphore
- type Store
- type WriteControlledStore
- func (w *WriteControlledStore) Close() error
- func (w *WriteControlledStore) Delete(messageID ...imap.InternalMessageID) error
- func (w *WriteControlledStore) Get(messageID imap.InternalMessageID) ([]byte, error)
- func (w *WriteControlledStore) List() ([]imap.InternalMessageID, error)
- func (w *WriteControlledStore) Set(messageID imap.InternalMessageID, reader io.Reader) error
- func (w *WriteControlledStore) SetUnchecked(messageID imap.InternalMessageID, reader io.Reader) error
- type WriteControlledStoreBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Fallback ¶ added in v0.15.0
type Fallback interface { Read(gcm cipher.AEAD, reader io.Reader) ([]byte, error) Write(gcm cipher.AEAD, filepath string, data []byte) error }
Fallback provides an interface to supply an alternative way to read a store file should the main route fail. This is mainly intended to allow users of the library to read old store formats they may have kept on disk. This is a stop-gap until a complete data migration cycle can be implemented in gluon.
type OnDiskStoreBuilder ¶ added in v0.9.0
type OnDiskStoreBuilder struct{}
func (*OnDiskStoreBuilder) Delete ¶ added in v0.12.0
func (*OnDiskStoreBuilder) Delete(path, userID string) error
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithFallback ¶ added in v0.15.0
func WithSemaphore ¶
type Semaphore ¶
type Semaphore struct {
// contains filtered or unexported fields
}
Semaphore implements a type used to limit concurrent operations.
func NewSemaphore ¶
func NewSemaphore(max int, panicHandler async.PanicHandler) *Semaphore
NewSemaphore constructs a new semaphore with the given limit.
func (*Semaphore) Block ¶
func (sem *Semaphore) Block()
Block prevents the semaphore from being locked.
func (*Semaphore) Do ¶
func (sem *Semaphore) Do(fn func())
Do executes the given function synchronously.
func (*Semaphore) Go ¶
func (sem *Semaphore) Go(fn func())
Go executes the given function asynchronously.
func (*Semaphore) Lock ¶
func (sem *Semaphore) Lock()
Lock locks the semaphore, waiting first until it is possible.
type Store ¶
type Store interface { Get(messageID imap.InternalMessageID) ([]byte, error) Set(messageID imap.InternalMessageID, reader io.Reader) error Delete(messageID ...imap.InternalMessageID) error Close() error List() ([]imap.InternalMessageID, error) }
type WriteControlledStore ¶ added in v0.15.0
type WriteControlledStore struct {
// contains filtered or unexported fields
}
WriteControlledStore ensures that a given file on disk can safely be accessed by multiple readers and only one writer. Internally we maintain a list of RWLocks per message ID.
func NewWriteControlledStore ¶ added in v0.15.0
func NewWriteControlledStore(impl Store) *WriteControlledStore
func (*WriteControlledStore) Close ¶ added in v0.15.0
func (w *WriteControlledStore) Close() error
func (*WriteControlledStore) Delete ¶ added in v0.15.0
func (w *WriteControlledStore) Delete(messageID ...imap.InternalMessageID) error
func (*WriteControlledStore) Get ¶ added in v0.15.0
func (w *WriteControlledStore) Get(messageID imap.InternalMessageID) ([]byte, error)
func (*WriteControlledStore) List ¶ added in v0.15.0
func (w *WriteControlledStore) List() ([]imap.InternalMessageID, error)
func (*WriteControlledStore) Set ¶ added in v0.15.0
func (w *WriteControlledStore) Set(messageID imap.InternalMessageID, reader io.Reader) error
func (*WriteControlledStore) SetUnchecked ¶ added in v0.15.0
func (w *WriteControlledStore) SetUnchecked(messageID imap.InternalMessageID, reader io.Reader) error
SetUnchecked allows the user to bypass lock access. This will only work if you can guarantee that the data being set does not previously exit (e.g: New message).
type WriteControlledStoreBuilder ¶ added in v0.15.0
type WriteControlledStoreBuilder struct {
// contains filtered or unexported fields
}
func NewWriteControlledStoreBuilder ¶ added in v0.15.0
func NewWriteControlledStoreBuilder(builder Builder) *WriteControlledStoreBuilder
func (*WriteControlledStoreBuilder) Delete ¶ added in v0.15.0
func (w *WriteControlledStoreBuilder) Delete(dir, userID string) error
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package mock_store is a generated GoMock package.
|
Package mock_store is a generated GoMock package. |