ÿØÿà JFIF ÿÛ „ ( %!1!%*+...983,7(-.-
save_data_with_atomic_file_rename_strategy-i.ri 0000644 00000000465 15236757456 0016145 0 ustar 00 U: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::NormalClass00 transaction-i.ri 0000644 00000002146 15236757456 0007702 0 ustar 00 U: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::BlankLine o;
; [
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::NormalClass00 on_windows%3f-i.ri 0000644 00000000355 15236757456 0010041 0 ustar 00 U: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::NormalClass00 cdesc-PStore.ri 0000644 00000011354 15236757456 0007423 0 ustar 00 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::BlankLine o; ;[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[i I"RDWR_ACCESS;FI"PStore::RDWR_ACCESS;T00o;;[ ;@f;0@f@cRDoc::NormalClass0U;[i I"RD_ACCESS;FI"PStore::RD_ACCESS;T00o;;[ ;@f;0@f@@s0U;[i I"WR_ACCESS;FI"PStore::WR_ACCESS;T00o;;[ ;@f;0@f@@s0U;[i I"EMPTY_STRING;FI"PStore::EMPTY_STRING;T00o;;[o; ;[I"5Constant for relieving Ruby's garbage collector.;T;@f;0@f@@s0U;[i I"EMPTY_MARSHAL_DATA;FI"PStore::EMPTY_MARSHAL_DATA;T00o;;[ ;@f;0@f@@s0U;[i I"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[i 0o;;[ ;0;0[@f@fcRDoc::TopLevel empty_marshal_checksum-i.ri 0000644 00000000403 15236757456 0012076 0 ustar 00 U: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::NormalClass00 save_data_with_fast_strategy-i.ri 0000644 00000000431 15236757456 0013271 0 ustar 00 U: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::NormalClass00 ultra_safe-i.ri 0000644 00000001351 15236757456 0007477 0 ustar 00 U: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::BlankLine o;
; [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::NormalClass0 load_data-i.ri 0000644 00000001021 15236757456 0007254 0 ustar 00 U: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::NormalClass00 fetch-i.ri 0000644 00000001421 15236757456 0006441 0 ustar 00 U: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::BlankLine o;
; [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::NormalClass00 root%3f-i.ri 0000644 00000000766 15236757456 0006644 0 ustar 00 U: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::BlankLine o;
; [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::NormalClass00 new-c.ri 0000644 00000001106 15236757456 0006133 0 ustar 00 U: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::BlankLine o;
; [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::NormalClass00 Error/cdesc-Error.ri 0000644 00000000725 15236757456 0010371 0 ustar 00 U: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[i 0o;;[ ;
0;0[@I"PStore;TcRDoc::NormalClass empty_marshal_data-i.ri 0000644 00000000373 15236757456 0011213 0 ustar 00 U: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::NormalClass00 open_and_lock_file-i.ri 0000644 00000001203 15236757456 0011140 0 ustar 00 U: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::BlankLine o;
; [I"FThe opened File object will be returned. If _read_only_ is true, ;TI"