Documentation ¶
Index ¶
- func DummyOnInit[T any](plugin *Plugin[T], conf map[string]any) map[string]any
- func GetManifest[T any](plugin *Plugin[T], request map[string]any) (map[string]any, error)
- func InitCall[T any](plugin *Plugin[T], request map[string]any) (map[string]any, error)
- type Id
- type Map
- type Plugin
- func (self *Plugin[T]) Decode(payload map[string]any, destination any) error
- func (self *Plugin[T]) Encode(obj any) (map[string]any, error)
- func (instance *Plugin[T]) GetConf(key string) (any, bool)
- func (self *Plugin[T]) GetEncoder() encoder.JSONEncoder
- func (instance *Plugin[T]) GetOpt(key string) (any, bool)
- func (self *Plugin[T]) GetState() T
- func (instance *Plugin[T]) Log(level string, message string)
- func (instance *Plugin[T]) RegisterHook(name string, before []string, after []string, ...)
- func (instance *Plugin[T]) RegisterNotification(name string, callback func(plugin *Plugin[T], request Map))
- func (instance *Plugin[T]) RegisterOption(name string, typ string, def string, description string, deprecated bool)
- func (instance *Plugin[T]) RegisterRPCMethod(name string, usage string, description string, ...)
- func (self *Plugin[T]) SetEncoder(encoder encoder.JSONEncoder)
- func (self *Plugin[T]) SetTracer(tracer tracer.Tracer)
- func (self *Plugin[T]) Start()
- type RPCCommand
- type RPCEvent
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetManifest ¶
GetManifest - is a method to generate the manfest object needed by Core Damon to register the plugin. https://lightning.readthedocs.io/PLUGINS.html
Types ¶
type Plugin ¶
type Plugin[T any] struct { State T RpcMethods map[string]*rpcMethod[T] Notifications map[string]*rpcNotification[T] Hooks map[string]*rpcHook[T] Subscriptions map[string]*rpcNotification[T] Options map[string]*rpcOption FeatureBits map[string]any Configuration map[string]any // contains filtered or unexported fields }
Plugin is the base plugin structure. Used to create and manage the state of a plugin.
func New ¶
func New[T any](state T, dynamic bool, onInit func(plugin *Plugin[T], config map[string]any) map[string]any) *Plugin[T]
FIXME: try to pass the pointer of the state to avoid the double copy here!
func (*Plugin[T]) GetEncoder ¶
func (self *Plugin[T]) GetEncoder() encoder.JSONEncoder
func (*Plugin[T]) RegisterHook ¶
func (instance *Plugin[T]) RegisterHook(name string, before []string, after []string, callback func(plugin *Plugin[T], request Map) (Map, error))
Method to add a new rpc hook to the plugin.
func (*Plugin[T]) RegisterNotification ¶
func (instance *Plugin[T]) RegisterNotification(name string, callback func(plugin *Plugin[T], request Map))
Method to add a new rpc notification to the plugin.
func (*Plugin[T]) RegisterOption ¶
func (instance *Plugin[T]) RegisterOption(name string, typ string, def string, description string, deprecated bool)
Method to add a new plugin option.
func (*Plugin[T]) RegisterRPCMethod ¶
func (instance *Plugin[T]) RegisterRPCMethod(name string, usage string, description string, callback func(plugin *Plugin[T], request Map) (Map, error))
Method to add a new rpc method to the plugin.
func (*Plugin[T]) SetEncoder ¶
func (self *Plugin[T]) SetEncoder(encoder encoder.JSONEncoder)
type RPCCommand ¶
RPCCommand FIXME: override the command pattern with the generic type alias when implemented
Click to show internal directories.
Click to hide internal directories.