server

package
v0.0.0-...-88b6b2c Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 35 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(m *NitricServer)

Run - Run a runtime server until a signal is received or an error occurs

Types

type NitricServer

type NitricServer struct {

	// Options
	ServiceAddress string
	// The command that will be used to invoke the child process
	ChildCommand []string
	// Commands that will be started before all others
	PreCommands [][]string

	// The total time to wait for the child process to be available in seconds
	ChildTimeoutSeconds int

	// The minimum number of workers that need to be available
	MinWorkers int

	// The provider adapter gateway
	GatewayPlugin gateway.GatewayService

	ResourcesPlugin resourcespb.ResourcesServer

	// Resource access plugins
	KeyValuePlugin      kvstorepb.KvStoreServer
	TopicsPlugin        topicspb.TopicsServer
	StoragePlugin       storagepb.StorageServer
	SecretManagerPlugin secretspb.SecretManagerServer
	WebsocketPlugin     websocketspb.WebsocketServer
	QueuesPlugin        queuespb.QueuesServer
	SqlPlugin           sqlpb.SqlServer
	BatchPlugin         batchpb.BatchServer

	// Worker plugins
	ApiPlugin               apis.ApiRequestHandler
	HttpPlugin              http.HttpRequestHandler
	SchedulesPlugin         schedules.ScheduleRequestHandler
	TopicsListenerPlugin    topics.SubscriptionRequestHandler
	StorageListenerPlugin   storage.BucketRequestHandler
	WebsocketListenerPlugin websockets.WebsocketRequestHandler
	JobHandlerPlugin        jobs.JobRequestHandler
	// contains filtered or unexported fields
}

func New

func New(opts ...ServerOption) (*NitricServer, error)

New - Create a new nitric server

func (*NitricServer) Start

func (s *NitricServer) Start(startOpts ...ServerStartOptions) error

Start the server

func (*NitricServer) Stop

func (s *NitricServer) Stop()

func (*NitricServer) WorkerCount

func (s *NitricServer) WorkerCount() int

type ServerOption

type ServerOption func(opts *NitricServer)

func WithApiPlugin

func WithApiPlugin(api apis.ApiRequestHandler) ServerOption

func WithBatchPlugin

func WithBatchPlugin(bp batchpb.BatchServer) ServerOption

func WithChildCommand

func WithChildCommand(command []string) ServerOption

func WithChildTimeoutSeconds

func WithChildTimeoutSeconds(timeout int) ServerOption

func WithGatewayPlugin

func WithGatewayPlugin(gw gateway.GatewayService) ServerOption

func WithHttpPlugin

func WithHttpPlugin(http http.HttpRequestHandler) ServerOption

func WithJobHandlerPlugin

func WithJobHandlerPlugin(jobs jobs.JobRequestHandler) ServerOption

func WithKeyValuePlugin

func WithKeyValuePlugin(kv kvstorepb.KvStoreServer) ServerOption

func WithMinWorkers

func WithMinWorkers(minWorkers int) ServerOption

WithMinWorkers - Set the minimum number of workers that need to be available. this option is ignored if the MIN_WORKERS environment variable is set

func WithPreCommands

func WithPreCommands(commands [][]string) ServerOption

func WithQueuesPlugin

func WithQueuesPlugin(qs queuespb.QueuesServer) ServerOption

func WithResourcesPlugin

func WithResourcesPlugin(resources resourcespb.ResourcesServer) ServerOption

func WithSchedulesPlugin

func WithSchedulesPlugin(schedules schedules.ScheduleRequestHandler) ServerOption

func WithSecretManagerPlugin

func WithSecretManagerPlugin(sm secretspb.SecretManagerServer) ServerOption

func WithServiceAddress

func WithServiceAddress(address string) ServerOption

func WithSqlPlugin

func WithSqlPlugin(sql sqlpb.SqlServer) ServerOption

func WithStorageListenerPlugin

func WithStorageListenerPlugin(storage storage.BucketRequestHandler) ServerOption

func WithStoragePlugin

func WithStoragePlugin(sp storagepb.StorageServer) ServerOption

func WithTopicsListenerPlugin

func WithTopicsListenerPlugin(topics topics.SubscriptionRequestHandler) ServerOption

func WithTopicsPlugin

func WithTopicsPlugin(tp topicspb.TopicsServer) ServerOption

func WithWebsocketListenerPlugin

func WithWebsocketListenerPlugin(websockets websockets.WebsocketRequestHandler) ServerOption

func WithWebsocketPlugin

func WithWebsocketPlugin(ws websocketspb.WebsocketServer) ServerOption

type ServerStartOptions

type ServerStartOptions func(m *NitricServer)

func WithGrpcServer

func WithGrpcServer(s *grpc.Server) ServerStartOptions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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