{"action":"created","comment":{"url":"https://api.github.com/repos/fxbox/foxbox/pulls/comments/57445287","id":57445287,"diff_hunk":"@@ -0,0 +1,404 @@\n+//! An adapter providing access to the Thinkerbell rules engine.\n+\n+use foxbox_taxonomy::adapter::{ AdapterManagerHandle, Adapter, WatchEvent, AdapterWatchGuard };\n+use foxbox_taxonomy::api::{ API, Error, InternalError, ResultMap };\n+use foxbox_taxonomy::services::{ Setter, Getter, AdapterId, ServiceId, Service, Channel, ChannelKind };\n+use foxbox_taxonomy::util::Id;\n+use foxbox_taxonomy::values::{ Range, Duration, Type, Value, TypeError, OnOff };\n+use foxbox_thinkerbell::compile::ExecutableDevEnv;\n+use foxbox_thinkerbell::manager::{ ScriptManager, ScriptId, Error as ScriptManagerError };\n+use foxbox_thinkerbell::run::ExecutionEvent;\n+\n+use timer;\n+use transformable_channels::mpsc::*;\n+\n+use std::collections::{ HashMap, HashSet };\n+use std::path::Path;\n+use std::sync::{ Arc, Mutex };\n+use std::thread;\n+\n+static ADAPTER_NAME: &'static str = \"Thinkerbell adapter (built-in)\";\n+static ADAPTER_VENDOR: &'static str = \"team@link.mozilla.org\";\n+static ADAPTER_VERSION: [u32;4] = [0, 0, 0, 0];\n+\n+/// ThinkerbellAdapter hooks up the rules engine (if this, then that) as an adapter.\n+///\n+/// Each \"rule\", or \"script\", is a JSON-serialized structure according to Thinkerbell conventions.\n+///\n+/// This adapter exposes a root service, with one AddThinkerbellRule setter (to add a new rule).","path":"src/adapters/thinkerbell/mod.rs","position":28,"original_position":28,"commit_id":"b48752f6c3a284447c4b57be45af8b66d0130921","original_commit_id":"b48752f6c3a284447c4b57be45af8b66d0130921","user":{"login":"Yoric","id":10190,"avatar_url":"https://avatars.githubusercontent.com/u/10190?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoric","html_url":"https://github.com/Yoric","followers_url":"https://api.github.com/users/Yoric/followers","following_url":"https://api.github.com/users/Yoric/following{/other_user}","gists_url":"https://api.github.com/users/Yoric/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoric/subscriptions","organizations_url":"https://api.github.com/users/Yoric/orgs","repos_url":"https://api.github.com/users/Yoric/repos","events_url":"https://api.github.com/users/Yoric/events{/privacy}","received_events_url":"https://api.github.com/users/Yoric/received_events","type":"User","site_admin":false},"body":"Note for the future: we'll probably want to add some kind of `PropertyBag` to getters/setters to convey information such as which `get enabled` matches with `set enabled`.","created_at":"2016-03-25T13:53:13Z","updated_at":"2016-03-25T13:53:13Z","html_url":"https://github.com/fxbox/foxbox/pull/254#discussion_r57445287","pull_request_url":"https://api.github.com/repos/fxbox/foxbox/pulls/254","_links":{"self":{"href":"https://api.github.com/repos/fxbox/foxbox/pulls/comments/57445287"},"html":{"href":"https://github.com/fxbox/foxbox/pull/254#discussion_r57445287"},"pull_request":{"href":"https://api.github.com/repos/fxbox/foxbox/pulls/254"}}},"pull_request":{"url":"https://api.github.com/repos/fxbox/foxbox/pulls/254","id":63962679,"html_url":"https://github.com/fxbox/foxbox/pull/254","diff_url":"https://github.com/fxbox/foxbox/pull/254.diff","patch_url":"https://github.com/fxbox/foxbox/pull/254.patch","issue_url":"https://api.github.com/repos/fxbox/foxbox/issues/254","number":254,"state":"open","locked":false,"title":"Add Thinkerbell as an adapter.","user":{"login":"mcav","id":42708,"avatar_url":"https://avatars.githubusercontent.com/u/42708?v=3","gravatar_id":"","url":"https://api.github.com/users/mcav","html_url":"https://github.com/mcav","followers_url":"https://api.github.com/users/mcav/followers","following_url":"https://api.github.com/users/mcav/following{/other_user}","gists_url":"https://api.github.com/users/mcav/gists{/gist_id}","starred_url":"https://api.github.com/users/mcav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcav/subscriptions","organizations_url":"https://api.github.com/users/mcav/orgs","repos_url":"https://api.github.com/users/mcav/repos","events_url":"https://api.github.com/users/mcav/events{/privacy}","received_events_url":"https://api.github.com/users/mcav/received_events","type":"User","site_admin":false},"body":"This depends on the following PRs:\r\n\r\n- https://github.com/fxbox/taxonomy/pull/35\r\n- https://github.com/fxbox/thinkerbell/pull/54","created_at":"2016-03-23T22:22:24Z","updated_at":"2016-03-25T13:53:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b003471f1e32749919afd6b269e557ea72801889","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fxbox/foxbox/pulls/254/commits","review_comments_url":"https://api.github.com/repos/fxbox/foxbox/pulls/254/comments","review_comment_url":"https://api.github.com/repos/fxbox/foxbox/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fxbox/foxbox/issues/254/comments","statuses_url":"https://api.github.com/repos/fxbox/foxbox/statuses/b48752f6c3a284447c4b57be45af8b66d0130921","head":{"label":"mcav:think","ref":"think","sha":"b48752f6c3a284447c4b57be45af8b66d0130921","user":{"login":"mcav","id":42708,"avatar_url":"https://avatars.githubusercontent.com/u/42708?v=3","gravatar_id":"","url":"https://api.github.com/users/mcav","html_url":"https://github.com/mcav","followers_url":"https://api.github.com/users/mcav/followers","following_url":"https://api.github.com/users/mcav/following{/other_user}","gists_url":"https://api.github.com/users/mcav/gists{/gist_id}","starred_url":"https://api.github.com/users/mcav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcav/subscriptions","organizations_url":"https://api.github.com/users/mcav/orgs","repos_url":"https://api.github.com/users/mcav/repos","events_url":"https://api.github.com/users/mcav/events{/privacy}","received_events_url":"https://api.github.com/users/mcav/received_events","type":"User","site_admin":false},"repo":{"id":51003720,"name":"foxbox","full_name":"mcav/foxbox","owner":{"login":"mcav","id":42708,"avatar_url":"https://avatars.githubusercontent.com/u/42708?v=3","gravatar_id":"","url":"https://api.github.com/users/mcav","html_url":"https://github.com/mcav","followers_url":"https://api.github.com/users/mcav/followers","following_url":"https://api.github.com/users/mcav/following{/other_user}","gists_url":"https://api.github.com/users/mcav/gists{/gist_id}","starred_url":"https://api.github.com/users/mcav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcav/subscriptions","organizations_url":"https://api.github.com/users/mcav/orgs","repos_url":"https://api.github.com/users/mcav/repos","events_url":"https://api.github.com/users/mcav/events{/privacy}","received_events_url":"https://api.github.com/users/mcav/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mcav/foxbox","description":"The FoxBox daemon","fork":true,"url":"https://api.github.com/repos/mcav/foxbox","forks_url":"https://api.github.com/repos/mcav/foxbox/forks","keys_url":"https://api.github.com/repos/mcav/foxbox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mcav/foxbox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mcav/foxbox/teams","hooks_url":"https://api.github.com/repos/mcav/foxbox/hooks","issue_events_url":"https://api.github.com/repos/mcav/foxbox/issues/events{/number}","events_url":"https://api.github.com/repos/mcav/foxbox/events","assignees_url":"https://api.github.com/repos/mcav/foxbox/assignees{/user}","branches_url":"https://api.github.com/repos/mcav/foxbox/branches{/branch}","tags_url":"https://api.github.com/repos/mcav/foxbox/tags","blobs_url":"https://api.github.com/repos/mcav/foxbox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mcav/foxbox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mcav/foxbox/git/refs{/sha}","trees_url":"https://api.github.com/repos/mcav/foxbox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mcav/foxbox/statuses/{sha}","languages_url":"https://api.github.com/repos/mcav/foxbox/languages","stargazers_url":"https://api.github.com/repos/mcav/foxbox/stargazers","contributors_url":"https://api.github.com/repos/mcav/foxbox/contributors","subscribers_url":"https://api.github.com/repos/mcav/foxbox/subscribers","subscription_url":"https://api.github.com/repos/mcav/foxbox/subscription","commits_url":"https://api.github.com/repos/mcav/foxbox/commits{/sha}","git_commits_url":"https://api.github.com/repos/mcav/foxbox/git/commits{/sha}","comments_url":"https://api.github.com/repos/mcav/foxbox/comments{/number}","issue_comment_url":"https://api.github.com/repos/mcav/foxbox/issues/comments{/number}","contents_url":"https://api.github.com/repos/mcav/foxbox/contents/{+path}","compare_url":"https://api.github.com/repos/mcav/foxbox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mcav/foxbox/merges","archive_url":"https://api.github.com/repos/mcav/foxbox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mcav/foxbox/downloads","issues_url":"https://api.github.com/repos/mcav/foxbox/issues{/number}","pulls_url":"https://api.github.com/repos/mcav/foxbox/pulls{/number}","milestones_url":"https://api.github.com/repos/mcav/foxbox/milestones{/number}","notifications_url":"https://api.github.com/repos/mcav/foxbox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mcav/foxbox/labels{/name}","releases_url":"https://api.github.com/repos/mcav/foxbox/releases{/id}","deployments_url":"https://api.github.com/repos/mcav/foxbox/deployments","created_at":"2016-02-03T14:08:53Z","updated_at":"2016-02-03T14:08:54Z","pushed_at":"2016-03-25T00:22:49Z","git_url":"git://github.com/mcav/foxbox.git","ssh_url":"git@github.com:mcav/foxbox.git","clone_url":"https://github.com/mcav/foxbox.git","svn_url":"https://github.com/mcav/foxbox","homepage":null,"size":486,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fxbox:master","ref":"master","sha":"8d3992d8ddade7f29398c774a4bcde3baa6aa1bd","user":{"login":"fxbox","id":17052474,"avatar_url":"https://avatars.githubusercontent.com/u/17052474?v=3","gravatar_id":"","url":"https://api.github.com/users/fxbox","html_url":"https://github.com/fxbox","followers_url":"https://api.github.com/users/fxbox/followers","following_url":"https://api.github.com/users/fxbox/following{/other_user}","gists_url":"https://api.github.com/users/fxbox/gists{/gist_id}","starred_url":"https://api.github.com/users/fxbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fxbox/subscriptions","organizations_url":"https://api.github.com/users/fxbox/orgs","repos_url":"https://api.github.com/users/fxbox/repos","events_url":"https://api.github.com/users/fxbox/events{/privacy}","received_events_url":"https://api.github.com/users/fxbox/received_events","type":"Organization","site_admin":false},"repo":{"id":50702140,"name":"foxbox","full_name":"fxbox/foxbox","owner":{"login":"fxbox","id":17052474,"avatar_url":"https://avatars.githubusercontent.com/u/17052474?v=3","gravatar_id":"","url":"https://api.github.com/users/fxbox","html_url":"https://github.com/fxbox","followers_url":"https://api.github.com/users/fxbox/followers","following_url":"https://api.github.com/users/fxbox/following{/other_user}","gists_url":"https://api.github.com/users/fxbox/gists{/gist_id}","starred_url":"https://api.github.com/users/fxbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fxbox/subscriptions","organizations_url":"https://api.github.com/users/fxbox/orgs","repos_url":"https://api.github.com/users/fxbox/repos","events_url":"https://api.github.com/users/fxbox/events{/privacy}","received_events_url":"https://api.github.com/users/fxbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fxbox/foxbox","description":"The FoxBox daemon","fork":false,"url":"https://api.github.com/repos/fxbox/foxbox","forks_url":"https://api.github.com/repos/fxbox/foxbox/forks","keys_url":"https://api.github.com/repos/fxbox/foxbox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fxbox/foxbox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fxbox/foxbox/teams","hooks_url":"https://api.github.com/repos/fxbox/foxbox/hooks","issue_events_url":"https://api.github.com/repos/fxbox/foxbox/issues/events{/number}","events_url":"https://api.github.com/repos/fxbox/foxbox/events","assignees_url":"https://api.github.com/repos/fxbox/foxbox/assignees{/user}","branches_url":"https://api.github.com/repos/fxbox/foxbox/branches{/branch}","tags_url":"https://api.github.com/repos/fxbox/foxbox/tags","blobs_url":"https://api.github.com/repos/fxbox/foxbox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fxbox/foxbox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fxbox/foxbox/git/refs{/sha}","trees_url":"https://api.github.com/repos/fxbox/foxbox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fxbox/foxbox/statuses/{sha}","languages_url":"https://api.github.com/repos/fxbox/foxbox/languages","stargazers_url":"https://api.github.com/repos/fxbox/foxbox/stargazers","contributors_url":"https://api.github.com/repos/fxbox/foxbox/contributors","subscribers_url":"https://api.github.com/repos/fxbox/foxbox/subscribers","subscription_url":"https://api.github.com/repos/fxbox/foxbox/subscription","commits_url":"https://api.github.com/repos/fxbox/foxbox/commits{/sha}","git_commits_url":"https://api.github.com/repos/fxbox/foxbox/git/commits{/sha}","comments_url":"https://api.github.com/repos/fxbox/foxbox/comments{/number}","issue_comment_url":"https://api.github.com/repos/fxbox/foxbox/issues/comments{/number}","contents_url":"https://api.github.com/repos/fxbox/foxbox/contents/{+path}","compare_url":"https://api.github.com/repos/fxbox/foxbox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fxbox/foxbox/merges","archive_url":"https://api.github.com/repos/fxbox/foxbox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fxbox/foxbox/downloads","issues_url":"https://api.github.com/repos/fxbox/foxbox/issues{/number}","pulls_url":"https://api.github.com/repos/fxbox/foxbox/pulls{/number}","milestones_url":"https://api.github.com/repos/fxbox/foxbox/milestones{/number}","notifications_url":"https://api.github.com/repos/fxbox/foxbox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fxbox/foxbox/labels{/name}","releases_url":"https://api.github.com/repos/fxbox/foxbox/releases{/id}","deployments_url":"https://api.github.com/repos/fxbox/foxbox/deployments","created_at":"2016-01-30T01:13:10Z","updated_at":"2016-03-24T00:09:53Z","pushed_at":"2016-03-25T12:04:17Z","git_url":"git://github.com/fxbox/foxbox.git","ssh_url":"git@github.com:fxbox/foxbox.git","clone_url":"https://github.com/fxbox/foxbox.git","svn_url":"https://github.com/fxbox/foxbox","homepage":null,"size":581,"stargazers_count":12,"watchers_count":12,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":46,"forks":27,"open_issues":46,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fxbox/foxbox/pulls/254"},"html":{"href":"https://github.com/fxbox/foxbox/pull/254"},"issue":{"href":"https://api.github.com/repos/fxbox/foxbox/issues/254"},"comments":{"href":"https://api.github.com/repos/fxbox/foxbox/issues/254/comments"},"review_comments":{"href":"https://api.github.com/repos/fxbox/foxbox/pulls/254/comments"},"review_comment":{"href":"https://api.github.com/repos/fxbox/foxbox/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fxbox/foxbox/pulls/254/commits"},"statuses":{"href":"https://api.github.com/repos/fxbox/foxbox/statuses/b48752f6c3a284447c4b57be45af8b66d0130921"}}}}