Part of Stem. This page defines the SetPolicy method of the sync RPC specification. Follow, pin and ignore are edits to this resource, not local settings.
The formal schema is attached as the schemaDefinition of this page: a struct {key, input, output} with key pinned to SetPolicy.
Replaces the account's sync policy by publishing a new Snapshot of its policy resource. Because the policy is a resource with audience key of the account, the account's other devices receive it through ordinary sync.
Input
field | type | required | meaning |
|---|---|---|---|
| yes | The account whose policy to write; a local key for it must exist. | |
| list of data/policy-rule | yes | The complete new rule list. |
Output
field | type | required | meaning |
|---|---|---|---|
| yes | The policy resource that was published, at its new version. |
Rules
The daemon must hold a key for account; otherwise invalid-argument.
The daemon builds a Snapshot with the new rules, prev set to the current policy heads, and a Node blob for the policy node (created on first use with access own and a Grant with audience key of the account), signs both, and runs them through Publish.
The policy node is the node of kind policy named policy directly under the account's space root; every device finds it by that name. Its node id is, like every id, the CID of its creating Node blob. Open: whether an account should be allowed several named policies.
The scheduler reloads at once. Rules are validated against the schema; an unknown mode is invalid-argument.
The policy resource is offered to the account's other devices like any other blob in the account's space; they are its only readers.
Today (HM24)
HM24's Subscriptions.Subscribe and Unsubscribe insert and delete rows in a local subscriptions table and run one discovery; the apps call them when a user joins or follows. The roadmap wants subscriptions removed as a user-facing concept. In Stem the user-facing concept is the policy, and joins and follows write rules into it.
Example
{"key": "SetPolicy", "input": {"account": {"/": {"bytes": "7QEAq1…"}}, "rules": [
{"scope": {"space": {"/": {"bytes": "7QEAq1…"}}, "depth": "subtree"}, "mode": "pin"},
{"scope": {"space": {"/": {"bytes": "7QEBz9…"}}, "depth": "subtree"}, "mode": "follow"}
]}}{"policy": {"space": {"/": {"bytes": "7QEAq1…"}}, "node": "policy", "version": "bafy…p7"}}See also
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime