pione 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +14 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +94 -0
- data/Rakefile +118 -0
- data/bin/pione-broker +5 -0
- data/bin/pione-clean +5 -0
- data/bin/pione-client +5 -0
- data/bin/pione-eval +111 -0
- data/bin/pione-relay +5 -0
- data/bin/pione-relay-account-db +5 -0
- data/bin/pione-relay-client-db +5 -0
- data/bin/pione-search-log +30 -0
- data/bin/pione-syntax-checker +5 -0
- data/bin/pione-task-worker +5 -0
- data/bin/pione-tuple-space-provider +5 -0
- data/bin/pione-tuple-space-receiver +5 -0
- data/bin/pione-tuple-space-viewer +5 -0
- data/demo/demo.rb +311 -0
- data/demo/public/base.css +94 -0
- data/demo/public/demo.js +107 -0
- data/demo/public/index.html +91 -0
- data/demo/public/jquery-1.8.3.min.js +2 -0
- data/example/CountChar/CountChar.pione +64 -0
- data/example/CountChar/misc/CountChar.rb +22 -0
- data/example/CountChar/text/aidokushono_insho.txt +32 -0
- data/example/CountChar/text/aikokuka_shokan.txt +108 -0
- data/example/CountChar/text/carlyle_hakubutsukan.txt +58 -0
- data/example/CountChar/text/dark_minister.txt +2440 -0
- data/example/CountChar/text/kaikano_otto.txt +61 -0
- data/example/CountChar/text/kaikon.txt +30 -0
- data/example/CountChar/text/nagashimano_shi.txt +45 -0
- data/example/CountChar/text/saikachibuchi.txt +80 -0
- data/example/CountChar/text/saikonihonno_josei.txt +91 -0
- data/example/CountChar/text/taishojugonenno_bundan.txt +21 -0
- data/example/FeatureExample/FeatureExample.pione +7 -0
- data/example/Fib/Fib.pione +56 -0
- data/example/Fib/FibBC.pione +56 -0
- data/example/HelloWorld/HelloWorld.pione +5 -0
- data/example/LucasNumber/LucasNumber.pione +64 -0
- data/example/MakePair/MakePair.pione +14 -0
- data/example/MakePair/data/1.i +0 -0
- data/example/MakePair/data/2.i +0 -0
- data/example/MakePair/data/3.i +0 -0
- data/example/MakePair/data/4.i +0 -0
- data/example/MakePair/data/5.i +0 -0
- data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +61 -0
- data/example/SingleParticlesWithRef/Makefile +289 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.Makefile +153 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.pione +116 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRefFull.pione +400 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift.pdb +3381 -0
- data/example/SingleParticlesWithRef/data/all.ref2d +0 -0
- data/example/SingleParticlesWithRef/data/all.ref3d +0 -0
- data/example/Sum/Sum.pione +52 -0
- data/example/SyntaxError/call_rule_error.pione +6 -0
- data/example/SyntaxError/feature_line_error.pione +7 -0
- data/example/SyntaxError/flow_block_error.pione +5 -0
- data/example/SyntaxError/input_line_error.pione +6 -0
- data/example/SyntaxError/invalid_rule_name.pione +6 -0
- data/example/SyntaxError/param_line_error.pione +7 -0
- data/example/SyntaxError/variable-binding-error.pione +11 -0
- data/lib/pione.rb +241 -0
- data/lib/pione/agent/basic-agent.rb +333 -0
- data/lib/pione/agent/broker.rb +274 -0
- data/lib/pione/agent/command-listener.rb +47 -0
- data/lib/pione/agent/input-generator.rb +194 -0
- data/lib/pione/agent/logger.rb +65 -0
- data/lib/pione/agent/process-manager.rb +38 -0
- data/lib/pione/agent/rule-provider.rb +64 -0
- data/lib/pione/agent/task-worker.rb +274 -0
- data/lib/pione/agent/trivial-routine-worker.rb +28 -0
- data/lib/pione/agent/tuple-space-client.rb +146 -0
- data/lib/pione/agent/tuple-space-server-client-life-checker.rb +29 -0
- data/lib/pione/command-option/basic-option.rb +42 -0
- data/lib/pione/command-option/child-process-option.rb +17 -0
- data/lib/pione/command-option/common-option.rb +29 -0
- data/lib/pione/command-option/daemon-option.rb +12 -0
- data/lib/pione/command-option/presence-notifier-option.rb +15 -0
- data/lib/pione/command-option/task-worker-owner-option.rb +17 -0
- data/lib/pione/command-option/tuple-space-provider-option.rb +26 -0
- data/lib/pione/command-option/tuple-space-provider-owner-option.rb +16 -0
- data/lib/pione/command-option/tuple-space-receiver-option.rb +12 -0
- data/lib/pione/command/basic-command.rb +126 -0
- data/lib/pione/command/child-process.rb +43 -0
- data/lib/pione/command/daemon-process.rb +18 -0
- data/lib/pione/command/front-owner-command.rb +37 -0
- data/lib/pione/command/pione-broker.rb +53 -0
- data/lib/pione/command/pione-clean.rb +16 -0
- data/lib/pione/command/pione-client.rb +273 -0
- data/lib/pione/command/pione-relay-account-db.rb +85 -0
- data/lib/pione/command/pione-relay-client-db.rb +80 -0
- data/lib/pione/command/pione-relay.rb +47 -0
- data/lib/pione/command/pione-syntax-checker.rb +103 -0
- data/lib/pione/command/pione-task-worker.rb +123 -0
- data/lib/pione/command/pione-tuple-space-provider.rb +87 -0
- data/lib/pione/command/pione-tuple-space-receiver.rb +55 -0
- data/lib/pione/command/pione-tuple-space-viewer.rb +151 -0
- data/lib/pione/command/tuple-space-provider-owner.rb +6 -0
- data/lib/pione/front/basic-front.rb +64 -0
- data/lib/pione/front/broker-front.rb +30 -0
- data/lib/pione/front/client-front.rb +28 -0
- data/lib/pione/front/relay-front.rb +19 -0
- data/lib/pione/front/task-worker-front.rb +16 -0
- data/lib/pione/front/task-worker-owner.rb +42 -0
- data/lib/pione/front/tuple-space-provider-front.rb +22 -0
- data/lib/pione/front/tuple-space-provider-owner.rb +11 -0
- data/lib/pione/front/tuple-space-receiver-front.rb +18 -0
- data/lib/pione/model/assignment.rb +89 -0
- data/lib/pione/model/basic-model.rb +395 -0
- data/lib/pione/model/binary-operator.rb +80 -0
- data/lib/pione/model/block.rb +233 -0
- data/lib/pione/model/boolean.rb +138 -0
- data/lib/pione/model/call-rule.rb +69 -0
- data/lib/pione/model/data-expr.rb +360 -0
- data/lib/pione/model/feature-expr.rb +794 -0
- data/lib/pione/model/float.rb +107 -0
- data/lib/pione/model/integer.rb +140 -0
- data/lib/pione/model/list.rb +104 -0
- data/lib/pione/model/message.rb +80 -0
- data/lib/pione/model/package.rb +48 -0
- data/lib/pione/model/parameters.rb +282 -0
- data/lib/pione/model/rule-expr.rb +120 -0
- data/lib/pione/model/rule-io.rb +166 -0
- data/lib/pione/model/rule.rb +294 -0
- data/lib/pione/model/string.rb +111 -0
- data/lib/pione/model/undefined-value.rb +24 -0
- data/lib/pione/model/variable-table.rb +315 -0
- data/lib/pione/model/variable.rb +87 -0
- data/lib/pione/parser/block-parser.rb +83 -0
- data/lib/pione/parser/common-parser.rb +145 -0
- data/lib/pione/parser/document-parser.rb +58 -0
- data/lib/pione/parser/error-message.yml +4 -0
- data/lib/pione/parser/expr-parser.rb +266 -0
- data/lib/pione/parser/feature-expr-parser.rb +105 -0
- data/lib/pione/parser/flow-element-parser.rb +181 -0
- data/lib/pione/parser/literal-parser.rb +182 -0
- data/lib/pione/parser/rule-definition-parser.rb +163 -0
- data/lib/pione/parser/syntax-error.rb +61 -0
- data/lib/pione/patch/array-patch.rb +3 -0
- data/lib/pione/patch/drb-patch.rb +467 -0
- data/lib/pione/patch/monitor-patch.rb +16 -0
- data/lib/pione/patch/rinda-patch.rb +759 -0
- data/lib/pione/patch/uri-patch.rb +66 -0
- data/lib/pione/relay/receiver-socket.rb +69 -0
- data/lib/pione/relay/relay-account-db.rb +55 -0
- data/lib/pione/relay/relay-client-db.rb +53 -0
- data/lib/pione/relay/relay-socket.rb +215 -0
- data/lib/pione/relay/trampoline.rb +22 -0
- data/lib/pione/relay/transmitter-socket.rb +167 -0
- data/lib/pione/resource/basic-resource.rb +92 -0
- data/lib/pione/resource/dropbox-resource.rb +106 -0
- data/lib/pione/resource/ftp.rb +84 -0
- data/lib/pione/resource/local.rb +113 -0
- data/lib/pione/rule-handler/action-handler.rb +184 -0
- data/lib/pione/rule-handler/basic-handler.rb +217 -0
- data/lib/pione/rule-handler/flow-handler.rb +339 -0
- data/lib/pione/rule-handler/root-handler.rb +23 -0
- data/lib/pione/rule-handler/system-handler.rb +13 -0
- data/lib/pione/system/common.rb +22 -0
- data/lib/pione/system/config.rb +20 -0
- data/lib/pione/system/document.rb +81 -0
- data/lib/pione/system/file-cache.rb +150 -0
- data/lib/pione/system/global.rb +346 -0
- data/lib/pione/system/identifier.rb +61 -0
- data/lib/pione/system/init.rb +16 -0
- data/lib/pione/system/object.rb +35 -0
- data/lib/pione/transformer/block-transformer.rb +23 -0
- data/lib/pione/transformer/document-transformer.rb +36 -0
- data/lib/pione/transformer/expr-transformer.rb +89 -0
- data/lib/pione/transformer/feature-expr-transformer.rb +56 -0
- data/lib/pione/transformer/flow-element-transformer.rb +66 -0
- data/lib/pione/transformer/literal-transformer.rb +76 -0
- data/lib/pione/transformer/rule-definition-transformer.rb +62 -0
- data/lib/pione/transformer/transformer-module.rb +37 -0
- data/lib/pione/tuple-space/data-finder.rb +165 -0
- data/lib/pione/tuple-space/presence-notifier.rb +83 -0
- data/lib/pione/tuple-space/relay.rb +9 -0
- data/lib/pione/tuple-space/tuple-space-provider.rb +85 -0
- data/lib/pione/tuple-space/tuple-space-receiver.rb +140 -0
- data/lib/pione/tuple-space/tuple-space-server-interface.rb +60 -0
- data/lib/pione/tuple-space/tuple-space-server.rb +156 -0
- data/lib/pione/tuple-space/update-criteria.rb +96 -0
- data/lib/pione/tuple/agent-tuple.rb +10 -0
- data/lib/pione/tuple/attribute-tuple.rb +7 -0
- data/lib/pione/tuple/base-uri-tuple.rb +9 -0
- data/lib/pione/tuple/basic-tuple.rb +317 -0
- data/lib/pione/tuple/bye-tuple.rb +9 -0
- data/lib/pione/tuple/command-tuple.rb +9 -0
- data/lib/pione/tuple/data-tuple.rb +18 -0
- data/lib/pione/tuple/dry-run-tuple.rb +8 -0
- data/lib/pione/tuple/exception-tuple.rb +11 -0
- data/lib/pione/tuple/finished-tuple.rb +17 -0
- data/lib/pione/tuple/foreground-tuple.rb +7 -0
- data/lib/pione/tuple/log-tuple.rb +14 -0
- data/lib/pione/tuple/process-info-tuple.rb +9 -0
- data/lib/pione/tuple/request-rule-tuple.rb +9 -0
- data/lib/pione/tuple/rule-tuple.rb +10 -0
- data/lib/pione/tuple/shift-tuple.rb +13 -0
- data/lib/pione/tuple/task-tuple.rb +36 -0
- data/lib/pione/tuple/task-worker-resource-tuple.rb +9 -0
- data/lib/pione/tuple/working-tuple.rb +13 -0
- data/lib/pione/uri-scheme/basic-scheme.rb +40 -0
- data/lib/pione/uri-scheme/broadcast-scheme.rb +11 -0
- data/lib/pione/uri-scheme/dropbox-scheme.rb +9 -0
- data/lib/pione/uri-scheme/local-scheme.rb +28 -0
- data/lib/pione/util/error-report.rb +12 -0
- data/lib/pione/util/log.rb +79 -0
- data/lib/pione/util/message.rb +155 -0
- data/lib/pione/util/misc.rb +73 -0
- data/lib/pione/util/terminal.rb +78 -0
- data/lib/pione/util/waiter-table.rb +53 -0
- data/lib/pione/version.rb +3 -0
- data/misc/env.sh +2 -0
- data/misc/test-drb-stop-service.rb +34 -0
- data/misc/test-ensure-and-thread-kill.rb +40 -0
- data/misc/test-many-waiters-client.rb +56 -0
- data/misc/test-many-waiters-server.rb +14 -0
- data/misc/write_and_take_test.png +0 -0
- data/misc/write_and_take_test.rb +36 -0
- data/pione.gemspec +49 -0
- data/test/agent/spec_basic-agent.rb +170 -0
- data/test/agent/spec_broker.rb +36 -0
- data/test/agent/spec_command-listener.rb +30 -0
- data/test/agent/spec_input-generator.rb +123 -0
- data/test/agent/spec_logger.rb +71 -0
- data/test/agent/spec_rule-provider.rb +65 -0
- data/test/agent/spec_task-worker.rb +307 -0
- data/test/agent/spec_tuple-space-client.rb +30 -0
- data/test/model/spec_assignment.rb +51 -0
- data/test/model/spec_binary-operator.rb +39 -0
- data/test/model/spec_block.rb +154 -0
- data/test/model/spec_boolean.rb +115 -0
- data/test/model/spec_call-rule.rb +23 -0
- data/test/model/spec_data-expr.rb +312 -0
- data/test/model/spec_feature-expr.rb +359 -0
- data/test/model/spec_feature-expr.yml +16 -0
- data/test/model/spec_float.rb +141 -0
- data/test/model/spec_integer.rb +141 -0
- data/test/model/spec_list.rb +26 -0
- data/test/model/spec_message.rb +42 -0
- data/test/model/spec_package.rb +15 -0
- data/test/model/spec_parameters.rb +148 -0
- data/test/model/spec_rule-expr.rb +66 -0
- data/test/model/spec_rule-io.rb +32 -0
- data/test/model/spec_rule.rb +158 -0
- data/test/model/spec_string.rb +106 -0
- data/test/model/spec_variable-table.rb +117 -0
- data/test/model/spec_variable.rb +84 -0
- data/test/parser/spec_block-parser.rb +5 -0
- data/test/parser/spec_block-parser.yml +85 -0
- data/test/parser/spec_common-parser.rb +281 -0
- data/test/parser/spec_expr-parser.rb +6 -0
- data/test/parser/spec_expr-parser.yml +82 -0
- data/test/parser/spec_feature-expr-parser.rb +32 -0
- data/test/parser/spec_feature-expr-parser.yml +25 -0
- data/test/parser/spec_flow-element-parser.rb +5 -0
- data/test/parser/spec_flow-element-parser.yml +180 -0
- data/test/parser/spec_literal-parser.rb +5 -0
- data/test/parser/spec_literal-parser.yml +123 -0
- data/test/parser/spec_rule-definition-parser.rb +5 -0
- data/test/parser/spec_rule-definition-parser.yml +93 -0
- data/test/patch/spec_rinda-patch.rb +32 -0
- data/test/patch/spec_uri-patch.rb +23 -0
- data/test/rule-handler/spec_action-handler.rb +135 -0
- data/test/rule-handler/spec_flow-handler.rb +127 -0
- data/test/spec_common.rb +14 -0
- data/test/spec_data-finder.rb +88 -0
- data/test/spec_data-finder.yml +115 -0
- data/test/spec_document.rb +76 -0
- data/test/spec_identifier.rb +29 -0
- data/test/spec_log.rb +52 -0
- data/test/spec_object.rb +20 -0
- data/test/spec_resource.rb +73 -0
- data/test/spec_update-criteria.rb +83 -0
- data/test/test-util.rb +223 -0
- data/test/transformer/spec_block-transformer.rb +26 -0
- data/test/transformer/spec_expr-transformer.rb +106 -0
- data/test/transformer/spec_feature-expr-transformer.rb +21 -0
- data/test/transformer/spec_flow-element-transformer.rb +154 -0
- data/test/transformer/spec_literal-transformer.rb +58 -0
- data/test/transformer/spec_rule-definition-transformer.rb +168 -0
- data/test/tuple-space/spec_tuple-space-provider.rb +36 -0
- data/test/tuple-space/spec_tuple-space-receiver.rb +32 -0
- data/test/tuple-space/spec_tuple-space-server.rb +49 -0
- data/test/tuple/spec_basic-tuple.rb +87 -0
- data/test/tuple/spec_data-tuple.rb +85 -0
- data/test/tuple/spec_finished-tuple.rb +61 -0
- data/test/tuple/spec_task-tuple.rb +127 -0
- data/test/tuple/spec_working-tuple.rb +58 -0
- data/test/uri-scheme/spec_broadcast-scheme.rb +40 -0
- data/test/uri-scheme/spec_dropbox-scheme.rb +31 -0
- data/test/uri-scheme/spec_local-scheme.rb +69 -0
- metadata +660 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Pione
|
|
2
|
+
module Tuple
|
|
3
|
+
# DataTuple is a class for input/output data.
|
|
4
|
+
class DataTuple < BasicTuple
|
|
5
|
+
define_format [:data,
|
|
6
|
+
# target domain
|
|
7
|
+
[:domain, String],
|
|
8
|
+
# data name
|
|
9
|
+
[:name, Type.or(String, Model::DataExpr)],
|
|
10
|
+
# resource location
|
|
11
|
+
[:uri, String],
|
|
12
|
+
# data created time
|
|
13
|
+
[:time, Time]
|
|
14
|
+
]
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Pione
|
|
2
|
+
module Tuple
|
|
3
|
+
class ExceptionTuple < BasicTuple
|
|
4
|
+
# exception notifier from agents
|
|
5
|
+
# uuid : uuid of the agent who happened the exception
|
|
6
|
+
# value : exception object
|
|
7
|
+
define_format [:exception, :uuid, :agent_type, :value]
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Pione
|
|
2
|
+
module Tuple
|
|
3
|
+
# FinishedTuple represents task finished notifier.
|
|
4
|
+
class FinishedTuple < BasicTuple
|
|
5
|
+
define_format [:finished,
|
|
6
|
+
# task domain
|
|
7
|
+
[:domain, String],
|
|
8
|
+
# status of the task processing
|
|
9
|
+
[:status, Symbol],
|
|
10
|
+
# outputs
|
|
11
|
+
[:outputs, Array],
|
|
12
|
+
# rule handler digest
|
|
13
|
+
[:digest, String]
|
|
14
|
+
]
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Pione
|
|
2
|
+
module Tuple
|
|
3
|
+
# LogTuple represents log messages.
|
|
4
|
+
class LogTuple < BasicTuple
|
|
5
|
+
# obj : Log's instance
|
|
6
|
+
define_format [:log, :message]
|
|
7
|
+
|
|
8
|
+
def timestamp=(time)
|
|
9
|
+
@timestamp = time
|
|
10
|
+
message.timestamp = time
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module Pione
|
|
2
|
+
module Tuple
|
|
3
|
+
# TaskTuple is a class for rule application job with inputs, outpus and parameters.
|
|
4
|
+
class TaskTuple < BasicTuple
|
|
5
|
+
define_format [:task,
|
|
6
|
+
# rule location path
|
|
7
|
+
[:rule_path, String],
|
|
8
|
+
# input data list
|
|
9
|
+
[:inputs, Array],
|
|
10
|
+
# parameter list
|
|
11
|
+
[:params, Model::Parameters],
|
|
12
|
+
# request features
|
|
13
|
+
[:features, Model::Feature::Expr],
|
|
14
|
+
# task domain
|
|
15
|
+
[:domain, String],
|
|
16
|
+
# call stack(domain list)
|
|
17
|
+
[:call_stack, Array]
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
# Returns the digest string of the task.
|
|
21
|
+
# @return [String]
|
|
22
|
+
# task digest string
|
|
23
|
+
def digest
|
|
24
|
+
"%s([%s],{%s})" % [
|
|
25
|
+
rule_path,
|
|
26
|
+
inputs.map{|i|
|
|
27
|
+
i.kind_of?(Array) ? "[%s, ...]" % i[0].name : i.name
|
|
28
|
+
}.join(","),
|
|
29
|
+
params.data.select{|k,_|
|
|
30
|
+
not(k.toplevel?)
|
|
31
|
+
}.map{|k,v| "%s:%s" % [k.name, v.textize]}.join(",")
|
|
32
|
+
]
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Pione
|
|
2
|
+
module Tuple
|
|
3
|
+
# WorkingTuple represents current working task informations.
|
|
4
|
+
class WorkingTuple < BasicTuple
|
|
5
|
+
define_format [:working,
|
|
6
|
+
# caller domain
|
|
7
|
+
[:domain, String],
|
|
8
|
+
# rule handler digest
|
|
9
|
+
[:digest, String]
|
|
10
|
+
]
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module Pione
|
|
2
|
+
module URIScheme
|
|
3
|
+
# BasicScheme is a URI scheme for PIONE.
|
|
4
|
+
class BasicScheme < ::URI::Generic
|
|
5
|
+
# Returns true always because classes inheriting BasicScheme are supported
|
|
6
|
+
# by PIONE system.
|
|
7
|
+
# @api private
|
|
8
|
+
def pione?
|
|
9
|
+
true
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Returns true if the scheme acts as storage.
|
|
13
|
+
# @return [Boolean]
|
|
14
|
+
# true if the scheme acts as storage
|
|
15
|
+
def storage?
|
|
16
|
+
self.class.instance_variable_get(:@storage)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Returns a new scheme. Use this method for inheriting BasicScheme if you
|
|
21
|
+
# create new scheme.
|
|
22
|
+
# @return [Class]
|
|
23
|
+
def BasicScheme(name, opts={})
|
|
24
|
+
klass = Class.new(BasicScheme)
|
|
25
|
+
|
|
26
|
+
def klass.inherited(scheme)
|
|
27
|
+
name = self.instance_variable_get(:@scheme_name)
|
|
28
|
+
URI.install_scheme(name.upcase, scheme)
|
|
29
|
+
scheme.instance_variable_set(:@storage, @storage)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
klass.instance_variable_set(:@scheme_name, name.upcase)
|
|
33
|
+
storage_flag = opts[:storage] || false
|
|
34
|
+
klass.instance_variable_set(:@storage, storage_flag)
|
|
35
|
+
|
|
36
|
+
return klass
|
|
37
|
+
end
|
|
38
|
+
module_function :BasicScheme
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Pione
|
|
2
|
+
module URIScheme
|
|
3
|
+
# BroadcastScheme is a scheme for representing broadcast address.
|
|
4
|
+
# @example
|
|
5
|
+
# URI.parse("broadcast://255.255.255.255:560001")
|
|
6
|
+
class BroadcastScheme < BasicScheme('broadcast')
|
|
7
|
+
# @api private
|
|
8
|
+
COMPONENT = [:scheme, :host, :port]
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Pione
|
|
2
|
+
module URIScheme
|
|
3
|
+
# Local represents local file system path.
|
|
4
|
+
# @example
|
|
5
|
+
# # absolute path form
|
|
6
|
+
# local:/home/keita/
|
|
7
|
+
# @example
|
|
8
|
+
# # relative path form
|
|
9
|
+
# local:./test.txt
|
|
10
|
+
class LocalScheme < BasicScheme('local', :storage => true)
|
|
11
|
+
# @api private
|
|
12
|
+
COMPONENT = [:scheme, :path]
|
|
13
|
+
|
|
14
|
+
# @api private
|
|
15
|
+
def self.build(args)
|
|
16
|
+
super(URI::Util::make_components_hash(self, args))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Returns absolute path.
|
|
20
|
+
# @return [URI]
|
|
21
|
+
# URI with absolute path
|
|
22
|
+
def absolute
|
|
23
|
+
uri = URI.parse("%s:%s" % [scheme, File.expand_path(path, Global.pwd)])
|
|
24
|
+
directory? ? uri.as_directory : uri
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
module Pione
|
|
2
|
+
module Util
|
|
3
|
+
# Log is a representation for logging.
|
|
4
|
+
# @example
|
|
5
|
+
# Log.new do
|
|
6
|
+
# add_record(
|
|
7
|
+
# component: "tuple-space-server",
|
|
8
|
+
# key: "action",
|
|
9
|
+
# value: "start"
|
|
10
|
+
# )
|
|
11
|
+
# end
|
|
12
|
+
#
|
|
13
|
+
class Log
|
|
14
|
+
# Log::Record is a key-value line for log. A record consisted of following items:
|
|
15
|
+
# - application
|
|
16
|
+
# - component
|
|
17
|
+
# - key
|
|
18
|
+
# - value
|
|
19
|
+
class Record
|
|
20
|
+
attr_reader :components
|
|
21
|
+
attr_reader :key
|
|
22
|
+
attr_reader :value
|
|
23
|
+
|
|
24
|
+
# Creates a log record.
|
|
25
|
+
def initialize(components, key, value)
|
|
26
|
+
@components = components.kind_of?(Array) ? components : [components]
|
|
27
|
+
@key = key
|
|
28
|
+
@value = value
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def application
|
|
32
|
+
"" # "pione"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Format as a string.
|
|
36
|
+
# i.e.
|
|
37
|
+
# 2012-04-25T14:48:57.791+09:00 A35D pione.rule-provider.status: initialized
|
|
38
|
+
def format(logid, time)
|
|
39
|
+
resource = [application, components, key].flatten.compact.join(".")
|
|
40
|
+
"%s %s %s: %s" % [time, logid, resource, value.to_json]
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
attr_reader :records
|
|
45
|
+
|
|
46
|
+
# Creatas a new log record.
|
|
47
|
+
def initialize
|
|
48
|
+
@records = []
|
|
49
|
+
yield self if block_given?
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def add_record(*args)
|
|
53
|
+
@records << Record.new(*args)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def timestamp=(time)
|
|
57
|
+
@time = time
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Format as string.
|
|
61
|
+
# i.e.
|
|
62
|
+
# 2012-04-25T14:48:57.791+09:00 A35D .task-worker.action: "take_task"
|
|
63
|
+
# 2012-04-25T14:48:57.791+09:00 A35D .task-worker.object: ...
|
|
64
|
+
def format
|
|
65
|
+
logid = generate_logid
|
|
66
|
+
time = @time.iso8601(3)
|
|
67
|
+
@records.map{|record| record.format(logid, time)}.join("\n")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
IDCHAR = ("A".."Z").to_a + (0..9).to_a.map{|i|i.to_s}
|
|
73
|
+
|
|
74
|
+
def generate_logid(i=4)
|
|
75
|
+
i > 0 ? IDCHAR[rand(IDCHAR.size)] + generate_logid(i-1) : ""
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
module Pione
|
|
2
|
+
module Util
|
|
3
|
+
# Message is a set of utility methods for sending messages to user.
|
|
4
|
+
module Message
|
|
5
|
+
# @api private
|
|
6
|
+
MessageQueue = Queue.new
|
|
7
|
+
|
|
8
|
+
# message queue thread
|
|
9
|
+
Thread.new {
|
|
10
|
+
while msg = MessageQueue.pop
|
|
11
|
+
puts msg
|
|
12
|
+
end
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
# @!group Message Mode
|
|
16
|
+
|
|
17
|
+
# @api private
|
|
18
|
+
@@debug_mode = false
|
|
19
|
+
|
|
20
|
+
# @api private
|
|
21
|
+
@@quiet_mode = false
|
|
22
|
+
|
|
23
|
+
# Evaluates the block in debug mode.
|
|
24
|
+
# @yield []
|
|
25
|
+
# target block
|
|
26
|
+
# @return [void]
|
|
27
|
+
def debug_mode
|
|
28
|
+
orig = @@debug_mode
|
|
29
|
+
@@debug_mode = true
|
|
30
|
+
yield
|
|
31
|
+
@@debug_mode = orig
|
|
32
|
+
end
|
|
33
|
+
module_function :debug_mode
|
|
34
|
+
|
|
35
|
+
# Sets debug mode.
|
|
36
|
+
# @param [bool] mode
|
|
37
|
+
# flag of debug mode
|
|
38
|
+
# @return [void]
|
|
39
|
+
def debug_mode=(mode)
|
|
40
|
+
@@debug_mode = mode
|
|
41
|
+
end
|
|
42
|
+
module_function :"debug_mode="
|
|
43
|
+
|
|
44
|
+
# Return true if the system is debug mode.
|
|
45
|
+
# @return [bool]
|
|
46
|
+
def debug_mode?
|
|
47
|
+
@@debug_mode
|
|
48
|
+
end
|
|
49
|
+
module_function :debug_mode?
|
|
50
|
+
|
|
51
|
+
# Evaluates the block in quiet mode.
|
|
52
|
+
# @yield []
|
|
53
|
+
# target block
|
|
54
|
+
# @return [void]
|
|
55
|
+
def quiet_mode
|
|
56
|
+
orig = @@quiet_mode
|
|
57
|
+
@@quiet_mode = true
|
|
58
|
+
yield
|
|
59
|
+
@@quiet_mode = orig
|
|
60
|
+
end
|
|
61
|
+
module_function :debug_mode
|
|
62
|
+
|
|
63
|
+
# Sets quiet mode.
|
|
64
|
+
# @param [bool] mode
|
|
65
|
+
# flag of quiet mode
|
|
66
|
+
# @return [void]
|
|
67
|
+
def quiet_mode=(mode)
|
|
68
|
+
@@quiet_mode = mode
|
|
69
|
+
end
|
|
70
|
+
module_function :"quiet_mode="
|
|
71
|
+
|
|
72
|
+
# Return true if the system is quiet mode.
|
|
73
|
+
# @return [bool]
|
|
74
|
+
def quiet_mode?
|
|
75
|
+
@@quiet_mode
|
|
76
|
+
end
|
|
77
|
+
module_function :quiet_mode?
|
|
78
|
+
|
|
79
|
+
# @!group Message Senders
|
|
80
|
+
|
|
81
|
+
# Sends the debug message.
|
|
82
|
+
# @param [String] msg
|
|
83
|
+
# debug message
|
|
84
|
+
# @param [Integer] level
|
|
85
|
+
# indent level
|
|
86
|
+
# @param [String] type
|
|
87
|
+
# message heading type
|
|
88
|
+
# @return [void]
|
|
89
|
+
def debug_message(msg, level=0, type="debug")
|
|
90
|
+
if debug_mode? and not(quiet_mode?)
|
|
91
|
+
message(type, :magenta, " "*level + msg)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
module_function :debug_message
|
|
95
|
+
|
|
96
|
+
# Sends the debug message to notify that something begins.
|
|
97
|
+
# @param [String] msg
|
|
98
|
+
# debug message
|
|
99
|
+
# @return [void]
|
|
100
|
+
def debug_message_begin(msg)
|
|
101
|
+
debug_message(msg, 0, ">>>")
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Sends the debug message to notify that something ends.
|
|
105
|
+
# @param [String] msg
|
|
106
|
+
# debug message
|
|
107
|
+
# @return [void]
|
|
108
|
+
def debug_message_end(msg)
|
|
109
|
+
debug_message(msg, 0, "<<<")
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Sends the user message.
|
|
113
|
+
# @param [String] msg
|
|
114
|
+
# user message
|
|
115
|
+
# @param [Integer] level
|
|
116
|
+
# indent level
|
|
117
|
+
# @param [String] type
|
|
118
|
+
# message heading type
|
|
119
|
+
# @return [void]
|
|
120
|
+
def user_message(msg, level=0, type="info")
|
|
121
|
+
if not(quiet_mode?)
|
|
122
|
+
message(type, :green, " "*level + msg)
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Sends the user message to notify that something begins.
|
|
127
|
+
# @param [String] msg
|
|
128
|
+
# user message
|
|
129
|
+
# @return [void]
|
|
130
|
+
def user_message_begin(msg)
|
|
131
|
+
user_message(msg, 0, ">>>")
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Sends the debug message to notify that something ends.
|
|
135
|
+
# @param [String] msg
|
|
136
|
+
# debug message
|
|
137
|
+
# @return [void]
|
|
138
|
+
def user_message_end(msg)
|
|
139
|
+
user_message(msg, 0, "<<<")
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# use this internal debug only
|
|
143
|
+
# @api private
|
|
144
|
+
def show(msg)
|
|
145
|
+
message("show", :red, msg)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# @api private
|
|
149
|
+
def message(type, color, msg)
|
|
150
|
+
MessageQueue.push "%s %s" % [Terminal.color(color, "%5s" % type), msg]
|
|
151
|
+
end
|
|
152
|
+
module_function :message
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|