Documentation ¶
Index ¶
Constants ¶
const ( // DefaultZipperAddr is the default address of downstream zipper. DefaultZipperAddr = "localhost:9000" // DefaultZipperListenAddr set default listening port to 9000 and binding to all interfaces. DefaultZipperListenAddr = "0.0.0.0:9000" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(o *options)
Option is a function that applies a YoMo-Client option.
func WithMeshConfigURL ¶
WithMeshConfigURL sets the initial edge-mesh config URL for the YoMo-Zipper.
func WithZipperAddr ¶
WithZipperAddr return a new options with ZipperAddr set to addr.
type Source ¶
type Source interface { // Close will close the connection to YoMo-Zipper. Close() error // Connect to YoMo-Zipper. Connect() error // SetDataTag will set the tag of data when invoking Write(). SetDataTag(tag uint8) // Write the data to downstream. Write(p []byte) (n int, err error) // WriteWithTag will write data with specified tag, default transactionID is epoch time. WriteWithTag(tag uint8, data []byte) error }
Source is responsible for sending data to yomo.
type StreamFunction ¶
type StreamFunction interface { // SetObserveDataID set the data id list that will be observed SetObserveDataID(id ...uint8) // SetHandler set the handler function, which accept the raw bytes data and return the tag & response SetHandler(fn func([]byte) (byte, []byte)) error // Connect create a connection to the zipper Connect() error // Close will close the connection Close() error // Send a data to zipper. Write(dataID byte, carriage []byte) error }
StreamFunction defines serverless streaming functions.
func NewStreamFunction ¶
func NewStreamFunction(name string, opts ...Option) StreamFunction
NewStreamFunction create a stream function.
type Zipper ¶
type Zipper interface { // ConfigWorkflow will register workflows from config files to zipper. ConfigWorkflow(conf string) error // ConfigMesh will register edge-mesh config URL ConfigMesh(url string) error // ListenAndServe start zipper as server. ListenAndServe() error // AddDownstreamZipper will add downstream zipper. AddDownstreamZipper(downstream Zipper) error // Addr returns the listen address of zipper. Addr() string // Stats return insight data Stats() int // Close will close the zipper. Close() error }
Zipper is the orchestrator of yomo. There are two types of zipper: one is Upstream Zipper, which is used to connect to multiple downstream zippers, another one is Downstream Zipper (will call it as Zipper directly), which is used to connected by `Upstream Zipper`, `Source` and `Stream Function`
func NewDownstreamZipper ¶
NewDownstreamZipper create a zipper descriptor for downstream zipper.
func NewZipperWithOptions ¶
NewZipperWithOptions create a zipper instance.