server

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedStateStore = errors.New("unsupported state store")
	ErrUnsupportedQueueType  = errors.New("unsupported queue type")
)

Functions

func DefaultStateStoreLoader added in v0.4.0

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

func GetBuiltinRuntimeFactoryBuilder added in v0.5.0

func GetBuiltinRuntimeFactoryBuilder() map[string]func(configMap common.ConfigMap) (api.FunctionRuntimeFactory, error)

func GetBuiltinTubeFactoryBuilder added in v0.5.0

func GetBuiltinTubeFactoryBuilder() map[string]func(configMap common.ConfigMap) (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"`

	Queue QueueConfig `mapstructure:"queue"`

	TubeConfig map[string]common.ConfigMap `mapstructure:"tube-config"`

	RuntimeConfig map[string]common.ConfigMap `mapstructure:"runtime-config"`

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

	// FunctionStore is the path to the function store
	FunctionStore string `mapstructure:"function-store"`

	EnableTLS   bool   `mapstructure:"enable-tls"`
	TLSCertFile string `mapstructure:"tls-cert-file"`
	TLSKeyFile  string `mapstructure:"tls-key-file"`
}

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 {
	// Deprecate
	Ref    *string           `mapstructure:"ref"`
	Type   *string           `mapstructure:"type"`
	Config *common.ConfigMap `mapstructure:"config"`
}

type FunctionStore added in v0.5.0

type FunctionStore interface {
	Load() error
}

func NewFunctionStoreDisabled added in v0.5.0

func NewFunctionStoreDisabled() FunctionStore

func NewFunctionStoreImpl added in v0.5.0

func NewFunctionStoreImpl(fm fs.FunctionManager, path string) (FunctionStore, error)

type FunctionStoreDisabled added in v0.5.0

type FunctionStoreDisabled struct {
}

func (*FunctionStoreDisabled) Load added in v0.5.0

func (f *FunctionStoreDisabled) Load() error

type FunctionStoreImpl added in v0.5.0

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

func (*FunctionStoreImpl) Load added in v0.5.0

func (f *FunctionStoreImpl) Load() error

type QueueConfig added in v0.5.0

type QueueConfig struct {
	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
	FunctionStore FunctionStore
	// 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 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 WithLogger added in v0.5.0

func WithLogger(log *logr.Logger) ServerOption

func WithQueueConfig added in v0.5.0

func WithQueueConfig(config QueueConfig) ServerOption

func WithRuntimeFactoryBuilder added in v0.5.0

func WithRuntimeFactoryBuilder(
	name string,
	builder func(configMap common.ConfigMap) (api.FunctionRuntimeFactory, error),
) ServerOption

func WithRuntimeFactoryBuilders added in v0.5.0

func WithRuntimeFactoryBuilders(
	builder map[string]func(configMap common.ConfigMap) (api.FunctionRuntimeFactory, error),
) ServerOption

func WithStateStoreLoader added in v0.4.0

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

func WithTubeFactoryBuilder added in v0.5.0

func WithTubeFactoryBuilder(
	name string,
	builder func(configMap common.ConfigMap) (contube.TubeFactory, error),
) ServerOption

func WithTubeFactoryBuilders added in v0.5.0

func WithTubeFactoryBuilders(
	builder map[string]func(configMap common.ConfigMap,
	) (contube.TubeFactory, error)) ServerOption

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