Skip to content

Commit 10ab410

Browse files
committed
Move dynamic plugins to a subpackage
Signed-off-by: Derek McGowan <derek@mcg.dev>
1 parent 602343a commit 10ab410

4 files changed

Lines changed: 39 additions & 20 deletions

File tree

dynamic/dynamic.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
Copyright The containerd Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package dynamic
18+
19+
import "fmt"
20+
21+
// Load loads all plugins at the provided path into containerd.
22+
//
23+
// Load is currently only implemented on non-static, non-gccgo builds for amd64
24+
// and arm64, and plugins must be built with the exact same version of Go as
25+
// containerd itself.
26+
func Load(path string) (err error) {
27+
defer func() {
28+
if v := recover(); v != nil {
29+
rerr, ok := v.(error)
30+
if !ok {
31+
rerr = fmt.Errorf("%s", v)
32+
}
33+
err = rerr
34+
}
35+
}()
36+
return loadPlugins(path)
37+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
limitations under the License.
1717
*/
1818

19-
package plugin
19+
package dynamic
2020

2121
import (
2222
"fmt"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
limitations under the License.
1717
*/
1818

19-
package plugin
19+
package dynamic
2020

2121
// loadPlugins is not supported;
2222
//

plugin.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,24 +96,6 @@ func (r *Registration) URI() string {
9696
return r.Type.String() + "." + r.ID
9797
}
9898

99-
// Load loads all plugins at the provided path into containerd.
100-
//
101-
// Load is currently only implemented on non-static, non-gccgo builds for amd64
102-
// and arm64, and plugins must be built with the exact same version of Go as
103-
// containerd itself.
104-
func Load(path string) (err error) {
105-
defer func() {
106-
if v := recover(); v != nil {
107-
rerr, ok := v.(error)
108-
if !ok {
109-
rerr = fmt.Errorf("%s", v)
110-
}
111-
err = rerr
112-
}
113-
}()
114-
return loadPlugins(path)
115-
}
116-
11799
// DisableFilter filters out disabled plugins
118100
type DisableFilter func(r *Registration) bool
119101

0 commit comments

Comments
 (0)