Frequently used go code for 80% projects when programming.
NOT stable yet and may change dramatically.
Features:
- basics(box)
- type converters
- encoder & decoders
- file operations
- math functions
- network operations
- timestamps
- cpu id
- meta patterns
- loop controller
- state machine
- network topology
- MQTT broker embedded based on Mochi
- MQTT client based on paho
- MQ client based on nats
- RPC server based on msgpack-rpc
- RPC client based on msgpack-rpc
- inter-module communication
- inner-proc event bus based on EventBus
- distributed node management
- node provisioning & configuration
- node status keeping & monitoring
- node online/offline(join & leave)
- admin api
- node info maintenance
- uploader & downloader
- inner-process services
Examples:
package main
import (
"fmt"
"github.com/zourva/pareto"
"github.com/zourva/pareto/meta"
"time"
)
func main() {
pareto.Setup()
loop := meta.NewLoop("monitor", meta.LoopConfig{
Tick: 1000, // tick interval, 1000 ms
Work: 1, //event callback trigger ticks
Sync: false, //execute callback in a separate goroutine
BailOnError: false,
})
loop.Run(meta.LoopRunHook{
Working: func() error {
fmt.Println("monitoring...")
return nil
},
})
time.Sleep(time.Second * 10)
loop.Stop()
pareto.Teardown()
}