mirror of
https://github.com/status-im/consul.git
synced 2025-01-09 21:35:52 +00:00
c029b20615
The new controller caches are initialized before the DependencyMappers or the Reconciler run, but importantly they are not populated. The expectation is that when the WatchList call is made to the resource service it will send an initial snapshot of all resources matching a single type, and then perpetually send UPSERT/DELETE events afterward. This initial snapshot will cycle through the caching layer and will catch it up to reflect the stored data. Critically the dependency mappers and reconcilers will race against the restoration of the caches on server startup or leader election. During this time it is possible a mapper or reconciler will use the cache to lookup a specific relationship and not find it. That very same reconciler may choose to then recompute some persisted resource and in effect rewind it to a prior computed state. Change - Since we are updating the behavior of the WatchList RPC, it was aligned to match that of pbsubscribe and pbpeerstream using a protobuf oneof instead of the enum+fields option. - The WatchList rpc now has 3 alternating response events: Upsert, Delete, EndOfSnapshot. When set the initial batch of "snapshot" Upserts sent on a new watch, those operations will be followed by an EndOfSnapshot event before beginning the never-ending sequence of Upsert/Delete events. - Within the Controller startup code we will launch N+1 goroutines to execute WatchList queries for the watched types. The UPSERTs will be applied to the nascent cache only (no mappers will execute). - Upon witnessing the END operation, those goroutines will terminate. - When all cache priming routines complete, then the normal set of N+1 long lived watch routines will launch to officially witness all events in the system using the primed cached.
309 lines
9.7 KiB
Go
309 lines
9.7 KiB
Go
// Code generated by protoc-json-shim. DO NOT EDIT.
|
|
package pbresource
|
|
|
|
import (
|
|
protojson "google.golang.org/protobuf/encoding/protojson"
|
|
)
|
|
|
|
// MarshalJSON is a custom marshaler for Type
|
|
func (this *Type) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for Type
|
|
func (this *Type) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for Tenancy
|
|
func (this *Tenancy) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for Tenancy
|
|
func (this *Tenancy) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for ID
|
|
func (this *ID) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for ID
|
|
func (this *ID) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for Resource
|
|
func (this *Resource) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for Resource
|
|
func (this *Resource) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for Status
|
|
func (this *Status) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for Status
|
|
func (this *Status) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for Condition
|
|
func (this *Condition) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for Condition
|
|
func (this *Condition) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for Reference
|
|
func (this *Reference) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for Reference
|
|
func (this *Reference) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for Tombstone
|
|
func (this *Tombstone) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for Tombstone
|
|
func (this *Tombstone) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for ReadRequest
|
|
func (this *ReadRequest) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for ReadRequest
|
|
func (this *ReadRequest) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for ReadResponse
|
|
func (this *ReadResponse) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for ReadResponse
|
|
func (this *ReadResponse) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for ListRequest
|
|
func (this *ListRequest) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for ListRequest
|
|
func (this *ListRequest) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for ListResponse
|
|
func (this *ListResponse) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for ListResponse
|
|
func (this *ListResponse) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for ListByOwnerRequest
|
|
func (this *ListByOwnerRequest) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for ListByOwnerRequest
|
|
func (this *ListByOwnerRequest) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for ListByOwnerResponse
|
|
func (this *ListByOwnerResponse) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for ListByOwnerResponse
|
|
func (this *ListByOwnerResponse) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for WriteRequest
|
|
func (this *WriteRequest) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for WriteRequest
|
|
func (this *WriteRequest) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for WriteResponse
|
|
func (this *WriteResponse) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for WriteResponse
|
|
func (this *WriteResponse) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for WriteStatusRequest
|
|
func (this *WriteStatusRequest) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for WriteStatusRequest
|
|
func (this *WriteStatusRequest) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for WriteStatusResponse
|
|
func (this *WriteStatusResponse) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for WriteStatusResponse
|
|
func (this *WriteStatusResponse) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for DeleteRequest
|
|
func (this *DeleteRequest) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for DeleteRequest
|
|
func (this *DeleteRequest) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for DeleteResponse
|
|
func (this *DeleteResponse) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for DeleteResponse
|
|
func (this *DeleteResponse) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for WatchListRequest
|
|
func (this *WatchListRequest) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for WatchListRequest
|
|
func (this *WatchListRequest) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for WatchEvent
|
|
func (this *WatchEvent) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for WatchEvent
|
|
func (this *WatchEvent) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for WatchEvent_Upsert
|
|
func (this *WatchEvent_Upsert) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for WatchEvent_Upsert
|
|
func (this *WatchEvent_Upsert) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for WatchEvent_Delete
|
|
func (this *WatchEvent_Delete) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for WatchEvent_Delete
|
|
func (this *WatchEvent_Delete) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for WatchEvent_EndOfSnapshot
|
|
func (this *WatchEvent_EndOfSnapshot) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for WatchEvent_EndOfSnapshot
|
|
func (this *WatchEvent_EndOfSnapshot) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for MutateAndValidateRequest
|
|
func (this *MutateAndValidateRequest) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for MutateAndValidateRequest
|
|
func (this *MutateAndValidateRequest) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
// MarshalJSON is a custom marshaler for MutateAndValidateResponse
|
|
func (this *MutateAndValidateResponse) MarshalJSON() ([]byte, error) {
|
|
str, err := ResourceMarshaler.Marshal(this)
|
|
return []byte(str), err
|
|
}
|
|
|
|
// UnmarshalJSON is a custom unmarshaler for MutateAndValidateResponse
|
|
func (this *MutateAndValidateResponse) UnmarshalJSON(b []byte) error {
|
|
return ResourceUnmarshaler.Unmarshal(b, this)
|
|
}
|
|
|
|
var (
|
|
ResourceMarshaler = &protojson.MarshalOptions{}
|
|
ResourceUnmarshaler = &protojson.UnmarshalOptions{DiscardUnknown: false}
|
|
)
|