mediastoredata

package
v1.1.2 Latest Latest
Warning

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

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

README

MediaStore Data

Parity grade: B · SDK aws-sdk-go-v2/service/mediastoredata@v1.29.19 · last audited 2026-07-13 (669b02ee0e53a5fb8796a317745e41f80638e107)

Coverage

Metric Value
Operations audited 5 (4 ok, 1 partial)
Feature families 2 (2 ok)
Known gaps 3
Deferred items 1
Resource leaks clean
Known gaps
  • PutObject's ad-hoc validation error codes (InvalidPathException, InvalidStorageClassException, InvalidContentSHA256Exception) are not part of the real mediastoredata SDK's error model (types/errors.go only defines ContainerNotFoundException, InternalServerError, ObjectNotFoundException, RequestedRangeNotSatisfiableException). A conformant SDK client can never trigger these paths anyway (client-side validators.go rejects nil/empty Path before the request is even sent), so this only affects raw-HTTP/curl-style callers; the SDK itself degrades gracefully to smithy.GenericAPIError on an unrecognized __type. Left as-is (no known correct replacement code exists in the model); not fixed this pass.
  • x-amz-upload-availability STREAMING is stored/echoed but has no real chunked/progressive-download semantics (an object is only ever visible after PutObject fully returns) -- real MediaStore streams partial reads to STREAMING objects while still uploading and ignores Range for such objects mid-upload. Not modeled; would require a bigger feature (partial/chunked PutObject) to emulate faithfully.
  • ContainerNotFoundException (a real modeled error) is never returned by this handler -- mediastoredata has no notion of containers in gopherstack's per-region flat object store (containers are provisioned by the separate mediastore service, not mediastoredata). Deferred: would require cross-referencing services/mediastore's container registry, which is out of scope for a mediastoredata-only pass (cross-service change).
Deferred
  • cross-service container-existence validation against services/mediastore (see gaps)

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a requested object does not exist.
	ErrNotFound = awserr.New("ObjectNotFoundException", awserr.ErrNotFound)

	// ErrInvalidPath is returned when a path fails validation.
	ErrInvalidPath = awserr.New("InvalidPathException", awserr.ErrInvalidParameter)

	// ErrInvalidStorageClass is returned when an unknown storage class is supplied.
	ErrInvalidStorageClass = awserr.New("InvalidStorageClassException", awserr.ErrInvalidParameter)
)

Functions

func ValidatePath

func ValidatePath(p string) error

ValidatePath checks that path is a legal MediaStore object path.

Types

type Handler

type Handler struct {
	Backend *InMemoryBackend
}

Handler is the Echo HTTP handler for Amazon MediaStore Data operations.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a new MediaStore Data handler.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns all regions this handler instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the operation name from the request method.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource extracts the path from the URL.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the list of supported operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a function that matches MediaStore Data requests. It identifies requests by the "mediastoredata" marker in the User-Agent header, which the AWS SDK always includes.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend. MediaStore Data had no persistence at all before Phase 3.3 -- neither Handler nor InMemoryBackend implemented Snapshot/Restore, so cli.go's generic setupPersistence (which type-asserts the registered service.Registerable, i.e. the Handler, for a Snapshot/Restore pair) never picked MediaStore Data up: dead wiring, with no persistence underneath it either. This delegation (matching the codecommit/cleanrooms/mediastore pattern) wires MediaStore Data into persistence for the first time.

type InMemoryBackend

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

InMemoryBackend is the in-memory store for MediaStore Data objects, nested per region.

states is nested per-region (map[string]*store.Table[Object] -- outer key is region) because MediaStore Data objects are isolated per region (see getRegion): the set of regions is only known at runtime, so states is NOT registered on a *store.Registry (Registry's SnapshotAll/RestoreAll require a fixed, construction-time-known table-name set) and is captured/restored directly in persistence.go instead, matching services/mediastore's region-nested containers field.

func NewInMemoryBackend

func NewInMemoryBackend(region string) *InMemoryBackend

NewInMemoryBackend creates a new in-memory MediaStore Data backend.

func (*InMemoryBackend) DeleteObject

func (b *InMemoryBackend) DeleteObject(ctx context.Context, path string) error

DeleteObject removes an object by path.

func (*InMemoryBackend) GetObject

func (b *InMemoryBackend) GetObject(ctx context.Context, path string) (*Object, error)

GetObject retrieves an object by path.

func (*InMemoryBackend) ListAllObjects

func (b *InMemoryBackend) ListAllObjects(ctx context.Context, prefix string) []*Item

ListAllObjects returns all stored objects for the request region for dashboard display.

func (*InMemoryBackend) ListItems

ListItems returns items at the given folder path with optional pagination.

func (*InMemoryBackend) PutObject

func (b *InMemoryBackend) PutObject(
	ctx context.Context,
	path string, body []byte, contentType, cacheControl, storageClass, uploadAvailability string,
) (*Object, error)

PutObject stores an object at the given path. Returns ErrInvalidPath if path is malformed or ErrInvalidStorageClass if storageClass is unrecognised.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the backend's default region.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serializes the backend state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) Stats

func (b *InMemoryBackend) Stats(ctx context.Context) Stats

Stats returns aggregate object count and total stored bytes for the request region.

func (*InMemoryBackend) UpdateObjectMetadata

func (b *InMemoryBackend) UpdateObjectMetadata(ctx context.Context, path, contentType, cacheControl string) error

UpdateObjectMetadata updates content-type and cache-control on an existing object without re-uploading the body. Returns ErrNotFound if path is absent.

type Item

type Item struct {
	LastModified  time.Time
	Name          string
	Type          string
	ETag          string
	SHA256        string
	ContentType   string
	CacheControl  string
	StorageClass  string
	ContentLength int64
}

Item is a metadata entry for a folder or object returned by ListItems.

type ListItemsInput

type ListItemsInput struct {
	FolderPath string
	NextToken  string // opaque pagination cursor (item Name)
	MaxResults int    // 0 → defaultMaxResults
}

ListItemsInput parameterises a ListItems call.

type ListItemsOutput

type ListItemsOutput struct {
	NextToken string // empty when no further pages remain
	Items     []*Item
}

ListItemsOutput is returned by ListItems.

type Object

type Object struct {
	LastModified       time.Time
	Path               string
	ETag               string
	SHA256             string // cached hex-encoded SHA-256 of Body
	ContentType        string
	CacheControl       string
	StorageClass       string
	UploadAvailability string
	Body               []byte
	ContentLength      int64
}

Object represents a stored media object.

Path is the object's normalized path (see normalizePath) and is also the primary key of the per-region store.Table it is stored in (see objectKeyFn in store_setup.go) -- it must always be set to the same value as the map key that used to hold the object pre-Phase-3.3, and must stay exported/serialized (no json:"-") since Object is registered directly rather than through a DTO (see .claude/memories/parity-principles.md's json:"-" hidden-ID gotcha).

type Provider

type Provider struct{}

Provider implements service.Provider for MediaStore Data.

func (*Provider) Init

Init initializes the MediaStore Data backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type Stats

type Stats struct {
	ObjectCount int
	TotalBytes  int64
}

Stats holds aggregate metrics for the store.

Jump to

Keyboard shortcuts

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