Help us shape the future of Go! Take the 2026 Go Developer Survey

mediastoredata

package
v1.8.3 Latest Latest
Warning

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

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

README

MediaStore Data

Parity grade: A · SDK aws-sdk-go-v2/service/mediastoredata@v1.32.4 · last audited 2026-10-07 (bce8159207)

Coverage

Metric Value
PARITY entries audited 5 (5 ok)
Feature families 2 (2 ok)
Known gaps 1
Structural gaps (can't be emulated) 1
Deferred items 1
Resource leaks clean
Known gaps
  • ValidationException (bad Path, out-of-range ListItems MaxResults) and PutObject's XAmzContentSHA256Mismatch are served but are not in any of the 5 per-op error models at v1.32.4 and no AWS page names the exact error codes; the names used are best-effort.
Structural gaps

These do not block an A grade — no implementation could produce real data here because the underlying data source cannot exist in an emulator.

  • x-amz-upload-availability STREAMING: real MediaStore serves partial reads of an in-flight upload; PutObject here is a single atomic request, so no partial object is ever visible. No read response carries UploadAvailability in the SDK, so completed objects are indistinguishable.
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)

	// ErrInvalidUploadAvailability is returned when x-amz-upload-availability
	// is set to a value other than the two real enum members (STANDARD,
	// STREAMING -- aws-sdk-go-v2/service/mediastoredata/types.
	// UploadAvailability's only Values()). See [ErrInvalidPath]'s doc comment
	// for why the wire __type is "ValidationException".
	ErrInvalidUploadAvailability = awserr.New("ValidationException", awserr.ErrInvalidParameter)

	// ErrObjectTooLarge is returned when a PutObject body exceeds the size
	// limit for its upload availability. See [maxObjectSizeStandard]/
	// [maxObjectSizeStreaming]. See [ErrInvalidPath]'s doc comment for why the
	// wire __type is "ValidationException" -- this limit has no exception of
	// its own in mediastoredata's 4-exception model (types/errors.go).
	ErrObjectTooLarge = 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 ContainerResolver

type ContainerResolver interface {
	ContainerExists(region, name string) bool
}

ContainerResolver reports whether a MediaStore container exists.

type Handler

type Handler struct {
	Backend *InMemoryBackend
	// contains filtered or unexported fields
}

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) SetContainerResolver

func (h *Handler) SetContainerResolver(r ContainerResolver)

SetContainerResolver makes requests addressed to a container endpoint fail with ContainerNotFoundException when the container does not exist.

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.

Not a real MediaStore Data API operation (the SDK has none -- PutObject always overwrites the full object). This backs the dashboard-only PATCH /dashboard/api/mediastoredata/objects endpoint (dashboard/ui.go's registerMediaStoreDataUpdateMetadataRoute), a gopherstack-internal UI convenience, not a wire-routed AWS operation -- see gopherstack-vxmb.

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