s3

package
v1.26.4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package s3 provides S3-compatible object storage for the TDTP framework.

The client is implemented on net/http alone (SigV4 in sign.go): Put, Get, Head, ListV2, Delete and CreateBucket. No AWS SDK — the exchange here is small packets ("скачать/записать"), the full SDK only added ~4.5 MB of credential-chain and multipart code this driver never uses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureBucket

func EnsureBucket(ctx context.Context, cfg storage.Config) error

EnsureBucket creates bucket when missing; an already-owned bucket is OK. Used by test setup and ops tooling — not part of ObjectStorage.

func NewDriver

func NewDriver(cfg storage.Config) (storage.ObjectStorage, error)

NewDriver creates an S3 driver from the given Config.

Types

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver implements storage.ObjectStorage over an S3-compatible API.

func (*Driver) Close

func (d *Driver) Close() error

Close is a no-op; the client is stateless.

func (*Driver) Delete

func (d *Driver) Delete(ctx context.Context, key string) error

Delete removes the object at key.

func (*Driver) Get

func (d *Driver) Get(ctx context.Context, key string) (io.ReadCloser, error)

Get returns a ReadCloser for the object at key. Caller must close it.

func (*Driver) List

func (d *Driver) List(ctx context.Context, prefix string) ([]storage.ObjectInfo, error)

List returns all objects with the given prefix.

func (*Driver) Put

func (d *Driver) Put(ctx context.Context, key string, reader io.Reader, meta map[string]string) error

Put streams reader to S3 key, attaching meta as x-amz-meta-tdtp-* headers. Small packets (≤ a few MB) go as a single PutObject — no multipart, no temp files.

func (*Driver) Stat

func (d *Driver) Stat(ctx context.Context, key string) (*storage.ObjectInfo, error)

Stat returns metadata for the object at key.

type Error

type Error struct {
	Op         string // e.g. "Put key", "Get key"
	StatusCode int
	Code       string
	Message    string
}

Error is an S3 request failure: HTTP status plus the <Code>/<Message> from the XML error body when the server sent one.

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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