server

package
v0.0.0-...-e652847 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDBNotInitialized = errors.New(
	"Database is not initialized. Run 'xbusd init'",
)

ErrDBNotInitialized is when the database was never initialized

View Source
var ErrDBNotVersionned = errors.New(
	"database is not versioned. " +
		"Apply manually the migration scripts up to version 3.0.0-beta.14, " +
		"then run 'xbusd migrate'")

ErrDBNotVersionned is returned by checkDBVersion if the database contains some tables but is not versionned, which means it was created before version 3.0.0-beta.14

Functions

This section is empty.

Types

type ErrDBNeedUpgrade

type ErrDBNeedUpgrade struct {
	CurrentVersion  uint
	RequiredVersion uint
}

ErrDBNeedUpgrade is returned if the database is not up-to-date with the server version

func (ErrDBNeedUpgrade) Error

func (e ErrDBNeedUpgrade) Error() string

Error returns the formatted error message

type InstanceProperties

type InstanceProperties struct {
	Name       string
	Production bool
}

InstanceProperties contains the description of a xbus instance

type Options

type Options struct {
	Instance                       InstanceProperties
	DatabaseDSN                    string
	DatabaseLogFlags               qb.LogFlags
	DatabaseMaxConnections         int
	ProcessStorageDBMaxConnections int
	RootCA                         string // a PEM or a path to a PEM file
	ServerCert                     string // a PEM or a path to a PEM file
	ServerKey                      string // a PEM or a path to a PEM file
	ClientCA                       string // a PEM or a path to a PEM file
	ClientCAKey                    string // a PEM or a path to a PEM file
	TLSTimeout                     float64
	NATSHost                       string
	NATSPort                       int
	NATSDebug                      bool
	NATSTrace                      bool
	ServeNATS                      bool
	ServeBroker                    bool
	ServeClientAPI                 bool
	ServeDirector                  bool
	ServeEnvelopeStorage           bool
	ServeControl                   bool
	ServeMetrics                   bool
	ServePostmortem                bool
	ServeProcessState              bool
	ServeRegistration              bool
	ServeSentinel                  bool
	GnatsdOptions                  gnatsd.Options
	SentryDSN                      string
	SentryEnvironment              string
	MetricsHTTPHost                string
	MetricsHTTPPort                int
}

Options of a server

type Server

type Server struct {
	ServiceManager *services.Manager
	// contains filtered or unexported fields
}

Server the XBus server

func NewServer

func NewServer(options Options) (*Server, error)

NewServer creates a Server

func (*Server) AccountStorage

func (s *Server) AccountStorage() storage.AccountStorage

AccountStorage returns the underlying AccountStorage

func (*Server) ActorStorage

func (s *Server) ActorStorage() storage.ActorStorage

ActorStorage returns the underlying ActorStorage

func (*Server) DBStats

func (s *Server) DBStats() (defaultDBStats *gosql.DBStats, processStorageDBStats *gosql.DBStats)

DBStats returns the Stats of the two database connexions, with a cache of 10ms

func (*Server) DefaultDBStats

func (s *Server) DefaultDBStats() *gosql.DBStats

DefaultDBStats returns the Stats of the default database

func (*Server) GetEnvelopeStorage

func (s *Server) GetEnvelopeStorage() storage.EnvelopeStorage

GetEnvelopeStorage returns the envelope storage

func (*Server) GetRavenClient

func (s *Server) GetRavenClient() *raven.Client

GetRavenClient returns the raven.Client instance

func (*Server) NATSConnectOptions

func (s *Server) NATSConnectOptions() nats.Options

NATSConnectOptions returns nats.Options to connect to the bus with full access

func (*Server) NATSUrl

func (s *Server) NATSUrl() string

NATSUrl returns the nats server url

func (*Server) PasswordStorage

func (s *Server) PasswordStorage() storage.PasswordStorage

PasswordStorage returns the underlying PasswordStorage

func (*Server) ProcessManager

func (s *Server) ProcessManager() *process.Manager

ProcessManager returns the process manager

func (*Server) ProcessStorage

func (s *Server) ProcessStorage() storage.ProcessStorage

ProcessStorage returns the underlying ProcessStorage

func (*Server) ProcessStorageDBStats

func (s *Server) ProcessStorageDBStats() *gosql.DBStats

ProcessStorageDBStats returns the Stats of the process storage database

func (*Server) SetEnvelopeStorageDB

func (s *Server) SetEnvelopeStorageDB(m *model.Model, db *yago.DB)

SetEnvelopeStorageDB sets the model & db for the envelope storage

func (*Server) SetLogger

func (s *Server) SetLogger(logger xbus.Logger)

SetLogger changes the logger used by server

func (*Server) SetRavenTransport

func (s *Server) SetRavenTransport(transport raven.Transport) error

SetRavenTransport forces a transport on the raven client and creates a client even if no SentryDSN is set

func (*Server) SetSQLDB

func (s *Server) SetSQLDB(m *model.Model, db *yago.DB)

SetSQLDB sets the model & db

func (*Server) SetupRaven

func (s *Server) SetupRaven() error

SetupRaven configures the raven client

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown stops the services and nats server (if relevant)

func (*Server) StartNATS

func (s *Server) StartNATS() error

StartNATS starts the nats server

func (*Server) Startup

func (s *Server) Startup() (err error)

Startup starts the server

func (*Server) StopNATS

func (s *Server) StopNATS()

StopNATS stops the nats server

Jump to

Keyboard shortcuts

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