Skip to content

Commit 353caa3

Browse files
committed
docs: added readme
1 parent 79b3557 commit 353caa3

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Code0-Flow - Flow Management Library
2+
3+
[![Crate](https://img.shields.io/crates/v/code0-flow.svg)](https://crates.io/crates/code0-flow)
4+
[![Documentation](https://docs.rs/code0-flow/badge.svg)](https://docs.rs/code0-flow)
5+
6+
code0-flow is a Rust library developed by Code0 for managing flows within the FlowQueue and FlowStore. This libray is only for the internal usage of the execution block services (Aquila, Draco & Tarurs) and is not intendet to get used elsewhere.
7+
8+
## Features
9+
10+
- `flow_store` insert, delete & query Flows in the FlowStore
11+
- `flow_definition` update the Adapter & Runtime definitions
12+
- `flow_queue` send a Flow into the queue to be executed.
13+
14+
## FlowStore
15+
16+
### Keys
17+
18+
The key in the FlowStore in a Store will always have the pattern:
19+
20+
`flow_id::project_id::flow_type_identifier::<any_flow_type_specific_data>`
21+
22+
E.g. for REST:
23+
24+
`1::1::REST::test.code0.tech::GET`
25+
26+
This would be a REST Flow identifier
27+
28+
## FlowDefinition
29+
30+
```rust
31+
// Define FlowType
32+
let flow_type = FlowType {
33+
identifier: String::from("REST"),
34+
settings: vec![],
35+
input_type_identifier: Some(String::from("HTTP_REQUEST_OBJECT")),
36+
return_type_identifier: Some(String::from("HTTP_RESPONSE_OBJECT")),
37+
editable: true,
38+
name: vec![Translation {
39+
code: String::from("en-US"),
40+
content: String::from("Rest Endpoint"),
41+
}],
42+
description: vec![Translation {
43+
code: String::from("en-US"),
44+
content: String::from("A REST API is a web service that lets clients interact with data on a server using standard HTTP methods like GET, POST, PUT, and DELETE, usually returning results in JSON format."),
45+
}],
46+
};
47+
48+
// Define DataTypes
49+
let data_type = DataType {
50+
variant: 5,
51+
name: vec![Translation {
52+
code: String::from("en-US"),
53+
content: String::from("HTTP Headers"),
54+
}],
55+
identifier: String::from("HTTP_HEADER_MAP"),
56+
input_types: vec![],
57+
return_type: None,
58+
parent_type_identifier: Some(String::from("ARRAY")),
59+
rules: vec![DataTypeRule {
60+
config: Some(Config::ContainsType(DataTypeContainsTypeRuleConfig {
61+
data_type_identifier: String::from("HTTP_HEADER_ENTRY"),
62+
})),
63+
}],
64+
}
65+
66+
// Send to get updated in Sagittarius
67+
let update_client = code0_flow::flow_definition::FlowUpdateService::from_url(aquila_url)
68+
.with_data_types(vec![data_type])
69+
.with_flow_types(vec![flow_type]);
70+
71+
// Response --> true if successfull
72+
update_client.send().await;
73+
```

0 commit comments

Comments
 (0)