serverless

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StreamTypeSource       string = "source"
	StreamTypeFlow         string = "flow"
	StreamTypeSink         string = "sink"
	StreamTypeZipperSender string = "zipper-sender"
)

Variables

This section is empty.

Functions

func Build

func Build(wfConf *WorkflowConfig, connMap *map[int64]*QuicConn) ([]yomo.FlowFunc, []yomo.SinkFunc)

Build the workflow by config (.yaml). It will create one stream for each flows/sinks.

func DispatcherWithFunc

func DispatcherWithFunc(flows []yomo.FlowFunc, reader io.Reader) rx.RxStream

DispatcherWithFunc dispatches the input stream to downstreams.

func GetSinks

func GetSinks(wfConf *WorkflowConfig, connMap *map[int64]*QuicConn) []yomo.SinkFunc

GetSinks get sinks from config and connMap

func Register

func Register(ext string, s Serverless)

func Start

func Start(endpoint string, handler quic.ServerHandler) error

Start QUIC service.

Types

type App

type App struct {
	Name string `yaml:"name"`
}

type Options

type Options struct {
	Filename  string
	Host      string
	Port      int
	Name      string
	Arguments []string
}

Options the for serverless command arguments.

type QuicConn

type QuicConn struct {
	Session    quic.Session
	Signal     quic.Stream
	Stream     io.ReadWriter
	StreamType string
	Name       string
	Heartbeat  chan byte
	IsClosed   bool
	Ready      bool
}

QuicConn represents the QUIC connection.

func (*QuicConn) Beat

func (c *QuicConn) Beat()

Beat sends the heartbeat to clients and checks if receiving the heartbeat back.

func (*QuicConn) Close

func (c *QuicConn) Close()

Close the QUIC connections.

func (*QuicConn) Init

func (c *QuicConn) Init(conf *WorkflowConfig)

Init the QUIC connection.

func (*QuicConn) SendSignal

func (c *QuicConn) SendSignal(b []byte) error

SendSignal sends the signal to clients.

type QuicHandler

type QuicHandler struct {
	// contains filtered or unexported fields
}

func NewQuicHandler

func NewQuicHandler(conf *WorkflowConfig, meshConfURL string) *QuicHandler

func (*QuicHandler) GetZipperSenders

func (s *QuicHandler) GetZipperSenders() error

GetZipperSenders connects to downstream zippers and get Zipper-Senders.

func (*QuicHandler) Listen

func (s *QuicHandler) Listen() error

func (*QuicHandler) Read

func (s *QuicHandler) Read(id int64, sess quic.Session, st quic.Stream) error

type Serverless

type Serverless interface {
	Init(opts *Options) error
	Build(clean bool) error
	Run() error
}

func Create

func Create(opts *Options) (Serverless, error)

type Workflow

type Workflow struct {
	Flows []App `yaml:"flows"`
	Sinks []App `yaml:"sinks"`
}

type WorkflowConfig

type WorkflowConfig struct {
	Name     string `yaml:"name"`
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Workflow `yaml:",inline"`
}

func Load

func Load(path string) (*WorkflowConfig, error)

func ParseConfig

func ParseConfig(config string) (*WorkflowConfig, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL