fix: Make API parameter type public (#996)

Fixes #988
This commit is contained in:
Roland Huß 2020-09-02 09:50:16 +02:00 committed by GitHub
parent 8fcd25c36b
commit c801e8205a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -40,7 +40,7 @@ import (
// Func signature for an updating function which returns the updated service object
// or an error
type serviceUpdateFunc func(origService *servingv1.Service) (*servingv1.Service, error)
type ServiceUpdateFunc func(origService *servingv1.Service) (*servingv1.Service, error)
// Kn interface to serving. All methods are relative to the
// namespace specified during construction
@ -65,7 +65,7 @@ type KnServingClient interface {
// UpdateServiceWithRetry updates service and retries if there is a version conflict.
// The updateFunc receives a deep copy of the existing service and can add update it in
// place.
UpdateServiceWithRetry(name string, updateFunc serviceUpdateFunc, nrRetries int) error
UpdateServiceWithRetry(name string, updateFunc ServiceUpdateFunc, nrRetries int) error
// Delete a service by name
DeleteService(name string, timeout time.Duration) error
@ -224,12 +224,12 @@ func (cl *knServingClient) UpdateService(service *servingv1.Service) error {
}
// Update the given service with a retry in case of a conflict
func (cl *knServingClient) UpdateServiceWithRetry(name string, updateFunc serviceUpdateFunc, nrRetries int) error {
func (cl *knServingClient) UpdateServiceWithRetry(name string, updateFunc ServiceUpdateFunc, nrRetries int) error {
return updateServiceWithRetry(cl, name, updateFunc, nrRetries)
}
// Extracted to be usable with the Mocking client
func updateServiceWithRetry(cl KnServingClient, name string, updateFunc serviceUpdateFunc, nrRetries int) error {
func updateServiceWithRetry(cl KnServingClient, name string, updateFunc ServiceUpdateFunc, nrRetries int) error {
var retries = 0
for {
service, err := cl.GetService(name)

View File

@ -101,7 +101,7 @@ func (c *MockKnServingClient) UpdateService(service *servingv1.Service) error {
}
// Delegate to shared retry method
func (c *MockKnServingClient) UpdateServiceWithRetry(name string, updateFunc serviceUpdateFunc, maxRetry int) error {
func (c *MockKnServingClient) UpdateServiceWithRetry(name string, updateFunc ServiceUpdateFunc, maxRetry int) error {
return updateServiceWithRetry(c, name, updateFunc, maxRetry)
}