MediaReplicaRequestedPayload media.replica.requested@1

Generated at from openvibe-contracts v0.97.0 and openvibe-sdk v0.26.0.

Version
1.0.0
Owner
media
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/events/payloads/media.replica.requested.v1.json

media.replica.requested v1 (OpenVibe.Media server/objects/tiering.js promote(), the recordPlacement inside the transaction that starts the copy; PR #18). Media decided to place a replica of a ready object: the canonical copy stays where it is and the bytes are copied to the target provider (R2, the popularity cache). Recorded before the copy, so a request with no following media.replica.ready means the copy never verified and no replica exists. The payload is deliberately narrow: the object id and its tenant, the placement class, the decision and the two providers. Envelope: subject { type: object, id: <object_id> }, visibility internal, priority low, actor service:media, source media. Sandbox tenants produce none. The event type is inside media.* because OpenVibe.Events gates a service's event_type to a prefix that starts with its source name.

Fields

FieldTypeRequiredDescriptionConstraints
object_idstringyes
  • pattern ^med_[0-9A-HJKMNP-TV-Z]{26}$
app_idstring | nullyesThe tenant that owns the object: an app (live, tools…) or a developer project's production tenant (prj_…); null when the object has no tenant.
  • minLength 1
  • maxLength 200
classenumyesThe placement class the move was budgeted against (media.storage_policy classes; tiering.classOf).
  • one of "video", "image", "download", "game-asset", "attachment", "backup"
actionenumyespromote copies the object to the target provider, demote removes a replica from it.
  • one of "promote", "demote"
fromenumyesThe canonical provider the copy is read from; null when the object has no canonical copy at request time.
  • one of "local", "b2", "r2", null
toenumyesThe provider the replica is placed on.
  • one of "local", "b2", "r2"
providerenumyesThe replica provider, named again so the decision is readable on its own.
  • one of "local", "b2", "r2"

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: no-canonical-copy
{
  "object_id": "med_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "app_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "class": "image",
  "action": "promote",
  "from": null,
  "to": "r2",
  "provider": "r2"
}
Valid: promote-local-to-r2
{
  "object_id": "med_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "app_id": "live",
  "class": "video",
  "action": "promote",
  "from": "local",
  "to": "r2",
  "provider": "r2"
}
Rejected: leaks-title
{
  "object_id": "med_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "app_id": "live",
  "class": "video",
  "action": "promote",
  "from": "local",
  "to": "r2",
  "provider": "r2",
  "title": "My stream"
}
Rejected: unknown-action
{
  "object_id": "med_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "app_id": "live",
  "class": "video",
  "action": "move",
  "from": "local",
  "to": "r2",
  "provider": "r2"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('media.replica.requested@1', value);   // { valid, errors: [{ path, message }] }