Documentation
¶
Index ¶
- Variables
- func ValidatePath(p string) error
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) DeleteObject(ctx context.Context, path string) error
- func (b *InMemoryBackend) GetObject(ctx context.Context, path string) (*Object, error)
- func (b *InMemoryBackend) ListAllObjects(ctx context.Context, prefix string) []*Item
- func (b *InMemoryBackend) ListItems(ctx context.Context, in ListItemsInput) *ListItemsOutput
- func (b *InMemoryBackend) PutObject(ctx context.Context, path string, body []byte, ...) (*Object, error)
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) Stats(ctx context.Context) Stats
- func (b *InMemoryBackend) UpdateObjectMetadata(ctx context.Context, path, contentType, cacheControl string) error
- type Item
- type ListItemsInput
- type ListItemsOutput
- type Object
- type Provider
- type Stats
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this handler instance handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase AWS service name for fault rule matching.
func (*Handler) ExtractOperation ¶
ExtractOperation returns the operation name from the request method.
func (*Handler) ExtractResource ¶
ExtractResource extracts the path from the URL.
func (*Handler) GetSupportedOperations ¶
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 ¶
MatchPriority returns the routing priority.
func (*Handler) RouteMatcher ¶
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 ¶
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) 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 ¶
func (b *InMemoryBackend) ListItems(ctx context.Context, in ListItemsInput) *ListItemsOutput
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 ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the MediaStore Data backend and handler.