Documentation
¶
Index ¶
- Constants
- Variables
- type Deps
- type Module
- type ModuleBase
- func (mb *ModuleBase) Go(fn func() error)
- func (mb *ModuleBase) Icon() ([]byte, string, error)
- func (mb *ModuleBase) MarshalMessage(msg *bus.BusMessage, v proto.Message)
- func (mb *ModuleBase) UnmarshalMessage(msg *bus.BusMessage, v protoreflect.ProtoMessage) *bus.Error
- func (mb *ModuleBase) Wait() error
- type ModuleDeps
- type PluginContext
- type Service
- type Web
Constants ¶
View Source
const AKLogoType = "image/svg+xml"
Variables ¶
View Source
var AKLogo []byte
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct {
Bus *bus.Bus
KV kv.KV
Log *log.MasterLogger
Web Web
StoragePath string
CachePath string
HttpClient *http.Client
Config *svc.Config
// contains filtered or unexported fields
}
Deps carries the deps of the modules system itself, not deps for a specific module
func (*Deps) UpdateConfig ¶ added in v0.1.8
func (*Deps) WatchConfig ¶ added in v0.1.8
type ModuleBase ¶
ModuleBase provides some common module functionality
func (*ModuleBase) Go ¶
func (mb *ModuleBase) Go(fn func() error)
Go launches a goroutine with the provided function using the internal errgroup
func (*ModuleBase) Icon ¶ added in v0.0.16
func (mb *ModuleBase) Icon() ([]byte, string, error)
Icon returns a default icon and MIME type
func (*ModuleBase) MarshalMessage ¶
func (mb *ModuleBase) MarshalMessage(msg *bus.BusMessage, v proto.Message)
MarshalMessage marshals a payload and sets it on the provided BusMessage. If marshalling fails, an error is logged and msg.Error is set
func (*ModuleBase) UnmarshalMessage ¶
func (mb *ModuleBase) UnmarshalMessage(msg *bus.BusMessage, v protoreflect.ProtoMessage) *bus.Error
UnmarshalMessage unmarshals a payload from a BusMessage. If unmarshalling fails, an error is logged and a *bus.Error is returned. A useful idiom is:
if reply.Error = m.UnmarshallMessage(msg, target); reply.Error != nil {
return reply
}
func (*ModuleBase) Wait ¶
func (mb *ModuleBase) Wait() error
Wait for the internal errgroup to finish.
type ModuleDeps ¶
type ModuleDeps struct {
Bus *bus.Bus
KV kv.KVPrefix
Log log.Logger
StoragePath string
CachePath string
Svc Service
}
ModuleDeps carries the deps specific to a module.
type PluginContext ¶ added in v0.1.8
type PluginContext struct {
RWDataPath string
}
type Service ¶ added in v0.0.19
type Service interface {
Handle(ctx *PluginContext, msg *bus.BusMessage) *bus.BusMessage
CloseModule(moduleID string)
}
Click to show internal directories.
Click to hide internal directories.