Documentation
¶
Overview ¶
Package storage is the object-storage port for the document framework: the kernel never talks to S3/minio/GCS directly, it talks to an Adapter. Uploads and downloads go through short-lived presigned URLs so blob bytes never transit the API process. The memory adapter (NewMemory) backs tests and local dev; a production adapter (S3/minio) implements the same four methods.
Index ¶
- type Adapter
- type Memory
- func (m *Memory) Delete(_ context.Context, key string) error
- func (m *Memory) Has(key string) bool
- func (m *Memory) Peek(_ context.Context, key string, n int) ([]byte, error)
- func (m *Memory) PresignGet(_ context.Context, key string, ttl time.Duration) (PresignedURL, error)
- func (m *Memory) PresignPut(_ context.Context, key string, ttl time.Duration) (PresignedURL, error)
- func (m *Memory) Put(key string, data []byte)
- func (m *Memory) Stat(_ context.Context, key string) (ObjectInfo, error)
- type ObjectInfo
- type PresignedURL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface {
PresignPut(ctx context.Context, key string, ttl time.Duration) (PresignedURL, error)
PresignGet(ctx context.Context, key string, ttl time.Duration) (PresignedURL, error)
Stat(ctx context.Context, key string) (ObjectInfo, error)
// Peek returns up to n leading bytes for MIME sniffing (http.DetectContentType
// reads at most 512). Returns KindNotFound if the object is absent.
Peek(ctx context.Context, key string, n int) ([]byte, error)
Delete(ctx context.Context, key string) error
}
Adapter is the object-storage port.
A tenant-prefixed Key ("<tenant>/<document>/<version>") is minted by the document service; the adapter treats keys as opaque. PresignPut/PresignGet return URLs valid for ttl. Stat and Peek support confirm-time verification (size + SHA-256 + a MIME-sniff prefix); a real adapter implements Stat via a HEAD and Peek via a ranged GET. Delete backs retention voiding.
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
Memory is an in-process Adapter for tests and local dev. Presigned URLs are synthetic ("mem://<key>?..."); the test/client uploads by calling Put with the bytes (standing in for the client's PUT to the presigned URL). Concurrency-safe.
func (*Memory) PresignGet ¶
func (*Memory) PresignPut ¶
type ObjectInfo ¶
ObjectInfo is what the store reports about a stored blob at confirm time. Checksum is the lowercase hex SHA-256 of the bytes.