The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Algorithm::SpatialIndex::Storage - Base class for storage backends

SYNOPSIS

  use Algorithm::SpatialIndex;
  my $idx = Algorithm::SpatialIndex->new(
    storage => 'Memory', # or others
  );

DESCRIPTION

METHODS

new

Constructor. Called by the Algorithm::SpatialIndex constructor. You probably do not need to call or implement this. Calls your init method if available.

init

If your subcass implements this, it will be called on the fresh object in the constructor.

fetch_node

Fetch a node from storage by node id.

Has to be implemented in a subclass.

store_node

Store the provided node. Assigns a new ID to it if it has none. Returns the (potentially new) node id.

Note that general id handling is the task of the storage backend. Users or strategies should not set node ids.

Has to be implemented in a subclass.

set_option

Takes a key/value pair for a tree property/option to be stored.

Has to be implemented in a subclass.

get_option

Takes a key for a tree property/option to be fetched from storage.

Has to be implemented in a subclass.

fetch_bucket

Takes a node id as argument and returns the bucket for this node (or undef on failure).

Has to be implemented in a subclass.

store_bucket

Takes a bucket object (with assigned node id) and stores the bucket as the bucket for this node id.

Has to be implemented in a subclass.

delete_bucket

Removes the given bucket (or bucket/node id) from the storage.

Has to be implemented in a subclass.

AUTHOR

Steffen Mueller, <smueller@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2010, 2011 by Steffen Mueller

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.