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

Change Reflector internal representation #56

Merged
merged 1 commit into from
Aug 3, 2019

Conversation

gnieto
Copy link
Contributor

@gnieto gnieto commented Aug 1, 2019

Change Reflector internal representation and index all the objects by
both name and namespace. With the previous implementation, there
were some issues with object with the same name, as described on:
#55

This makes the Cache internal and we convert the data to a Vec when
it's read.


I think that this implementation combines the 2 ideas we discussed on the issue. Even that, I'm not convinced about returning a Vec. I was thinking about returning an iterator, but I would need to think about it a little bit more. What do you think?

Change `Reflector` internal representation and index all the objects by
both `name` and `namespace`. With the previous implementation, there
were some issues with object with the same `name`, as described on:
kube-rs#55

This makes the `Cache` internal and we convert the data to a `Vec` when
it's read.
src/api/reflector.rs Show resolved Hide resolved
namespace: object_meta.namespace.clone(),
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This is a nice place to hide this complexity. Nice use of traits on ObjectId 👍

@clux
Copy link
Member

clux commented Aug 3, 2019

I think this is great for now. It definitely resolves the main problem, and it makes the examples cleaner to use by hiding the unnecessary pair.

Some better iterator support in general would be nice, but not sure how to efficiently encapsulate that when it's referring to a read-locked resource. Cloning and moving feels acceptable since rust's fast at compute, and a reflector is mostly waiting for IO anyway. PRs are of course welcome though 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants