Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
129 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ User guides | |
|
||
configurations/storage | ||
configurations/registry | ||
configurations/long_polling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Long polling | ||
*experimental* | ||
|
||
Kie leverage gossip protocol to broad cast cluster events. if client use query parameter "?wait=5s" to poll key value, | ||
this polling will become long polling and if there is key value change events, | ||
server will response key values to client. | ||
|
||
kie must join to a cluster and listen to peer events | ||
|
||
start first node | ||
```shell script | ||
./kie --name=kie0 --listen-peer-addr=10.1.1.11:5000 | ||
``` | ||
|
||
start another node | ||
```shell script | ||
./kie --name=kie1 --listen-peer-addr=10.1.1.12:5000 --peer-addr=10.1.1.11:5000 | ||
``` | ||
|
||
### event payload and trigger condition | ||
|
||
condition: key value put or delete | ||
|
||
payload: | ||
```go | ||
{ | ||
"Key": "timeout", | ||
"Action": "put", | ||
"Labels": { | ||
"app": "default", | ||
"service": "order" | ||
}, | ||
"DomainID": "default", | ||
"Project": "default" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ Get started | |
:glob: | ||
|
||
getstarted/install.md | ||
getstarted/verify.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# After running | ||
Put a key | ||
```shell script | ||
curl -X PUT \ | ||
http://127.0.0.1:30110/v1/default/kie/kv/ingressRule \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"value":"some rule", | ||
"type": "yaml", | ||
"labels":{"app":"default"} | ||
}' | ||
``` | ||
|
||
response is | ||
```json | ||
{ | ||
"id": "05529229-efc3-49ca-a765-05759b23ab28", | ||
"label_id": "e7faac8e-053e-4906-99ab-989f61febe74", | ||
"key": "ingressRule", | ||
"value": "some rule", | ||
"value_type": "text", | ||
"create_revision": 13, | ||
"update_revision": 13, | ||
"labels": { | ||
"app": "default" | ||
} | ||
} | ||
``` | ||
|
||
the api docs is http://127.0.0.1:30110/apidocs.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,46 @@ | ||
# Concepts | ||
|
||
### Labels | ||
key value must belong to a identical label, | ||
### labels | ||
key value must belong to an identical label, | ||
a labels is equivalent to a map, it is represent as a json object | ||
```json | ||
{ | ||
"app": "some_app", | ||
"service": "payment", | ||
"service": "web", | ||
"environment": "production", | ||
"version": "1.0.1" | ||
} | ||
``` | ||
for each unique label map, kie will generate a label id for it and produce a db record. | ||
### key value | ||
A key is usually related to some function in your program, let's say a new web UI should enable or not. | ||
the labels is just like a map to tell you where this program located in. the map says, | ||
it is located in production environment,the version is 1.0.1 | ||
A key value is usually a snippet configuration for your component, let's say a web UI widget should be enabled or not. | ||
But usually, a component has different version and deployed in different environments. | ||
the labels is indicates where this component located in. | ||
below the labels indicates it is located in production environment,the version is 1.0.1 | ||
```json | ||
{ | ||
"value":"true", | ||
"labels":{ | ||
"service": "web-console", | ||
"environment": "production", | ||
"version": "1.0.1" | ||
} | ||
"id": "05529229-efc3-49ca-a765-05759b23ab28", | ||
"label_id": "e7faac8e-053e-4906-99ab-989f61febe74", | ||
"key": "enable_a_function", | ||
"value": "true", | ||
"value_type": "text", | ||
"create_revision": 13, | ||
"update_revision": 13, | ||
"labels": { | ||
"app": "some_app", | ||
"service": "web", | ||
"environment": "production", | ||
"version": "1.0.1" | ||
} | ||
} | ||
``` | ||
``` | ||
|
||
### revision | ||
kie holds a global revision number it starts from 1, | ||
each creation or update action of key value record will cause the increasing of this revision number, | ||
key value has a immutable attribute "create_revision" when first created. | ||
after each modify, "update_revision" will increase. | ||
kie leverage this revision to reduce network cost, | ||
when client polling for key values, it can give a revision number "?revision=200" in query parameter, | ||
server side compare current revision with it , if they are the same, server will only return http status 304 to client. | ||
at each query server will return current revision to client with response header "X-Kie-Revision" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.