s3adapter

package
v1.113.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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

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.

func (*ClientAdapter) PutObject

func (a *ClientAdapter) PutObject(ctx context.Context, bucket, key string, data []byte, contentType string) error

PutObject uploads data to the given bucket and key.

func (*ClientAdapter) PutObjectStream

func (a *ClientAdapter) PutObjectStream(ctx context.Context, bucket, key string, body io.Reader, contentType string) (int64, error)

PutObjectStream streams body to the given bucket and key, returning the number of bytes uploaded.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL