forked from riverqueue/river
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.go
28 lines (23 loc) · 1014 Bytes
/
plugin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package river
import (
"github.com/riverqueue/river/rivershared/baseservice"
"github.com/riverqueue/river/rivershared/riverpilot"
"github.com/riverqueue/river/rivershared/startstop"
)
// A plugin API that drivers may implement to extend a River client. Driver
// plugins may, for example, add additional maintenance services.
//
// This should be considered a River internal API and its stability is not
// guaranteed. DO NOT USE.
type driverPlugin[TTx any] interface {
// PluginInit initializes a plugin with an archetype and client. It's
// invoked on Client.NewClient.
PluginInit(archetype *baseservice.Archetype, client *Client[TTx])
// PluginMaintenanceServices returns additional maintenance services (will
// only run on an elected leader) for a River client.
PluginMaintenanceServices() []startstop.Service
PluginPilot() riverpilot.Pilot
// PluginServices returns additional non-maintenance services (will run on
// all clients) for a River client.
PluginServices() []startstop.Service
}