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

Re: [Xen-API] [xen-api-libs.hg:PATCH 0 of 2] Uuid stuff.



On 29/07/10 17:30, Jonathan Knowles wrote:
> On 29/07/10 16:46, magnus.therning@xxxxxxxxxxxxx wrote:
>> This is not ready for merging, but I'd like some comments on the code and
>> direction.
>>
>> Besides the minor clean-up (is more needed?) it introduces a new function,
>> make_uuid_random, which reads from /dev/random (and therefore may block).
>>
>> The plan is to change make_uuid to use the PRNG in Random, and then modify
>> xapi so that make_uuid_random is used where it's necessary (creating pool
>> secret and sessions, what else?).
> 
> After applying your patches, UUID has two constructors:
> 
>> val make_uuid        : unit -> 'a t
>> val make_uuid_random : unit -> 'a  t
> 
> If your intent is that:
> 
>      * function "make_uuid"        uses a PRNG
>      * function "make_uuid_random" uses /dev/random
> 
> then why not make the difference more explicit to the caller.  For example:
> 
>> val make_uuid_pseudo_random : unit -> 'a t
>> val make_uuid_really_random : unit -> 'a t
> 
> Otherwise, it's not very clear to users of the API what they'll get by
> calling "make_uuid".

I'll modify the patch to use

  val make_uuid_prng : unit -> 'a t
  val make_uuid_rnd : unit - 'a t

It's a bit shorter, while still being as clear.  It also allows me to add

  val make_uuid_urnd : unit -> 'a t

if I want it in the future.

Cheers,
M

-- 
Magnus Therning
magnus.therning@xxxxxxxxxxxxx          Jabber: magnusth@eng

There does not now, nor will there ever, exist a programming language
in which it is the least bit hard to write bad programs.
     -- Flon's Axiom

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.