Documentation
¶
Overview ¶
Package s3adapter adapts an mcp-s3 client to the portal.S3Client interface used by the portal handler for blob storage. It lives in its own package so the (self-contained) adapter mechanism does not count against the portal package's size budget.
Index ¶
- type API
- type ClientAdapter
- func (a *ClientAdapter) Close() error
- func (a *ClientAdapter) DeleteObject(ctx context.Context, bucket, key string) error
- func (a *ClientAdapter) GetObject(ctx context.Context, bucket, key string) (body []byte, contentType string, err error)
- func (a *ClientAdapter) PutObject(ctx context.Context, bucket, key string, data []byte, contentType string) error
- func (a *ClientAdapter) PutObjectStream(ctx context.Context, bucket, key string, body io.Reader, contentType string) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
PutObject(ctx context.Context, input *s3client.PutObjectInput) (*s3client.PutObjectOutput, error)
PutObjectStream(ctx context.Context, input *s3client.PutObjectStreamInput) (*s3client.PutObjectOutput, error)
GetObject(ctx context.Context, bucket, key string) (*s3client.ObjectContent, error)
DeleteObject(ctx context.Context, bucket, key string) error
Close() error
}
API is the subset of the mcp-s3 *client.Client the adapter calls. Declaring it as an interface (satisfied by the concrete client) lets the adapter be exercised with an in-memory fake in tests without standing up a real S3 endpoint.
type ClientAdapter ¶
type ClientAdapter struct {
// contains filtered or unexported fields
}
ClientAdapter wraps an mcp-s3 Client to satisfy portal.S3Client. It is returned as a concrete type; callers assign it to a portal.S3Client-typed field, which Go satisfies structurally (no import back into portal).
func New ¶
func New(client *s3client.Client) *ClientAdapter
New creates a ClientAdapter backed by an mcp-s3 Client.
func (*ClientAdapter) Close ¶
func (a *ClientAdapter) Close() error
Close releases the underlying client.
func (*ClientAdapter) DeleteObject ¶
func (a *ClientAdapter) DeleteObject(ctx context.Context, bucket, key string) error
DeleteObject removes the object at the given bucket and key.
func (*ClientAdapter) GetObject ¶
func (a *ClientAdapter) GetObject(ctx context.Context, bucket, key string) (body []byte, contentType string, err error)
GetObject fetches the object at the given bucket and key.