#flows #define #flow-store #code0 #flow-definition

code0-flow

Crate for managing the code0-flows inside of the Flow Queue & FlowStore

12 releases

new 0.0.12 May 28, 2025
0.0.11 May 27, 2025
0.0.9 Apr 30, 2025
0.0.3 Feb 15, 2025

#449 in Database interfaces

Download history 80/week @ 2025-01-29 38/week @ 2025-02-05 278/week @ 2025-02-12 10/week @ 2025-02-19 11/week @ 2025-02-26 14/week @ 2025-04-02 343/week @ 2025-04-09 314/week @ 2025-04-16 46/week @ 2025-04-23 279/week @ 2025-04-30 81/week @ 2025-05-07 77/week @ 2025-05-14

502 downloads per month

Apache-2.0

3.5MB
1.5K SLoC

Code0-Flow - Flow Management Library

Crate Documentation

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.

Features

  • flow_store insert, delete & query Flows in the FlowStore
  • flow_definition update the Adapter & Runtime definitions
  • flow_queue send a Flow into the queue to be executed.

FlowStore

Keys

The key in the FlowStore in a Store will always have the pattern:

flow_id::project_id::flow_type_identifier::<any_flow_type_specific_data>

E.g. for REST:

1::1::REST::test.code0.tech::GET

This would be a REST Flow identifier

FlowDefinition

// Define FlowType
let flow_type = FlowType {
    identifier: String::from("REST"),
    settings: vec![],
    input_type_identifier: Some(String::from("HTTP_REQUEST_OBJECT")),
    return_type_identifier: Some(String::from("HTTP_RESPONSE_OBJECT")),
    editable: true,
    name: vec![Translation {
        code: String::from("en-US"),
        content: String::from("Rest Endpoint"),
    }],
    description: vec![Translation {
        code: String::from("en-US"),
        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."),
    }],
};

// Define DataTypes
let data_type = DataType {
    variant: 5,
    name: vec![Translation {
        code: String::from("en-US"),
        content: String::from("HTTP Headers"),
    }],
    identifier: String::from("HTTP_HEADER_MAP"),
    input_types: vec![],
    return_type: None,
    parent_type_identifier: Some(String::from("ARRAY")),
    rules: vec![DataTypeRule {
        config: Some(Config::ContainsType(DataTypeContainsTypeRuleConfig {
            data_type_identifier: String::from("HTTP_HEADER_ENTRY"),
        })),
    }],
}

// Send to get updated in Sagittarius
let update_client = code0_flow::flow_definition::FlowUpdateService::from_url(aquila_url)
           .with_data_types(vec![data_type])
           .with_flow_types(vec![flow_type]);

// Response --> true if successfull
update_client.send().await;

Dependencies

~16–29MB
~452K SLoC