I was going to talk about pstore.rb. But then I read it. And read it again. Then I realized what I was reading was less important than how I was reading it.
of it wiki.transaction do # store page... wiki[home_page.page_name] = home_page # ensure that an index has been created... wiki[:wiki_index] ||= Array.new # update wiki index... wiki[:wiki_index].push(*page.references) end # commit changes 13-05-08
begin @lock.lock rescue ThreadError raise PStore::Error, "nested transaction" end begin @rdonly = read_only @abort = false file = open_and_lock_file(@filename, read_only) if file begin @table, checksum, original_data_size = load_data(file, read_only) catch(:pstore_abort_transaction) do value = yield(self) end if !@abort && !read_only save_data(checksum, original_data_size, file) end ensure file.close if !file.closed? end else # This can only occur if read_only == true. @table = {} catch(:pstore_abort_transaction) do value = yield(self) end end ensure @lock.unlock end value end 13-05-08
block with PStore::Error. 2011-12-20 nahi Cosmetic changes of lib/pstore.rb. Patch by Masaki Matsushita. See #5248. 2011-12-20 nahi content update perf optimization. Patch by Masaki Matsushita. 2011-11-05 ktsj remove unused block arguments to avoid creating Proc objects. 2011-09-13 nobu suppress warnings with -v. 2011-09-13 nobu always open in binary mode even if default encodings are set. 2011-03-13 sorah Fix don't raise "nested transaction" when thread_safe is true. ! ! ! Patch by Masaki Matsushita (Glass_saga). [ruby-dev:43337] 2011-03-07 sorah Delete variable @transaction and fix #4474. Patch by Masaki Matsushita (Glass_saga). 2010-02-15 akr initialize: initialize @thread_safe. 2009-06-13 nobu on_windows: fixed typo. 2009-03-06 nobu removed trailing spaces. 2008-07-10 nobu transaction: return the result from the block. 2008-06-04 matz massive spelling correction patch from Evan Farrar 2008-04-11 matz YAML::load: modified to support empty database. 2008-04-10 matz dump, load: allow subclass overriding. 2008-04-10 matz replaced by Hongli Lai's faster version. 2006-09-08 nobu open all in binary mode, and get rid of the quirk of msvcrt. 2006-02-05 ocean should return default value if name is not found. should raise PStore::Error if not in transaction. 2005-11-01 matz [no mention] 2005-10-27 matz [no mention] 2005-03-04 matz transaction: Use the empty content when a file is not found. 2004-10-06 matz [no mention] 2004-10-05 matz [no mention] 2004-06-01 nobu PStore#transaction: get rid of opening in write mode when read only transaction 2004-05-27 matz transaction: allow overriding dump and load 2004-03-07 eban commit_new: use FileUtils.copy_stream for Cygwin 2004-02-17 matz [no mention] 2003-01-07 matz [no mention] 2002-11-14 matz [no mention] 2002-07-11 matz [no mention] 2002-06-24 matz [no mention] 2001-12-01 knu Reflect the update of the MD5 module which is now Digest::MD5. 2001-11-19 matz [no mention] 2001-10-03 matz [no mention] 2001-07-31 matz [no mention] 2001-05-06 matz [no mention] 2000-10-11 matz [no mention] 2000-09-19 matz [no mention] 2000-06-13 matz pstore abort handle 2000-03-06 matz [no mention] 1999-11-19 matz [no mention] 1999-11-25 matz [no mention] 1999-11-17 matz [no mention] 1999-01-20 matz [no mention] 1998-01-16 matz Initial revision 13-05-08