Documentation
¶
Overview ¶
Package local stores objects on the local disk: development's storage driver (ADR-0075). Objects live under <root>/objects/<key>; each has a sidecar under <root>/meta/<key>.json with its content type, ETag and metadata. Signed URLs are HMAC-signed links served by Store.Handler, which the app mounts (for example at /storage/).
Stability: experimental (ADR-0054).
Index ¶
- type Option
- type Store
- func (s *Store) Copy(ctx context.Context, src, dst string) (storage.Object, error)
- func (s *Store) Delete(_ context.Context, key string) error
- func (s *Store) Get(ctx context.Context, key string) (io.ReadCloser, storage.Object, error)
- func (s *Store) Handler() http.Handler
- func (s *Store) Info() storage.Info
- func (s *Store) List(ctx context.Context, opts storage.ListOptions) (storage.Page, error)
- func (s *Store) Ping(context.Context) error
- func (s *Store) Put(_ context.Context, key string, r io.Reader, _ int64, opts storage.PutOptions) (storage.Object, error)
- func (s *Store) Root() string
- func (s *Store) SignedURL(_ context.Context, key, method string, expiry time.Duration) (string, error)
- func (s *Store) Stat(_ context.Context, key string) (storage.Object, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Store)
Option configures a Store.
func WithSigner ¶
WithSigner enables signed URLs: secret signs them and baseURL (such as http://127.0.0.1:8080/storage) is where Store.Handler is mounted.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a local-disk storage.Store.
func (*Store) Copy ¶
Copy implements storage.Store.
func (*Store) Delete ¶
Delete implements storage.Store.
func (*Store) Get ¶
Get implements storage.Store.
func (*Store) Handler ¶
Handler serves signed URLs: GET downloads the object, PUT stores the body. Mount it where WithSigner's baseURL points, with the prefix stripped (http.StripPrefix).
func (*Store) List ¶
List implements storage.Store. The cursor is the last key of the previous page.
func (*Store) Put ¶
func (s *Store) Put(_ context.Context, key string, r io.Reader, _ int64, opts storage.PutOptions) (storage.Object, error)
Put implements storage.Store.