temporalite

package
v1.25.0-115.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package temporalite contains high level helpers for setting up a SQLite based server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LiteServer

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

LiteServer is a high level wrapper for Server that automatically configures a SQLite backend.

func NewLiteServer

func NewLiteServer(liteConfig *LiteServerConfig, opts ...temporal.ServerOption) (*LiteServer, error)

NewLiteServer initializes a Server with a SQLite backend.

Additional configuration can be specified either via variadic ServerOption arguments or by setting the BaseConfig field in LiteServerConfig.

Always use BaseConfig instead of the WithConfig server option, as WithConfig overrides all LiteServer specific settings.

func (*LiteServer) FrontendHostPort

func (s *LiteServer) FrontendHostPort() string

FrontendHostPort returns the host:port for this server.

When constructing a Temporalite client from within the same process, NewClient or NewClientWithOptions should be used instead.

func (*LiteServer) NewClient

func (s *LiteServer) NewClient(ctx context.Context, namespace string) (client.Client, error)

NewClient initializes a client ready to communicate with the Temporal server in the target namespace.

func (*LiteServer) NewClientWithOptions

func (s *LiteServer) NewClientWithOptions(ctx context.Context, options client.Options) (client.Client, error)

NewClientWithOptions is the same as NewClient but allows further customization.

To set the client's namespace, use the corresponding field in client.Options.

Note that options.HostPort will always be overridden.

func (*LiteServer) Start

func (s *LiteServer) Start() error

Start temporal server.

func (*LiteServer) Stop

func (s *LiteServer) Stop() error

Stop the server.

type LiteServerConfig

type LiteServerConfig struct {
	// When true, Ephemeral disables file persistence and uses the in-memory storage driver.
	// State will be reset on each process restart.
	Ephemeral bool
	// DatabaseFilePath persists state to the file at the specified path. If the db file does
	// not already exist, it is created and schema migrations are automatically run.
	//
	// This is required if Ephemeral is false.
	DatabaseFilePath string
	// Address on which frontend service should listen.
	FrontendIP string
	// Port on which frontend service should listen.
	FrontendPort int
	// WithMetricsPort sets the listening port for the default Prometheus metrics handler.
	//
	// When unspecified, the port will be system-chosen.
	//
	// This field is ignored when the WithCustomMetricsHandler server option is enabled.
	MetricsPort int
	// Namespaces specified here will be automatically registered on Temporal start.
	Namespaces []string
	// SQLitePragmas specified here will be applied as pragma statements to SQLite on Temporal start.
	SQLitePragmas map[string]string
	// Logger overrides the default logger.
	Logger log.Logger
	// BaseConfig sets the default Temporal server configuration.
	//
	// Storage and client configuration will always be overridden, however base config can be
	// used to enable settings like TLS or authentication.
	//
	// Note that ServerOption arguments can also be passed to the NewLiteServer function.
	// Always prefer setting BaseConfig over using WithConfig however, as WithConfig overrides
	// all LiteServer specific settings.
	BaseConfig *config.Config
	// DynamicConfig sets dynamic config values used by the server.
	DynamicConfig dynamicconfig.StaticClient
}

LiteServerConfig encodes options for LiteServer instances.

type PortProvider added in v1.24.0

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

func NewPortProvider added in v1.24.0

func NewPortProvider() *PortProvider

func (*PortProvider) Close added in v1.24.0

func (p *PortProvider) Close() error

func (*PortProvider) GetFreePort added in v1.24.0

func (p *PortProvider) GetFreePort() (int, error)

GetFreePort finds an open port on the system which is ready to use.

func (*PortProvider) MustGetFreePort added in v1.24.0

func (p *PortProvider) MustGetFreePort() int

MustGetFreePort calls GetFreePort, panicking on error.

Jump to

Keyboard shortcuts

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