Actor Namespace 0.1.0
IDごとに状態を保存し、処理を順番に実行するActorの名前空間を定義します。
公開パッケージの内容を取得して検証済みです。
Hostの対応や受け入れ判断は、パッケージの公開とは別です。このバージョンを使う前に、利用先のHostで確認してください。
使い方
チャットの部屋IDごとに状態を保存し、呼び出しを順番に扱うときに使います。部屋ごとにインフラのリソースを作る必要はありません。
たとえばチャットの部屋ごとにActorを使えます。このFormで指定するのはWorkerとクラス名です。個々のActorは実行時にIDで呼び出し、最初の呼び出しで作られます。部屋ごとにFormリソースを作るものではありません。トラフィックの重みが付いたすべてのWorkerVersionで、そのクラスをエクスポートする必要があります。
組み合わせと比較対象
- ModuleWorker 0.1.0 — 必須の参照:Actorクラスを実行するWorkerです。
- WorkerVersion 0.3.0 — コードと呼び出し側:実行するバージョンはクラスを公開し、呼び出し側は型付きActor Bindingを使います。
- WorkerDeployment 0.2.0 — 実行コードの選択:Actor専用のコード固定ではなく、有効なデプロイがバージョンを選びます。
定義の説明(英語原文)
Long-lived identity of one addressable-actor id space: a class the worker's active deployment serves, with at most one live execution context per actor id, private durable storage per id, and one alarm per id. The Form fixes that model by identity through the worker.actor@1.0.0 contract in its providedInterfaces; it carries no implementation snapshot, so which code answers is whatever the worker's active Worker Deployment selects. Actors are runtime data reached through module-worker.actor bindings, never Resources: every id addresses an actor and the first delivery is its creation. One worker carries at most one Actor Namespace per class name, because two namespaces over one class would give that class two disjoint id spaces.
設定項目
項目名とスキーマ内の説明は、パッケージに含まれる英語の原文です。日本語の解説は定義に要件を追加するものではありません。
className
必須 · string
Class export name the serving module provides, in the JavaScript identifier grammar. Every weighted version of the active deployment must export it; one that does not keeps this namespace from becoming Ready, and invoking a stub of it is refused rather than queued.
- pattern: "^[A-Za-z_$][A-Za-z0-9_$]*$"
worker
必須 · object
Module Worker identity whose active deployment serves this actor class. Changing it replaces the namespace.
- additionalProperties: false
設定の例
パッケージに含まれるfixtures/desired.jsonをそのまま掲載しています。完全なHost APIリクエストやOpenTofuの設定ではありません。例のリソース参照とArtifactのダイジェストは、実際の値に置き換えてください。このJSONだけでリソースが作成されることはありません。
{
"className": "ChatRoom",
"worker": {
"apiVersion": "edge.forms.takoform.com",
"kind": "ModuleWorker",
"name": "module-worker"
}
}設定のスキーマ全文(英語原文)
入れ子の項目、選択肢、すべてのスキーマ制約を以下に掲載しています。Hostが検証する意味上の規則は、定義の説明にも記載されています。
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"description": "Long-lived identity of one addressable-actor id space: a class the worker's active deployment serves, with at most one live execution context per actor id, private durable storage per id, and one alarm per id. The Form fixes that model by identity through the worker.actor@1.0.0 contract in its providedInterfaces; it carries no implementation snapshot, so which code answers is whatever the worker's active Worker Deployment selects. Actors are runtime data reached through module-worker.actor bindings, never Resources: every id addresses an actor and the first delivery is its creation. One worker carries at most one Actor Namespace per class name, because two namespaces over one class would give that class two disjoint id spaces.",
"properties": {
"className": {
"description": "Class export name the serving module provides, in the JavaScript identifier grammar. Every weighted version of the active deployment must export it; one that does not keeps this namespace from becoming Ready, and invoking a stub of it is refused rather than queued.",
"pattern": "^[A-Za-z_$][A-Za-z0-9_$]*$",
"type": "string"
},
"worker": {
"additionalProperties": false,
"description": "Module Worker identity whose active deployment serves this actor class. Changing it replaces the namespace.",
"properties": {
"apiVersion": {
"const": "edge.forms.takoform.com",
"type": "string"
},
"kind": {
"const": "ModuleWorker",
"type": "string"
},
"name": {
"maxLength": 63,
"minLength": 1,
"pattern": "^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$",
"type": "string"
}
},
"required": [
"apiVersion",
"kind",
"name"
],
"type": "object",
"x-takoform-required-interface": {
"apiVersion": "interfaces.takoform.com/v1alpha1",
"name": "worker.runtime",
"schemaDigest": "sha256:ed2f8211aac5be94488d391945ca6aca7627a4ecbd261e39790093e887feae08",
"version": "1.1.0"
}
}
},
"required": [
"className",
"worker"
],
"title": "Actor Namespace desired state",
"type": "object"
}ライフサイクル
役割: identity — 特定のコードの版やトラフィックの割り当てとは分けて扱う、長く使うリソースの識別子です。
この定義が持つ操作は以下のとおりです。変更不可のrevisionは書き換えず、新しいリソースとして作成します。
- create
- read
- delete
- import
- observe
提供するInterface
- worker.actor@1.0.0 — sha256:f5428fb587de80261dd7363dc5b8a3f4aab7e469fa1b5fce8441ad9acbec8218
パッケージ参照
| 項目 | 値 |
|---|---|
| Kind | ActorNamespace |
| Package digest | sha256:eb174b666890ef630e82746374c8a91aec8692c64e98e82dc580a85d17307743 |
| Schema digest | sha256:3669f3bebf7b4c6169d5a3cdf7e7ca4e8d1851516702a437be6ef69c2b9b98d7 |
| Tag | forms/k-mvsgozjomzxxe3ltfz2gc23pmzxxe3jomnxw2l2bmn2g64somfwwk43qmfrwk/sha256-eb174b666890ef630e82746374c8a91aec8692c64e98e82dc580a85d17307743 |
| Source path | forms/releases/k-mvsgozjomzxxe3ltfz2gc23pmzxxe3jomnxw2l2bmn2g64somfwwk43qmfrwk/sha256-eb174b666890ef630e82746374c8a91aec8692c64e98e82dc580a85d17307743 |
| 署名セット | e7f8a39311dd011b8467e97e7f300cabb9a6b06c |
4項目のFormRef
{
"apiVersion": "edge.forms.takoform.com",
"kind": "ActorNamespace",
"definitionVersion": "0.1.0",
"schemaDigest": "sha256:3669f3bebf7b4c6169d5a3cdf7e7ca4e8d1851516702a437be6ef69c2b9b98d7"
}次に進む
- アプリを作る:利用するHostのドキュメントで接続先・認証・対応する正確なFormRefを確認し、そのHostで使うOpenTofuの案内またはGoクライアントの手順へ進みます。ここに載せたJSONは設定の形を読む例で、配備手順ではありません。
- Hostやクライアントを実装する:Coreの実装ガイドで共通APIと検証の手順を確認します。各Formの振る舞いを実装する必要があり、Schemaの検証だけでは対応済みになりません。
- 定義を検証する:各ページのパッケージ参照から、正確なタグ・ダイジェスト・Schemaを照合します。パッケージ検証は利用するHostへの接続なしで試せます。