storage

package
v0.0.0-...-e616b43 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIME_FORMAT = time.RFC3339
)

Variables

This section is empty.

Functions

func DeleteExpiredFile

func DeleteExpiredFile(pile, entry string) error

func IsConfiguredBucket

func IsConfiguredBucket(buckets [][]byte, name []byte) bool

func Startup

func Startup(config Config, db *bbolt.DB) error

func VoidExpired

func VoidExpired(config Config, db *bbolt.DB)

Types

type BoltDatabase

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

func MustOpenBoltDatabase

func MustOpenBoltDatabase(filename string) BoltDatabase

func (BoltDatabase) CreateEntry

func (eh BoltDatabase) CreateEntry(pile string, filename string, create CreateWithFunc) (string, error)

func (BoltDatabase) GetEntry

func (eh BoltDatabase) GetEntry(pile string, entry string, get GetWithFunc) error

func (BoltDatabase) GetPileEntries

func (eh BoltDatabase) GetPileEntries(pile string) (map[string]EntryMeta, error)

func (BoltDatabase) Startup

func (eh BoltDatabase) Startup(config Config) error

type Config

type Config struct {
	Piles         map[string]PileConfig `json:"piles"`
	ForwardHeader string                `json:"forward_header"`
}

func LoadConfig

func LoadConfig(filename string) Config

func (Config) BucketNames

func (c Config) BucketNames() [][]byte

func (Config) Pile

func (c Config) Pile(pile string) (PileConfig, error)

type CreateWithFunc

type CreateWithFunc func(id string, destination io.Writer) error

type EntryCreator

type EntryCreator interface {
	CreateEntry(pile string, entry string, creator CreateWithFunc) (entryID string, err error)
}

type EntryGetter

type EntryGetter interface {
	GetEntry(pile string, entry string, read GetWithFunc) (err error)
}

type EntryHandler

type EntryHandler interface {
	EntryGetter
	EntryCreator
}

type EntryMeta

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

func EntryMetaFromBytes

func EntryMetaFromBytes(data []byte) (EntryMeta, error)

func NewEntryMeta

func NewEntryMeta(filename string, created time.Time) EntryMeta

func (EntryMeta) Bytes

func (em EntryMeta) Bytes() ([]byte, error)

func (EntryMeta) Filename

func (em EntryMeta) Filename() string

func (EntryMeta) IsZero

func (em EntryMeta) IsZero() bool

func (EntryMeta) String

func (em EntryMeta) String() string

func (EntryMeta) Time

func (em EntryMeta) Time() time.Time

type ErrDuringFileOperation

type ErrDuringFileOperation struct {
	Pile          string
	Entry         string
	UpstreamError error
}

func (ErrDuringFileOperation) Error

func (err ErrDuringFileOperation) Error() string

type ErrFailedCreatingEntryFile

type ErrFailedCreatingEntryFile struct {
	Pile          string
	Entry         string
	UpstreamError error
}

func (ErrFailedCreatingEntryFile) Error

func (err ErrFailedCreatingEntryFile) Error() string

type ErrFailedCreatingPileDirectory

type ErrFailedCreatingPileDirectory struct {
	Pile          string
	UpstreamError error
}

func (ErrFailedCreatingPileDirectory) Error

type ErrFailedMakingId

type ErrFailedMakingId struct {
	UpstreamError error
}

func (ErrFailedMakingId) Error

func (err ErrFailedMakingId) Error() string

type ErrFailedStoringEntryMetadata

type ErrFailedStoringEntryMetadata struct {
	Pile          string
	Entry         string
	UpstreamError error
}

func (ErrFailedStoringEntryMetadata) Error

type ErrNoSuchEntry

type ErrNoSuchEntry struct {
	Pile  string
	Entry string
}

func (ErrNoSuchEntry) Error

func (err ErrNoSuchEntry) Error() string

type ErrNoSuchPile

type ErrNoSuchPile struct {
	Pile string
}

func (ErrNoSuchPile) Error

func (err ErrNoSuchPile) Error() string

type ErrUnparsableMeta

type ErrUnparsableMeta struct {
	Raw        []byte
	ParseError error
}

func (ErrUnparsableMeta) Error

func (err ErrUnparsableMeta) Error() string

type GetWithFunc

type GetWithFunc func(metaData EntryMeta, MIMEType string, file io.Reader) error

type Lifetime

type Lifetime struct {
	time.Duration
}

func (Lifetime) MarshalJSON

func (lt Lifetime) MarshalJSON() ([]byte, error)

func (*Lifetime) UnmarshalJSON

func (lt *Lifetime) UnmarshalJSON(b []byte) error

type PileConfig

type PileConfig struct {
	Lifetime Lifetime `json:"lifetime"`
	Origin   string   `json:"origin"`
	POSTKey  string   `json:"post_key"`
	GETKey   string   `json:"get_key"`
	ListKey  string   `json:"list_key"`
	MaxSize  int64    `json:"max_size"`
}

type PileGetter

type PileGetter interface {
	GetPileEntries(pile string) (map[string]EntryMeta, error)
}

type QuitSignalChan

type QuitSignalChan chan<- interface{}

func StartExpireLoop

func StartExpireLoop(interval time.Duration, config Config, db *bbolt.DB) QuitSignalChan

type Starter

type Starter interface {
	Startup(Config) error
}

Jump to

Keyboard shortcuts

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