Documentation
¶
Overview ¶
Package trove adapts a *trove.Trove instance as an artifact.Backend.
It is the reference backend for Dispatch's artifact plane, but not a required one: the core depends only on the artifact.Backend interface, so any object store can be plugged in instead.
Two Trove features carry through without any code here. Its write-path middleware means compression, AES-256-GCM encryption, and virus scanning are configuration rather than Dispatch concerns — and scanning on write is what lets a malicious upload be rejected before any memory-unsafe parser opens it. Its multi-store routing means the backend name recorded on each artifact is simply the Trove store it lives in.
Index ¶
- Constants
- Variables
- type Backend
- func (b *Backend) Create(ctx context.Context, bucket, key string) (artifact.Writer, error)
- func (b *Backend) Delete(ctx context.Context, ref artifact.Ref) error
- func (b *Backend) Name() string
- func (b *Backend) Open(ctx context.Context, ref artifact.Ref) (io.ReadCloser, error)
- func (b *Backend) OpenRange(ctx context.Context, ref artifact.Ref, off, n int64) (io.ReadCloser, error)
- func (b *Backend) PresignGet(ctx context.Context, ref artifact.Ref, ttl time.Duration) (string, error)
- func (b *Backend) Stat(ctx context.Context, ref artifact.Ref) (artifact.ObjectInfo, error)
- func (b *Backend) SupportsPresign(ref artifact.Ref) bool
- type Option
Constants ¶
const DefaultName = "trove"
DefaultName is the backend identifier used when none is configured.
Variables ¶
var ErrRangeUnsupported = errors.New("trove: driver does not support range reads")
ErrRangeUnsupported means the underlying Trove driver cannot serve byte ranges, so the caller must read the whole object instead.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend adapts a *trove.Trove as an artifact.Backend.
func (*Backend) Create ¶
Create begins writing a new object.
Trove's Put consumes a reader, so the writer drives it from a pipe on a background goroutine and joins that goroutine in Commit or Abort.
func (*Backend) Delete ¶
Delete removes the object. Deleting a missing object is not an error, which makes the purge pass idempotent under retry.
func (*Backend) OpenRange ¶
func (b *Backend) OpenRange(ctx context.Context, ref artifact.Ref, off, n int64) (io.ReadCloser, error)
OpenRange returns a reader over n bytes starting at off. A negative n reads to the end.
Range support is a Trove driver capability, not a Get option: a driver that lacks it silently returns the entire object. Rather than hand back more bytes than asked for, this reports ErrRangeUnsupported so callers can fall back deliberately.
func (*Backend) PresignGet ¶
func (b *Backend) PresignGet(ctx context.Context, ref artifact.Ref, ttl time.Duration) (string, error)
PresignGet returns a time-limited read URL when the underlying driver supports pre-signing, and ErrNotFound-free failure otherwise.