Documentation ¶
Index ¶
- type Config
- type DiskStorage
- func (st *DiskStorage) Clean(ctx context.Context) error
- func (st *DiskStorage) Filepath(key string) (path string, err error)
- func (st *DiskStorage) ReadBytes(ctx context.Context, key string) ([]byte, error)
- func (st *DiskStorage) ReadStream(ctx context.Context, key string) (io.ReadCloser, error)
- func (st *DiskStorage) Remove(ctx context.Context, key string) error
- func (st *DiskStorage) Stat(ctx context.Context, key string) (*storage.Entry, error)
- func (st *DiskStorage) WalkKeys(ctx context.Context, opts storage.WalkKeysOpts) error
- func (st *DiskStorage) WriteBytes(ctx context.Context, key string, value []byte) (int, error)
- func (st *DiskStorage) WriteStream(ctx context.Context, key string, stream io.Reader) (int64, error)
- type OpenArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // OpenRead are the arguments passed // to syscall.Open() when opening a // file for read operations. OpenRead OpenArgs // OpenWrite are the arguments passed // to syscall.Open() when opening a // file for write operations. OpenWrite OpenArgs // MkdirPerms are the permissions used // when creating necessary sub-dirs in // a storage key with slashes. MkdirPerms uint32 // WriteBufSize is the buffer size // to use when writing file streams. WriteBufSize int }
Config defines options to be used when opening a DiskStorage.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default DiskStorage configuration.
type DiskStorage ¶
type DiskStorage struct {
// contains filtered or unexported fields
}
DiskStorage is a Storage implementation that stores directly to a filesystem.
func Open ¶
func Open(path string, cfg *Config) (*DiskStorage, error)
Open opens a DiskStorage instance for given folder path and configuration.
func (*DiskStorage) Clean ¶
func (st *DiskStorage) Clean(ctx context.Context) error
Clean: implements Storage.Clean().
func (*DiskStorage) Filepath ¶
func (st *DiskStorage) Filepath(key string) (path string, err error)
Filepath checks and returns a formatted Filepath for given key.
func (*DiskStorage) ReadStream ¶
func (st *DiskStorage) ReadStream(ctx context.Context, key string) (io.ReadCloser, error)
ReadStream: implements Storage.ReadStream().
func (*DiskStorage) Remove ¶
func (st *DiskStorage) Remove(ctx context.Context, key string) error
Remove implements Storage.Remove().
func (*DiskStorage) Stat ¶
func (st *DiskStorage) Stat(ctx context.Context, key string) (*storage.Entry, error)
Stat implements Storage.Stat().
func (*DiskStorage) WalkKeys ¶
func (st *DiskStorage) WalkKeys(ctx context.Context, opts storage.WalkKeysOpts) error
WalkKeys implements Storage.WalkKeys().
func (*DiskStorage) WriteBytes ¶
WriteBytes: implements Storage.WriteBytes().
func (*DiskStorage) WriteStream ¶
func (st *DiskStorage) WriteStream(ctx context.Context, key string, stream io.Reader) (int64, error)
WriteStream: implements Storage.WriteStream().
Click to show internal directories.
Click to hide internal directories.