Documentation ¶
Index ¶
- Constants
- type Filestore
- func (f *Filestore) Exists(ctx context.Context, hash string) (bool, error)
- func (f *Filestore) Fetch(ctx context.Context, hash string) (io.ReadCloser, error)
- func (f *Filestore) ImgproxyURLSource(hash string) (string, error)
- func (f *Filestore) Iterate(ctx context.Context, maxBatch int, callback func(hashes []string) error) error
- func (f *Filestore) Remove(ctx context.Context, hash string) error
- func (f *Filestore) Size(ctx context.Context, hash string) (int64, error)
- func (f *Filestore) Store(ctx context.Context, r io.Reader) (hash string, err error)
- func (f *Filestore) StoreHashed(ctx context.Context, r io.Reader, hash string) error
Constants ¶
View Source
const ( // DefaultPrefixSize is the default path prefix size. DefaultPrefixSize = 2 // DefaultTargetFileMode is the default file mode when storing assets. DefaultTargetFileMode = 0644 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filestore ¶
type Filestore struct { TargetFileMode os.FileMode PrefixSize int // contains filtered or unexported fields }
Filestore is a file store that stores files on a local filesystem.
func NewFilestore ¶
NewFilestore creates a new file store operating on a (local) filesystem.
The assetsPath is the path to a directory where the assets will be stored. The tmpPath is the path to a directory where temporary files will be stored. It should be on the same filesystem as assetsPath to support atomic renames.
func (*Filestore) Fetch ¶
Fetch returns a reader to the file with the given hash. If the file does not exist, ErrNotExist is returned.
func (*Filestore) ImgproxyURLSource ¶
ImgproxyURLSource gets a source URL to a local file for imgproxy.
func (*Filestore) Iterate ¶
func (f *Filestore) Iterate(ctx context.Context, maxBatch int, callback func(hashes []string) error) error
Iterate over all files in the store with a batch size of maxBatch.
Click to show internal directories.
Click to hide internal directories.