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.

CLASS METHODS

commit_transaction( )

Requests the data store used commit the transaction.

dirty( obj )

Marks the object as dirty

disconnect( )

Requests the data store used disconnect.

encrypt_pass( pass_string )

Returns a string of the argument encrypted.

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.

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.

has_path_to_root( obj )

Returns true if the argument ( which can be an array ref, hash ref or yote object ) can trace a path back to the root Yote::YoteRoot object ( id 1 ). This is used to detect if the object is dead and should be recycled.

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_xpath( xpath, start, length )

This method returns a paginated slice of a hash that is attached to the xpath given. The slice order is sorted so that subsequent calls have a guaranteed order.

paginate_xpath_list( xpath, start, length )

This method returns a paginated portion of a list that is attached to the xpath given.

path_to_root( object )

Returns the xpath of the given object tracing back a path to the root. This is not guaranteed to be the shortest path to root.

paths_to_root( object )

Returns the a list of all valid xpaths of the given object tracing back a path to the root.

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_object( obj_id )

Sets the available for recycle mark on the object entry in the database by object id and removes its data.

recycle_objects( start_id, end_id )

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

reset_changed( )

This is a helper method that clears out a changed hash. The hash stores objects that become dirty until reset changed is called again.

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.

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.

xpath( path )

Given a path designator, returns the object at the end of it, starting in the root. The notation is /foo/bar/baz where foo, bar and baz are field names.

For example, get the value of the hash keyed to 'zap' where the hash is the second element of an array that is attached to the root with the key 'baz' :

my $object = Yote::ObjProvider::xpath( "/baz/1/zap" );

xpath_count( path )

Given a path designator, returns the number of fields of the object at the end of it, starting in the root. The notation is /foo/bar/baz where foo, bar and baz are field names. This is useful for counting how many things are in a list.

my $count = Yote::ObjProvider::xpath_count( "/foo/bar/baz/myarray" );

Takes two objects as arguments. Returns true if object a is branched off of object b.

if( Yote::ObjProvider::xpath_count( $obj_a, $obj_b ) ) {

xpath_delete( path )

Deletes the entry specified by the path.

xpath_insert( path, item )

Inserts the item at the given xpath, overwriting anything that had existed previously.

xpath_list_insert( path, item )

Appends the item to the list located at the given xpath.

AUTHOR

Eric Wolf

LICENSE AND COPYRIGHT

Copyright (C) 2012 Eric Wolf

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