If beneficial for performance or complexity sections

This commit is contained in:
Stefan Schießl 2018-08-10 07:15:18 +02:00 committed by GitHub
parent f9c2df5d35
commit bd2af374af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -103,7 +103,7 @@ List of possible restrictions are:
| `any` | [`list`, `of`, `allowed`, `values`] | stateless | | `any` | [`list`, `of`, `allowed`, `values`] | stateless |
| `none` | [`none`, `of`, `these`, `values`] | stateless | | `none` | [`none`, `of`, `these`, `values`] | stateless |
| `lt, le, gt, ge, eq, neq` | `comparative` | stateless | | `lt, le, gt, ge, eq, neq` | `comparative` | stateless |
| `contains, not_contains` | [`list`, `of`, `values`] | stateless | | `contains_all, contains_none` | [`list`, `of`, `values`] | stateless |
| `limit` | [`max_cumsum`, `interval_in_sec`] | [`current_cumsum`, `interval_began`] | | `limit` | [`max_cumsum`, `interval_in_sec`] | [`current_cumsum`, `interval_began`] |
| `limit_monthly` | [`max_cumsum`, `interval_in_months`] | [`current_cumsum`, `interval_began`] | | `limit_monthly` | [`max_cumsum`, `interval_in_months`] | [`current_cumsum`, `interval_began`] |
| `attribute_assert` | list of restrictions | stateless | | `attribute_assert` | list of restrictions | stateless |
@ -117,15 +117,22 @@ Following cases must hold for a restriction:
Note: Note:
- If required a field can be added that stores the assumed type of the argument - If required a field can be added that stores the assumed type of the argument
- This list of restrictions may be redefined to improve clarity, performance or to reduce complexity of implementation while maintaining the intended functionality
In the following we list possible `restriction`s. Mentioning `argument value` in the text below refers to the value of In the following we list possible `restriction`s. Mentioning `argument value` in the text below refers to the value of
the argument of the operation specified by `argument` of a restriction. the argument of the operation specified by `argument` of a restriction.
#### `any` #### `any`
Stateless assert, all argument types. `Argument value` must be equal to one of values in the data list Stateless assert, all argument types. `Argument value` must be equal to one of values in the data list.
Note
- If beneficial for performance or complexity an additional operator `equal` can be implemented that only compares to one.
#### `none` #### `none`
Stateless assert, all argument types. `Argument value` must NOT be equal to any of the values in the list. Stateless assert, all argument types. `Argument value` must NOT be equal to any of the values in the list.
Note
- If beneficial for performance or complexity an additional operator `not_equal` can be implemented that only compares to one.
#### `lt, le, gt, ge, eq, neq` #### `lt, le, gt, ge, eq, neq`
Stateless assert. Allows explicit type conversion: Stateless assert. Allows explicit type conversion:
@ -140,12 +147,16 @@ The different asserts read as:
- `gt`: `Argument value` must be greater than `comparative` - `gt`: `Argument value` must be greater than `comparative`
- `ge`: `Argument value` must be greater than or equal to `comparative` - `ge`: `Argument value` must be greater than or equal to `comparative`
- `eq`: `Argument value` must equal to `comparative` - `eq`: `Argument value` must equal to `comparative`
- `eq`: `Argument value` must NOT be equal to `comparative` - `neq`: `Argument value` must NOT be equal to `comparative`
#### `contains, not_contains` Note
- `eq` and `neq` are implicit number comparators and not to be mistaken by a strict left must equal right operator, just like `lt, le, gt, ge` (for example, comparing `1 > list object` would have no sense)
- If beneficial for performance or complexity the implicit type conversions can be removed and distinct operators introduced that do not have implicit type conversions
#### `contains_all, contains_none`
Stateless assert, for `list` type arguments. Stateless assert, for `list` type arguments.
- `contains`: The `argument value` must contain all items specified by `data`, but can contain more - `contains_all`: The `argument value` must contain all items specified by `data`, but can contain more
- `not_contains`: The `argument value` must NOT contain any of the items specified by `data`, but can contain others - `contains_none`: The `argument value` must NOT contain any of the items specified by `data`, but can contain others
#### `limit` #### `limit`
Stateful assert, only `int` type arguments. When the authority is created, `interval_began` is set to `valid_from` from its custom active authority and `max_cumsum` to `0`. Incoming operations are first tried to match all stateless asserts, Stateful assert, only `int` type arguments. When the authority is created, `interval_began` is set to `valid_from` from its custom active authority and `max_cumsum` to `0`. Incoming operations are first tried to match all stateless asserts,
@ -375,7 +386,7 @@ the transaction is executed.
We propose do split the implmentation into two milestones. Each milestone will be voted on as a separate BSIP: We propose do split the implmentation into two milestones. Each milestone will be voted on as a separate BSIP:
1. Implementation of basic functionaliy to allow custom active permissions and authorities, including `any`, `none` and `lt, le, gt, ge, eq, neq`, `contains, not_contains` and `attribute_assert` `asserts`. If deemed necessary by developpers, reduce to only allow one key or one account for every `custom active authority` 1. Implementation of basic functionaliy to allow custom active permissions and authorities, including `any`, `none` and `lt, le, gt, ge, eq, neq`, `contains_all, contains_none` and `attribute_assert` `asserts`. If deemed necessary by developpers, reduce to only allow one key or one account for every `custom active authority`
2. Implement stateful asserts `limit` and `limit_monthly` 2. Implement stateful asserts `limit` and `limit_monthly`
3. Implement `logical_or` 3. Implement `logical_or`