mediastoredata

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

MediaStore Data

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

Coverage

Metric Value
Operations audited 5 (5 ok)
Feature families 2 (2 ok)
Known gaps 4
Deferred items 1
Resource leaks clean
Known gaps
  • ValidationException (used by PutObject/GetObject/DeleteObject/DescribeObject via ValidatePath, and separately by ListItems for an out-of-range MaxResults) and PutObject's XAmzContentSHA256Mismatch, while real AWS error names (unlike the fabricated names they replaced this pass), are not officially enumerated in ANY of mediastoredata's 5 per-op error models -- confirmed this pass by reading all 5 deserializeOpError* switches at the pinned v1.32.4: PutObject/ListItems={ContainerNotFoundException,InternalServerError}, DeleteObject/DescribeObject={+ObjectNotFoundException}, GetObject={+ObjectNotFoundException,RequestedRangeNotSatisfiableException} -- none list ValidationException. (The prior audit only checked/flagged this for PutObject and GetObject; it applies identically to DeleteObject, DescribeObject, and ListItems since they share the same ValidatePath/MaxResults-bound code paths.) All of these ARE reachable by a real (non-conformant-only) SDK caller: client-side validators.go on every op checks only that Path/Body != nil (never their content), and ListItemsInput has no client-side validator at all -- confirmed via grep 'func validateOp' validators.go returning only 4 hits (Delete/Describe/Get/PutObjectInput), so a malformed Path or out-of-range MaxResults always reaches the server. 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 and 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 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 the Range header for such objects mid-upload (api_op_GetObject.go:62-63: 'ignores this header for partially uploaded objects'). Verified this pass that this is a genuine, permanent absence, not a partial gap: neither GetObjectOutput, DescribeObjectOutput, nor Item (the ListItems entry) has an UploadAvailability field at all in the real SDK, so a COMPLETED object's read response is byte-identical regardless of how it was uploaded in real AWS too -- there is nothing for gopherstack to expose on a normal read either way. The only real difference is entirely inside the upload window (an in-flight PUT's partial bytes become visible to a concurrent GET), which requires a chunked/progressive PutObject this backend's atomic single-request model cannot produce. UploadAvailability is stored on Object (and persisted) purely as an internal record, never serialized onto any wire response -- not modeled elsewhere, 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). Confirmed structural, not just deferred-for-convenience: the real wire protocol has NO ContainerName-shaped field on any of the 5 operations (confirmed: grep ContainerName across the whole pinned SDK package returns nothing) -- real MediaStore Data identifies the target container purely by which per-container hostname the client's BaseEndpoint points at (endpoints.go:204 resolveBaseEndpoint; a container's Endpoint, e.g. https://.data.mediastore..amazonaws.com, is obtained out-of-band from mediastore:DescribeContainer). gopherstack is single-origin and routes purely on SDK User-Agent marker (handler.go RouteMatcher), with no Host-based dispatch anywhere in the codebase (confirmed: no r.Host/Header.Get("Host") use in pkgs/service or this package). Reaching ContainerNotFoundException would need BOTH: (1) route-level wiring to recover a container identifier from the request (most plausibly the Host header, since gopherstack's mediastore already synthesizes AWS-shaped per-container endpoint hostnames in containerEndpoint() -- services/mediastore/store.go:27), which touches RouteMatcher/cli.go and is out of scope here, AND (2) a cross-service read of services/mediastore's container registry from this handler. Deferred: cross-service + routing change, out of scope for a mediastoredata-only pass.
  • InMemoryBackend.UpdateObjectMetadata (objects.go) is NOT a wire-routed AWS operation and has no aws-sdk-go-v2/service/mediastoredata counterpart (confirmed: only PutObject/GetObject/DeleteObject/DescribeObject/ListItems exist in the real SDK's api_op_*.go set) -- gopherstack-vxmb's premise that it was orphaned dead code was WRONG: it is the sole implementation behind dashboard/ui.go's registerMediaStoreDataUpdateMetadataRoute, which IS registered (called from setupSubRouter) and backs the live PATCH /dashboard/api/mediastoredata/objects dashboard-only endpoint. A service-directory-scoped grep for callers missed this cross-package (dashboard/) consumer and led to briefly (and incorrectly) deleting it 2026-08-07 before the dashboard build failure caught the mistake; restored with a doc comment recording that it is intentionally dashboard-internal, not a modeled AWS operation.
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)
)

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.

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