IOWA 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTORS +14 -0
- data/README.md +23 -0
- data/RELEASE_NOTES +77 -0
- data/ToDo +21 -0
- data/components/CRUDList/CRUDList.html +13 -0
- data/components/CRUDList/CRUDList.iwa +136 -0
- data/components/Content/Content.html +0 -0
- data/components/Content/Content.iwa +143 -0
- data/components/Content/example/README +9 -0
- data/components/Content/example/cgi/iowa.cgi +10 -0
- data/components/Content/example/demo.rb +30 -0
- data/components/Content/example/doc/index.html +7 -0
- data/components/Content/example/iowa/Content.html +1 -0
- data/components/Content/example/iowa/Content.iwa +1 -0
- data/components/Content/example/iowa/Main.html +6 -0
- data/components/Content/example/iowa/Main.iwa +3 -0
- data/components/Content/example/iowa/_content/body +7 -0
- data/components/Content/example/iowa/_content/body2 +3 -0
- data/components/Content/example/iowa/_content/title +2 -0
- data/components/Content/example/iowa/app.cnf +8 -0
- data/components/Content/example/iowa/app.rb +8 -0
- data/components/Content/example/webrick.rb +38 -0
- data/components/Include/Include.html +1 -0
- data/components/Include/Include.iwa +30 -0
- data/components/Include/readme +5 -0
- data/components/JumpTo/JumpTo.html +8 -0
- data/components/JumpTo/JumpTo.iwa +8 -0
- data/components/JumpTo/readme +6 -0
- data/doc/Architecture.txt +6 -0
- data/doc/History.txt +33 -0
- data/doc/StandardDispatcher.txt +19 -0
- data/examples/blog/README +1 -0
- data/examples/hello_world/README +17 -0
- data/examples/hello_world/htdocs/hello_world_html.html +24 -0
- data/examples/hello_world/htdocs/hello_world_ruby.html +41 -0
- data/examples/hello_world/iowa/HelloWorld.html +14 -0
- data/examples/hello_world/iowa/HelloWorld.iwa +31 -0
- data/examples/hello_world/iowa/Index.html +16 -0
- data/examples/hello_world/iowa/Index.iwa +5 -0
- data/examples/hello_world/iowa/iowa_hello_world.cnf +19 -0
- data/examples/hello_world/iowa/iowa_hello_world.rb +5 -0
- data/examples/hello_world/iowa/mapfile.cnf +6 -0
- data/examples/hw1/iowa/Main.html +1 -0
- data/examples/hw1/iowa/README +9 -0
- data/examples/hw1/iowa/hw.rb +4 -0
- data/examples/hw2/iowa/Main.html +10 -0
- data/examples/hw2/iowa/Main.iwa +7 -0
- data/examples/hw2/iowa/README +16 -0
- data/examples/hw2/iowa/hw.rb +4 -0
- data/examples/hw3/iowa/Main.html +11 -0
- data/examples/hw3/iowa/Main.iwa +7 -0
- data/examples/hw3/iowa/README +22 -0
- data/examples/hw3/iowa/hw.rb +4 -0
- data/examples/hw4/iowa/Greetings.html +10 -0
- data/examples/hw4/iowa/Greetings.iwa +9 -0
- data/examples/hw4/iowa/Main.html +12 -0
- data/examples/hw4/iowa/Main.iwa +10 -0
- data/examples/hw4/iowa/README +28 -0
- data/examples/hw4/iowa/hw.rb +4 -0
- data/examples/hw5/iowa/Footer.html +2 -0
- data/examples/hw5/iowa/Greetings.html +4 -0
- data/examples/hw5/iowa/Greetings.iwa +12 -0
- data/examples/hw5/iowa/Header.html +6 -0
- data/examples/hw5/iowa/Main.html +12 -0
- data/examples/hw5/iowa/Main.iwa +13 -0
- data/examples/hw5/iowa/README +16 -0
- data/examples/hw5/iowa/hw.rb +4 -0
- data/examples/template_server/iowa/Content.iwa +121 -0
- data/examples/template_server/iowa/Content.view +0 -0
- data/examples/template_server/iowa/DBContentDispatcher.rb +112 -0
- data/examples/template_server/iowa/DBContentPage.html +3 -0
- data/examples/template_server/iowa/DBContentPage.iwa +85 -0
- data/examples/template_server/iowa/app.cnf +13 -0
- data/examples/template_server/iowa/app.rb +5 -0
- data/ext/Classifier/classifier.c +256 -0
- data/ext/Classifier/ext_help.h +14 -0
- data/ext/Classifier/extconf.rb +5 -0
- data/ext/Classifier/tst.h +40 -0
- data/ext/Classifier/tst_cleanup.c +24 -0
- data/ext/Classifier/tst_delete.c +146 -0
- data/ext/Classifier/tst_grow_node_free_list.c +38 -0
- data/ext/Classifier/tst_init.c +41 -0
- data/ext/Classifier/tst_insert.c +192 -0
- data/ext/Classifier/tst_search.c +68 -0
- data/ext/http11/README +11 -0
- data/ext/http11/ext_help.h +15 -0
- data/ext/http11/extconf.rb +5 -0
- data/ext/http11/http11.c +534 -0
- data/ext/http11/http11.c.dif +422 -0
- data/ext/http11/http11_parser.c +1243 -0
- data/ext/http11/http11_parser.c.dif +193 -0
- data/ext/http11/http11_parser.h +49 -0
- data/ext/http11/http11_parser.h.dif +20 -0
- data/ext/http11/http11_parser.rl +192 -0
- data/ext/httpmachine/Makefile +149 -0
- data/ext/httpmachine/extconf.rb +33 -0
- data/ext/httpmachine/http.cpp +430 -0
- data/ext/httpmachine/http.h +156 -0
- data/ext/httpmachine/rubyhttp.cpp +165 -0
- data/external/mime-types/LICENCE +18 -0
- data/external/mime-types/README +46 -0
- data/external/mime-types/doc/classes/MIME.html +120 -0
- data/external/mime-types/doc/classes/MIME/InvalidContentType.html +119 -0
- data/external/mime-types/doc/classes/MIME/Type.html +866 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000010.html +22 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000011.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000012.html +19 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000013.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000014.html +26 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000015.html +33 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000016.html +27 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000017.html +35 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000018.html +34 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000019.html +24 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000020.html +38 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000021.html +22 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000022.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000023.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000024.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000025.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000026.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000027.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000028.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000029.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000030.html +19 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000031.html +26 -0
- data/external/mime-types/doc/classes/MIME/Types.html +459 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000001.html +19 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000002.html +32 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000003.html +21 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000004.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000005.html +26 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000006.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000007.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000008.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000009.html +18 -0
- data/external/mime-types/doc/created.rid +1 -0
- data/external/mime-types/doc/files/ChangeLog.html +320 -0
- data/external/mime-types/doc/files/README.html +145 -0
- data/external/mime-types/doc/files/lib/mime/types_rb.html +101 -0
- data/external/mime-types/doc/fr_class_index.html +30 -0
- data/external/mime-types/doc/fr_file_index.html +29 -0
- data/external/mime-types/doc/fr_method_index.html +57 -0
- data/external/mime-types/doc/index.html +24 -0
- data/external/mime-types/doc/rdoc-style.css +208 -0
- data/external/mime-types/lib/mime/types.rb +1558 -0
- data/external/package.rb +672 -0
- data/external/test_support.rb +95 -0
- data/external/tmail/README +7 -0
- data/external/tmail/tmail.rb +4 -0
- data/external/tmail/tmail/address.rb +222 -0
- data/external/tmail/tmail/base64.rb +52 -0
- data/external/tmail/tmail/compat.rb +39 -0
- data/external/tmail/tmail/config.rb +50 -0
- data/external/tmail/tmail/encode.rb +447 -0
- data/external/tmail/tmail/header.rb +895 -0
- data/external/tmail/tmail/info.rb +14 -0
- data/external/tmail/tmail/loader.rb +1 -0
- data/external/tmail/tmail/mail.rb +869 -0
- data/external/tmail/tmail/mailbox.rb +386 -0
- data/external/tmail/tmail/mbox.rb +1 -0
- data/external/tmail/tmail/net.rb +260 -0
- data/external/tmail/tmail/obsolete.rb +123 -0
- data/external/tmail/tmail/parser.rb +1475 -0
- data/external/tmail/tmail/parser.y +372 -0
- data/external/tmail/tmail/port.rb +356 -0
- data/external/tmail/tmail/scanner.rb +17 -0
- data/external/tmail/tmail/scanner_r.rb +243 -0
- data/external/tmail/tmail/stringio.rb +256 -0
- data/external/tmail/tmail/textutils.rb +197 -0
- data/external/tmail/tmail/tmail.rb +1 -0
- data/external/tmail/tmail/utils.rb +23 -0
- data/external/win32-process/README +133 -0
- data/external/win32-process/lib/win32/process.rb +561 -0
- data/external/windows-pr/README +145 -0
- data/external/windows-pr/doc/conversion_guide.txt +25 -0
- data/external/windows-pr/lib/windows/clipboard.rb +72 -0
- data/external/windows-pr/lib/windows/console.rb +323 -0
- data/external/windows-pr/lib/windows/device_io.rb +88 -0
- data/external/windows-pr/lib/windows/directory.rb +80 -0
- data/external/windows-pr/lib/windows/error.rb +313 -0
- data/external/windows-pr/lib/windows/eventlog.rb +120 -0
- data/external/windows-pr/lib/windows/file.rb +349 -0
- data/external/windows-pr/lib/windows/filesystem.rb +16 -0
- data/external/windows-pr/lib/windows/handle.rb +31 -0
- data/external/windows-pr/lib/windows/library.rb +76 -0
- data/external/windows-pr/lib/windows/limits.rb +13 -0
- data/external/windows-pr/lib/windows/memory.rb +117 -0
- data/external/windows-pr/lib/windows/msvcrt/buffer.rb +48 -0
- data/external/windows-pr/lib/windows/msvcrt/file.rb +18 -0
- data/external/windows-pr/lib/windows/msvcrt/string.rb +46 -0
- data/external/windows-pr/lib/windows/national.rb +557 -0
- data/external/windows-pr/lib/windows/path.rb +296 -0
- data/external/windows-pr/lib/windows/pipe.rb +77 -0
- data/external/windows-pr/lib/windows/process.rb +171 -0
- data/external/windows-pr/lib/windows/registry.rb +238 -0
- data/external/windows-pr/lib/windows/security.rb +89 -0
- data/external/windows-pr/lib/windows/service.rb +183 -0
- data/external/windows-pr/lib/windows/shell.rb +88 -0
- data/external/windows-pr/lib/windows/sound.rb +52 -0
- data/external/windows-pr/lib/windows/synchronize.rb +161 -0
- data/external/windows-pr/lib/windows/system_info.rb +70 -0
- data/external/windows-pr/lib/windows/unicode.rb +138 -0
- data/external/windows-pr/lib/windows/window.rb +22 -0
- data/iowa.gemspec +45 -0
- data/microprojects/DiskCache/LICENSE +28 -0
- data/microprojects/DiskCache/README +17 -0
- data/microprojects/DiskCache/external/package.rb +608 -0
- data/microprojects/DiskCache/external/test_support.rb +8 -0
- data/microprojects/DiskCache/setup.rb +22 -0
- data/microprojects/DiskCache/src/iowa/Association.rb +67 -0
- data/microprojects/DiskCache/src/iowa/Constants.rb +159 -0
- data/microprojects/DiskCache/src/iowa/DiskStore.rb +377 -0
- data/microprojects/DiskCache/src/iowa/Hash.rb +63 -0
- data/microprojects/DiskCache/src/iowa/Lockfile.rb +575 -0
- data/microprojects/DiskCache/src/iowa/Mutex.rb +142 -0
- data/microprojects/DiskCache/src/iowa/caches/DiskCache.rb +605 -0
- data/microprojects/DiskCache/src/iowa/caches/LRUCache.rb +287 -0
- data/microprojects/DiskCache/test/TC_DiskCache.rb +218 -0
- data/microprojects/LRUCache/LICENSE +28 -0
- data/microprojects/LRUCache/README +13 -0
- data/microprojects/LRUCache/external/package.rb +608 -0
- data/microprojects/LRUCache/external/test_support.rb +8 -0
- data/microprojects/LRUCache/setup.rb +22 -0
- data/microprojects/LRUCache/src/iowa/Association.rb +57 -0
- data/microprojects/LRUCache/src/iowa/Constants.rb +159 -0
- data/microprojects/LRUCache/src/iowa/Hash.rb +63 -0
- data/microprojects/LRUCache/src/iowa/Mutex.rb +129 -0
- data/microprojects/LRUCache/src/iowa/caches/LRUCache.rb +287 -0
- data/microprojects/LRUCache/test/TC_LRUCache.rb +65 -0
- data/microprojects/LinkedList/LICENSE +28 -0
- data/microprojects/LinkedList/README +13 -0
- data/microprojects/LinkedList/external/package.rb +608 -0
- data/microprojects/LinkedList/external/test_support.rb +8 -0
- data/microprojects/LinkedList/setup.rb +22 -0
- data/microprojects/LinkedList/src/iowa/LinkedList.rb +165 -0
- data/microprojects/LinkedList/test/TC_LinkedList.rb +42 -0
- data/microprojects/README +8 -0
- data/setup.rb +116 -0
- data/share/iowa/app_skeleton/Main.html +8 -0
- data/share/iowa/app_skeleton/Main.iwa +15 -0
- data/share/iowa/app_skeleton/app.cnf +48 -0
- data/share/iowa/app_skeleton/app.rb +58 -0
- data/share/iowa/app_skeleton/models/model.rb +49 -0
- data/src/ihc.rb +223 -0
- data/src/iowa.cgi +29 -0
- data/src/iowa.rb +637 -0
- data/src/iowa/AbstractCache.rb +96 -0
- data/src/iowa/AcceptLanguage.rb +76 -0
- data/src/iowa/Application.rb +928 -0
- data/src/iowa/ApplicationStats.rb +72 -0
- data/src/iowa/Association.rb +67 -0
- data/src/iowa/BindingsParser.rb +62 -0
- data/src/iowa/Breakpoint.rb +273 -0
- data/src/iowa/CSS.rb +564 -0
- data/src/iowa/Client.rb +192 -0
- data/src/iowa/Component.rb +405 -0
- data/src/iowa/ComponentProxy.rb +26 -0
- data/src/iowa/Config.rb +21 -0
- data/src/iowa/Constants.rb +226 -0
- data/src/iowa/Context.rb +218 -0
- data/src/iowa/ContextLogger.rb +16 -0
- data/src/iowa/DbPool.rb +222 -0
- data/src/iowa/DetachedComponent.rb +18 -0
- data/src/iowa/Dispatcher.rb +27 -0
- data/src/iowa/DynamicElements.rb +471 -0
- data/src/iowa/Element.rb +100 -0
- data/src/iowa/Email.rb +287 -0
- data/src/iowa/Extensions/AllExtensions.rb +4 -0
- data/src/iowa/Extensions/Class.rb +94 -0
- data/src/iowa/Extensions/Date.rb +88 -0
- data/src/iowa/Extensions/DateTime.rb +88 -0
- data/src/iowa/Extensions/Hash.rb +22 -0
- data/src/iowa/Extensions/Kernel.rb +6 -0
- data/src/iowa/Extensions/Numeric.rb +47 -0
- data/src/iowa/Extensions/Object.rb +11 -0
- data/src/iowa/Extensions/String.rb +60 -0
- data/src/iowa/Extensions/Time.rb +89 -0
- data/src/iowa/Extensions/TimeExtensions.rb +6 -0
- data/src/iowa/Form.rb +368 -0
- data/src/iowa/Hash.rb +85 -0
- data/src/iowa/ISAAC.rb +175 -0
- data/src/iowa/ImageSize.rb +279 -0
- data/src/iowa/IowaComponentMixins.rb +7 -0
- data/src/iowa/JSON-lexer.rb +296 -0
- data/src/iowa/JSON-objects.rb +201 -0
- data/src/iowa/KeyValueCoding.rb +91 -0
- data/src/iowa/LinkedList.rb +175 -0
- data/src/iowa/Loader.rb +22 -0
- data/src/iowa/Lockfile.rb +575 -0
- data/src/iowa/Logger.rb +74 -0
- data/src/iowa/Monkey.rb +20 -0
- data/src/iowa/Mutex.rb +142 -0
- data/src/iowa/Policy.rb +70 -0
- data/src/iowa/Pool.rb +243 -0
- data/src/iowa/PrettyException.rb +1091 -0
- data/src/iowa/Request.rb +244 -0
- data/src/iowa/Response.rb +133 -0
- data/src/iowa/Session.rb +354 -0
- data/src/iowa/SessionStats.rb +78 -0
- data/src/iowa/String.rb +65 -0
- data/src/iowa/Tag.rb +101 -0
- data/src/iowa/TemplateParser.rb +236 -0
- data/src/iowa/Util.rb +314 -0
- data/src/iowa/Webcache.rb +122 -0
- data/src/iowa/caches/BiLevelCache.rb +65 -0
- data/src/iowa/caches/ClassLimitedCache.rb +67 -0
- data/src/iowa/caches/DiskCache.rb +609 -0
- data/src/iowa/caches/DiskStore.rb +380 -0
- data/src/iowa/caches/LRUCache-alternative.rb +155 -0
- data/src/iowa/caches/LRUCache.rb +290 -0
- data/src/iowa/caches/SimpleLRUCache.rb +112 -0
- data/src/iowa/dispatchers/StandardDispatcher.rb +396 -0
- data/src/iowa/dispatchers/StandardDispatcherWithClassifier.rb +93 -0
- data/src/iowa/js/iowa_jsonrpc.js +381 -0
- data/src/iowa/js/jsonrpc.js +187 -0
- data/src/iowa/js/jsonrpc_async.js +261 -0
- data/src/iowa/loaders/DiskLoader.rb +50 -0
- data/src/iowa/loggers/Analogger.rb +54 -0
- data/src/iowa/loggers/AsyncLogger.rb +54 -0
- data/src/iowa/loggers/BitBucket.rb +38 -0
- data/src/iowa/loggers/Log4R.rb +13 -0
- data/src/iowa/loggers/Log4rLogger.rb +48 -0
- data/src/iowa/loggers/Logger.rb +29 -0
- data/src/iowa/loggers/RubyLogger.rb +9 -0
- data/src/iowa/pools/DBConnectionPool.rb +53 -0
- data/src/iowa/request/Apache.rb +90 -0
- data/src/iowa/request/EMHybrid.rb +59 -0
- data/src/iowa/request/ENV.rb +80 -0
- data/src/iowa/request/FCGI.rb +68 -0
- data/src/iowa/request/HTTPMachine.rb +75 -0
- data/src/iowa/request/Mongrel.rb +68 -0
- data/src/iowa/request/WEBrick.rb +48 -0
- data/src/iowa/version.rb +3 -0
- data/src/iowa/webrick/HTTPServer.rb +43 -0
- data/src/iowa/webrick/WEBrickServlet.rb +28 -0
- data/src/iowa_fcgi_handler.rb +101 -0
- data/src/iowa_httpmachine.rb +141 -0
- data/src/iowa_hybrid.rb +193 -0
- data/src/iowa_hybrid_cluster.rb +231 -0
- data/src/iowa_mongrel.rb +136 -0
- data/src/iowa_webrick.rb +194 -0
- data/src/iowa_webrick_legacy.rb +104 -0
- data/src/mod_iowa.rb +104 -0
- data/tcss.rb +61 -0
- data/test/README.windows +12 -0
- data/test/TC_AcceptLanguage.rb +61 -0
- data/test/TC_AppConfig.rb +43 -0
- data/test/TC_AppConfig/cgi/iowa.cgi +7 -0
- data/test/TC_AppConfig/doc/index.html +1 -0
- data/test/TC_AppConfig/iowa/Main.html +4 -0
- data/test/TC_AppConfig/iowa/Main.iwa +17 -0
- data/test/TC_AppConfig/iowa/README +1 -0
- data/test/TC_AppConfig/iowa/app.cnf +19 -0
- data/test/TC_AppConfig/iowa/app.rb +8 -0
- data/test/TC_AppConfig/webrick.rb +38 -0
- data/test/TC_Association.rb +29 -0
- data/test/TC_BiLevelCache.rb +71 -0
- data/test/TC_CGI_Adaptor.rb +55 -0
- data/test/TC_CGI_Adaptor/cgi/iowa.cgi +7 -0
- data/test/TC_CGI_Adaptor/doc/index.html +1 -0
- data/test/TC_CGI_Adaptor/iowa/Main.html +8 -0
- data/test/TC_CGI_Adaptor/iowa/Main.iwa +14 -0
- data/test/TC_CGI_Adaptor/iowa/README +1 -0
- data/test/TC_CGI_Adaptor/iowa/app.cnf +8 -0
- data/test/TC_CGI_Adaptor/iowa/app.rb +8 -0
- data/test/TC_CGI_Adaptor/webrick.rb +38 -0
- data/test/TC_CSS.rb +660 -0
- data/test/TC_ClassLimitedCache.rb +89 -0
- data/test/TC_Classifier.rb +80 -0
- data/test/TC_DbPool.rb +127 -0
- data/test/TC_DiskCache.rb +218 -0
- data/test/TC_Hybrid.rb +58 -0
- data/test/TC_Hybrid/doc/thing.txt +1 -0
- data/test/TC_Hybrid/iowa/Main.html +3 -0
- data/test/TC_Hybrid/iowa/Main.iwa +7 -0
- data/test/TC_Hybrid/iowa/NewPage.html +1 -0
- data/test/TC_Hybrid/iowa/NewPage.iwa +5 -0
- data/test/TC_Hybrid/iowa/app.cnf +10 -0
- data/test/TC_Hybrid/iowa/app.rb +5 -0
- data/test/TC_IOWAFunctions/doc/Ajax1.html +1 -0
- data/test/TC_IOWAFunctions/doc/Ajax1.iwa +1 -0
- data/test/TC_IOWAFunctions/doc/index.html +1 -0
- data/test/TC_IOWAFunctions/doc/js/dojo.js +9686 -0
- data/test/TC_IOWAFunctions/iowa/Ajax1.html +40 -0
- data/test/TC_IOWAFunctions/iowa/Ajax1.iwa +23 -0
- data/test/TC_IOWAFunctions/iowa/AjaxWidget.iwa +19 -0
- data/test/TC_IOWAFunctions/iowa/AjaxWidget.view +22 -0
- data/test/TC_IOWAFunctions/iowa/DanielTest.html +9 -0
- data/test/TC_IOWAFunctions/iowa/DanielTest.iwa +10 -0
- data/test/TC_IOWAFunctions/iowa/IntervalWidget.html +1 -0
- data/test/TC_IOWAFunctions/iowa/IntervalWidget.iwa +14 -0
- data/test/TC_IOWAFunctions/iowa/Main.html +1 -0
- data/test/TC_IOWAFunctions/iowa/NestedRepeat1.html +12 -0
- data/test/TC_IOWAFunctions/iowa/NestedRepeat1.iwa +24 -0
- data/test/TC_IOWAFunctions/iowa/RPCResponse.iwa +7 -0
- data/test/TC_IOWAFunctions/iowa/RPCResponse.view +1 -0
- data/test/TC_IOWAFunctions/iowa/Repeat1.iwa +31 -0
- data/test/TC_IOWAFunctions/iowa/Repeat1.view +9 -0
- data/test/TC_IOWAFunctions/iowa/Repeat2.iwa +32 -0
- data/test/TC_IOWAFunctions/iowa/Repeat2.view +11 -0
- data/test/TC_IOWAFunctions/iowa/Repeat3.iwa +44 -0
- data/test/TC_IOWAFunctions/iowa/Repeat3.view +18 -0
- data/test/TC_IOWAFunctions/iowa/TesCon.html +1 -0
- data/test/TC_IOWAFunctions/iowa/TesCon.iwa +5 -0
- data/test/TC_IOWAFunctions/iowa/app.cnf +19 -0
- data/test/TC_IOWAFunctions/iowa/app.rb +9 -0
- data/test/TC_IOWAFunctions/iowa/mapfile.cnf +8 -0
- data/test/TC_ISAAC.rb +52 -0
- data/test/TC_ImageSize.rb +84 -0
- data/test/TC_ImageSize/img.bmp +0 -0
- data/test/TC_ImageSize/img.gif +0 -0
- data/test/TC_ImageSize/img.jpg +0 -0
- data/test/TC_ImageSize/img.pcx +0 -0
- data/test/TC_ImageSize/img.pgm +7144 -0
- data/test/TC_ImageSize/img.png +0 -0
- data/test/TC_ImageSize/img.ppm +0 -0
- data/test/TC_ImageSize/img.psd +0 -0
- data/test/TC_ImageSize/img.tiff +0 -0
- data/test/TC_ImageSize/img.xbm +22 -0
- data/test/TC_KeyValueCoding.rb +35 -0
- data/test/TC_LRUCache.rb +296 -0
- data/test/TC_LinkedList.rb +46 -0
- data/test/TC_Lockfile.rb +106 -0
- data/test/TC_Minimal.rb +45 -0
- data/test/TC_Minimal/app.cnf +8 -0
- data/test/TC_Minimal/cgi-bin/iowa.cgi +11 -0
- data/test/TC_Minimal/doc/index.html +1 -0
- data/test/TC_Minimal/iowa/Main.html +1 -0
- data/test/TC_Minimal/iowa/README +1 -0
- data/test/TC_Minimal/iowa/app.rb +3 -0
- data/test/TC_Minimal/webrick.rb +38 -0
- data/test/TC_Mongrel.rb +58 -0
- data/test/TC_Mongrel/doc/thing.txt +1 -0
- data/test/TC_Mongrel/iowa/Main.html +3 -0
- data/test/TC_Mongrel/iowa/Main.iwa +7 -0
- data/test/TC_Mongrel/iowa/NewPage.html +1 -0
- data/test/TC_Mongrel/iowa/NewPage.iwa +5 -0
- data/test/TC_Mongrel/iowa/app.cnf +10 -0
- data/test/TC_Mongrel/iowa/app.rb +5 -0
- data/test/TC_NoSubclass.rb +56 -0
- data/test/TC_NoSubclass/cgi/iowa.cgi +7 -0
- data/test/TC_NoSubclass/doc/index.html +1 -0
- data/test/TC_NoSubclass/iowa/Main.html +8 -0
- data/test/TC_NoSubclass/iowa/Main.iwa +14 -0
- data/test/TC_NoSubclass/iowa/README +1 -0
- data/test/TC_NoSubclass/iowa/app.cnf +8 -0
- data/test/TC_NoSubclass/iowa/app.rb +5 -0
- data/test/TC_NoSubclass/webrick.rb +38 -0
- data/test/TC_Pool.rb +139 -0
- data/test/TC_RenderedCache/doc/thing.txt +1 -0
- data/test/TC_RenderedCache/iowa/BigPage.html +1 -0
- data/test/TC_RenderedCache/iowa/BigPage.iwa +12 -0
- data/test/TC_RenderedCache/iowa/Main.html +3 -0
- data/test/TC_RenderedCache/iowa/Main.iwa +7 -0
- data/test/TC_RenderedCache/iowa/NewPage.html +1 -0
- data/test/TC_RenderedCache/iowa/NewPage.iwa +11 -0
- data/test/TC_RenderedCache/iowa/app.cnf +13 -0
- data/test/TC_RenderedCache/iowa/app.rb +5 -0
- data/test/TC_RenderedCache/iowa/mapfile.map +4 -0
- data/test/TC_ResourceURL.rb +73 -0
- data/test/TC_ResourceURL/iowa/Main.html +2 -0
- data/test/TC_ResourceURL/iowa/Main.iwa +10 -0
- data/test/TC_ResourceURL/iowa/app.cnf +10 -0
- data/test/TC_ResourceURL/iowa/app.rb +5 -0
- data/test/TC_SimpleDetached.rb +41 -0
- data/test/TC_StandardDispatcher.rb +362 -0
- data/test/TC_StandardDispatcherWithClassifier.rb +358 -0
- data/test/TC_String.rb +24 -0
- data/test/TC_Tag.rb +41 -0
- data/test/TC_Webrick.rb +56 -0
- data/test/TC_Webrick/doc/thing.txt +1 -0
- data/test/TC_Webrick/iowa/Main.html +3 -0
- data/test/TC_Webrick/iowa/Main.iwa +7 -0
- data/test/TC_Webrick/iowa/NewPage.html +1 -0
- data/test/TC_Webrick/iowa/NewPage.iwa +5 -0
- data/test/TC_Webrick/iowa/app.cnf +10 -0
- data/test/TC_Webrick/iowa/app.rb +5 -0
- data/test/tc_template.rb +15 -0
- data/test/tests.conf +19 -0
- data/utils/CVS/Entries +3 -0
- data/utils/CVS/Repository +1 -0
- data/utils/CVS/Root +1 -0
- data/utils/QuickCert-1.0.2.tar.gz +0 -0
- data/utils/QuickCert-1.0.2/InstalledFiles +7 -0
- data/utils/QuickCert-1.0.2/MANIFEST +10 -0
- data/utils/QuickCert-1.0.2/Makefile +15 -0
- data/utils/QuickCert-1.0.2/README +56 -0
- data/utils/QuickCert-1.0.2/bin/QuickCert +355 -0
- data/utils/QuickCert-1.0.2/config.save +12 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/README +60 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_c.rb +26 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_s.rb +35 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/qc_config +21 -0
- data/utils/QuickCert-1.0.2/lib/QuickCert/defaults.rb +28 -0
- data/utils/QuickCert-1.0.2/setup.rb +1312 -0
- data/utils/iowa_apps +422 -0
- data/utils/smtp_sink.rb +9 -0
- data/utils/startup_template.cnf +27 -0
- data/utils/startup_template.rb +73 -0
- metadata +551 -0
@@ -0,0 +1,287 @@
|
|
1
|
+
require 'enumerator'
|
2
|
+
require 'iowa/Mutex'
|
3
|
+
require 'iowa/Constants'
|
4
|
+
require 'iowa/Hash'
|
5
|
+
|
6
|
+
module Iowa
|
7
|
+
module Caches
|
8
|
+
|
9
|
+
#++
|
10
|
+
# Iowa::Caches::LRUCache is an LRU cache based on a linked list.
|
11
|
+
# It provides efficient random access to elements, like a hash,
|
12
|
+
# along with efficient stack or queue-like behaviors -- elements can
|
13
|
+
# be pushed, poped, shifted, and unshifted from the cache.
|
14
|
+
|
15
|
+
class LRUCache
|
16
|
+
include Enumerable
|
17
|
+
|
18
|
+
# * Iowa::Caches::LRUCache.new
|
19
|
+
# * Iowa::Caches::LRUCache.new(:maxsize => 20)
|
20
|
+
# * Iowa::Caches::LRUCache.new(20)
|
21
|
+
# * Iowa::Caches::LRUCache.new(:maxsize => 20, :ttl => 3600)
|
22
|
+
# * Iowa::Caches::LRUCache.new(20,3600)
|
23
|
+
#
|
24
|
+
# If called with no arguments, the cache will default to a max size
|
25
|
+
# of 20 elements, with no max time to live (ttl) on the elements.
|
26
|
+
#
|
27
|
+
# If called using a hash with keyword arguments, the :maxsize is the
|
28
|
+
# maximum number of elements to keep in the hash, and :ttl is the
|
29
|
+
# maximum age allowed for elements in the hash.
|
30
|
+
#
|
31
|
+
# If called with list arguments, the first is the max size, and the
|
32
|
+
# second is the TTL.
|
33
|
+
|
34
|
+
def initialize(args = {Cmaxsize => 20, Cttl => nil}, ttlarg = nil)
|
35
|
+
if args.kind_of? ::Hash
|
36
|
+
oargs = args
|
37
|
+
args = Iowa::Hash.new
|
38
|
+
args.step_merge!(oargs)
|
39
|
+
end
|
40
|
+
args.stringify_keys! if args.respond_to? :stringify_keys!
|
41
|
+
begin
|
42
|
+
@max = args[Cmaxsize] || 20
|
43
|
+
@maxttl = args[Cttl]
|
44
|
+
@mutex = Iowa::Mutex.new
|
45
|
+
rescue Exception
|
46
|
+
args = {Cmaxsize => args || 20, Cttl => ttlarg}
|
47
|
+
retry
|
48
|
+
end
|
49
|
+
@finalizers = []
|
50
|
+
@head = Node.new
|
51
|
+
@tail = Node.new
|
52
|
+
@lookup = Hash.new
|
53
|
+
node_join(@head,@tail)
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
# Check to see if the given key is in the cache.
|
58
|
+
|
59
|
+
def include?(v)
|
60
|
+
@lookup.has_key?(v)
|
61
|
+
end
|
62
|
+
|
63
|
+
def [](v)
|
64
|
+
@mutex.lock
|
65
|
+
if @lookup.has_key?(v)
|
66
|
+
n = @lookup[v]
|
67
|
+
n.age = Time.now
|
68
|
+
node_delete(n)
|
69
|
+
node_join(n,@head.next_node)
|
70
|
+
node_join(@head,n)
|
71
|
+
node_prune
|
72
|
+
@mutex.unlock
|
73
|
+
n.value
|
74
|
+
else
|
75
|
+
node_prune
|
76
|
+
@mutex.unlock
|
77
|
+
nil
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def []=(k,v)
|
82
|
+
@mutex.lock
|
83
|
+
if @lookup.has_key?(k)
|
84
|
+
n = @lookup[k]
|
85
|
+
n.value = v
|
86
|
+
n.age = Time.now
|
87
|
+
node_delete(n)
|
88
|
+
node_join(n,@head.next_node)
|
89
|
+
node_join(@head,n)
|
90
|
+
else
|
91
|
+
n = Node.new(k,v,Time.now,@head,@head.next_node)
|
92
|
+
node_join(n,@head.next_node)
|
93
|
+
node_join(@head,n)
|
94
|
+
@lookup[k] = n
|
95
|
+
end
|
96
|
+
node_prune
|
97
|
+
@mutex.unlock
|
98
|
+
v
|
99
|
+
end
|
100
|
+
|
101
|
+
def empty?
|
102
|
+
@lookup.empty?
|
103
|
+
end
|
104
|
+
|
105
|
+
def delete(k)
|
106
|
+
@mutex.lock
|
107
|
+
n = @lookup.delete(k)
|
108
|
+
node_purge(n) if n
|
109
|
+
node_prune
|
110
|
+
@mutex.unlock
|
111
|
+
n
|
112
|
+
end
|
113
|
+
|
114
|
+
def first
|
115
|
+
@head.next_node.value
|
116
|
+
end
|
117
|
+
|
118
|
+
def last
|
119
|
+
@tail.prev_node.value
|
120
|
+
end
|
121
|
+
|
122
|
+
def shift
|
123
|
+
@mutex.lock
|
124
|
+
k = @head.next_node.key
|
125
|
+
n = @lookup.delete(k)
|
126
|
+
node_delete(n) if n
|
127
|
+
node_prune
|
128
|
+
@mutex.unlock
|
129
|
+
end
|
130
|
+
|
131
|
+
def unshift(v)
|
132
|
+
@mutex.lock
|
133
|
+
if @lookup.has_key?(v)
|
134
|
+
n = @lookup[v]
|
135
|
+
node_delete(n)
|
136
|
+
node_join(n,@head.next_node)
|
137
|
+
node_join(@head,n)
|
138
|
+
else
|
139
|
+
n = Node.new(v,v,Time.now,@head,@head.next_node)
|
140
|
+
node_join(n,@head.next_node)
|
141
|
+
node_join(@head,n)
|
142
|
+
@lookup[v] = n
|
143
|
+
end
|
144
|
+
node_prune
|
145
|
+
@mutex.unlock
|
146
|
+
v
|
147
|
+
end
|
148
|
+
|
149
|
+
def pop
|
150
|
+
@mutex.lock
|
151
|
+
k = @tail.prev_node.key
|
152
|
+
n = @lookup.delete(k)
|
153
|
+
node_delete(n) if n
|
154
|
+
node_prune
|
155
|
+
@mutex.unlock
|
156
|
+
end
|
157
|
+
|
158
|
+
def push(v)
|
159
|
+
@mutex.lock
|
160
|
+
if @lookup.has_key?(v)
|
161
|
+
n = @lookup[v]
|
162
|
+
node_delete(n)
|
163
|
+
node_join(@tail.prev_node,n)
|
164
|
+
node_join(n,@tail)
|
165
|
+
else
|
166
|
+
n = Node.new(v,v,Time.now,@tail.prev_node,@tail)
|
167
|
+
node_join(@tail.prev_node,n)
|
168
|
+
node_join(n,@tail)
|
169
|
+
@lookup[v] = n
|
170
|
+
end
|
171
|
+
node_prune
|
172
|
+
@mutex.unlock
|
173
|
+
v
|
174
|
+
end
|
175
|
+
|
176
|
+
def queue
|
177
|
+
r = []
|
178
|
+
n = @head
|
179
|
+
while (n = n.next_node) and n != @tail
|
180
|
+
r << n.key
|
181
|
+
end
|
182
|
+
r
|
183
|
+
end
|
184
|
+
|
185
|
+
def to_a
|
186
|
+
r = []
|
187
|
+
n = @head
|
188
|
+
while (n = n.next_node) and n != @tail
|
189
|
+
r << n.value
|
190
|
+
end
|
191
|
+
r
|
192
|
+
end
|
193
|
+
|
194
|
+
def length
|
195
|
+
@lookup.length
|
196
|
+
end
|
197
|
+
alias :size :length
|
198
|
+
|
199
|
+
def each
|
200
|
+
n = @head
|
201
|
+
while (n = n.next_node) and n != @tail
|
202
|
+
yield(n.key,n.value)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
def maxsize
|
207
|
+
@max
|
208
|
+
end
|
209
|
+
|
210
|
+
def maxsize=(v)
|
211
|
+
@max = v
|
212
|
+
node_prune
|
213
|
+
end
|
214
|
+
alias :size= :maxsize=
|
215
|
+
|
216
|
+
def ttl
|
217
|
+
@maxttl
|
218
|
+
end
|
219
|
+
|
220
|
+
def ttl=(v)
|
221
|
+
@maxttl = v
|
222
|
+
node_prune
|
223
|
+
end
|
224
|
+
|
225
|
+
# Adds a finalization method to the cache that will be called before
|
226
|
+
# the object in the cache is expired.
|
227
|
+
|
228
|
+
def add_finalizer(*args,&block)
|
229
|
+
@finalizers.push [block,args]
|
230
|
+
end
|
231
|
+
|
232
|
+
private
|
233
|
+
|
234
|
+
def node_delete(n)
|
235
|
+
node_join(n.prev_node,n.next_node)
|
236
|
+
end
|
237
|
+
|
238
|
+
def node_purge(n)
|
239
|
+
node_join(n.prev_node,n.next_node)
|
240
|
+
v = n.value
|
241
|
+
k = n.key
|
242
|
+
n.value = nil
|
243
|
+
n.key = nil
|
244
|
+
n.next_node = nil
|
245
|
+
n.prev_node = nil
|
246
|
+
do_finalization(k,v) if @finalizers
|
247
|
+
v
|
248
|
+
end
|
249
|
+
|
250
|
+
def node_join(a,b)
|
251
|
+
a.next_node = b
|
252
|
+
b.prev_node = a
|
253
|
+
end
|
254
|
+
|
255
|
+
def node_prune
|
256
|
+
node_purge(@lookup.delete(@tail.prev_node.key)) while @lookup.size > @max
|
257
|
+
if @maxttl
|
258
|
+
expiration_date = Time.now - @maxttl
|
259
|
+
while (n = @tail.prev_node).age < expiration_date
|
260
|
+
node_purge(@lookup.delete(n.key))
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
# Is called when an object in the cache is expired. Iterates through
|
266
|
+
# the defined finalization methods, if any.
|
267
|
+
def do_finalization(key,obj)
|
268
|
+
@finalizers.each do |f|
|
269
|
+
f[0].call(key,obj,*f[1])
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
class Node
|
274
|
+
attr_accessor :key, :value, :age, :prev_node, :next_node
|
275
|
+
|
276
|
+
def initialize(key=nil,value=nil,age=Time.now,prev_node=nil,next_node=nil)
|
277
|
+
@key = key
|
278
|
+
@value = value
|
279
|
+
@age = age
|
280
|
+
@prev_node = prev_node
|
281
|
+
@next_node = next_node
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
@@ -0,0 +1,218 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'external/test_support'
|
3
|
+
IWATestSupport.set_src_dir
|
4
|
+
require 'iowa/caches/DiskCache'
|
5
|
+
require 'iowa/caches/DiskStore'
|
6
|
+
require 'tmpdir'
|
7
|
+
require 'fileutils'
|
8
|
+
require 'benchmark'
|
9
|
+
require 'pstore'
|
10
|
+
|
11
|
+
TMPDIR = Dir::tmpdir
|
12
|
+
|
13
|
+
class TC_DiskCache < Test::Unit::TestCase
|
14
|
+
def make_tmpdir_path; FileUtils.mkdir("#{TMPDIR}/tc_diskcache.#{Time.now.to_i}#{rand}").first; end
|
15
|
+
def make_shm_tmpdir_path; FileUtils.mkdir("/dev/shm/tc_diskcache.#{Time.now.to_i}#{rand}").first; end
|
16
|
+
@@testdir = IWATestSupport.test_dir(__FILE__)
|
17
|
+
|
18
|
+
def setup
|
19
|
+
Dir.chdir(@@testdir)
|
20
|
+
IWATestSupport.announce(:diskcache,"Iowa::Caches::DiskCache / Iowa::Caches::DiskStore")
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_creation
|
24
|
+
tmpdir = make_tmpdir_path
|
25
|
+
assert_nothing_raised("Failed while creating an Iowa::Caches::DiskCache object") do
|
26
|
+
@cache = Iowa::Caches::DiskCache.new({:directory => tmpdir, :maxsize => 12})
|
27
|
+
end
|
28
|
+
FileUtils.rm_rf(tmpdir)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_cache_size
|
32
|
+
tmpdir = make_tmpdir_path
|
33
|
+
@cache = Iowa::Caches::DiskCache.new({:directory => tmpdir, :maxsize => 12})
|
34
|
+
(1..14).each {|n| @cache[n] = n}
|
35
|
+
s = @cache.size
|
36
|
+
assert_equal(12,s,"The expected size (12) did not match the returned size (#{s}).")
|
37
|
+
FileUtils.rm_rf(tmpdir)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_cache_size2
|
41
|
+
tmpdir = make_tmpdir_path
|
42
|
+
@cache = Iowa::Caches::DiskCache.new({:directory => tmpdir, :maxsize => 12})
|
43
|
+
(1..14).each {|n| @cache[n] = n}
|
44
|
+
@cache.size=3
|
45
|
+
s = @cache.size
|
46
|
+
assert_equal(3,s,"The cache size does not appear to to have change as expected; want size of 3, have size of #{s}.")
|
47
|
+
FileUtils.rm_rf(tmpdir)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_values
|
51
|
+
tmpdir = make_tmpdir_path
|
52
|
+
@cache = Iowa::Caches::DiskCache.new({:directory => tmpdir, :maxsize => 3})
|
53
|
+
@cache['a'] = 1
|
54
|
+
@cache['b'] = 2
|
55
|
+
@cache['c'] = 3
|
56
|
+
s = @cache['b']
|
57
|
+
assert_equal(2,s,"The value retrieved from the cache (#{s}) did not match what was expected (2).")
|
58
|
+
FileUtils.rm_rf(tmpdir)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_expire1
|
62
|
+
tmpdir = make_tmpdir_path
|
63
|
+
@cache = Iowa::Caches::DiskCache.new({:directory => tmpdir, :maxsize => 3})
|
64
|
+
@cache['a'] = 1
|
65
|
+
@cache['b'] = 2
|
66
|
+
@cache['c'] = 3
|
67
|
+
s = @cache['b']
|
68
|
+
@cache['d'] = 4
|
69
|
+
s = true
|
70
|
+
s = false if @cache.include? 'a'
|
71
|
+
assert_equal(true,s,"Key 'a' should have fallen out of the cache. It did not.")
|
72
|
+
FileUtils.rm_rf(tmpdir)
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_expire2
|
76
|
+
tmpdir = make_tmpdir_path
|
77
|
+
@cache = Iowa::Caches::DiskCache.new({:directory => tmpdir, :maxsize => 3})
|
78
|
+
@cache['a'] = 1
|
79
|
+
@cache['b'] = 2
|
80
|
+
@cache['c'] = 3
|
81
|
+
s = @cache['b']
|
82
|
+
@cache['d'] = 4
|
83
|
+
s = false
|
84
|
+
s = true if @cache.include? 'b'
|
85
|
+
assert_equal(true,s,"Key 'b' appears to have fallen out of the cache. It should not have.")
|
86
|
+
FileUtils.rm_rf(tmpdir)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_transactions
|
90
|
+
tmpdir = make_tmpdir_path
|
91
|
+
@cache = Iowa::Caches::DiskCache.new({:directory => tmpdir, :maxsize => 20})
|
92
|
+
assert_nothing_raised("Something blew up when trying to test transactions.") do
|
93
|
+
@cache[:a] = 1
|
94
|
+
@cache[:b] = 2
|
95
|
+
@cache.transaction do
|
96
|
+
@cache[:c] = 3
|
97
|
+
end
|
98
|
+
assert_equal(3,@cache[:c],"Transaction failed.")
|
99
|
+
@cache.transaction do
|
100
|
+
@cache[:d] = 4
|
101
|
+
@cache.commit
|
102
|
+
@cache[:e] = 5
|
103
|
+
end
|
104
|
+
assert_equal(4,@cache[:d],"Transaction failed.")
|
105
|
+
assert_equal(5,@cache[:e],"Transaction failed.")
|
106
|
+
@cache.transaction do
|
107
|
+
@cache[:f] = 6
|
108
|
+
@cache.rollback
|
109
|
+
end
|
110
|
+
assert(!@cache.include?(:f),"Transaction rollback failed.")
|
111
|
+
@cache.transaction do
|
112
|
+
@cache[:f] = 6
|
113
|
+
@cache.rollback
|
114
|
+
@cache[:g] = 6
|
115
|
+
end
|
116
|
+
assert(!@cache.include?(:f),"Transaction rollback failed.")
|
117
|
+
assert_equal(6,@cache[:g],"Transaction failed.")
|
118
|
+
@cache.transaction do
|
119
|
+
@cache[:h] = 7
|
120
|
+
@cache.transaction do
|
121
|
+
@cache[:i] = 8
|
122
|
+
@cache.transaction do
|
123
|
+
@cache[:j] = 9
|
124
|
+
@cache.rollback
|
125
|
+
end
|
126
|
+
@cache.transaction do
|
127
|
+
@cache[:k] = 9
|
128
|
+
end
|
129
|
+
@cache.rollback
|
130
|
+
end
|
131
|
+
end
|
132
|
+
assert(!@cache.include?(:j),"Nested transaction rollback(:j) failed.")
|
133
|
+
assert(!@cache.include?(:i),"Nexted transaction rollback(:i) failed.")
|
134
|
+
assert_equal(7,@cache[:h],"Transaction failed.")
|
135
|
+
assert_equal(9,@cache[:k],"Transaction failed.")
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_speed
|
140
|
+
n = 2000
|
141
|
+
test_dirs = []
|
142
|
+
test_dirs << ["In-Memory (/dev/shm) Test", make_shm_tmpdir_path] if FileTest.exist?('/dev/shm') and FileTest.writable?('/dev/shm')
|
143
|
+
test_dirs << ["On Disk Test (performance directly related to disk i/o performance)", make_tmpdir_path]
|
144
|
+
assert_nothing_raised("Something blew up during the DiskCache stress test.") do
|
145
|
+
test_dirs.each do |td|
|
146
|
+
puts "\n#{td[0]}"
|
147
|
+
cache = Iowa::Caches::DiskCache.new({:directory => td[1], :maxsize => 4294967296})
|
148
|
+
Benchmark.benchmark do |bm|
|
149
|
+
flush_disk
|
150
|
+
puts "Writing #{n} records to disk cache:"
|
151
|
+
bm.report('dc write') do
|
152
|
+
n.times {|x| cache[x] = x}
|
153
|
+
end
|
154
|
+
flush_disk
|
155
|
+
puts "Updating #{n} records in disk cache:"
|
156
|
+
bm.report('dc update') do
|
157
|
+
n.times {|x| cache[x] = x * 2}
|
158
|
+
end
|
159
|
+
flush_disk
|
160
|
+
puts "Reading #{n} records from disk cache:"
|
161
|
+
bm.report('dc read') do
|
162
|
+
(n).times {|x| cache[x]}
|
163
|
+
end
|
164
|
+
flush_disk
|
165
|
+
puts "Deleting #{n} records from disk cache:"
|
166
|
+
bm.report('dc delete') do
|
167
|
+
n.times {|x| cache.delete(x)}
|
168
|
+
end
|
169
|
+
flush_disk
|
170
|
+
end
|
171
|
+
FileUtils.rm_rf(td[1])
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
flush_disk
|
176
|
+
puts "\n\nNow Running speed comparison of DiskStore"
|
177
|
+
test_dirs = []
|
178
|
+
test_dirs << ["In-Memory (/dev/shm) Test", make_shm_tmpdir_path] if FileTest.exist?('/dev/shm') and FileTest.writable?('/dev/shm')
|
179
|
+
test_dirs << ["On Disk Test (performance directly related to disk i/o performance)", make_tmpdir_path]
|
180
|
+
assert_nothing_raised("Something blew up during the DiskCache stress test.") do
|
181
|
+
test_dirs.each do |td|
|
182
|
+
puts "\n#{td[0]}"
|
183
|
+
cache = Iowa::Caches::DiskStore.new({:directory => td[1]})
|
184
|
+
Benchmark.benchmark do |bm|
|
185
|
+
flush_disk
|
186
|
+
puts "Writing #{n} records to disk cache:"
|
187
|
+
bm.report('dc write') do
|
188
|
+
n.times {|x| cache[x] = x}
|
189
|
+
end
|
190
|
+
flush_disk
|
191
|
+
puts "Updating #{n} records in disk cache:"
|
192
|
+
bm.report('dc update') do
|
193
|
+
n.times {|x| cache[x] = x * 2}
|
194
|
+
end
|
195
|
+
flush_disk
|
196
|
+
puts "Reading #{n} records from disk cache:"
|
197
|
+
bm.report('dc read') do
|
198
|
+
(n).times {|x| cache[x]}
|
199
|
+
end
|
200
|
+
flush_disk
|
201
|
+
puts "Deleting #{n} records from disk cache:"
|
202
|
+
bm.report('dc delete') do
|
203
|
+
n.times {|x| cache.delete(x)}
|
204
|
+
end
|
205
|
+
flush_disk
|
206
|
+
end
|
207
|
+
FileUtils.rm_rf(td[1])
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def flush_disk
|
213
|
+
if FileTest.exist?('/bin/sync')
|
214
|
+
system('/bin/sync')
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|