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

NAME

Yote::ObjProvider - Serves Yote objects. Configured to a persistance engine.

DESCRIPTION

This module is essentially a private module and its methods will not be called directly by programs. This module is the front end for assigning IDs to objects, fetching objects, keeping track of objects that need saving (are dirty) and saving all dirty objects. It is the only module to directly interact with the datastore layer.

INIT METHODS

new
init - takes a hash of args, passing them to a new Yote::SQLite object and starting it up.
attach_server( datalocker )

This links a datalocker to this objprovider. This is called automatically by Yote::WebAppServer which also serves as the locker. The datalocker is responsible for locking and unlocking objects.

CLASS METHODS

commit_transaction( )

Requests the data store used commit the transaction.

count( container_id, args )

Returns the number of items in the given container. Args are optional and are

    * search_fields - a list of fields to search for in collections of yote objects * search_terms - a list of terms to search for

dirty( obj )

Marks the item as needing a save.

disconnect( )

Requests the data store used disconnect.

encrypt_pass( pass_string, handle_string )

Returns a string of the argument encrypted. This is

fetch( id )

Returns the array ref, hash ref or yote object specified by the numeric id or hash path.

first_id( id )

Returns the id of the first object in the system, the YoteRoot. This may or may not be numeric.

flush( id )

Removes any object with the given ID from any cache.

flush_all_volatile()

Clears out all caches.

get_id( obj )

Returns the id assigned to the array ref, hash ref or yote object. This method assigns that id if none had been assigned to it.

hash_delete( hash_id, key )

Removes the key from the hash given by the id direclty from the database.

hash_fetch( hash_id, key )

Uses a database lookup to return the value for the key for the hash specified by hash_id.

hash_has_key( hash_id, key )

Uses a database lookup to return if the key for the hash specified by hash_id has a value.

hash_insert( hash_id, key, value )

Insert a key value pair directly into the database for the given hash_id.

list_delete( list_id, idx )

Uses the database to directly delete a given list element. This will cause the list to be reindexed.

list_fetch( list_id, idx )

Directly looks in the database to return the list element at the given index.

list_insert( list_id, val, idx )

Inserts the item into the list with an optional index. If not given, this inserts to the end of the list. This method will cause the list to be reindexed.

lock( id, ref )

Requests that the object locker lock the object given by id and reference to this thread. Calling this blocks until the item is unlocked.

package_methods( package_name )

This method returns a list of the public API methods attached to the given package name. This excludes the automatic getters and setters that are part of yote objects.

paginate( obj_id, args )

Returns a paginated list or hash that is attached to the object specified by obj_id. Arguments are

    * search_fields - a list of fields to search for in collections of yote objects * search_terms - a list of terms to search for * sort_fields - a list of fields to sort by for collections of yote objects * reversed_orders - a list of true or false values corresponding to the sort_fields list. A true value means that field is sorted in reverse * limit - maximum number of entries to return * skip - skip this many entries before returning the list * return_hash - return the result as a hashtable rather than as a list * reverse - return the result in reverse order

power_clone( item )

Returns a deep clone of the object. This will clone any object that is part of the yote system except for the yote root or any app (a Yote::AppRoot object)

recycle_objects( start_id, end_id )

Recycles all objects in the range given if they cannot trace back a path to root.

remove_from( list_id, item )

Removes the items ( by value ) from the list with the given id.

start_transaction( )

Requests that the underlying data store start a transaction.

stow( obj )

This saves the hash ref, array ref or yote object argument in the data store.

stow_all( )

Stows all objects that are marked as dirty. This is called automatically by the application server and need not be explicitly called.

unlock( id )

Requests the object locker release the object referenced by the given id that was locked to this thread.

xform_in( value )

Returns the internal yote storage for the value, be it a string/number value, or yote reference.

xform_out( identifier )

Returns the external value given the internal identifier. The external value can be a string/number value or a yote reference.

AUTHOR

Eric Wolf coyocanid@gmail.com http://madyote.com

LICENSE AND COPYRIGHT

Copyright (C) 2012 Eric Wolf

This module is free software; it can be used under the same terms as perl itself.