ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- save_data_with_atomic_file_rename_strategy-i.ri000064400000000465152367574560016145 0ustar00U:RDoc::AnyMethod[iI"/save_data_with_atomic_file_rename_strategy:EFI"6PStore#save_data_with_atomic_file_rename_strategy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I"(data, file);T@ FI" PStore;TcRDoc::NormalClass00transaction-i.ri000064400000002146152367574560007702 0ustar00U:RDoc::AnyMethod[iI"transaction:EFI"PStore#transaction;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"OOpens a new transaction for the data store. Code executed inside a block ;TI"Npassed to this method may read and write data to and from the data store ;TI" file.;To:RDoc::Markup::BlankLineo; ; [ I"FAt the end of the block, changes are committed to the data store ;TI"Nautomatically. You may exit the transaction early with a call to either ;TI"MPStore#commit or PStore#abort. See those methods for details about how ;TI"Ichanges are handled. Raising an uncaught Exception in the block is ;TI"(equivalent to calling PStore#abort.;T@o; ; [I"PIf _read_only_ is set to +true+, you will only be allowed to read from the ;TI"Pdata store during the transaction and any attempts to change the data will ;TI"raise a PStore::Error.;T@o; ; [I";Note that PStore does not support nested transactions.;T: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below00I" pstore;F[I"(read_only = false);T@ FI" PStore;TcRDoc::NormalClass00on_windows%3f-i.ri000064400000000355152367574560010041 0ustar00U:RDoc::AnyMethod[iI"on_windows?:EFI"PStore#on_windows?;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" PStore;TcRDoc::NormalClass00cdesc-PStore.ri000064400000011354152367574560007423 0ustar00U: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 pstore.ultra_safe = true. ;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"EMPTY_STRING;FI"PStore::EMPTY_STRING;T00o;;[o; ;[I"5Constant for relieving Ruby's garbage collector.;T;@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::TopLevelempty_marshal_checksum-i.ri000064400000000403152367574560012076 0ustar00U:RDoc::AnyMethod[iI"empty_marshal_checksum:EFI""PStore#empty_marshal_checksum;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" PStore;TcRDoc::NormalClass00save_data_with_fast_strategy-i.ri000064400000000431152367574560013271 0ustar00U:RDoc::AnyMethod[iI"!save_data_with_fast_strategy:EFI"(PStore#save_data_with_fast_strategy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I"(data, file);T@ FI" PStore;TcRDoc::NormalClass00ultra_safe-i.ri000064400000001351152367574560007477 0ustar00U:RDoc::Attr[iI"ultra_safe:ETI"PStore#ultra_safe;TI"RW;T: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"TWhether PStore should do its best to prevent file corruptions, even when under ;TI"Runlikely-to-occur error conditions such as out-of-space conditions and other ;TI"Tunusual OS filesystem errors. Setting this flag comes at the price in the form ;TI"of a performance loss.;To:RDoc::Markup::BlankLineo; ; [I"SThis flag only has effect on platforms on which file renames are atomic (e.g. ;TI"Tall POSIX platforms: Linux, MacOS X, FreeBSD, etc). The default value is false.;T: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below0F@I" PStore;TcRDoc::NormalClass0load_data-i.ri000064400000001021152367574560007254 0ustar00U:RDoc::AnyMethod[iI"load_data:EFI"PStore#load_data;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"!Load the given PStore file. ;TI"EIf +read_only+ is true, the unmarshalled Hash will be returned. ;TI"KIf +read_only+ is false, a 3-tuple will be returned: the unmarshalled ;TI"AHash, an MD5 checksum of the data, and the size of the data.;T: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I"(file, read_only);T@FI" PStore;TcRDoc::NormalClass00fetch-i.ri000064400000001421152367574560006441 0ustar00U:RDoc::AnyMethod[iI" fetch:EFI"PStore#fetch;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"JThis method is just like PStore#[], save that you may also provide a ;TI"O_default_ value for the object. In the event the specified _name_ is not ;TI"Rfound in the data store, your _default_ will be returned instead. If you do ;TI"Nnot specify a default, PStore::Error will be raised if the object is not ;TI" found.;To:RDoc::Markup::BlankLineo; ; [I"M*WARNING*: This method is only valid in a PStore#transaction. It will ;TI"5raise PStore::Error if called at any other time.;T: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I""(name, default=PStore::Error);T@FI" PStore;TcRDoc::NormalClass00root%3f-i.ri000064400000000766152367574560006644 0ustar00U:RDoc::AnyMethod[iI" root?:EFI"PStore#root?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HReturns true if the supplied _name_ is currently in the data store.;To:RDoc::Markup::BlankLineo; ; [I"M*WARNING*: This method is only valid in a PStore#transaction. It will ;TI"5raise PStore::Error if called at any other time.;T: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I" (name);T@FI" PStore;TcRDoc::NormalClass00new-c.ri000064400000001106152367574560006133 0ustar00U:RDoc::AnyMethod[iI"new:ETI"PStore::new;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PTo construct a PStore object, pass in the _file_ path where you would like ;TI"the data to be stored.;To:RDoc::Markup::BlankLineo; ; [I"OPStore objects are always reentrant. But if _thread_safe_ is set to true, ;TI"Lthen it will become thread-safe at the cost of a minor performance hit.;T: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I" (file, thread_safe = false);T@FI" PStore;TcRDoc::NormalClass00Error/cdesc-Error.ri000064400000000725152367574560010371 0ustar00U:RDoc::NormalClass[iI" Error:ETI"PStore::Error;TI"StandardError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"1The error type thrown by all PStore methods.;T: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[@I" PStore;TcRDoc::NormalClassempty_marshal_data-i.ri000064400000000373152367574560011213 0ustar00U:RDoc::AnyMethod[iI"empty_marshal_data:EFI"PStore#empty_marshal_data;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" PStore;TcRDoc::NormalClass00open_and_lock_file-i.ri000064400000001203152367574560011140 0ustar00U:RDoc::AnyMethod[iI"open_and_lock_file:EFI"PStore#open_and_lock_file;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"AOpen the specified filename (either in read-only mode or in ;TI"9read-write mode) and lock it for reading or writing.;To:RDoc::Markup::BlankLineo; ; [I"FThe opened File object will be returned. If _read_only_ is true, ;TI" ["rational.rb", "pstore.rb"], ;TI"L "James Gray" => ["erb.rb", "pstore.rb"] } ;TI"?end # commit changes to data store file ;T: @format0o; ; [I"Q*WARNING*: This method is only valid in a PStore#transaction and it cannot ;TI"Lbe read-only. It will raise PStore::Error if called at any other time.;T: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I"(name, value);T@"FI" PStore;TcRDoc::NormalClass00in_transaction_wr-i.ri000064400000000642152367574560011077 0ustar00U:RDoc::AnyMethod[iI"in_transaction_wr:EFI"PStore#in_transaction_wr;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PRaises PStore::Error if the calling code is not in a PStore#transaction or ;TI"6if the code is in a read-only PStore#transaction.;T: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" PStore;TcRDoc::NormalClass00save_data-i.ri000064400000000424152367574560007301 0ustar00U:RDoc::AnyMethod[iI"save_data:EFI"PStore#save_data;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I"2(original_checksum, original_file_size, file);T@ FI" PStore;TcRDoc::NormalClass00commit-i.ri000064400000001757152367574560006654 0ustar00U:RDoc::AnyMethod[iI" commit:EFI"PStore#commit;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"MEnds the current PStore#transaction, committing any changes to the data ;TI"store immediately.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example:;T@o:RDoc::Markup::Verbatim; [I"require "pstore" ;TI" ;TI",store = PStore.new("data_file.pstore") ;TI"/store.transaction do # begin transaction ;TI"* # load some data into the store... ;TI" store[:one] = 1 ;TI" store[:two] = 2 ;TI" ;TI"F store.commit # end transaction here, committing changes ;TI" ;TI": store[:three] = 3 # this change is never reached ;TI" end ;T: @format0o; ; [I"M*WARNING*: This method is only valid in a PStore#transaction. It will ;TI"5raise PStore::Error if called at any other time.;T: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@$FI" PStore;TcRDoc::NormalClass00roots-i.ri000064400000000762152367574560006525 0ustar00U:RDoc::AnyMethod[iI" roots:EFI"PStore#roots;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HReturns the names of all object hierarchies currently in the store.;To:RDoc::Markup::BlankLineo; ; [I"M*WARNING*: This method is only valid in a PStore#transaction. It will ;TI"5raise PStore::Error if called at any other time.;T: @fileI"lib/pstore.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" PStore;TcRDoc::NormalClass00