Documentation ¶
Index ¶
- Constants
- func BuildBasePredictorFromInferenceService(isvc *v1beta1.InferenceService) (*v1alpha1.Predictor, error)
- func ResolveSource(nn types.NamespacedName, defaultSource string) (types.NamespacedName, string)
- type Error
- type EventType
- type InferenceServiceRegistry
- func (isvcr InferenceServiceRegistry) Find(ctx context.Context, namespace string, ...) (bool, error)
- func (isvcr InferenceServiceRegistry) Get(ctx context.Context, nname types.NamespacedName) (*v1alpha1.Predictor, error)
- func (isvcr InferenceServiceRegistry) GetSourceName() string
- func (isvcr InferenceServiceRegistry) UpdateStatus(ctx context.Context, predictor *v1alpha1.Predictor) (bool, error)
- type PredictorCRRegistry
- func (pr PredictorCRRegistry) Find(ctx context.Context, namespace string, predicate func(*api.Predictor) bool) (bool, error)
- func (pr PredictorCRRegistry) Get(ctx context.Context, name types.NamespacedName) (*api.Predictor, error)
- func (pr PredictorCRRegistry) GetSourceName() string
- func (pr PredictorCRRegistry) UpdateStatus(ctx context.Context, predictor *api.Predictor) (bool, error)
- type PredictorEvent
- type PredictorEventChan
- type PredictorEventStream
- type PredictorRegistry
- type PredictorSource
- type PredictorStatusUpdater
- type PredictorStreamEvent
- type PredictorWatcher
Constants ¶
View Source
const ( EVENT_UPDATE = iota EVENT_DELETE )
View Source
const ERR_TOO_OLD = Error("ERR_TOO_OLD")
Variables ¶
This section is empty.
Functions ¶
func BuildBasePredictorFromInferenceService ¶
func BuildBasePredictorFromInferenceService(isvc *v1beta1.InferenceService) (*v1alpha1.Predictor, error)
func ResolveSource ¶
func ResolveSource(nn types.NamespacedName, defaultSource string) (types.NamespacedName, string)
Types ¶
type InferenceServiceRegistry ¶
func (InferenceServiceRegistry) Get ¶
func (isvcr InferenceServiceRegistry) Get(ctx context.Context, nname types.NamespacedName) (*v1alpha1.Predictor, error)
func (InferenceServiceRegistry) GetSourceName ¶
func (isvcr InferenceServiceRegistry) GetSourceName() string
func (InferenceServiceRegistry) UpdateStatus ¶
type PredictorCRRegistry ¶
func (PredictorCRRegistry) Get ¶
func (pr PredictorCRRegistry) Get(ctx context.Context, name types.NamespacedName) (*api.Predictor, error)
func (PredictorCRRegistry) GetSourceName ¶
func (pr PredictorCRRegistry) GetSourceName() string
func (PredictorCRRegistry) UpdateStatus ¶
func (pr PredictorCRRegistry) UpdateStatus(ctx context.Context, predictor *api.Predictor) (bool, error)
UpdateStatus returns true if update was successful
type PredictorEvent ¶
type PredictorEvent types.NamespacedName
type PredictorEventChan ¶
type PredictorEventChan chan PredictorEvent
func (*PredictorEventChan) Event ¶
func (pec *PredictorEventChan) Event(name string, namespace string)
type PredictorEventStream ¶
type PredictorEventStream chan PredictorStreamEvent
type PredictorRegistry ¶
type PredictorRegistry interface { // Get should retrieve the Predictor from a local cache that's synchronized via a watch Get(ctx context.Context, name types.NamespacedName) (*api.Predictor, error) // Find is temporary until runtime deployment scaling logic is refactored Find(ctx context.Context, namespace string, predicate func(*api.Predictor) bool) (bool, error) UpdateStatus(ctx context.Context, predictor *api.Predictor) (bool, error) GetSourceName() string }
type PredictorSource ¶
type PredictorSource interface { // StartWatch should not return until PredictorRegistry is fully populated StartWatch(ctx context.Context) (PredictorRegistry, PredictorEventChan, error) // GetSourceId return short, fixed and unique identifier for this source GetSourceId() string }
PredictorSource provides a registry of Predictors along with a channel of update events corresponding to the Predictors. An event should be produced for every Predictor upon starting, and subsequently each time any Predictor is added, has its Spec modified, or is deleted.
func NewPredictorStreamSource ¶
func NewPredictorStreamSource(id string, name string, events PredictorEventStream, updater PredictorStatusUpdater) PredictorSource
NewPredictorStreamSource returns a new PredictorSource based on a persistent event stream
func NewWatchPredictorSource ¶
func NewWatchPredictorSource(id string, name string, watcher PredictorWatcher) PredictorSource
NewWatchPredictorSource returns a new PredictorSource based on a refresh-and-watch PredictorWatcher implementation
type PredictorStatusUpdater ¶
type PredictorStatusUpdater interface { // UpdateStatus updates the given Predictor's status conditional on its resource version. // The returned boolean reflects whether the conditional update was successful; in both // cases the returned Predictor will reflect the latest version from the source *including // its updated resource version*. // In the case that the Predictor is not found, (nil, rv, false, nil) will be returned, where // rv is the current resource version at which the Predictor was observed to not be found. UpdateStatus(ctx context.Context, p *api.Predictor) (newP *api.Predictor, resourceVersion string, ok bool, err error) }
type PredictorStreamEvent ¶
Both UPDATE and DELETE events are expected to have a Predictor containing the corresponding resourceVersion
type PredictorWatcher ¶
type PredictorWatcher interface { // UpdateStatus updates the given Predictor's status conditional on its resource version. // The returned boolean reflects whether the conditional update was successful; in both // cases the returned Predictor will reflect the latest version from the source *including // its updated resource version*. // In the case that the Predictor is not found, (nil, rv, false, nil) will be returned, where // rv is the current resource version at which the Predictor was observed to not be found. UpdateStatus(ctx context.Context, p *api.Predictor) (newP *api.Predictor, resourceVersion string, ok bool, err error) // Refresh returns a complete list of Predictors at the current point in time as of the // ResourceVersion contained in the returned PredictorList. // The limit arg may be used to request a limit, and the from arg can be used to request // a continuation list from a previously returned trucated list (the returned lists' // ResourceVersions will match in this case). Refresh(ctx context.Context, limit int, from string) (api.PredictorList, error) // Watch for predictor events starting from the specified resourceVersion. A returned error // of ERR_TOO_OLD indicates that the requested resourceVersion is too old. In this case a refresh/resync // is typically performed. Watch(ctx context.Context, resourceVersion string) (PredictorEventStream, error) }
Click to show internal directories.
Click to hide internal directories.