MCPcopy Index your code
hub / github.com/Rustixir/tokio_sky

github.com/Rustixir/tokio_sky @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
213 symbols 312 edges 28 files 14 documented · 7%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

TokioSky

Download

Build concurrent and multi-stage data ingestion and data processing pipelines with Rust+Tokio. TokioSky allows developers to consume data efficiently from different sources, known as producers, such as Apache Kafka, Apache Pulsar and others. inspired by elixir broadway

Features

TokioSky takes the burden of defining concurrent GenStage topologies and provide a simple configuration API that automatically defines concurrent producers, concurrent processing, leading to both time and cost efficient ingestion and processing of data. It features:

  • Producer - source of data pipelines

  • Processor - process message also can send to next stage by dispatcher

  • BatchProcessor process group of message, that is used for latest stage, can not have next stage

  • Dispatcher - dispatch message with three mode (RoundRobin, BroadCast, Partition)

  • Customizable - can use built-in Producer, Processor, BatchProcessor like Apache Kafka, Apache Pulsar or write your custom Producer, Processor, BatchProcessor

  • Batching - TokioSky provides built-in batching, allowing you to group messages either by size and/or by time. This is important in systems such as Amazon SQS, where batching is the most efficient way to consume messages, both in terms of time and cost. Good Example imagine processor has to check out a database connection to insert a record for every single insert operation, That’s pretty inefficient, especially if we’re processing lots of inserts.Fortunately, with TokioSky we can use this technique, is grouping operations into batches, otherwise known as Partitioning. See Example

  • Dynamic batching - TokioSky allows developers to batch messages based on custom criteria. For example, if your pipeline needs to build batches based on the user_id, email address, etc, See Example

  • Ordering and Partitioning - TokioSky allows developers to partition messages across workers, guaranteeing messages within the same partition are processed in order. For example, if you want to guarantee all events tied to a given user_id are processed in order and not concurrently, you can use Dispatcher with Partition mode option. See Example.

  • Data Collector - when source Producer of your app is web server and need absorb data from client request can use 'Collector' as Producer, that asynchronous absorb data, then feeds to pipelines See Example

  • Graceful shutdown - first terminate Producers, wait until all processors job done, then shutdown

  • Topology - create and syncing components

Examples

The complete Examples on Link.

Explain

  • factory - instance factory

  • concurrency - creates multiple instance (For parallelism)

  • router - used by dispatcher for routing message (RoundRobin || BroadCast || Partition)

  • producer_buffer_pool - producer internally used buffer for increase throughout

  • run_topology - TokioSky always have one Producer Layer and at-least have 1 processor layer and at-max 5 processor layer and 1 optional layer batcher for creating and syncing components must use run_topology_X or run_topology_X_with_batcher

Attention

  • Producer.dispatcher cannot be Partition mode

  • Processor if have not next stage channel must return ProcResult::Continue unless processor (skip) that message

  • All Built-in processor if have next stage, must dispatcher not be partition mode

Crates.io

tokio_sky = 1.0.0

Author

  • DanyalMh

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Extension points exported contracts — how you extend this code

Processor (Interface)
(no doc) [18 implementers]
src/processor.rs
Producer (Interface)
(no doc) [14 implementers]
src/producer.rs
BatchProcessor (Interface)
(no doc) [3 implementers]
src/batcher.rs

Core symbols most depended-on inside this repo

start_processor
called by 30
src/topology.rs
start_producer
called by 10
src/topology.rs
run_topology_1
called by 6
src/topology.rs
start_batch_processor
called by 5
src/topology.rs
run_topology_1_with_batcher
called by 4
src/topology.rs
run
called by 3
src/batcher.rs
run_topology_2
called by 3
src/topology.rs
dispatch
called by 2
src/dispatcher.rs

Shape

Method 117
Class 54
Function 31
Enum 8
Interface 3

Languages

Rust100%

Modules by API surface

src/topology.rs15 symbols
examples/dynamic_batching.rs15 symbols
src/dispatcher.rs13 symbols
examples/ordering_and_paritioning.rs13 symbols
examples/batch_insert_mysql.rs12 symbols
src/builtin/kafka_producer.rs11 symbols
examples/complex(3 layer).rs11 symbols
examples/pulsar_batcher.rs10 symbols
examples/complex(2 layer).rs9 symbols
src/builtin/kafka_processor.rs8 symbols
examples/simple(1 layer).rs8 symbols
examples/pulsar_processor_complex.rs8 symbols

For agents

$ claude mcp add tokio_sky \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact