Durable staging handoff, transactional outbox, at-least-once worker with lease fencing, idempotent versioned pipeline, three variants, operator tooling, contract tests and evidence. Includes the review fixes: reprocess source selection and failure settlement, replay guards, stale-job retirement, PNG structural/raster validation, migration rollback safety and audit events.
35 lines
1.3 KiB
Go
35 lines
1.3 KiB
Go
// Package objectstore defines the S3-compatible port used by attachments.
|
|
// Metadata never belongs here: PostgreSQL is the source of truth, this package
|
|
// only moves bytes and exposes object timestamps for the orphan sweeper.
|
|
package objectstore
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
// Object is the provider-neutral view of one stored object.
|
|
type Object struct {
|
|
Key string
|
|
Size int64
|
|
ContentType string
|
|
LastModified time.Time
|
|
Metadata map[string]string
|
|
}
|
|
|
|
// Store is implemented by S3-compatible backends. Put requires a seekable body
|
|
// because AWS SigV4 may need to rewind the payload; the proxy upload path always
|
|
// passes an *os.File.
|
|
type Store interface {
|
|
// Ping verifies that the bucket is reachable and the credentials are valid.
|
|
Ping(ctx context.Context) error
|
|
Put(ctx context.Context, key string, body io.ReadSeeker, size int64, contentType string, metadata map[string]string) error
|
|
Open(ctx context.Context, key string) (io.ReadCloser, Object, error)
|
|
Head(ctx context.Context, key string) (Object, error)
|
|
Copy(ctx context.Context, src, dst, contentType string, metadata map[string]string) error
|
|
Delete(ctx context.Context, key string) error
|
|
List(ctx context.Context, prefix string) ([]Object, error)
|
|
PresignPut(ctx context.Context, key string, size int64, ttl time.Duration) (string, time.Time, error)
|
|
}
|