mediastoredata

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 19 Imported by: 0

README

MediaStore Data

Parity grade: A · SDK aws-sdk-go-v2/service/mediastoredata@v1.29.19 · last audited 2026-07-24 (f0a0c951412c5ff4f0122ab4503605c44c2fef49)

Coverage

Metric Value
Operations audited 5 (5 ok)
Feature families 2 (2 ok)
Known gaps 3
Deferred items 1
Resource leaks clean
Known gaps
  • PutObject/GetObject's ValidationException and PutObject's XAmzContentSHA256Mismatch, while real AWS error names (unlike the fabricated names they replaced this pass), are not officially enumerated in mediastoredata's own narrow per-op error models (deserializeOpErrorPutObject only lists ContainerNotFoundException/InternalServerError; deserializeOpErrorGetObject adds ObjectNotFoundException/RequestedRangeNotSatisfiableException but still no ValidationException). Both conditions ARE reachable by a real (non-conformant-only) SDK caller though: client-side validators.go only checks Path != nil (an empty non-nil Path, a Path containing '..', or an out-of-range StorageClass string all pass client-side validation and would hit a real server), so this isn't dead/unreachable code. Without live-AWS access there is no way to confirm the exact wire name real AWS uses for these cases; ValidationException/XAmzContentSHA256Mismatch are the closest verified-real AWS error names (established gopherstack-wide convention / confirmed real S3-family error respectively) and are a strict improvement over the wholly-invented names they replaced. The empty-Path sub-case specifically IS unreachable via a real SDK client (client serializers reject Path==nil or len(Path)==0 with a local SerializationError before the request is ever sent), so that one branch can never be observed on the wire at all.
  • 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, present in every op's model) 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.
	//
	// The wire __type for this is "ValidationException", NOT a fabricated
	// "InvalidPathException" -- the real mediastoredata SDK error model
	// (aws-sdk-go-v2/service/mediastoredata/types/errors.go) defines exactly
	// four exceptions (ContainerNotFoundException, InternalServerError,
	// ObjectNotFoundException, RequestedRangeNotSatisfiableException) and none
	// of them cover client-side parameter validation. "ValidationException" is
	// the AWS-wide/gopherstack-wide convention for this situation (see e.g.
	// services/mediastore/handler.go, and this handler's own MaxResults bound
	// check), which is a real error name actually used across AWS APIs, unlike
	// a wholly invented service-specific exception name.
	ErrInvalidPath = awserr.New("ValidationException", awserr.ErrInvalidParameter)

	// ErrInvalidStorageClass is returned when an unknown storage class is
	// supplied. See [ErrInvalidPath]'s doc comment for why the wire __type is
	// "ValidationException" rather than a fabricated
	// "InvalidStorageClassException".
	ErrInvalidStorageClass = awserr.New("ValidationException", 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"/"mediastore-data" marker present in either the User-Agent header (set by native SDKs) or the X-Amz-User-Agent header (used by the AWS SDK for JavaScript in a browser, which cannot set User-Agent itself -- see service.MatchesUserAgentMarker).

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