Package AccessGrid :: Module GUID :: Class GUID
[show private | hide private]
[frames | no frames]

Class GUID


A globally-unique identifier made up of time and ip and 3 random digits: 35 characters wide A globally unique identifier that combines ip, time, and random bits. Since the time is listed first, you can sort records by guid. You can also extract the time and ip if needed.

GUIDs make wonderful database keys. They require no access to the database (to get the max index number), they are extremely unique, and they sort automatically by time. GUIDs prevent key clashes when merging two databases together, combining data, or generating keys in distributed systems.
Method Summary
  __init__(self, guid)
Constructor.
  __str__(self)
Returns the string value of this guid
  ip(self)
Extracts the ip portion out of the guid and returns it as a string like 10.10.10.10
  random(self)
Extracts the random bits from the guid.
  time(self)
Extracts the time portion out of the guid and returns the number of milliseconds since the epoch

Class Variable Summary
str hexip = '008c00dd00220047'
str i = '71'
str lastguid = '0000010342a6b059008c00dd002200471d3'
Random rand = <random.Random object at 0x00B40578>

Method Details

__init__(self, guid=None)
(Constructor)

Constructor. Use no args if you want the guid generated (this is the normal method) or send a string-typed guid to generate it from the string

__str__(self)
(Informal representation operator)

Returns the string value of this guid

ip(self)

Extracts the ip portion out of the guid and returns it as a string like 10.10.10.10

random(self)

Extracts the random bits from the guid. I have no idea how this would be useful, but I've included it for completeness.

time(self)

Extracts the time portion out of the guid and returns the number of milliseconds since the epoch

Class Variable Details

hexip

Type:
str
Value:
'008c00dd00220047'                                                     

i

Type:
str
Value:
'71'                                                                   

lastguid

Type:
str
Value:
'0000010342a6b059008c00dd002200471d3'                                  

rand

Type:
Random
Value:
<random.Random object at 0x00B40578>                                   

Generated by Epydoc 2.1 on Thu Apr 14 16:39:27 2005 http://epydoc.sf.net