[Community] Refactor of rtree.index.Index

Sean Gillies sean.gillies at gmail.com
Wed Sep 16 13:43:40 EEST 2009


The Index class's __init__ method does different things depending on  
whether it's been passed a filename name parameter or not. IMO,  
different classes for disk or memory indexes will make for cleaner  
code, and also make it easier to implement storage-dependent features  
like the sync() method I am planning (syncs the live and persisted  
states of the index).

I propose:

* a not-to-be-instantiated IndexBase class, which is the current Index  
class minus storage-specific code in __init__

* a MemoryIndex class

* a DiskIndex class with disk storage-specific initialization code,  
open(), close(), and sync() methods

I considered separating storage out as a class, but I don't see a use  
case for switching storage once the index has been created.

--
Sean




More information about the Community mailing list