@@ -52,15 +52,15 @@ Specify target host and timeout for forwarding requests
5252 3 ) prefix or proxying - ` /my/* `
5353 4 ) mixed ` /my/{parameter}/path/* `
5454
55- And need to define rules for our route: each rule heve ` type ` and options related to this kind of rule,
55+ And need to define rules for our route: each rule heve ` kind ` and options related to this kind of rule,
5656
5757 ``` json
5858 {
5959 // ...
6060 "rules" : {
6161 "/posts/{id}" : [ // route
6262 {
63- "type " : " cache" , // rule type "cache" - simple cache strategy
63+ "kind " : " cache" , // rule kind "cache" - simple cache strategy
6464 "ttl" : " 10s" , // cache ttl
6565 "key" : " post-{id}" , // cache key template, can contain url parameter from route
6666 "storage" : " main_ha" // storage name from "storages" section that will be used for this rule
@@ -73,12 +73,12 @@ Specify target host and timeout for forwarding requests
7373 ```
7474 That is, you can run ` circa ` and it will cache requests to GET /posts/{id} for 10 seconds and proxy all other requests
7575
76- There are a list of rules types and parameters for each:
76+ There are a list of rules kinds and parameters for each:
7777
78781 . Cache with ttl
7979``` json
8080{
81- "type " : " cache" , // by default
81+ "kind " : " cache" , // by default
8282 "ttl" : " 10m50s" , // cache time to live Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.
8383 "key" : " ....."
8484}
@@ -87,7 +87,7 @@ Specify target host and timeout for forwarding requests
87872 . Cache with early expiration -
8888``` json
8989{
90- "type " : " early" ,
90+ "kind " : " early" ,
9191 "ttl" : " 10h" , // cache time to live
9292 "early_ttl" : " 1h" , // time for pre invalidation
9393 "key" : " ....."
@@ -97,7 +97,7 @@ Specify target host and timeout for forwarding requests
97973 . Cache with hit expiration -
9898``` json
9999{
100- "type " : " hit" ,
100+ "kind " : " hit" ,
101101 "ttl" : " 10h" , // cache time to live
102102 "hits" : 100 , // number of hits before cache will be invalidated
103103 "update_after" : 10 , // optional; number of hits for pre invalidation
@@ -108,7 +108,7 @@ Specify target host and timeout for forwarding requests
1081084 . Failover cache -
109109``` json
110110{
111- "type " : " fail" ,
111+ "kind " : " fail" ,
112112 "ttl" : " 10h" , // cache time to live
113113 "key" : " ....."
114114}
@@ -117,7 +117,7 @@ Specify target host and timeout for forwarding requests
1171175 . Rate limit -
118118``` json
119119{
120- "type " : " rate-limit" ,
120+ "kind " : " rate-limit" ,
121121 "ttl" : " 10m" , // limit period
122122 "hits" : 100 , // number of hits ( read as 100 request per 10 min)
123123 "key" : " ....."
@@ -127,7 +127,7 @@ Specify target host and timeout for forwarding requests
1271276 . Retry -
128128``` json
129129{
130- "type " : " retry" ,
130+ "kind " : " retry" ,
131131 "methods" : [" GET" , " HEAD" ],
132132 "backoff" : " 5s" ,
133133 "count" : 5 // retry attempts
@@ -138,7 +138,7 @@ Specify target host and timeout for forwarding requests
1381387 . request_id - ` skip_return ` - check that backend return response with tha same request ID
139139``` json
140140{
141- "type " : " request_id" ,
141+ "kind " : " request_id" ,
142142 "methods" : [" GET" , " POST" , " DELETE" , " PUT" , " PATCH" ],
143143 "skip_return" : false // by default
144144}
@@ -147,7 +147,7 @@ Specify target host and timeout for forwarding requests
1471478 . idempotency
148148``` json
149149{
150- "type " : " idempotency" ,
150+ "kind " : " idempotency" ,
151151 "ttl" : " 1m"
152152 // "key": "{R:body|hash }",
153153}
@@ -156,7 +156,7 @@ Specify target host and timeout for forwarding requests
1561569 . invalidate
157157``` json
158158{
159- "type " : " invalidate" ,
159+ "kind " : " invalidate" ,
160160 "methods" : [" POST" , " DELETE" , " PUT" , " PATCH" ],
161161 "key" : " posts-{id}:key" // the key template that will be deleted after success request
162162}
@@ -165,14 +165,14 @@ Specify target host and timeout for forwarding requests
16516510 . skip - will skip all rules see "Routing"
166166``` json
167167{
168- "type " : " skip"
168+ "kind " : " skip"
169169}
170170```
171171
17217211 . proxy - rule to change method or target host for proxing
173173``` json
174174{
175- "type " : " proxy" ,
175+ "kind " : " proxy" ,
176176 "methods" : [" GET" ],
177177 "path" : " /posts/" , // optional
178178 "method" : " POST" , // optional
@@ -184,20 +184,29 @@ Will proxy all get methods as post request to the https://google.com/posts/
18418412 . Glue
185185``` json
186186{
187- "type" : " json" ,
188- "paths" : [" /posts" , " /articles" ]
187+ "kind" : " glue" ,
188+ "model" : " single" , // "list"
189+ "calls" : {
190+ "user_info" : " /users/{id}/info" ,
191+ "user_meta" : " /users/{id}/meta" ,
192+ "posts" : " /posts/?user={id}"
193+ },
194+ "mapping" : {
195+ "posts" : " posts"
196+ } // {..info, ..meta, "posts": posts }
189197}
190198
191199TODO:
192- - unix socket as target
193- - proxy fast with no rules
194- - glue
200+ - proxy fast with no rules [x] - with /* rule - fast tpp
201+ - cache resolve
202+ - glue[partly]
203+ - proxy header - like request-id just get and return back
204+ - cache condition - header, time, query
195205 - proxy filebody
206+ - proxy Location - bug
207+ - manage api
196208 - circuit-breaker []
197209 - rate-limit with a sliding window
198210 - hot cache ?
199- - hot reload with config change
200211 - config flush
201-
202- ConfigRepo (store a config) -> Config (control a rules storages and sync configRepo) -> Runner
203- Request -> Resolver (route -> rules) -> Rule -> Handler -> Requester -> Response
212+ - unix socket as targe
0 commit comments