Documentation
¶
Index ¶
- func SpacePrefix(tenantID, spaceID uuid.UUID) string
- type ObjectInfo
- type S3Client
- func (c *S3Client) CopyObject(ctx context.Context, srcKey, dstKey string) error
- func (c *S3Client) DeleteObject(ctx context.Context, key string) error
- func (c *S3Client) DeletePrefix(ctx context.Context, prefix string) error
- func (c *S3Client) EnsureBucket(ctx context.Context) error
- func (c *S3Client) GetObject(ctx context.Context, key string) (io.ReadCloser, error)
- func (c *S3Client) HeadObject(ctx context.Context, key string) (ObjectInfo, string, error)
- func (c *S3Client) ListObjects(ctx context.Context, prefix string) ([]ObjectInfo, error)
- func (c *S3Client) Ping(ctx context.Context) error
- func (c *S3Client) PresignGetURL(ctx context.Context, key string, expiry time.Duration) (string, error)
- func (c *S3Client) PresignPutURL(ctx context.Context, key string, expiry time.Duration) (string, error)
- func (c *S3Client) PublicPresignGetURL(ctx context.Context, key string, expiry time.Duration) (string, error)
- func (c *S3Client) PutObject(ctx context.Context, key string, reader io.Reader, size int64) error
- func (c *S3Client) PutObjectWithMetadata(ctx context.Context, key string, reader io.Reader, size int64, ...) error
- func (c *S3Client) SyncDown(ctx context.Context, tenantID, spaceID uuid.UUID, localRoot string) error
- func (c *S3Client) SyncPath(ctx context.Context, tenantID, spaceID uuid.UUID, relPath, localRoot string) error
- func (c *S3Client) SyncUp(ctx context.Context, tenantID, spaceID uuid.UUID, localRoot string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SpacePrefix ¶
SpacePrefix returns the S3 prefix for a space's shared files.
Types ¶
type ObjectInfo ¶
type ObjectInfo struct {
Key string
Size int64
LastModified time.Time
Metadata map[string]string // user-defined S3 metadata (X-Amz-Meta-*)
}
ObjectInfo describes an object in S3.
type S3Client ¶
type S3Client struct {
// contains filtered or unexported fields
}
S3Client provides S3/MinIO file storage for spaces.
func NewS3Client ¶
NewS3Client creates an S3Client from config. Panics if S3URL is empty.
func NewS3ClientFromParams ¶
NewS3ClientFromParams creates an S3Client from explicit parameters (for non-airlock binaries like Anchor).
func (*S3Client) CopyObject ¶
CopyObject performs a server-side copy from srcKey to dstKey within the same bucket.
func (*S3Client) DeleteObject ¶
DeleteObject deletes the object at the given key.
func (*S3Client) DeletePrefix ¶
DeletePrefix deletes all objects under the given prefix.
func (*S3Client) GetObject ¶
GetObject returns a reader for the object at the given key. Caller must close the reader.
func (*S3Client) HeadObject ¶
HeadObject returns metadata for the object at the given key.
func (*S3Client) ListObjects ¶
ListObjects lists objects under the given prefix.
func (*S3Client) Ping ¶
EnsureBucket creates the bucket if it doesn't exist. Ping is a read-only liveness check: HeadBucket on the configured bucket. Returns nil if S3/MinIO is reachable and the bucket exists.
func (*S3Client) PresignGetURL ¶
func (c *S3Client) PresignGetURL(ctx context.Context, key string, expiry time.Duration) (string, error)
PresignGetURL returns a presigned GET URL for downloading a file.
func (*S3Client) PresignPutURL ¶
func (c *S3Client) PresignPutURL(ctx context.Context, key string, expiry time.Duration) (string, error)
PresignPutURL returns a presigned PUT URL for uploading a file.
func (*S3Client) PublicPresignGetURL ¶
func (c *S3Client) PublicPresignGetURL(ctx context.Context, key string, expiry time.Duration) (string, error)
PublicPresignGetURL returns a presigned GET URL signed for the public endpoint. If S3_URL_PUBLIC is not configured, falls back to the internal presigned URL.
func (*S3Client) PutObject ¶
PutObject uploads data from a reader to the given key. If the reader is not seekable, it is buffered into memory first.
func (*S3Client) PutObjectWithMetadata ¶ added in v0.2.0
func (c *S3Client) PutObjectWithMetadata(ctx context.Context, key string, reader io.Reader, size int64, meta map[string]string) error
PutObjectWithMetadata is the same as PutObject but persists user-defined metadata (X-Amz-Meta-*) on the stored object. The "filename" key carries the original upload filename — surfaced via HeadObject.Metadata. The "content-type" key, if set, overrides the auto-detected Content-Type.
func (*S3Client) SyncDown ¶
func (c *S3Client) SyncDown(ctx context.Context, tenantID, spaceID uuid.UUID, localRoot string) error
SyncDown downloads the shared/ directory from S3 to localRoot/shared/.