Do interface{} -> runtime.Object rename everywhere

This commit is contained in:
Daniel Smith
2014-09-05 19:22:03 -07:00
parent 1c2b65788d
commit 0d30a656ef
33 changed files with 190 additions and 198 deletions

View File

@@ -19,6 +19,7 @@ package watch
import (
"sync"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
)
@@ -27,7 +28,7 @@ type Decoder interface {
// Decode should return the type of event, the decoded object, or an error.
// An error will cause StreamWatcher to call Close(). Decode should block until
// it has data or an error occurs.
Decode() (action EventType, object interface{}, err error)
Decode() (action EventType, object runtime.Object, err error)
// Close should close the underlying io.Reader, signalling to the source of
// the stream that it is no longer being watched. Close() must cause any

View File

@@ -18,6 +18,8 @@ package watch
import (
"sync"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)
// Mux distributes event notifications among any number of watchers. Every event
@@ -88,7 +90,7 @@ func (m *Mux) closeAll() {
}
// Action distributes the given event among all watchers.
func (m *Mux) Action(action EventType, obj interface{}) {
func (m *Mux) Action(action EventType, obj runtime.Object) {
m.incoming <- Event{action, obj}
}

View File

@@ -22,16 +22,19 @@ import (
"testing"
)
type myType struct {
ID string
Value string
}
func (*myType) IsAnAPIObject() {}
func TestMux(t *testing.T) {
type myType struct {
ID string
Value string
}
table := []Event{
{Added, myType{"foo", "hello world 1"}},
{Added, myType{"bar", "hello world 2"}},
{Modified, myType{"foo", "goodbye world 3"}},
{Deleted, myType{"bar", "hello world 4"}},
{Added, &myType{"foo", "hello world 1"}},
{Added, &myType{"bar", "hello world 2"}},
{Modified, &myType{"foo", "goodbye world 3"}},
{Deleted, &myType{"bar", "hello world 4"}},
}
// The mux we're testing

View File

@@ -18,6 +18,8 @@ package watch
import (
"sync"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)
// Interface can be implemented by anything that knows how to watch and report changes.
@@ -47,7 +49,7 @@ type Event struct {
// If Type == Deleted, then this is the state of the object
// immediately before deletion.
Object interface{}
Object runtime.Object
}
// FakeWatcher lets you test anything that consumes a watch.Interface; threadsafe.
@@ -78,21 +80,21 @@ func (f *FakeWatcher) ResultChan() <-chan Event {
}
// Add sends an add event.
func (f *FakeWatcher) Add(obj interface{}) {
func (f *FakeWatcher) Add(obj runtime.Object) {
f.result <- Event{Added, obj}
}
// Modify sends a modify event.
func (f *FakeWatcher) Modify(obj interface{}) {
func (f *FakeWatcher) Modify(obj runtime.Object) {
f.result <- Event{Modified, obj}
}
// Delete sends a delete event.
func (f *FakeWatcher) Delete(lastValue interface{}) {
func (f *FakeWatcher) Delete(lastValue runtime.Object) {
f.result <- Event{Deleted, lastValue}
}
// Action sends an event of the requested type, for table-based testing.
func (f *FakeWatcher) Action(action EventType, obj interface{}) {
func (f *FakeWatcher) Action(action EventType, obj runtime.Object) {
f.result <- Event{action, obj}
}