Documentation
¶
Overview ¶
Package kernel provides the main kernel service.
Index ¶
- Constants
- type CreateAuthManagerFunc
- type CreateBoxManagerFunc
- type Kernel
- func (kern *Kernel) GetConfig(srvnum Service, key string) any
- func (kern *Kernel) GetKernelLogLevel() slog.Level
- func (kern *Kernel) GetKernelLogger() *slog.Logger
- func (kern *Kernel) GetLastLogTime() time.Time
- func (kern *Kernel) GetLogger(srvnum Service) *slog.Logger
- func (kern *Kernel) GetServiceStatistics(srvnum Service) []KeyValue
- func (kern *Kernel) LogRecover(name string, recoverInfo any)
- func (kern *Kernel) RetrieveLogEntries() []LogEntry
- func (kern *Kernel) SetConfig(srvnum Service, key, value string) error
- func (kern *Kernel) SetCreators(createAuthManager CreateAuthManagerFunc, createBoxManager CreateBoxManagerFunc, ...)
- func (kern *Kernel) SetLogLevel(logLevel string)
- func (kern *Kernel) Setup(progname, version string, versionTime time.Time)
- func (kern *Kernel) Shutdown(silent bool)
- func (kern *Kernel) Start(headline, lineServer bool, configFilename string)
- func (kern *Kernel) StartProfiling(profileName, fileName string) error
- func (kern *Kernel) StartService(srvnum Service) error
- func (kern *Kernel) StopProfiling() error
- func (kern *Kernel) WaitForShutdown()
- type KeyDescrValue
- type KeyValue
- type LogEntry
- type Service
- type SetupWebServerFunc
Constants ¶
const ( ProfileCPU = "CPU" ProfileHead = "heap" )
Constants for profile names.
const ( CoreDebug = "debug" CoreGoArch = "go-arch" CoreGoOS = "go-os" CoreGoVersion = "go-version" CoreHostname = "hostname" CorePort = "port" CoreProgname = "progname" CoreStarted = "started" CoreVerbose = "verbose" CoreVersion = "version" CoreVTime = "vtime" )
Constants for core service system keys.
const ( ConfigSimpleMode = "simple-mode" ConfigInsecureHTML = "insecure-html" )
Constants for config service keys.
const ( AuthOwner = "owner" AuthReadonly = "readonly" )
Constants for authentication service keys.
const ( BoxDefaultDirType = "defdirtype" BoxURIs = "box-uri-" )
Constants for box service keys.
const ( BoxDirTypeNotify = "notify" BoxDirTypeSimple = "simple" )
Allowed values for BoxDefaultDirType
const ( ConfigSecureHTML = "secure" ConfigSyntaxHTML = "html" ConfigMarkdownHTML = "markdown" ConfigZmkHTML = "zettelmarkup" )
Constants for config service keys.
const ( WebAssetDir = "asset-dir" WebBaseURL = "base-url" WebListenAddress = "listen" WebLoopbackIdent = "loopback-ident" WebLoopbackZid = "loopback-zid" WebPersistentCookie = "persistent" WebProfiling = "profiling" WebMaxRequestSize = "max-request-size" WebSecureCookie = "secure" WebSxMaxNesting = "sx-max-nesting" WebTokenLifetimeAPI = "api-lifetime" WebTokenLifetimeHTML = "html-lifetime" WebURLPrefix = "prefix" )
Constants for web service keys.
const (
CoreDefaultVersion = "unknown"
)
Defined values for core service.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateAuthManagerFunc ¶
CreateAuthManagerFunc is called to create a new auth manager.
type CreateBoxManagerFunc ¶
type CreateBoxManagerFunc func( boxURIs []*url.URL, authManager auth.Manager, rtConfig config.Config, ) (box.Manager, error)
CreateBoxManagerFunc is called to create a new box manager.
type Kernel ¶
type Kernel struct {
// contains filtered or unexported fields
}
Kernel is the main internal kernel.
var Main *Kernel
Main references the main kernel.
func (*Kernel) GetKernelLogLevel ¶ added in v0.22.0
GetKernelLogLevel return the logging level of the kernel logger.
func (*Kernel) GetKernelLogger ¶
GetKernelLogger returns the kernel logger.
func (*Kernel) GetLastLogTime ¶
GetLastLogTime returns the time when the last logging with level > DEBUG happened.
func (*Kernel) GetServiceStatistics ¶
GetServiceStatistics returns a key/value list with statistical data.
func (*Kernel) LogRecover ¶
LogRecover outputs some information about the previous panic.
func (*Kernel) RetrieveLogEntries ¶
RetrieveLogEntries returns all buffered log entries.
func (*Kernel) SetCreators ¶
func (kern *Kernel) SetCreators( createAuthManager CreateAuthManagerFunc, createBoxManager CreateBoxManagerFunc, setupWebServer SetupWebServerFunc, )
SetCreators store functions to be called when a service has to be created.
func (*Kernel) SetLogLevel ¶
SetLogLevel sets the logging level for logger maintained by the kernel.
Its syntax is: (SERVICE ":")? LEVEL (";" (SERVICE ":")? LEVEL)*.
func (*Kernel) Setup ¶
Setup sets the most basic data of a software: its name, its version, and when the version was created.
func (*Kernel) StartProfiling ¶
StartProfiling starts profiling the software according to a profile. It is an error to start more than one profile.
profileName is a valid profile (see runtime/pprof/Lookup()), or the value "cpu" for profiling the CPI. fileName is the name of the file where the results are written to.
func (*Kernel) StartService ¶
StartService start the given service.
func (*Kernel) StopProfiling ¶
StopProfiling stops the current profiling and writes the result to the file, which was named during StartProfiling(). It will always be called before the software stops its operations.
func (*Kernel) WaitForShutdown ¶
func (kern *Kernel) WaitForShutdown()
WaitForShutdown blocks the call until Shutdown is called.
type KeyDescrValue ¶
type KeyDescrValue struct{ Key, Descr, Value string }
KeyDescrValue is a triple of config data.
type Service ¶
type Service uint8
Service specifies a service, e.g. web, ...
const ( KernelService Service // The Kernel itself is also a sevice CoreService // Manages startup specific functionality ConfigService // Provides access to runtime configuration AuthService // Manages authentication BoxService // Boxes provide zettel WebService // Access to Zettelstore through Web-based API and WebUI )
Constants for type Service.