• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

trento-project / agent / 12758094583

13 Jan 2025 11:32PM UTC coverage: 70.941%. First build
12758094583

Pull #361

github

balanza
rename
Pull Request #361: Handle context in plugins

0 of 91 new or added lines in 5 files covered. (0.0%)

4050 of 5709 relevant lines covered (70.94%)

20.37 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.14
/pkg/factsengine/plugininterface/interface.go
1
package plugininterface
2

3
import (
4
        "context"
5
        "encoding/gob"
6
        "net/rpc"
7

8
        "github.com/hashicorp/go-plugin"
9
        "github.com/trento-project/agent/pkg/factsengine/entities"
10
)
11

12
// TODO: move this to a common place in the pkg folder
13
// This is needed by the plugin system to be able to serialize the FactValue type
14
func init() {
4✔
15
        gob.Register(&entities.FactValueInt{})
4✔
16
        gob.Register(&entities.FactValueFloat{})
4✔
17
        gob.Register(&entities.FactValueString{})
4✔
18
        gob.Register(&entities.FactValueBool{})
4✔
19
        gob.Register(&entities.FactValueList{})
4✔
20
        gob.Register(&entities.FactValueMap{})
4✔
21
}
4✔
22

23
// Gatherer is the interface exposed as a plugin.
24
type Gatherer interface {
25
        Gather(context context.Context, factsRequests []entities.FactRequest) ([]entities.Fact, error)
26
}
27

28
// This is the implementation of plugin.Plugin
29
type GathererPlugin struct {
30
        // Impl Injection
31
        Impl Gatherer
32
}
33

34
func (p *GathererPlugin) Server(*plugin.MuxBroker) (interface{}, error) {
×
35
        return &GathererRPCServer{Impl: p.Impl}, nil
×
36
}
×
37

38
func (GathererPlugin) Client(_ *plugin.MuxBroker, c *rpc.Client) (interface{}, error) {
×
NEW
39
        return GathererRPC{client: c}, nil
×
40
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc