Hey Andrew

> I'd like to tie in to jclouds's TemplateBuilder so that I can use its
> filtering capabilities but then use custom logic to determine which of
> the matching images is "best" (for my custom value of best).

Rather than adding ordering semantics, how about allowing you to add a
"filterBy(...)" or similar predicate that would be applied to each
image that matches the template? Or do you need the *whole list* of
matching images in order to be able to make your decision..?

There is already `TemplateBuilder.imageMatches(Predicate)`. However I think
we do need to whole list in order to decide which is best, i.e. what is the
latest version of Ubuntu or CentOS.

I'm thinking allowing to set an `imageSorter(Ordering)`. This fits with how
the Impl currently works (it already uses an Ordering, you just can't change
it; and it stays in line with the naming convention of `Sorter` as in
`Ordering hardwareSorter()`.)

Note that this doesn't change runtime from $O(N)$ to $O(N \log N)$ (or worse)
(if that is your concern Andrew, I had to convince myself!) because we aren't
sorting the whole list, we are just finding the max.

Best
Alex

Reply via email to