Skip to content

Commit

Permalink
Merge pull request kubernetes#2034 from deads2k/expose-parseWatchReso…
Browse files Browse the repository at this point in the history
…urceVersion

expose ParseWatchResourceVersion for downstream use
  • Loading branch information
smarterclayton committed Oct 28, 2014
2 parents dfd7ef3 + 613bf93 commit 1da5c44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions pkg/registry/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ func makePodKey(ctx api.Context, id string) (string, error) {
return MakeEtcdItemKey(ctx, PodPath, id)
}

// parseWatchResourceVersion takes a resource version argument and converts it to
// ParseWatchResourceVersion takes a resource version argument and converts it to
// the etcd version we should pass to helper.Watch(). Because resourceVersion is
// an opaque value, the default watch behavior for non-zero watch is to watch
// the next value (if you pass "1", you will see updates from "2" onwards).
func parseWatchResourceVersion(resourceVersion, kind string) (uint64, error) {
func ParseWatchResourceVersion(resourceVersion, kind string) (uint64, error) {
if resourceVersion == "" || resourceVersion == "0" {
return 0, nil
}
Expand Down Expand Up @@ -143,7 +143,7 @@ func (r *Registry) ListPodsPredicate(ctx api.Context, filter func(*api.Pod) bool

// WatchPods begins watching for new, changed, or deleted pods.
func (r *Registry) WatchPods(ctx api.Context, resourceVersion string, filter func(*api.Pod) bool) (watch.Interface, error) {
version, err := parseWatchResourceVersion(resourceVersion, "pod")
version, err := ParseWatchResourceVersion(resourceVersion, "pod")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -353,7 +353,7 @@ func (r *Registry) ListControllers(ctx api.Context) (*api.ReplicationControllerL

// WatchControllers begins watching for new, changed, or deleted controllers.
func (r *Registry) WatchControllers(ctx api.Context, resourceVersion string) (watch.Interface, error) {
version, err := parseWatchResourceVersion(resourceVersion, "replicationControllers")
version, err := ParseWatchResourceVersion(resourceVersion, "replicationControllers")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -515,7 +515,7 @@ func (r *Registry) UpdateService(ctx api.Context, svc *api.Service) error {

// WatchServices begins watching for new, changed, or deleted service configurations.
func (r *Registry) WatchServices(ctx api.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
version, err := parseWatchResourceVersion(resourceVersion, "service")
version, err := ParseWatchResourceVersion(resourceVersion, "service")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -560,7 +560,7 @@ func (r *Registry) UpdateEndpoints(ctx api.Context, endpoints *api.Endpoints) er

// WatchEndpoints begins watching for new, changed, or deleted endpoint configurations.
func (r *Registry) WatchEndpoints(ctx api.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
version, err := parseWatchResourceVersion(resourceVersion, "endpoints")
version, err := ParseWatchResourceVersion(resourceVersion, "endpoints")
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/registry/etcd/etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestEtcdParseWatchResourceVersion(t *testing.T) {
{Version: "10", ExpectVersion: 11},
}
for _, testCase := range testCases {
version, err := parseWatchResourceVersion(testCase.Version, testCase.Kind)
version, err := ParseWatchResourceVersion(testCase.Version, testCase.Kind)
switch {
case testCase.Err:
if err == nil {
Expand Down

0 comments on commit 1da5c44

Please sign in to comment.