-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add plugin framework which supports executing custom code at…
… plugin points like start and stop in life cyle of container and daemon
- Loading branch information
Showing
11 changed files
with
233 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package plugins | ||
|
||
import "io" | ||
|
||
// ContainerPlugin defines in which place a plugin will be triggered in container lifecycle | ||
type ContainerPlugin interface { | ||
// PreCreate defines plugin point where recevives an container create request, in this plugin point user | ||
// could change the container create body passed-in by http request body | ||
PreCreate(io.ReadCloser) (io.ReadCloser, error) | ||
|
||
// PreStart returns an array of priority and args which will pass to runc, the every priority | ||
// used to sort the pre start array that pass to runc, network plugin hook always has priority value 0. | ||
PreStart(interface{}) ([]int, [][]string, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package plugins | ||
|
||
// DaemonPlugin defines in which place does pouch daemon support plugin | ||
type DaemonPlugin interface { | ||
// PreStartHook is invoked by pouch daemon before real start, in this hook user could start dfget proxy or other | ||
// standalone process plugins | ||
PreStartHook() error | ||
|
||
// PreStopHook is invoked by pouch daemon before daemon process exit, not a promise if daemon is killed, in this | ||
// hook user could stop the process or plugin started by PreStartHook | ||
PreStopHook() error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.