Documentation
¶
Overview ¶
Package archive uploads task HTML to cold object storage (R2, S3, B2) and exposes the canonical key layout used by the HTML persister.
Index ¶
- func ColdKey(jobID, taskID string) string
- func LighthouseObjectPath(jobID, taskID, profile string, runID int64) string
- func TaskHTMLObjectPath(jobID, taskID string) string
- type ColdStorageProvider
- type Config
- type S3Provider
- func (p *S3Provider) Delete(ctx context.Context, bucket, key string) error
- func (p *S3Provider) Download(ctx context.Context, bucket, key string) (io.ReadCloser, error)
- func (p *S3Provider) Exists(ctx context.Context, bucket, key string) (bool, error)
- func (p *S3Provider) Ping(ctx context.Context, bucket string) error
- func (p *S3Provider) Provider() string
- func (p *S3Provider) Upload(ctx context.Context, bucket, key string, data io.Reader, opts UploadOptions) error
- type UploadOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LighthouseObjectPath ¶ added in v0.33.10
Empty taskID (parent deleted via ON DELETE SET NULL on lighthouse_runs.source_task_id) falls back to a run-id keyed path so the audit is still archived.
func TaskHTMLObjectPath ¶
ARCHIVE_PATH_PREFIX (when set) is prepended with a "/" join so review-app deployments stay siloed from the production bucket layout.
Types ¶
type ColdStorageProvider ¶
type ColdStorageProvider interface {
// Call at startup to catch bad credentials/endpoints early.
Ping(ctx context.Context, bucket string) error
Upload(ctx context.Context, bucket, key string, data io.Reader, opts UploadOptions) error
Download(ctx context.Context, bucket, key string) (io.ReadCloser, error)
Exists(ctx context.Context, bucket, key string) (bool, error)
// Returns one of: "r2", "s3", "b2".
Provider() string
}
ColdStorageProvider abstracts an S3-compatible object store.
func ProviderFromEnv ¶
func ProviderFromEnv() (ColdStorageProvider, error)
ProviderFromEnv builds a ColdStorageProvider from ARCHIVE_* env vars. Returns (nil, nil) if ARCHIVE_PROVIDER is unset.
type Config ¶
func ConfigFromEnv ¶
func ConfigFromEnv() *Config
Returns nil when ARCHIVE_PROVIDER or ARCHIVE_BUCKET is unset (feature disabled).
func DefaultConfig ¶
func DefaultConfig() Config
type S3Provider ¶
type S3Provider struct {
// contains filtered or unexported fields
}
S3Provider implements ColdStorageProvider for any S3-compatible service (Cloudflare R2, Backblaze B2, AWS S3, MinIO, etc.).
func NewS3Provider ¶
func NewS3Provider(endpoint, accessKeyID, secretAccessKey, region, providerName string) (*S3Provider, error)
NewS3Provider creates a provider from explicit credentials.
func (*S3Provider) Delete ¶
func (p *S3Provider) Delete(ctx context.Context, bucket, key string) error
func (*S3Provider) Download ¶
func (p *S3Provider) Download(ctx context.Context, bucket, key string) (io.ReadCloser, error)
func (*S3Provider) Provider ¶
func (p *S3Provider) Provider() string
func (*S3Provider) Upload ¶
func (p *S3Provider) Upload(ctx context.Context, bucket, key string, data io.Reader, opts UploadOptions) error