Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Migrates control to use subscription groups
Browse files Browse the repository at this point in the history
- subscriptionGroups maintain a view of requested metrics, expanded metrics plugins and metric configuration per subscription group
- subscriptionGroups are added/removed when tasks are stopped/started (SubscribeDeps/UnsubscribeDeps)
- subscriptionGroups are processed on plugin load and unload events
  - processing a subscriptionGroup involves determing the resulting metrics from the requested metrics and subscribing/unsubscribing to plugins as necessary
- Removes the need for bound vs unbound subscriptions with respect to plugin pools
  • Loading branch information
jcooklin committed Aug 17, 2016
1 parent c97f824 commit 63211ac
Show file tree
Hide file tree
Showing 41 changed files with 2,338 additions and 1,691 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ Documentation for Snap will be kept in this repository for now with an emphasis
* [build and test](docs/BUILD_AND_TEST.md)
* [REST API](docs/REST_API.md)
* [tasks](docs/TASKS.md)
* [plugin life cycle](docs/PLUGIN_LIFECYCLE.md)
* [plugin signing](docs/PLUGIN_SIGNING.md)
* [tribe](docs/TRIBE.md)

Expand Down
3 changes: 3 additions & 0 deletions control/available_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const (
var (
ErrPoolNotFound = errors.New("plugin pool not found")
ErrBadKey = errors.New("bad key")
ErrBadTaskId = errors.New("bad task id")
)

// availablePlugin represents a plugin which is
Expand Down Expand Up @@ -538,6 +539,8 @@ func (ap *availablePlugins) findLatestPool(pType, name string) (strategy.Pool, s
}

func (ap *availablePlugins) getOrCreatePool(key string) (strategy.Pool, error) {
ap.Lock()
defer ap.Unlock()
var err error
pool, ok := ap.table[key]
if ok {
Expand Down
1 change: 1 addition & 0 deletions control/available_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestAvailablePlugin(t *testing.T) {
Convey("Stop()", t, func() {
Convey("returns nil if plugin successfully stopped", func() {
r := newRunner()
r.SetEmitter(new(MockEmitter))
a := plugin.Arg{
PluginLogPath: "/tmp/snap-test-plugin-stop.log",
}
Expand Down
Loading

0 comments on commit 63211ac

Please sign in to comment.