[ANN] New indexes for DateAndTime and UUID instances

Brent Pinkney brent.pinkney at aircom.co.za
Thu Dec 22 12:36:06 UTC 2005


Hi,

There is some chatter on this list regarding new projects using Magma.

To prevent duplication and despair I have attached the extensions to Magma that I use to index UUID and DateAndTime
instances.

Indexing UUIDs
-----------------
MaUUIDIndex will index any UUID and has a keySize of 128 bits. This it because a UUID is 16 bytes long.

Indexing DateAndTimes
--------------------------
A DateAndTime instance includes the offset from UTC and has nanoSecond precision. It can also store any date 
since  24 November -4713.

Indexing a full DateAndTime would require a LOT of bits, which is probably why Chris never added an index for 
them.

Fortunately, we do not need
	a) to store dates all the way back to the dawn of time
	b) nano second precision
	c) to store dates infinitely far into the future.

MaDateAndTimeIndex allows the developer to specify:
	a) the start epoch (dates on or before this are not allowed)
	b) the clock precision (one of 1 second. 1 milliSecond, 1 nanoSecond)
	c) the duration into the furture (ie. epoc + duration = last date which is allowed)

The default has a keySize of 72 bits and gives nanoSecond precision from 1 January 1900 for 1000 years!

I usually use:

	(MaDateAndTimeIndex attribute: #dateOfBirth)
		epoch: 2000 asYear; 
		duration: (100 * 365.24) days;
		precision: 1 second;
		yourself

which gives a keySize of 32 bits.

Feedback welcomed. 

Chris, if you like this work, feel free to modify it and add it to Magma.

Regards

Brent





-------------- next part --------------
A non-text attachment was scrubbed...
Name: magmaFixes-brp.10.cs.gz
Type: application/x-gzip
Size: 1455 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/magma/attachments/20051222/514ab9c9/magmaFixes-brp.10.cs.bin


More information about the Magma mailing list