Comments (3)
The filter is part of the old processing logic of the protocol stack, and is used to distribute requests to different handlers.
Currently recommended use req_path to distribute between different handlers, and the filter field should be left empty.
from cyfs.
This filter is a built-in expression of cyfs-stack, the design and development was completed relatively early, some historical reasons for not updating to github, the following is the documentation of the filter expression:
Legal characters supported by filter expression variables
The legal character set is as follows
- English letters
- numbers
- hyphen (-)
- underscore (_)
- dot (.)
- dollar sign($)
- asterisk(*)
- forward slash (/) and backslash (\)
If the variable contains characters other than the above legal ones, you need to enclose it in quotes, either single or double quotes
req_path == '/put/**'
req_path == "/'put'/**"
Integer constants are available in binary, octal, decimal and hexadecimal.
- decimal by default
- binary Beginning with 0b or 0B
- octal starting with 0o or 0O
- hexadecimal starting with 0x or 0X
Boolean constants support the following two forms.
- true, false
- 1, 0
Special expressions
The following special expressions are currently supported.
- "*" The result is fixed to true and is used in filters to indicate that the filter must match.
The data types supported by filter expressions
The following five types are supported.
1. None
means empty, corresponding to rust is Option=None, using the reserved word $none
For example
object.owner == $none
2. string
String type, the most commonly used type, represents a string value or a type that can be converted to a string, such as object_id, dec_id, etc.
String and glob types need to be enclosed in single or double quotes if they contain reserved characters, otherwise they will fail to be parsed
3. glob
This is mainly used for fuzzy matching of paths, using the standard glob pattern under linux, please refer to the related documentation for details
Currently req_path and inner_path are glob types
"req_path == '/**/*.js'"
4. bool
supports logical operations, the result of all intermediate expressions, is also of type bool
bool variables can be true/false, 0/1
5. integers
Signed and unsigned.
- signed: I8, I16, I32, I64
- unsigned: U8, U16, U32, U64
Types of operations supported by filter expressions
The types of operations supported by filter expressions are briefly divided into several categories.
- match comparison == and ! =
- size comparisons <=, <, >=, >
- logical operations && ||
- bitwise operations &, ^, |
- logical non-operations (NOT) !
The operations supported by each data type are shown in the table below.
datatatype | matching comparison | size comparison | logical operations | bitwise operations | logical non |
---|---|---|---|---|---|
None | YES | ||||
string | YES | ||||
glob | YES | ||||
bool | YES | YES | YES | YES | |
I8 | YES | YES | YES | ||
I16 | YES | YES | YES | YES | |
I32 | YES | YES | YES | YES | |
I64 | YES | YES | YES | YES | |
U8 | YES | YES | YES | YES | |
U16 | YES | YES | YES | YES | |
U32 | YES | YES | YES | YES | |
U64 | YES | YES | YES | YES |
Operator priority
The priorities are sorted from highest to lowest as follows.
Operator | Priority |
---|---|
NOT | 17 |
LT/LT/GT/GE | 12 |
NE/EQ | 11 |
BAND | 10 |
BXOR | 9 |
BOR | 8 |
AND | 7 |
OR | 6 |
Expressions support parentheses, use them as much as possible if you don't know the operator precedence.
(a ! = 0 && ((b!=1) || c < 10))
Some sample expressions.
"a & 0x10"
"! (c && ! !c)"
"(a >= 11 || (b==10)) && d <= 10"
"(a ! = 0 && (a!=1) && a == c && (b ! = b1 || (!c) || d == 1))"
"(x ! = $none)"
"req_path == '/**/*.js'"
"(*)"
"*"
from cyfs.
If I want to use stack.router_handlers().add_handler() to register an event, how do I set the filter? There is currently no document found about filter rules
The dynamic acl handler supports two types of filters, string and blob, and the corresponding usage methods can be found in the above document.
For the introduction and usage of glob, please refer to https://docs.rs/globset/latest/globset/#syntax
from cyfs.
Related Issues (20)
- Nighlt OOD preview version has an incomplete update HOT 6
- After App-manager restarted the DEC APP installation process, the DEC APP was not started HOT 3
- Linux app-manager restore installation failed when app-manager breaks down when DEC APP is running "npm i" HOT 4
- Optimize service publishing process HOT 1
- If ACL Handler response error,satck.root_state_accessor_stub.get_object_by_path() will not return HOT 8
- The `ping` with `sn` is stopped? HOT 2
- Systemctl status of ood-daemon.service is error HOT 8
- Create restore task not save archive file to disk HOT 1
- Connection problem between runtime and gateway HOT 3
- Stable sort for HashSet HOT 4
- Only web dec_app install failed HOT 1
- Customizing system info HOT 3
- Backup service supports conditional filtering of key data HOT 2
- Release schedule for 84
- Test schedule for 84 Release
- Problems with ood-daemon restore backup data HOT 3
- Query task group state failed in rust. HOT 3
- Method to get an object from MetaChain by body-hash to get a specific version. HOT 1
- Unsound `transmute` in safe method
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cyfs.