rpc spec: define method namespacing.

Closes #822
This commit is contained in:
Nick Mathewson 2023-04-13 10:49:20 -04:00
parent 31b6c9243d
commit e524f05aa9
2 changed files with 30 additions and 6 deletions

2
Cargo.lock generated
View File

@ -3098,7 +3098,7 @@ checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.12",
"syn 2.0.14",
]
[[package]]

View File

@ -219,11 +219,8 @@ obj
method
: A string naming the method to invoke. It is required.
Method names are namespaced;
For now, we commit to not using any method name
beginning with "x-" or "X-".
(If you want to reserve any other prefix,
we can eventually start a registry or something.)
Method names are namespaced; see
"Method Namespacing" below.
params
: A JSON object describing the parameters for the method.
@ -307,6 +304,33 @@ Any given response will have exactly one of
> TODO: Specify our error format to be the same as,
> or similar to, that used by JSON-RPC.
#### Method namespacing
Any method name containing a colon belongs to a namespace.
The namespace of a method is everything up to the first colon.
(For example, the method name `arti:connect`
is in the namespace `arti`.
The method name `gettype` is not in any namespace.)
Only this spec MAY declare non-namespaced methods.
All methods defined elsewhere SHOULD be in a namespace.
Right now, the following namespaces are reserved:
* `arti` — For use by the Arti tor implementation project.
* `auth` — Defined in this spec; for authenticating an initial session.
To reserve a namespace, open a merge request to change the list above.
Namespaces starting with `x-` will never be allocated.
They are reserved for experimental use.
Method names starting with `x-` indicate
experimental or unstable status:
any code using them should expect to be unstable.
### Errors
Errors are reported as responses with an `error` field (as above).