-
-
Notifications
You must be signed in to change notification settings - Fork 320
Expand file tree
/
Copy pathmodule.go
More file actions
35 lines (29 loc) · 700 Bytes
/
module.go
File metadata and controls
35 lines (29 loc) · 700 Bytes
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
29
30
31
32
33
34
35
package ferret
// Module represents a self-contained unit of functionality that can be registered with the engine.
type (
Module interface {
Name() string
Register(Bootstrap) error
}
// Bootstrap defines an interface for configuring the host and registering lifecycle hooks with the runtime engine.
Bootstrap interface {
Host() HostConfigurer
Hooks() HookRegistrar
}
bootstrap struct {
host *hostBuilder
hooks *hookRegistry
}
)
func newBootstrap(opts *options) *bootstrap {
return &bootstrap{
host: newHostBuilder(opts),
hooks: opts.hooks,
}
}
func (b *bootstrap) Host() HostConfigurer {
return b.host
}
func (b *bootstrap) Hooks() HookRegistrar {
return b.hooks
}