attach

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyAll

func ApplyAll(cfg *config.Config, cmd *cli.Command)

ApplyAll calls Apply on all registered plugins that define one.

func Names

func Names() []string

Names returns all registered attachment store plugin names.

func PluginFlags

func PluginFlags(cfg *config.Config) []cli.Flag

PluginFlags returns CLI flags contributed by all registered attachment store plugins.

func Register

func Register(p Plugin)

Register adds an attachment store plugin.

Types

type AttachmentStore

type AttachmentStore interface {
	// Store writes file data and returns storage key, size, and SHA256.
	Store(ctx context.Context, data io.Reader, maxSize int64, contentType string) (*FileStoreResult, error)
	// Retrieve returns a reader for the stored file.
	Retrieve(ctx context.Context, storageKey string) (io.ReadCloser, error)
	// Delete removes the stored file.
	Delete(ctx context.Context, storageKey string) error
	// GetSignedURL returns a time-limited signed download URL, if supported.
	GetSignedURL(ctx context.Context, storageKey string, expiry time.Duration) (*url.URL, error)
}

AttachmentStore defines the interface for file storage backends.

type FileStoreResult

type FileStoreResult struct {
	StorageKey string
	Size       int64
	SHA256     string
}

FileStoreResult is the result of a file store operation.

type Loader

type Loader func(ctx context.Context) (AttachmentStore, error)

Loader creates an AttachmentStore from config.

func Select

func Select(name string) (Loader, error)

Select returns the loader for the named attachment store plugin.

type Plugin

type Plugin struct {
	Name   string
	Loader Loader
	Flags  func(cfg *config.Config) []cli.Flag
	Apply  func(cfg *config.Config, cmd *cli.Command)
}

Plugin represents an attachment store plugin.

Jump to

Keyboard shortcuts

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