Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta: Standardize results of List call for every backend #35

Merged
merged 2 commits into from
Oct 13, 2017

Conversation

abronan
Copy link
Owner

@abronan abronan commented Oct 10, 2017

Carry #32


List is used to list child keys of a directory, whether
recursively over the entire tree and subfolders or just
direct childs.

Results from the List calls where inconsistent on every
backend, some would return the direct children while others
would return the recursive result by default, some backends
would include the directory key in the result, etc.

This PR normalizes the result of the List call to be the
same on every store for the recursive version.

For example, considering this tree:

parent/
parent/child
parent/subfolder
parent/subfolder/child1
parent/subfolder/child2
parent/subfolder/child3

If we call 'List' on "parent", the result of the List call
will be:

parent/child
parent/subfolder
parent/subfolder/child1
parent/subfolder/child2
parent/subfolder/child3

Signed-off-by: Alexandre Beslic abeslic@abronan.com

c = strings.TrimSuffix(directory, "/") + "/" + c
err := s.listChildrenRecursive(list, c)
if err != nil {
return err
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing: We should ignore the error if the key is ephemeral (zk.ErrNoChildrenForEphemerals) here.

nmengin and others added 2 commits October 13, 2017 11:47
…ing an empty list if the key given in entry has no child. The modifications are done on ETCD V2,V3, BoltDB and Redis stores.
List is used to list child keys of a directory, whether
recursively over the entire tree and subfolders or just
direct childs.

Results from the List calls where inconsistent on every
backend, some would return the direct children while others
would return the recursive result by default, some backends
would include the directory key in the result, etc.

This PR normalizes the result of the List call to be the
same on every store for the recursive version.

For example, considering this tree:

    parent/
    parent/child
    parent/subfolder
    parent/subfolder/child1
    parent/subfolder/child2
    parent/subfolder/child3

If we call 'List' on "parent", the result of the List call
will be:

    parent/child
    parent/subfolder
    parent/subfolder/child1
    parent/subfolder/child2
    parent/subfolder/child3

Signed-off-by: Alexandre Beslic <abeslic@abronan.com>
@abronan abronan merged commit 26427fa into master Oct 13, 2017
@abronan abronan deleted the meta_list_fix branch October 13, 2017 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants