=head1 NAME

Hub::Data::Data - Interface for storing and retrieving web-content

Part of the L<Hub Library|hublib>

=head1 SYNOPSIS


    use Hub;
    my $data = Hub::mkinst( 'Data' );

    $data->store( $hash );              # stores data by implicit address
    $data->store_at( $addr, $hash );    # stores data at address $addr
    $data->get( $addr );                # returns data at address

    $data->commit();                    # writes to disk

=head1 DESCRIPTION

This class provides interfaces for storing and retrieving data.


=head1 DESCRIPTION



=head1 METHODS

=begin html

<table><tr><td>
<a class="methlink" href="#item_attach">attach</a>

</td><td>
<a class="methlink" href="#item_define_id">define_id</a>

</td><td>
<a class="methlink" href="#item_init">init</a>

</td><td>
<a class="methlink" href="#item_refreshmeta">refreshmeta</a>

</td><td>
<a class="methlink" href="#item_store">store</a>

</td></tr><tr><td>
<a class="methlink" href="#item_commit">commit</a>

</td><td>
<a class="methlink" href="#item_delete_at">delete_at</a>

</td><td>
<a class="methlink" href="#item_new">new</a>

</td><td>
<a class="methlink" href="#item_resort">resort</a>

</td><td>
<a class="methlink" href="#item_store_at">store_at</a>

</td></tr><tr><td>
<a class="methlink" href="#item_cp">cp</a>

</td><td>
<a class="methlink" href="#item_get">get</a>

</td><td>
<a class="methlink" href="#item_packdata">packdata</a>

</td><td>
<a class="methlink" href="#item_set">set</a>

</td><td>
<a class="methlink" href="#item_touch">touch</a>

</td></tr><tr><td>
<a class="methlink" href="#item_create_id">create_id</a>

</td><td>
<a class="methlink" href="#item_get_root">get_root</a>

</td><td>
<a class="methlink" href="#item_refresh">refresh</a>

</td><td>
<a class="methlink" href="#item_set_root">set_root</a>

</td></tr></table>

=end html


=over 4

=item attach

B<>

 Usage: attach this data object to an existing HashFile instance



=back

=over 4

=item commit

B<>

write to disk



=back

=over 4

=item cp

B<>

get (return a copy) information



=back

=over 4

=item create_id

B<>

create id



=back

=over 4

=item define_id

B<>

define id



=back

=over 4

=item delete_at

B<>

remove data



=back

=over 4

=item get

B<>

 Usage: get information



=back

=over 4

=item get_root

B<>

 Usage: get_root

Get the root of the data

=back

=over 4

=item init

B<>

 Usage: initialize myself and load the disk files



=back

=over 4

=item new

B<>

constructor



=back

=over 4

=item packdata

B<>

 Usage: packdata HASHREF

From the bottom up, pack each variable's data.


=back

=over 4

=item refresh

B<>

reload from disk and reset any instance data



=back

=over 4

=item refreshmeta

B<>

 Usage: refreshmeta ID

Refresh the meta variables (which already exist) at point ID

=back

=over 4

=item resort

B<>

 Usage: resort( $address )


Before calling this method, set '_sort2' to a *number* on the
subhashes which have priority.  This method will clear that property.



Resorts the items which are peers at the given address.  If no address is
given, we will resort all root items.  The sort value is stored in the
subkey: '_sort'.




=back

=over 4

=item set

B<>

 Usage: set information



=back

=over 4

=item set_root

B<>

 Usage: set_root HASH

Set the root of the data!

=back

=over 4

=item store

B<>

 Usage: store information in the embedded hashfile


examples


  1)  store( { _id => 'user1', name => 'Ryan', height => '5\'9\"', } );


      %user1{
          name == Ryan
          height == 5'9"
      }


  2)  store( { name => "Ryan", height => "5\'9\"", } );


      name == Ryan
      height == 5'9"


  2)  store( { user1:name => "Ryan", user1:height => "5\'9\"", } );


      name == Ryan
      height == 5'9"



=back

=over 4

=item store_at

B<>

store information at the specified address



=back

=over 4

=item touch

B<>

 Usage: touch($hashref)
 Usage: touch($address)


Update meta-data.  See touch() in Meta.pm for what gets modified.



  Example:


      touch( { a => "aye", b => "bee" } )
      touch( "file:data" )


  Will:


      update the hash provided
      update the item at address 'file:data' if it is a hash



=back

=head1 INTERNAL

=begin html



=end html

=head1 AUTHOR



Ryan Gies

=head1 COPYRIGHT



Copyright (c) 2006 Livesite Networks, LLC.  All rights reserved.

Copyright (c) 2000-2005 Ryan Gies.  All rights reserved.

=head1 UPDATED

This file created by  on  at 

=cut
