Documentation ¶
Overview ¶
Package kernel provides the main kernel service.
Index ¶
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" WebPersistentCookie = "persistent" WebMaxRequestSize = "max-request-size" WebSecureCookie = "secure" 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 interface { // Setup sets the most basic data of a software: its name, its version, // and when the version was created. Setup(progname, version string, versionTime time.Time) // Start the service. Start(headline bool, lineServer bool, configFile string) // WaitForShutdown blocks the call until Shutdown is called. WaitForShutdown() // Shutdown the service. Waits for all concurrent activities to stop. Shutdown(silent bool) // GetKernelLogger returns the kernel logger. GetKernelLogger() *logger.Logger // SetLogLevel sets the logging level for logger maintained by the kernel. // // Its syntax is: (SERVICE ":")? LEVEL (";" (SERICE ":")? LEVEL)*. SetLogLevel(string) // LogRecover outputs some information about the previous panic. LogRecover(name string, recoverInfo interface{}) bool // 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. StartProfiling(profileName, fileName string) error // 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. StopProfiling() error // SetConfig stores a configuration value. SetConfig(srv Service, key, value string) error // GetConfig returns a configuration value. GetConfig(srv Service, key string) interface{} // GetConfigList returns a sorted list of configuration data. GetConfigList(Service) []KeyDescrValue // GetLogger returns a logger for the given service. GetLogger(Service) *logger.Logger // SetLevel sets the logging level for the given service. SetLevel(Service, logger.Level) // RetrieveLogEntries returns all buffered log entries. RetrieveLogEntries() []LogEntry // GetLastLogTime returns the time when the last logging with level > DEBUG happened. GetLastLogTime() time.Time // StartService start the given service. StartService(Service) error // RestartService stops and restarts the given service, while maintaining service dependencies. RestartService(Service) error // StopService stop the given service. StopService(Service) error // GetServiceStatistics returns a key/value list with statistical data. GetServiceStatistics(Service) []KeyValue // DumpIndex writes some data about the internal index into a writer. DumpIndex(io.Writer) // SetCreators store functions to be called when a service has to be created. SetCreators(CreateAuthManagerFunc, CreateBoxManagerFunc, SetupWebServerFunc) }
Kernel is the main internal service.
var Main Kernel
Main references the main kernel.
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.
type SetupWebServerFunc ¶
type SetupWebServerFunc func( webServer server.Server, boxManager box.Manager, authManager auth.Manager, rtConfig config.Config, ) error
SetupWebServerFunc is called to create a new web service handler.
type ShutdownChan ¶
type ShutdownChan <-chan Unit
ShutdownChan is a channel used to signal a system shutdown.