ObjStore::Table3 - RDBMS Style Tables


ObjStore documentation  | view source Contained in the ObjStore distribution.

Index


NAME

Top

  ObjStore::Table3 - RDBMS Style Tables

SYNOPSIS

Top

  my $table = ObjStore::Table3->new($near);
  $table->add_index('name', sub { ObjStore::Index->new($table, path => 'name') }};

DESCRIPTION

Top

Unstructured perl databases are probably under-constrained for most applications. Tables standardize the interface for storing a bunch of records and their associated indices.

A table is no more than a collection of indices (as opposed to a some sort of heavy-weight object). Think of it like an event manager for indices.

API

* $t->anyx

Returns a non-empty index.

* $t->add($e)

Adds $e to all table indices.

* $t->remove($e)

Removes $e from all table indices.

* $t->index($index_name)

Returns the index named $index_name.

* $t->fetch($index_name, @keys)

Returns the record resulting from looking up @keys in the index named $index_name. Also works in an array context.

* $t->at($index_name, $offset)

The $offset should either be numeric or 'last'.

* $t->add_index($name, $index)

Adds an index. The index can be a closure if your not sure if it already exists.

* $t->remove_index($index)
* $t->map_indices($coderef)

Calls $coderef->($index) on each index.

CAVEAT

Be aware that index cursors may only be used by one process/thread at a time. Therefore, it is usually not helpful to store pre-created cursors in a database.

TODO

Top

I'm fairly satisfied at this point. Some thing may still be improved. Ideas welcome!


ObjStore documentation  | view source Contained in the ObjStore distribution.