YoMo
YoMo is an open-source Streaming Serverless Framework for building Low-latency Edge Computing applications. Built atop QUIC Transport Protocol and Functional Reactive Programming interface. makes real-time data processing reliable, secure, and easy.
Official Website: π¦https://yomo.run
Gitee
π Getting Started
1. Install CLI
Note: YoMo requires Go 1.15 and above, run go version
to get the version of Go in your environment, please follow this link to install or upgrade if it doesn't fit the requirement.
# Ensure use $GOPATH, golang requires main and plugin highly coupled
β echo $GOPATH
if $GOPATH
is not set, check Set $GOPATH and $GOBIN first.
$ GO111MODULE=off go get github.com/yomorun/yomo
$ cd $GOPATH/src/github.com/yomorun/yomo
$ make install
2. Create your serverless app
$ mkdir -p $GOPATH/src/github.com/{YOUR_GITHUB_USERNAME} && cd $_
$ yomo init yomo-app-demo
2020/12/29 13:03:57 Initializing the Serverless app...
2020/12/29 13:04:00 β
Congratulations! You have initialized the serverless app successfully.
2020/12/29 13:04:00 π You can enjoy the YoMo Serverless via the command: yomo dev
$ cd yomo-app-demo
CLI will automatically create the app.go
:
package main
import (
"context"
"fmt"
"time"
"github.com/reactivex/rxgo/v2"
y3 "github.com/yomorun/y3-codec-golang"
"github.com/yomorun/yomo/pkg/rx"
)
// NoiseDataKey represents the Tag of a Y3 encoded data packet
const NoiseDataKey = 0x10
// NoiseData represents the structure of data
type NoiseData struct {
Noise float32 `yomo:"0x11"`
Time int64 `yomo:"0x12"`
From string `yomo:"0x13"`
}
var printer = func(_ context.Context, i interface{}) (interface{}, error) {
value := i.(NoiseData)
rightNow := time.Now().UnixNano() / int64(time.Millisecond)
return fmt.Sprintf("[%s] %d > value: %f β‘οΈ=%dms", value.From, value.Time, value.Noise, rightNow-value.Time), nil
}
var callback = func(v []byte) (interface{}, error) {
var mold NoiseData
err := y3.ToObject(v, &mold)
if err != nil {
return nil, err
}
mold.Noise = mold.Noise / 10
return mold, nil
}
// Handler will handle data in Rx way
func Handler(rxstream rx.RxStream) rx.RxStream {
stream := rxstream.
Subscribe(NoiseDataKey).
OnObserve(callback).
Debounce(rxgo.WithDuration(50 * time.Millisecond)).
Map(printer).
StdOut()
return stream
}
3. Build and run
- Run
yomo dev
from the terminal. you will see the following message:
Congratulations! You have done your first YoMo application.
Optional: Set $GOPATH and $GOBIN
for current session:
export GOPATH=~/.go
export PATH=$GOPATH/bin:$PATH
for shell:
for zsh
users
echo "export GOPATH=~/.go" >> .zshrc
echo "path+=$GOPATH/bin" >> .zshrc
for bash
users
echo 'export GOPATH=~/.go' >> .bashrc
echo 'export PATH="$GOPATH/bin:$PATH"' >> ~/.bashrc
π Documentation
YoMo β€οΈ Vercel, Our documentation website is
π― Focuses on computings out of data center
- IoT/IIoT/AIoT
- Latency-sensitive applications.
- Networking situation with packet loss or high latency.
- Handling continuous high frequency generated data with stream-processing.
- Building Complex systems with Streaming-Serverless architecture.
π Why YoMo
- Based on QUIC (Quick UDP Internet Connection) protocol for data transmission, which uses the User Datagram Protocol (UDP) as its basis instead of the Transmission Control Protocol (TCP); significantly improves the stability and throughput of data transmission. Especially for cellular networks like 5G.
- A self-developed
yomo-codec
optimizes decoding performance. For more information, visit its own repository on GitHub.
- Based on stream computing, which improves speed and accuracy when dealing with data handling and analysis; simplifies the complexity of stream-oriented programming.
- Secure-by-default from transport protocol.
π¦Έ Contributing
First off, thank you for considering making contributions. It's people like you that make YoMo better. There are many ways in which you can participate in the project, for example:
- File a bug report. Be sure to include information like what version of YoMo you are using, what your operating system is, and steps to recreate the bug.
- Suggest a new feature.
- Read our contributing guidelines to learn about what types of contributions we are looking for.
- We have also adopted a code of conduct that we expect project participants to adhere to.
π€Ήπ»ββοΈ Feedback
Any questions or good ideas, please feel free to come to our Discussion. Any feedback would be greatly appreciated!
License
Apache License 2.0