server

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedTRuntimeType = errors.New("unsupported runtime type")
	ErrUnsupportedTubeType     = errors.New("unsupported tube type")
	ErrUnsupportedStateStore   = errors.New("unsupported state store")
)

Functions

func DefaultRuntimeLoader added in v0.4.0

func DefaultRuntimeLoader(c *FactoryConfig) (api.FunctionRuntimeFactory, error)

func DefaultStateStoreLoader added in v0.4.0

func DefaultStateStoreLoader(c *StateStoreConfig) (api.StateStore, error)

func DefaultTubeLoader added in v0.4.0

func DefaultTubeLoader(c *FactoryConfig) (contube.TubeFactory, error)

Types

type Config added in v0.4.0

type Config struct {
	// ListenAddr is the address that the function stream REST service will listen on.
	ListenAddr string `mapstructure:"listen_addr"`

	// TubeFactory is the list of tube factories that the function stream server will use.
	TubeFactory map[string]*FactoryConfig `mapstructure:"tube_factory"`

	// RuntimeFactory is the list of runtime factories that the function stream server will use.
	RuntimeFactory map[string]*FactoryConfig `mapstructure:"runtime_factory"`

	// StateStore is the configuration for the state store that the function stream server will use.
	// Optional
	StateStore *StateStoreConfig `mapstructure:"state_store"`
}

func LoadConfigFromEnv

func LoadConfigFromEnv() (*Config, error)

func LoadConfigFromFile added in v0.4.0

func LoadConfigFromFile(filePath string) (*Config, error)

type FactoryConfig added in v0.4.0

type FactoryConfig struct {
	Ref    *string           `mapstructure:"ref"`
	Type   *string           `mapstructure:"type"`
	Config *common.ConfigMap `mapstructure:"config"`
}

type RuntimeLoaderType added in v0.4.0

type RuntimeLoaderType func(c *FactoryConfig) (api.FunctionRuntimeFactory, error)

type Server

type Server struct {
	Manager *fs.FunctionManager
	// contains filtered or unexported fields
}

func NewDefaultServer

func NewDefaultServer() (*Server, error)

func NewServer

func NewServer(opts ...ServerOption) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) Run

func (s *Server) Run(context context.Context)

func (*Server) WaitForReady

func (s *Server) WaitForReady(ctx context.Context) <-chan struct{}

type ServerOption

type ServerOption interface {
	// contains filtered or unexported methods
}

func WithConfig added in v0.4.0

func WithConfig(config *Config) ServerOption

func WithFunctionManager

func WithFunctionManager(opts ...fs.ManagerOption) ServerOption

WithFunctionManager sets the function Manager for the server.

func WithHttpListener

func WithHttpListener(listener net.Listener) ServerOption

WithHttpListener sets the listener for the HTTP server. If not set, the server will listen on the Config.ListenAddr.

func WithHttpTubeFactory

func WithHttpTubeFactory(factory *contube.HttpTubeFactory) ServerOption

WithHttpTubeFactory sets the factory for the HTTP tube. If not set, the server will use the default HTTP tube factory.

func WithRuntimeLoader added in v0.4.0

func WithRuntimeLoader(loader RuntimeLoaderType) ServerOption

WithRuntimeLoader sets the loader for the runtime factory. This must be called before WithConfig.

func WithStateStoreLoader added in v0.4.0

func WithStateStoreLoader(loader func(c *StateStoreConfig) (api.StateStore, error)) ServerOption

func WithTubeLoader added in v0.4.0

func WithTubeLoader(loader TubeLoaderType) ServerOption

WithTubeLoader sets the loader for the tube factory. This must be called before WithConfig.

type StateStoreConfig added in v0.4.0

type StateStoreConfig struct {
	Type   *string           `mapstructure:"type"`
	Config *common.ConfigMap `mapstructure:"config"`
}

type StateStoreLoaderType added in v0.4.0

type StateStoreLoaderType func(c *StateStoreConfig) (api.StateStore, error)

type TubeLoaderType added in v0.4.0

type TubeLoaderType func(c *FactoryConfig) (contube.TubeFactory, error)

Jump to

Keyboard shortcuts

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