wurui bb8e3dbe00 feat: system prompt supports backend Overwrite and Prefix (#917) 6 天之前
..
0-basic 0dfc54457f chore: bump to go1.21 (#747) 7 月之前
1-pipeline bb8e3dbe00 feat: system prompt supports backend Overwrite and Prefix (#917) 6 天之前
10-ai bb8e3dbe00 feat: system prompt supports backend Overwrite and Prefix (#917) 6 天之前
2-iopipe bb8e3dbe00 feat: system prompt supports backend Overwrite and Prefix (#917) 6 天之前
3-multi-sfn b5317dc1a9 refactor: separate the logic of distributed tracing (#736) 7 月之前
4-cascading-zipper 5e24c90f96 refacor: change config field downstreams to mesh (#694) 9 月之前
5-backflow 097e9d252f feat: remove source backflow feature (#683) 10 月之前
6-mesh 5e24c90f96 refacor: change config field downstreams to mesh (#694) 9 月之前
7-wasm bb8e3dbe00 feat: system prompt supports backend Overwrite and Prefix (#917) 6 天之前
8-deno 41711df1a3 remove function names from zipper config (#616) 1 年之前
9-cli bb8e3dbe00 feat: system prompt supports backend Overwrite and Prefix (#917) 6 天之前
a-target-and-cron 0dfc54457f chore: bump to go1.21 (#747) 7 月之前
uppercase 41711df1a3 remove function names from zipper config (#616) 1 年之前
README.md 6ec97515bb feat: transmitting data is broadcast across zippers by default (#612) 1 年之前
Taskfile.yaml d391c37bae feat: trace (#575) 1 年之前
config.yaml 41711df1a3 remove function names from zipper config (#616) 1 年之前
tidy_go_mod.sh 8eedd7dd67 chore: add tidy example go.mod script and use it (#884) 2 月之前

README.md

Examples

Prerequisite

Install Task

Install Task

Install YoMo CLI

$ task -t ../Taskfile.yml cli:install

All examples can be run by Task, following the Install Task, execute task -l in this directory will list all the examples.

$ task -l |grep example

* example-backflow:                     Backflow usage
* example-basic:                        YoMo basic usage
* example-cascading-zipper:             Cascading zippers
* example-iopipe:                       IO Pipe
* example-multi-sfn:                    Multiple stream functions
* example-pipeline:                     Unix pipeline to cloud
* example-mesh:                         Edge mesh
* example-wasm:                         YoMo Stream Function using WebAssembly
* example-deno:                         YoMo Stream Function using Deno
* example-cli:                          Use the CLI to run stream functions

can run each example directly by task example-basic, task example-cascading-zipper and etc.

Basic example

  • 0-basic: process the streams from IoT sound sensor.

Linux Pipeline over cloud

Multiple stream functions

  • 3-multi-sfn: use 3 stream functions to process the streams in different cases.
    • stream-fn-1: calculate the sound value in real-time.
    • stream-fn-2: print the warning message when the sound value reaches a threshold.
    • stream-fn-3: calculate the average value in a sliding window.

Cascading zippers

Backflow

This feature is experimental.

Steps:

  1. Set observe data tags on source:
   source := yomo.NewSource(
     "yomo-source",
     "127.0.0.1:9000",
     // set observe data tags, 0x34, 0x35 is sfn return data tags
     yomo.WithObserveDataTags(0x34, 0x35), 
   )
  1. Set receive handler on source
   // set receive handler
   source.SetReceiveHandler(func(tag byte, data []byte) {
     logger.Printf("[source] ♻️  receive backflow: tag=%#v, data=%s", tag, data)
     // TODO:
   })