Documentation
¶
Overview ¶
Compatibility layer — deprecated symbols retained for migration. Will be removed in v2.0.
Package lynx provides the core application framework for building Go microservices.
The implementation lives in internal/app; this file and facade.go re-export the public API so that callers continue to use import paths of the form github.com/go-lynx/lynx.
Architecture ¶
The framework is organized around the following core concepts:
- LynxApp: Application-facing assembly for the core runtime and plugin manager
- Plugin Manager: Handles plugin registration, dependency resolution, and lifecycle
- UnifiedRuntime: Provides resource sharing, event handling, and plugin-scoped runtime views
- Control Plane: Optional shell-facing integration for discovery, routing, and config sources
Package Organization ¶
The root package is a thin facade over internal/app. All implementation lives in:
- internal/app/: Core implementation (LynxApp, managers, lifecycle, etc.)
- internal/app/compat/: Deprecated TypedRuntimePlugin wrapper (removed in v2.0)
Quick Start ¶
Basic usage of the Lynx core:
package main
import (
"github.com/go-kratos/kratos/v2/config"
"github.com/go-kratos/kratos/v2/config/file"
"github.com/go-lynx/lynx"
"github.com/go-lynx/lynx/boot"
)
func main() {
// Load configuration
cfg := config.New(config.WithSource(file.NewSource("config.yaml")))
cfg.Load()
// Create application with plugins
app, err := lynx.NewStandaloneApp(cfg)
if err != nil {
panic(err)
}
defer app.Close()
// Load and start plugins
if err := app.LoadPlugins(); err != nil {
panic(err)
}
// Or hand the app to the optional boot package
// boot.NewApplication(wire).Run()
}
For More Information ¶
Visit the official documentation at https://go-lynx.cn/docs
Package lynx provides the core application framework for building Go microservices.
The implementation lives in internal/app; this file re-exports the public API so that callers continue to use import paths of the form github.com/go-lynx/lynx.
Index ¶
- Constants
- Variables
- func GetTypedPlugin[T plugins.Plugin](name string) (T, error)
- func GetTypedPluginFromApp[T plugins.Plugin](app *LynxApp, name string) (T, error)
- func GetTypedPluginFromManager[T plugins.Plugin](m PluginManager, name string) (T, error)
- func GetTypedResource[T any](r *TypedRuntimePlugin, name string) (T, error)
- func GetTypedResourceFromRuntime[T any](runtime plugins.Runtime, name string) (T, error)
- func ListPluginNames(m PluginManager) []string
- func MustGetTypedPluginFromApp[T plugins.Plugin](app *LynxApp, name string) T
- func MustGetTypedPluginFromManager[T plugins.Plugin](m PluginManager, name string) T
- func NewPluginManager[T plugins.Plugin](pluginList ...T) *iapp.DefaultPluginManager[T]
- func NewPluginManagerWithError[T plugins.Plugin](pluginList ...T) (*iapp.DefaultPluginManager[T], error)
- func Plugins(m PluginManager) []plugins.Plugin
- func RegisterTypedResource[T any](r *TypedRuntimePlugin, name string, resource T) error
- func RegisterTypedResourceOnRuntime[T any](runtime plugins.Runtime, name string, resource T) error
- type ActionFunc
- type CertificateProvider
- type CircuitBreaker
- type CircuitState
- type ConfigManager
- type ConfigReloadEntry
- type ConfigReloadPlan
- type ControlPlane
- type ControlPlaneCapability
- type ControlPlaneCapabilityReporter
- type ControlPlaneConfigTarget
- type ControlPlaneConfigWatcherProvider
- type CoreRuntimeReport
- type DefaultControlPlane
- type DefaultPluginManager
- type DefaultRecoveryStrategy
- type ErrorCategory
- type ErrorRecord
- type ErrorRecoveryManager
- type ErrorSeverity
- type FallbackRecoveryStrategy
- type LynxApp
- type MultiConfigControlPlane
- type PluginManager
- type PluginRuntimeReport
- type PluginWithLevel
- type PrepareFailure
- type PrepareReport
- type RateLimiter
- type RecoveryRecord
- type RecoveryStrategy
- type RestartRecoveryStrategy
- type RestartRequirementReport
- type RetryRecoveryStrategy
- type RouteManager
- type RuntimePlugin
- type ServiceRegistry
- type SystemCore
- type TypedPluginManager
- type TypedRuntimePlugin
- type UnloadFailureRecord
Constants ¶
const ( ControlPlaneCapabilityConfig = iapp.ControlPlaneCapabilityConfig ControlPlaneCapabilityRegistry = iapp.ControlPlaneCapabilityRegistry ControlPlaneCapabilityDiscovery = iapp.ControlPlaneCapabilityDiscovery ControlPlaneCapabilityRouter = iapp.ControlPlaneCapabilityRouter ControlPlaneCapabilityRateLimit = iapp.ControlPlaneCapabilityRateLimit ControlPlaneCapabilityTrafficProtection = iapp.ControlPlaneCapabilityTrafficProtection ControlPlaneCapabilityWatcher = iapp.ControlPlaneCapabilityWatcher )
const ( CircuitStateClosed = iapp.CircuitStateClosed CircuitStateOpen = iapp.CircuitStateOpen CircuitStateHalfOpen = iapp.CircuitStateHalfOpen )
const ( ErrorSeverityLow = iapp.ErrorSeverityLow ErrorSeverityMedium = iapp.ErrorSeverityMedium ErrorSeverityHigh = iapp.ErrorSeverityHigh ErrorSeverityCritical = iapp.ErrorSeverityCritical ErrorCategoryNetwork = iapp.ErrorCategoryNetwork ErrorCategoryDatabase = iapp.ErrorCategoryDatabase ErrorCategoryConfig = iapp.ErrorCategoryConfig ErrorCategoryPlugin = iapp.ErrorCategoryPlugin ErrorCategoryResource = iapp.ErrorCategoryResource ErrorCategorySecurity = iapp.ErrorCategorySecurity ErrorCategoryTimeout = iapp.ErrorCategoryTimeout ErrorCategoryValidation = iapp.ErrorCategoryValidation ErrorCategorySystem = iapp.ErrorCategorySystem )
Variables ¶
var ClearDefaultApp = iapp.ClearDefaultApp
var ControlPlaneCapabilitiesOf = iapp.ControlPlaneCapabilitiesOf
var ControlPlaneCapabilityResourceName = iapp.ControlPlaneCapabilityResourceName
var DefaultLogger = log.DefaultLogger
DefaultLogger re-exports kratos log.DefaultLogger for callers that import only lynx.
var GetEventAdapterFromApp = iapp.GetEventAdapterFromApp
var GetEventListenerManagerFromApp = iapp.GetEventListenerManagerFromApp
var GetEventManagerFromApp = iapp.GetEventManagerFromApp
var GetGlobalConfigFromApp = iapp.GetGlobalConfigFromApp
var GetHost = icompat.GetHost
var GetName = icompat.GetName
var GetPluginManagerFromApp = iapp.GetPluginManagerFromApp
var GetServiceDiscovery = icompat.GetServiceDiscovery
var GetServiceRegistry = icompat.GetServiceRegistry
var GetVersion = icompat.GetVersion
var Lynx = icompat.Lynx
var NewApp = icompat.NewApp
var NewCircuitBreaker = iapp.NewCircuitBreaker
var NewDefaultRecoveryStrategy = iapp.NewDefaultRecoveryStrategy
var NewDefaultRuntime = iapp.NewDefaultRuntime
var NewErrorRecoveryManager = iapp.NewErrorRecoveryManager
var NewFallbackRecoveryStrategy = iapp.NewFallbackRecoveryStrategy
var NewRestartRecoveryStrategy = iapp.NewRestartRecoveryStrategy
var NewRetryRecoveryStrategy = iapp.NewRetryRecoveryStrategy
var NewRuntimePlugin = icompat.NewRuntimePlugin
var NewStandaloneApp = iapp.NewStandaloneApp
var NewTypedPluginManager = iapp.NewTypedPluginManager
var NewTypedRuntimePlugin = icompat.NewTypedRuntimePlugin
var RegisterControlPlaneCapabilityResources = iapp.RegisterControlPlaneCapabilityResources
var SetDefaultApp = iapp.SetDefaultApp
Re-export compat app functions
var StartControlPlaneWatcher = iapp.StartControlPlaneWatcher
Functions ¶
func GetTypedPluginFromApp ¶ added in v1.6.0
func GetTypedPluginFromManager ¶
func GetTypedPluginFromManager[T plugins.Plugin](m PluginManager, name string) (T, error)
func GetTypedResource ¶
func GetTypedResource[T any](r *TypedRuntimePlugin, name string) (T, error)
func GetTypedResourceFromRuntime ¶ added in v1.6.0
func ListPluginNames ¶
func ListPluginNames(m PluginManager) []string
func MustGetTypedPluginFromApp ¶ added in v1.6.0
func MustGetTypedPluginFromManager ¶
func MustGetTypedPluginFromManager[T plugins.Plugin](m PluginManager, name string) T
func NewPluginManager ¶
func NewPluginManager[T plugins.Plugin](pluginList ...T) *iapp.DefaultPluginManager[T]
func NewPluginManagerWithError ¶ added in v1.6.0
func NewPluginManagerWithError[T plugins.Plugin](pluginList ...T) (*iapp.DefaultPluginManager[T], error)
func Plugins ¶
func Plugins(m PluginManager) []plugins.Plugin
func RegisterTypedResource ¶
func RegisterTypedResource[T any](r *TypedRuntimePlugin, name string, resource T) error
Types ¶
type ActionFunc ¶ added in v1.6.3
type ActionFunc = iapp.ActionFunc
type CertificateProvider ¶
type CertificateProvider = iapp.CertificateProvider
type CircuitBreaker ¶
type CircuitBreaker = iapp.CircuitBreaker
type CircuitState ¶
type CircuitState = iapp.CircuitState
type ConfigManager ¶
type ConfigManager = iapp.ConfigManager
type ConfigReloadEntry ¶ added in v1.6.0
type ConfigReloadEntry = iapp.ConfigReloadEntry
type ConfigReloadPlan ¶ added in v1.6.0
type ConfigReloadPlan = iapp.ConfigReloadPlan
ConfigReloadPlan is retained only as a compatibility report for older callers.
type ControlPlane ¶
type ControlPlane = iapp.ControlPlane
type ControlPlaneCapability ¶ added in v1.6.0
type ControlPlaneCapability = iapp.ControlPlaneCapability
type ControlPlaneCapabilityReporter ¶ added in v1.6.0
type ControlPlaneCapabilityReporter = iapp.ControlPlaneCapabilityReporter
type ControlPlaneConfigTarget ¶ added in v1.6.0
type ControlPlaneConfigTarget = iapp.ControlPlaneConfigTarget
type ControlPlaneConfigWatcherProvider ¶ added in v1.6.0
type ControlPlaneConfigWatcherProvider = iapp.ControlPlaneConfigWatcherProvider
type CoreRuntimeReport ¶ added in v1.6.0
type CoreRuntimeReport = iapp.CoreRuntimeReport
type DefaultControlPlane ¶
type DefaultControlPlane = iapp.DefaultControlPlane
type DefaultPluginManager ¶
type DefaultPluginManager[T plugins.Plugin] = iapp.DefaultPluginManager[T]
type DefaultRecoveryStrategy ¶
type DefaultRecoveryStrategy = iapp.DefaultRecoveryStrategy
type ErrorCategory ¶
type ErrorCategory = iapp.ErrorCategory
type ErrorRecord ¶
type ErrorRecord = iapp.ErrorRecord
type ErrorRecoveryManager ¶
type ErrorRecoveryManager = iapp.ErrorRecoveryManager
type ErrorSeverity ¶
type ErrorSeverity = iapp.ErrorSeverity
type FallbackRecoveryStrategy ¶ added in v1.6.3
type FallbackRecoveryStrategy = iapp.FallbackRecoveryStrategy
type MultiConfigControlPlane ¶
type MultiConfigControlPlane = iapp.MultiConfigControlPlane
type PluginManager ¶
type PluginManager = iapp.PluginManager
type PluginRuntimeReport ¶ added in v1.6.0
type PluginRuntimeReport = iapp.PluginRuntimeReport
type PluginWithLevel ¶
type PluginWithLevel = iapp.PluginWithLevel
type PrepareFailure ¶ added in v1.6.0
type PrepareFailure = iapp.PrepareFailure
type PrepareReport ¶ added in v1.6.0
type PrepareReport = iapp.PrepareReport
type RateLimiter ¶
type RateLimiter = iapp.RateLimiter
type RecoveryRecord ¶
type RecoveryRecord = iapp.RecoveryRecord
type RecoveryStrategy ¶
type RecoveryStrategy = iapp.RecoveryStrategy
type RestartRecoveryStrategy ¶ added in v1.6.3
type RestartRecoveryStrategy = iapp.RestartRecoveryStrategy
type RestartRequirementReport ¶ added in v1.6.0
type RestartRequirementReport = iapp.RestartRequirementReport
type RetryRecoveryStrategy ¶ added in v1.6.3
type RetryRecoveryStrategy = iapp.RetryRecoveryStrategy
Concrete recovery strategies (preferred over DefaultRecoveryStrategy).
type RouteManager ¶
type RouteManager = iapp.RouteManager
type RuntimePlugin ¶
type RuntimePlugin = icompat.RuntimePlugin
type ServiceRegistry ¶
type ServiceRegistry = iapp.ServiceRegistry
type SystemCore ¶
type SystemCore = iapp.SystemCore
type TypedPluginManager ¶
type TypedPluginManager = icompat.TypedPluginManager
TypedPluginManager is a deprecated alias for PluginManager.
type TypedRuntimePlugin ¶
type TypedRuntimePlugin = icompat.TypedRuntimePlugin
TypedRuntimePlugin and RuntimePlugin are in the compat package.
type UnloadFailureRecord ¶
type UnloadFailureRecord = iapp.UnloadFailureRecord
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
lynx
module
|
|
|
Package events is the Lynx unified event bus, built on kelindar/event.
|
Package events is the Lynx unified event bus, built on kelindar/event. |
|
internal
|
|
|
app
Package app provides the core application framework for building microservices.
|
Package app provides the core application framework for building microservices. |
|
app/compat
Compatibility layer — process-wide singleton helpers.
|
Compatibility layer — process-wide singleton helpers. |
|
resource
Package resource provides simple runtime resources used by other components.
|
Package resource provides simple runtime resources used by other components. |
|
Package kratos provides integration with the Kratos framework
|
Package kratos provides integration with the Kratos framework |
|
Package log provides a unified logging interface for the Lynx framework.
|
Package log provides a unified logging interface for the Lynx framework. |
|
observability
|
|
|
pkg
|
|
|
config
Package config provides a minimal validation framework used by plugins and core.
|
Package config provides a minimal validation framework used by plugins and core. |
|
factory
Package factory provides functionality for creating and managing plugins in the Lynx framework.
|
Package factory provides functionality for creating and managing plugins in the Lynx framework. |
|
Package plugins provides the core plugin system for the Lynx framework.
|
Package plugins provides the core plugin system for the Lynx framework. |
|
db/mysql
module
|
|
|
db/pgsql
module
|
|
|
mq/kafka
module
|
|
|
nosql/redis
module
|
|
|
polaris
module
|
|
|
seata
module
|
|
|
service/grpc
module
|
|
|
service/http
module
|
|
|
sql/base
module
|
|
|
sql/interfaces
module
|
|
|
sql/mysql
module
|
|
|
sql/pgsql
module
|
|
|
swagger
module
|
|
|
tracer
module
|
|
|
third_party
|
|