mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-13 11:25:19 +00:00
Change resourceVersion to string in storage.Interface
This commit is contained in:
@@ -191,24 +191,32 @@ func (h *etcdHelper) Delete(ctx context.Context, key string, out runtime.Object)
|
||||
}
|
||||
|
||||
// Implements storage.Interface.
|
||||
func (h *etcdHelper) Watch(ctx context.Context, key string, resourceVersion uint64, filter storage.FilterFunc) (watch.Interface, error) {
|
||||
func (h *etcdHelper) Watch(ctx context.Context, key string, resourceVersion string, filter storage.FilterFunc) (watch.Interface, error) {
|
||||
if ctx == nil {
|
||||
glog.Errorf("Context is nil")
|
||||
}
|
||||
watchRV, err := storage.ParseWatchResourceVersion(resourceVersion)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
key = h.prefixEtcdKey(key)
|
||||
w := newEtcdWatcher(false, nil, filter, h.codec, h.versioner, nil, h)
|
||||
go w.etcdWatch(h.client, key, resourceVersion)
|
||||
go w.etcdWatch(h.client, key, watchRV)
|
||||
return w, nil
|
||||
}
|
||||
|
||||
// Implements storage.Interface.
|
||||
func (h *etcdHelper) WatchList(ctx context.Context, key string, resourceVersion uint64, filter storage.FilterFunc) (watch.Interface, error) {
|
||||
func (h *etcdHelper) WatchList(ctx context.Context, key string, resourceVersion string, filter storage.FilterFunc) (watch.Interface, error) {
|
||||
if ctx == nil {
|
||||
glog.Errorf("Context is nil")
|
||||
}
|
||||
watchRV, err := storage.ParseWatchResourceVersion(resourceVersion)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
key = h.prefixEtcdKey(key)
|
||||
w := newEtcdWatcher(true, exceptKey(key), filter, h.codec, h.versioner, nil, h)
|
||||
go w.etcdWatch(h.client, key, resourceVersion)
|
||||
go w.etcdWatch(h.client, key, watchRV)
|
||||
return w, nil
|
||||
}
|
||||
|
||||
@@ -352,7 +360,7 @@ func (h *etcdHelper) decodeNodeList(nodes []*etcd.Node, filter storage.FilterFun
|
||||
}
|
||||
|
||||
// Implements storage.Interface.
|
||||
func (h *etcdHelper) List(ctx context.Context, key string, resourceVersion uint64, filter storage.FilterFunc, listObj runtime.Object) error {
|
||||
func (h *etcdHelper) List(ctx context.Context, key string, resourceVersion string, filter storage.FilterFunc, listObj runtime.Object) error {
|
||||
if ctx == nil {
|
||||
glog.Errorf("Context is nil")
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ func TestList(t *testing.T) {
|
||||
var got api.PodList
|
||||
// TODO: a sorted filter function could be applied such implied
|
||||
// ordering on the returned list doesn't matter.
|
||||
err := helper.List(context.TODO(), key, 0, storage.Everything, &got)
|
||||
err := helper.List(context.TODO(), key, "", storage.Everything, &got)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
@@ -156,7 +156,7 @@ func TestListFiltered(t *testing.T) {
|
||||
}
|
||||
|
||||
var got api.PodList
|
||||
err := helper.List(context.TODO(), key, 0, filter, &got)
|
||||
err := helper.List(context.TODO(), key, "", filter, &got)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
@@ -206,7 +206,7 @@ func TestListAcrossDirectories(t *testing.T) {
|
||||
list.Items[2] = *returnedObj
|
||||
|
||||
var got api.PodList
|
||||
err := roothelper.List(context.TODO(), rootkey, 0, storage.Everything, &got)
|
||||
err := roothelper.List(context.TODO(), rootkey, "", storage.Everything, &got)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ func TestWatch(t *testing.T) {
|
||||
key := "/some/key"
|
||||
h := newEtcdHelper(server.Client, codec, etcdtest.PathPrefix())
|
||||
|
||||
watching, err := h.Watch(context.TODO(), key, 0, storage.Everything)
|
||||
watching, err := h.Watch(context.TODO(), key, "0", storage.Everything)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
@@ -289,7 +289,7 @@ func TestWatchEtcdState(t *testing.T) {
|
||||
defer server.Terminate(t)
|
||||
|
||||
h := newEtcdHelper(server.Client, codec, etcdtest.PathPrefix())
|
||||
watching, err := h.Watch(context.TODO(), key, 0, storage.Everything)
|
||||
watching, err := h.Watch(context.TODO(), key, "0", storage.Everything)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
@@ -353,7 +353,7 @@ func TestWatchFromZeroIndex(t *testing.T) {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
watching, err := h.Watch(context.TODO(), key, 0, storage.Everything)
|
||||
watching, err := h.Watch(context.TODO(), key, "0", storage.Everything)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
@@ -388,7 +388,7 @@ func TestWatchListFromZeroIndex(t *testing.T) {
|
||||
defer server.Terminate(t)
|
||||
h := newEtcdHelper(server.Client, codec, key)
|
||||
|
||||
watching, err := h.WatchList(context.TODO(), key, 0, storage.Everything)
|
||||
watching, err := h.WatchList(context.TODO(), key, "0", storage.Everything)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
@@ -420,7 +420,7 @@ func TestWatchListIgnoresRootKey(t *testing.T) {
|
||||
defer server.Terminate(t)
|
||||
h := newEtcdHelper(server.Client, codec, key)
|
||||
|
||||
watching, err := h.WatchList(context.TODO(), key, 0, storage.Everything)
|
||||
watching, err := h.WatchList(context.TODO(), key, "0", storage.Everything)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
@@ -451,7 +451,7 @@ func TestWatchPurposefulShutdown(t *testing.T) {
|
||||
h := newEtcdHelper(server.Client, codec, etcdtest.PathPrefix())
|
||||
|
||||
// Test purposeful shutdown
|
||||
watching, err := h.Watch(context.TODO(), key, 0, storage.Everything)
|
||||
watching, err := h.Watch(context.TODO(), key, "0", storage.Everything)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user