83 lines
3.5 KiB
Go
83 lines
3.5 KiB
Go
|
|
// Code generated by tools/schemagen. DO NOT EDIT.
|
||
|
|
// Source: schemas/. Regenerate with `make generate`.
|
||
|
|
|
||
|
|
package contract
|
||
|
|
|
||
|
|
// What keeps a long-lived consumer on one side of an experiment.
|
||
|
|
type RoutingPolicyRulesItemStickyBy string
|
||
|
|
|
||
|
|
const (
|
||
|
|
RoutingPolicyRulesItemStickyByConsumerID RoutingPolicyRulesItemStickyBy = "consumer_id"
|
||
|
|
RoutingPolicyRulesItemStickyByTenant RoutingPolicyRulesItemStickyBy = "tenant"
|
||
|
|
RoutingPolicyRulesItemStickyByCorrelationID RoutingPolicyRulesItemStickyBy = "correlation_id"
|
||
|
|
RoutingPolicyRulesItemStickyByNone RoutingPolicyRulesItemStickyBy = "none"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Valid reports whether v is a defined RoutingPolicyRulesItemStickyBy.
|
||
|
|
func (v RoutingPolicyRulesItemStickyBy) Valid() bool {
|
||
|
|
switch v {
|
||
|
|
case RoutingPolicyRulesItemStickyByConsumerID, RoutingPolicyRulesItemStickyByTenant, RoutingPolicyRulesItemStickyByCorrelationID, RoutingPolicyRulesItemStickyByNone:
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
type RoutingPolicyRulesItem struct {
|
||
|
|
// Revision id to traffic share. Shares must sum to 1. Assignment of a given
|
||
|
|
// consumer must be stable across requests.
|
||
|
|
Allocation map[string]UnitInterval `json:"allocation" yaml:"allocation"`
|
||
|
|
Cohort *CohortID `json:"cohort,omitempty" yaml:"cohort,omitempty"`
|
||
|
|
Experiment *ExperimentID `json:"experiment,omitempty" yaml:"experiment,omitempty"`
|
||
|
|
|
||
|
|
// What keeps a long-lived consumer on one side of an experiment.
|
||
|
|
StickyBy *RoutingPolicyRulesItemStickyBy `json:"sticky_by,omitempty" yaml:"sticky_by,omitempty"`
|
||
|
|
Tenant string `json:"tenant,omitempty" yaml:"tenant,omitempty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type RoutingPolicySignatureAlgorithm string
|
||
|
|
|
||
|
|
const (
|
||
|
|
RoutingPolicySignatureAlgorithmEd25519 RoutingPolicySignatureAlgorithm = "ed25519"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Valid reports whether v is a defined RoutingPolicySignatureAlgorithm.
|
||
|
|
func (v RoutingPolicySignatureAlgorithm) Valid() bool {
|
||
|
|
switch v {
|
||
|
|
case RoutingPolicySignatureAlgorithmEd25519:
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
type RoutingPolicySignature struct {
|
||
|
|
Algorithm RoutingPolicySignatureAlgorithm `json:"algorithm" yaml:"algorithm"`
|
||
|
|
KeyID string `json:"key_id" yaml:"key_id"`
|
||
|
|
Value string `json:"value" yaml:"value"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type RoutingPolicy struct {
|
||
|
|
// Where a request lands when no earlier resolution step matched.
|
||
|
|
DefaultRevision RevisionID `json:"default_revision" yaml:"default_revision"`
|
||
|
|
|
||
|
|
// Monotonic. The router ignores a policy older than the one it holds.
|
||
|
|
Generation int64 `json:"generation" yaml:"generation"`
|
||
|
|
ID string `json:"id,omitempty" yaml:"id,omitempty"`
|
||
|
|
Interface InterfaceID `json:"interface" yaml:"interface"`
|
||
|
|
IssuedAt *Timestamp `json:"issued_at,omitempty" yaml:"issued_at,omitempty"`
|
||
|
|
IssuedBy *Actor `json:"issued_by,omitempty" yaml:"issued_by,omitempty"`
|
||
|
|
|
||
|
|
// Evaluated in order; the first matching rule wins. Matching must be a pure
|
||
|
|
// function of the request and its cohort assignment.
|
||
|
|
Rules []RoutingPolicyRulesItem `json:"rules" yaml:"rules"`
|
||
|
|
SchemaVersion SchemaVersion `json:"schema_version" yaml:"schema_version"`
|
||
|
|
Signature *RoutingPolicySignature `json:"signature,omitempty" yaml:"signature,omitempty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// Deterministic routing written by the experiment controller and consumed by the
|
||
|
|
// revision router. The controller never touches traffic itself; this separation
|
||
|
|
// keeps experimental intent out of the runtime decision mechanism
|
||
|
|
// (ArchitectureBlueprint.md section 17).
|
||
|
|
type RoutingPolicyDocument struct {
|
||
|
|
RoutingPolicy RoutingPolicy `json:"routing_policy" yaml:"routing_policy"`
|
||
|
|
}
|