-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement functional opts pattern to support xds options
Signed-off-by: Alec Holmes <[email protected]>
- Loading branch information
1 parent
28c9137
commit c85611c
Showing
9 changed files
with
190 additions
and
118 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,25 @@ | ||
package config | ||
|
||
// Opts for individual xDS implementations that can be | ||
// utilized through the functional opts pattern | ||
type Opts struct { | ||
// If true respond to ADS requests with a guaranteed resource ordering | ||
Ordered bool | ||
} | ||
|
||
func NewOpts() Opts { | ||
return Opts{ | ||
Ordered: false, | ||
} | ||
} | ||
|
||
// Each xDS implementation should implement their own functional opts. | ||
// It is recommended that config values be added in this package specifically, | ||
// but the individual opts functions should be in their respective | ||
// implementation package so the import looks like the following: | ||
// | ||
// `sotw.WithOrderedADS()` | ||
// `delta.WithOrderedADS()` | ||
// | ||
// this allows for easy inference as to which opt applies to what implementation. | ||
type XDSOption func(*Opts) |
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,22 @@ | ||
/* | ||
Config abstracts xDS server options into a unified configuration package | ||
that allows for easy manipulation as well as unified passage of options | ||
to individual xDS server implementations. | ||
This enables code reduction as well as a unified source of config. Delta | ||
and SOTW might have similar ordered responses through ADS and rather than | ||
duplicating the logic across server implementations, we add the options | ||
in this package which are passed down to each individual spec. | ||
Each xDS implementation should implement their own functional opts. | ||
It is recommended that config values be added in this package specifically, | ||
but the individual opts functions should be in their respective | ||
implementation package so the import looks like the following: | ||
`sotw.WithOrderedADS()` | ||
`delta.WithOrderedADS()` | ||
this allows for easy inference as to which opt applies to what implementation. | ||
*/ | ||
|
||
package config |
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.