Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct { Bus *bus.Bus KV kv.KV Log *slog.Logger Web Web StoragePath string CachePath string }
Deps carries the deps of the modules system itself, not deps for a specific module
type Module ¶
type Module interface {
Start(context.Context, *ModuleDeps) error
}
A Module can be started with context and deps
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) 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.
Click to show internal directories.
Click to hide internal directories.