README.md 5.7 KB
Newer Older
1
<p align="center">
2
  <img width="200px" height="200px" src="https://yomo.run/yomo-logo.png" />
3 4
</p>

F
fiftyloops 已提交
5
# YoMo ![Go](https://github.com/yomorun/yomo/workflows/Go/badge.svg)
F
fanweixiao 已提交
6

F
fanweixiao 已提交
7
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.
F
fanweixiao 已提交
8

F
fanweixiao 已提交
9
Official Website: 🦖[https://yomo.run](https://yomo.run)
10

F
fanweixiao 已提交
11
[Gitee](https://gitee.com/yomorun/yomo)
F
fanweixiao 已提交
12

13
## 🚀 Getting Started
F
fanweixiao 已提交
14

15
### 1. Install CLI
16

17
```bash
18 19
# Ensure use $GOPATH, golang requires main and plugin highly coupled
echo $GOPATH
F
fiftyloops 已提交
20

21 22 23 24 25
```

if `$GOPATH` is not set, check [Set $GOPATH and $GOBIN](#optional-set-gopath-and-gobin) first.

```bash
F
fanweixiao 已提交
26
$ GO111MODULE=off go get github.com/yomorun/yomo
27

F
fanweixiao 已提交
28
$ cd $GOPATH/src/github.com/yomorun/yomo
29

F
fanweixiao 已提交
30
$ make install
31 32
```

33
![YoMo Tutorial 1](https://yomo.run/tutorial-1.png)
F
fanweixiao 已提交
34

35
### 2. Create your serverless app
36 37

```bash
F
fanweixiao 已提交
38
$ mkdir -p $GOPATH/src/github.com/{YOUR_GITHUB_USERNAME} && cd $_
39

F
fanweixiao 已提交
40
$ yomo init yomo-app-demo
41 42 43
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
F
fanweixiao 已提交
44

F
fanweixiao 已提交
45
$ cd yomo-app-demo
F
fiftyloops 已提交
46

47 48
```

49
![YoMo Tutorial 2](https://yomo.run/tutorial-2.png)
F
fanweixiao 已提交
50

51
CLI will automatically create the `app.go`:
F
fanweixiao 已提交
52

53
```go
F
fanweixiao 已提交
54 55 56
package main

import (
57 58 59
	"context"
	"fmt"
	"time"
F
fanweixiao 已提交
60

61
	"github.com/reactivex/rxgo/v2"
weixin_53053927's avatar
weixin_53053927 已提交
62
	y3 "github.com/yomorun/y3-codec-golang"
63 64
	"github.com/yomorun/yomo/pkg/rx"
)
F
fanweixiao 已提交
65

66 67 68 69
// KeyNoise represents the Tag of a Y3 encoded data packet
const KeyNoise = 0x10

// NoiseData represents the structure of data
weixin_53053927's avatar
weixin_53053927 已提交
70 71 72 73 74 75
type NoiseData struct {
	Noise float32 `yomo:"0x11"`
	Time  int64   `yomo:"0x12"`
	From  string  `yomo:"0x13"`
}

76
var printer = func(_ context.Context, i interface{}) (interface{}, error) {
weixin_53053927's avatar
weixin_53053927 已提交
77
	value := i.(NoiseData)
78 79
	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
F
fanweixiao 已提交
80 81
}

weixin_53053927's avatar
weixin_53053927 已提交
82 83 84 85 86 87 88 89 90 91
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
}

92 93 94
// Handler will handle data in Rx way
func Handler(rxstream rx.RxStream) rx.RxStream {
	stream := rxstream.
95
		Subscribe(0x10).
weixin_53053927's avatar
weixin_53053927 已提交
96
		OnObserve(callback).
97
		Debounce(rxgo.WithDuration(50 * time.Millisecond)).
98 99
		Map(printer).
		StdOut()
100

101
	return stream
102
}
103

F
fanweixiao 已提交
104 105
```

F
fanweixiao 已提交
106
### 3. Build and run
F
fanweixiao 已提交
107

108
1. Run `yomo dev` from the terminal. you will see the following message:
109

110
![YoMo Tutorial 3](https://yomo.run/tutorial-3.png)
111

112
Congratulations! You have done your first YoMo application.
113

114 115 116 117 118
### Optional: Set $GOPATH and $GOBIN

for current session:

```bash
119
export GOPATH=~/.go
120 121 122 123 124 125 126 127
export PATH=$GOPATH/bin:$PATH
```

for shell: 

for `zsh` users

```bash
128
echo "export GOPATH=~/.go" >> .zshrc
129 130 131 132 133 134
echo "path+=$GOPATH/bin" >> .zshrc
```

for `bash` users

```bash
135
echo 'export GOPATH=~/.go' >> .bashrc
136 137 138
echo 'export PATH="$GOPATH/bin:$PATH"' >> ~/.bashrc
```

139 140
## 📚 Documentation

F
fanweixiao 已提交
141 142 143 144 145 146 147 148 149 150
+ `YoMo-Source`: [yomo.run/source](https://yomo.run/source)
+ `YoMo-Flow`: [yomo.run/flow](https://yomo.run/flow)
+ `YoMo-Sink`: [yomo.run/sink](https://yomo.run/sink)
+ `YoMo-Zipper`: [yomo.run/zipper](https://yomo.run/zipper)
+ `Stream Processing in Rx way`: [Rx](https://yomo.run/rx)
+ `Faster than real-time codec`: [Y3](https://github.com/yomorun/y3-codec)

[YoMo](https://yomo.run) ❤️ [Vercel](https://vercel.com/?utm_source=cella&utm_campaign=oss), Our documentation website is

![Vercel Logo](https://raw.githubusercontent.com/yomorun/yomo-docs/main/public/vercel.svg)
151

152
## 🎯 Focuses on computings out of data center
F
fanweixiao 已提交
153

F
fanweixiao 已提交
154
- IoT/IIoT/AIoT
155 156 157 158
- 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.
F
fanweixiao 已提交
159

160
## 🌟 Why YoMo
F
fiftyloops 已提交
161

162
- 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.
F
fiftyloops 已提交
163 164
- A self-developed `yomo-codec` optimizes decoding performance. For more information, visit [its own repository](https://github.com/yomorun/yomo-codec) 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.
165
- Secure-by-default from transport protocol.
F
fanweixiao 已提交
166

167
## 🦸 Contributing
F
fanweixiao 已提交
168

F
fiftyloops 已提交
169
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:
F
fanweixiao 已提交
170

F
fiftyloops 已提交
171 172 173 174
- File a [bug report](https://github.com/yomorun/yomo/issues/new?assignees=&labels=bug&template=bug_report.md&title=%5BBUG%5D). 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](https://github.com/yomorun/yomo/blob/master/CONTRIBUTING.md) to learn about what types of contributions we are looking for.
- We have also adopted a [code of conduct](https://github.com/yomorun/yomo/blob/master/CODE_OF_CONDUCT.md) that we expect project participants to adhere to.
F
fanweixiao 已提交
175

176
## 🤹🏻‍♀️ Feedback
F
fanweixiao 已提交
177

178
Any questions or good ideas, please feel free to come to our [Discussion](https://github.com/yomorun/yomo/discussions). Any feedback would be greatly appreciated!
F
fanweixiao 已提交
179

F
fiftyloops 已提交
180
## License
F
fanweixiao 已提交
181

F
fiftyloops 已提交
182
[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)