Make ResourceVersion a string internally instead of uint64

Allows us to define different watch versioning regimes in the future
as well as to encode information with the resource version.

This changes /watch/resources?resourceVersion=3 to start the watch at
4 instead of 3, which means clients can read a resource version and
then send it back to the server. Clients should no longer do math on
resource versions.
This commit is contained in:
Clayton Coleman
2014-10-07 16:51:28 -04:00
parent 31e02b882b
commit 82bcdd3b3b
54 changed files with 518 additions and 240 deletions

View File

@@ -156,28 +156,28 @@ func TestWatchParamParsing(t *testing.T) {
table := []struct {
rawQuery string
resourceVersion uint64
resourceVersion string
labelSelector string
fieldSelector string
}{
{
rawQuery: "resourceVersion=1234",
resourceVersion: 1234,
resourceVersion: "1234",
labelSelector: "",
fieldSelector: "",
}, {
rawQuery: "resourceVersion=314159&fields=Host%3D&labels=name%3Dfoo",
resourceVersion: 314159,
resourceVersion: "314159",
labelSelector: "name=foo",
fieldSelector: "Host=",
}, {
rawQuery: "fields=ID%3dfoo&resourceVersion=1492",
resourceVersion: 1492,
resourceVersion: "1492",
labelSelector: "",
fieldSelector: "ID=foo",
}, {
rawQuery: "",
resourceVersion: 0,
resourceVersion: "",
labelSelector: "",
fieldSelector: "",
},
@@ -186,7 +186,7 @@ func TestWatchParamParsing(t *testing.T) {
for _, item := range table {
simpleStorage.requestedLabelSelector = nil
simpleStorage.requestedFieldSelector = nil
simpleStorage.requestedResourceVersion = 5 // Prove this is set in all cases
simpleStorage.requestedResourceVersion = "5" // Prove this is set in all cases
dest.RawQuery = item.rawQuery
resp, err := http.Get(dest.String())
if err != nil {