Documentation
¶
Overview ¶
Package source fetches one object by its exact key from S3 (or an S3-compatible store), SFTP or a local directory. There is no listing: the agent must name the key. Errors from the libraries are kept for the audit; what leaves Fetch towards the agent is only "fetch_failed".
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrKeyOutsidePrefix = errors.New("key_outside_prefix")
ErrKeyOutsidePrefix refuses a key that is not plainly under the profile prefix. Its text is the agent code.
var ErrSource = errors.New("source error")
ErrSource wraps every error a source library or the OS returned.
Functions ¶
Types ¶
type FetchError ¶
type FetchError struct{ Cause error }
FetchError is any failure of Fetch. Its text is the agent code; Cause is for the audit only.
func (*FetchError) Error ¶
func (e *FetchError) Error() string
func (*FetchError) Unwrap ¶
func (e *FetchError) Unwrap() error
type SFTPConfig ¶
type Source ¶
type Source interface {
Stat(ctx context.Context, key string) (ObjectInfo, error)
Open(ctx context.Context, key string) (io.ReadCloser, error)
}
Source reads single objects by key. Implementations check the key themselves (CheckKey) and return ErrKeyOutsidePrefix for one that escapes.
func NewLocal ¶
NewLocal serves files under root. os.Root refuses any path, symlinks included, that resolves outside it.