[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] new API to get list of *all* interfaces matching a MAC



On Mon, Aug 24, 2009 at 03:24:13PM -0400, Laine Stump wrote:
> (This probably seems like overanalysis of a simple problem. That's what 
> I'm best at ;-)
> 
> Due to oversight, the function virInterfaceLookupByMACString() can only 
> return a single interface, but it's possible that a host may have more 
> than one interface with the same MAC. Since the API had already been 
> released by the time we realized this, the existing function will remain 
> and a new one added that can return a list of interfaces. This new API 
> will need to deal with the fact that the list length is effectively 
> unbounded. I can see three ways of dealing with this, and want to learn 
> which is preferred by others before spending time on the implementation.

I'm rather wondering why exactly we need another API. 

For APIs which return a singleton result we have LookupByXXX
methods, since it gives apps a good efficiency win making
the API O(1), instead of O(n).

We already have an API for listing all interfaces. An application
can simply use that and then discard the results which have a
non-matching MAC address. THis is O(n) with the existing API
we have for listing interfaces, and would be O(n) with any new
API we might add.  

So I don't really see any point in adding more to list filtering
on MAC address.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]