[Community] Refactor of rtree.index.Index
Howard Butler
hobu.inc at gmail.com
Wed Sep 16 17:18:34 EEST 2009
On Sep 16, 2009, at 5:43 AM, Sean Gillies wrote:
> 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).
>
Would the convenience this afforded to the rtree.Rtree class continue
to exist? I doubt there's much code depending on rtree.index.Index's
behavior wrt filenames, but there probably is for rtree.Rtree.
> 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
Sounds ok to me.
>
> 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.
Not currently possible with libspatialindex unless you were to walk
all of the leaf nodes of the tree and reinsert into the new storage.
More information about the Community
mailing list