objectstore

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetKey

func AssetKey(identityID, assetID string) string

Types

type Attrs

type Attrs struct {
	SizeBytes int64
	ETag      string
	MIMEType  string
}

type FakeStore

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

func NewFake

func NewFake() *FakeStore

func (*FakeStore) Delete

func (s *FakeStore) Delete(ctx context.Context, ref ObjectRef) error

func (*FakeStore) Get

func (s *FakeStore) Get(ctx context.Context, ref ObjectRef) (io.ReadCloser, Attrs, error)

func (*FakeStore) Head

func (s *FakeStore) Head(ctx context.Context, ref ObjectRef) (Attrs, error)

func (*FakeStore) PresignPut

func (s *FakeStore) PresignPut(ctx context.Context, req PresignPutRequest) (PresignedPut, error)

func (*FakeStore) Put

func (s *FakeStore) Put(ctx context.Context, ref ObjectRef, body io.Reader, opts PutOptions) (Attrs, error)

type FilesystemStore

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

func NewFilesystem

func NewFilesystem(root string) *FilesystemStore

func (*FilesystemStore) Delete

func (s *FilesystemStore) Delete(ctx context.Context, ref ObjectRef) error

func (*FilesystemStore) Get

func (*FilesystemStore) Head

func (s *FilesystemStore) Head(ctx context.Context, ref ObjectRef) (Attrs, error)

func (*FilesystemStore) PresignPut

func (*FilesystemStore) Put

func (s *FilesystemStore) Put(ctx context.Context, ref ObjectRef, body io.Reader, opts PutOptions) (Attrs, error)

type ObjectRef

type ObjectRef struct {
	Bucket string
	Key    string
}

type PresignPutRequest

type PresignPutRequest struct {
	Ref        ObjectRef
	MIMEType   string
	Size       int64
	ExpiresIn  time.Duration
	PublicBase string
}

type PresignedPut

type PresignedPut struct {
	URL             string            `json:"upload_url"`
	Method          string            `json:"method"`
	RequiredHeaders map[string]string `json:"required_headers"`
	ExpiresAt       time.Time         `json:"expires_at"`
}

type PutOptions

type PutOptions struct {
	MIMEType string
	Size     int64
}

type S3Config

type S3Config struct {
	Endpoint       string
	PublicEndpoint string
	Region         string
	AccessKey      string
	SecretKey      string
	PathStyle      bool
}

type S3Store

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

func NewS3

func NewS3(ctx context.Context, cfg S3Config) (*S3Store, error)

func (*S3Store) ConfigureBrowserUploadCORS

func (s *S3Store) ConfigureBrowserUploadCORS(ctx context.Context, bucket string) error

func (*S3Store) Delete

func (s *S3Store) Delete(ctx context.Context, ref ObjectRef) error

func (*S3Store) Get

func (s *S3Store) Get(ctx context.Context, ref ObjectRef) (io.ReadCloser, Attrs, error)

func (*S3Store) Head

func (s *S3Store) Head(ctx context.Context, ref ObjectRef) (Attrs, error)

func (*S3Store) PresignPut

func (s *S3Store) PresignPut(ctx context.Context, req PresignPutRequest) (PresignedPut, error)

func (*S3Store) Put

func (s *S3Store) Put(ctx context.Context, ref ObjectRef, body io.Reader, opts PutOptions) (Attrs, error)

Jump to

Keyboard shortcuts

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