Documentation ¶
Overview ¶
Package filestore stores files in various types of storage systems.
Index ¶
- Variables
- type File
- type Interface
- type Local
- func (l *Local) Delete(ctx context.Context, relPath string) error
- func (l *Local) Get(ctx context.Context, relPath string) (*File, io.ReadCloser, error)
- func (l *Local) Head(ctx context.Context, relPath string) (*File, error)
- func (l *Local) List(ctx context.Context, relPath string, recursive bool) (<-chan *File, <-chan error)
- func (l *Local) Put(ctx context.Context, relPath string, r io.Reader) (*File, error)
- func (l *Local) Type() string
- type S3
- func (s *S3) Delete(ctx context.Context, relPath string) error
- func (s *S3) Get(ctx context.Context, relPath string) (*File, io.ReadCloser, error)
- func (s *S3) Head(ctx context.Context, relPath string) (*File, error)
- func (s *S3) List(ctx context.Context, relPath string, recursive bool) (<-chan *File, <-chan error)
- func (s *S3) Put(ctx context.Context, relPath string, reader io.Reader) (*File, error)
- func (s *S3) Type() string
- type S3Option
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { // Modified it the last modification time. Modified time.Time // Path is the path to the file relative to the root of the file store. // Path separators are always slash ('/') characters. Path string // Size if the number of bytes of data in the file. Size int64 // URL is a URL where the file can be retrieved from, if available. URL string }
File contains information about a stored file.
type Interface ¶
type Interface interface { // Delete removes the specified file from storage. Delete(ctx context.Context, path string) error // Get retrieves the specified file from storage. Get(ctx context.Context, path string) (*File, io.ReadCloser, error) // Head gets information about the specified file in storage. Head(ctx context.Context, path string) (*File, error) // List returns a series of *File on the first channel returned. If an // error occurs, the first channel is closed and the error is returned on // the second channel. List(ctx context.Context, path string, recursive bool) (<-chan *File, <-chan error) // Put writes a file to storage. A nil reader creates an empty file. Put(ctx context.Context, path string, reader io.Reader) (*File, error) // Type returns the file store type. Type() string }
Interface is the interface supported by all file store implementations. All Path arguments are relative to the root of the file store and always use slash ('/') characters.
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local is a file store that stores files in the local file system.
Click to show internal directories.
Click to hide internal directories.