Add context object to interfaces

This commit is contained in:
derekwaynecarr
2014-09-25 14:34:01 -04:00
parent 377a9ac3d7
commit 3e685674e7
15 changed files with 115 additions and 63 deletions

View File

@@ -19,6 +19,8 @@ package endpoint
import (
"errors"
"code.google.com/p/go.net/context"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
@@ -38,12 +40,12 @@ func NewREST(registry Registry) *REST {
}
// Get satisfies the RESTStorage interface.
func (rs *REST) Get(id string) (runtime.Object, error) {
func (rs *REST) Get(ctx context.Context, id string) (runtime.Object, error) {
return rs.registry.GetEndpoints(id)
}
// List satisfies the RESTStorage interface.
func (rs *REST) List(label, field labels.Selector) (runtime.Object, error) {
func (rs *REST) List(ctx context.Context, label, field labels.Selector) (runtime.Object, error) {
if !label.Empty() || !field.Empty() {
return nil, errors.New("label/field selectors are not supported on endpoints")
}
@@ -52,22 +54,22 @@ func (rs *REST) List(label, field labels.Selector) (runtime.Object, error) {
// Watch returns Endpoint events via a watch.Interface.
// It implements apiserver.ResourceWatcher.
func (rs *REST) Watch(label, field labels.Selector, resourceVersion uint64) (watch.Interface, error) {
func (rs *REST) Watch(ctx context.Context, label, field labels.Selector, resourceVersion uint64) (watch.Interface, error) {
return rs.registry.WatchEndpoints(label, field, resourceVersion)
}
// Create satisfies the RESTStorage interface but is unimplemented.
func (rs *REST) Create(obj runtime.Object) (<-chan runtime.Object, error) {
func (rs *REST) Create(ctx context.Context, obj runtime.Object) (<-chan runtime.Object, error) {
return nil, errors.New("unimplemented")
}
// Update satisfies the RESTStorage interface but is unimplemented.
func (rs *REST) Update(obj runtime.Object) (<-chan runtime.Object, error) {
func (rs *REST) Update(ctx context.Context, obj runtime.Object) (<-chan runtime.Object, error) {
return nil, errors.New("unimplemented")
}
// Delete satisfies the RESTStorage interface but is unimplemented.
func (rs *REST) Delete(id string) (<-chan runtime.Object, error) {
func (rs *REST) Delete(ctx context.Context, id string) (<-chan runtime.Object, error) {
return nil, errors.New("unimplemented")
}