Documentation ¶
Overview ¶
Package policy provides policy primatives, policy registration and functions to run policies against a WorkReq that is submitted to the system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Policy ¶
type Policy interface { // Run runs the policy against a request with settings that are specific // to the policy. settings can be nil for certain implementations. Run(ctx context.Context, req *pb.WorkReq, settings Settings) error }
Policy represents a policy that is defined to check a WorkReq is compliant.
type PolicyArgs ¶
type PolicyArgs struct { // Name of the policy in the registry. Name string // Settings for that policy invocation. Settings Settings }
PolicyArgs detail a policy and settings to use to invoke it.
type Settings ¶
type Settings interface { // Validate validates the Settings for a Policy. Validate() error }
Setting holds a struct that is used to hold the Policy settings that are invoked. These are defined per policy. This should always be a struct and not a *struct.
func GetSettings ¶
GetSettings fetches the Settings for a named Policy.
Directories ¶
Path | Synopsis |
---|---|
Package config stores the policy configuration Go representation, a global variable called Policies that is for reading the Config as it is updated on disk and configuration validation to make sure errors don't slip in to the Config.
|
Package config stores the policy configuration Go representation, a global variable called Policies that is for reading the Config as it is updated on disk and configuration validation to make sure errors don't slip in to the Config. |
register
|
|
restrictjobtypes
Package restrictjobtypes provides a policy that can be invoked to ensure that a WorkReq only contains jobs of certain types.
|
Package restrictjobtypes provides a policy that can be invoked to ensure that a WorkReq only contains jobs of certain types. |
sameargs
Package sameargs defines a generic policy that can be used to look at Jobs of certain types and validate that every Job of that type has certain arguments that are the same for every invocation.
|
Package sameargs defines a generic policy that can be used to look at Jobs of certain types and validate that every Job of that type has certain arguments that are the same for every invocation. |
startorend
Package startorend implements a policy that can be used to check that a WorkReq has a particular Job in the first block or the last block with certain settings.
|
Package startorend implements a policy that can be used to check that a WorkReq has a particular Job in the first block or the last block with certain settings. |
Click to show internal directories.
Click to hide internal directories.