{"action":"created","comment":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments/37543606","id":37543606,"diff_hunk":"@@ -0,0 +1,141 @@\n+- Feature Name: Configs for structured data\n+- Status: draft\n+- Start Date: 2015-08-19\n+- RFC PR: [#2183](https://github.com/cockroachdb/cockroach/pull/2183)\n+- Cockroach Issue: [#2090](https://github.com/cockroachdb/cockroach/issues/2090)\n+\n+# Summary\n+\n+This RFC describes the application of various configurations to the structured data\n+representation. We address storage, distribution, and modification.\n+\n+# Motivation\n+\n+Structured data will soon be the only publicly accessible API. This requires a change\n+in the way configurations are specified and applied, moving from prefix-based logic\n+to databases and tables.\n+\n+The following configs currently exist:\n+* Accounting: usage limits (bytes, counts). Not currently used.\n+* Permissions: user read/write permissions. Used by the KV endpoint.\n+* Users: password storage for the web interface. Currently settable, but not used.\n+* Zones: replication configuration. Used to make allocation decisions.\n+\n+# Prerequisites\n+\n+Complete implementation of this RFC depends on the following:\n+* Gossip system database: [#2179](https://github.com/cockroachdb/cockroach/issues/2179)\n+* Disable KV endpoint: [#2089](https://github.com/cockroachdb/cockroach/issues/2089)\n+\n+# Detailed design\n+\n+## Storage\n+\n+We propose moving all configuration files to the `system` database as separate tables.\n+\n+The table schema depends on the configuration. Some (eg: `users`) apply globally,\n+while some (eg: `accounting`, `zones`) apply to databases and tables.\n+\n+For each configuration, we propose the following schemas:\n+\n+#### Accounting\n+\n+The accounting table applies to databases and potentially to tables as well.\n+Its contents have yet to be determined.\n+\n+#### Permissions\n+\n+The permissions table is only used for the KV endpoint. It will not be migrated\n+to the structured data API and will instead be removed after\n+[#2089](https://github.com/cockroachdb/cockroach/issues/2089) is resolved.\n+\n+#### Users\n+\n+The users table is currently the only configuration applicable globally.\n+It contains a mapping of username to password hash and salt.\n+\n+Schema:\n+```SQL\n+CREATE TABLE system.users (\n+  \"username\"  CHAR primary key,\n+  \"hashed\"    BLOB\n+)\n+```\n+\n+#### Zones\n+\n+The zone config applies to tables, with a database-level entry used as default.\n+When a database is created, it will use a global default.\n+When a table is created, it will inherit its database zone config.\n+\n+Schema:\n+```SQL\n+CREATE TABLE system.zones (\n+  \"target\"           CHAR primary key,\n+  \"attributes\"       CHAR,\n+  \"range_min_bytes\"  INT,\n+  \"range_max_bytes\"  INT,\n+  \"gc_ttl_seconds\"   INT\n+)\n+```\n+\n+The `target` field can take the form:\n+* `DEFAULT`: the default for new databases.","path":"docs/RFCS/structured_configs.md","position":83,"original_position":83,"commit_id":"cd3b8ab74901a41690c3a72fe3bb6a4cd9c56911","original_commit_id":"cd3b8ab74901a41690c3a72fe3bb6a4cd9c56911","user":{"login":"MBerhault","id":5901480,"avatar_url":"https://avatars.githubusercontent.com/u/5901480?v=3","gravatar_id":"","url":"https://api.github.com/users/MBerhault","html_url":"https://github.com/MBerhault","followers_url":"https://api.github.com/users/MBerhault/followers","following_url":"https://api.github.com/users/MBerhault/following{/other_user}","gists_url":"https://api.github.com/users/MBerhault/gists{/gist_id}","starred_url":"https://api.github.com/users/MBerhault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MBerhault/subscriptions","organizations_url":"https://api.github.com/users/MBerhault/orgs","repos_url":"https://api.github.com/users/MBerhault/repos","events_url":"https://api.github.com/users/MBerhault/events{/privacy}","received_events_url":"https://api.github.com/users/MBerhault/received_events","type":"User","site_admin":false},"body":"yeah. Not sure what to call this for now. It definitely can't be `system` alone since we want to be able to customize that. I'll change it to `system.DEFAULT` and add a note.","created_at":"2015-08-20T15:31:13Z","updated_at":"2015-08-20T15:31:13Z","html_url":"https://github.com/cockroachdb/cockroach/pull/2183#discussion_r37543606","pull_request_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/2183","_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments/37543606"},"html":{"href":"https://github.com/cockroachdb/cockroach/pull/2183#discussion_r37543606"},"pull_request":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/2183"}}},"pull_request":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/2183","id":42939409,"html_url":"https://github.com/cockroachdb/cockroach/pull/2183","diff_url":"https://github.com/cockroachdb/cockroach/pull/2183.diff","patch_url":"https://github.com/cockroachdb/cockroach/pull/2183.patch","issue_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/2183","number":2183,"state":"open","locked":false,"title":"RFC: structured configs","user":{"login":"MBerhault","id":5901480,"avatar_url":"https://avatars.githubusercontent.com/u/5901480?v=3","gravatar_id":"","url":"https://api.github.com/users/MBerhault","html_url":"https://github.com/MBerhault","followers_url":"https://api.github.com/users/MBerhault/followers","following_url":"https://api.github.com/users/MBerhault/following{/other_user}","gists_url":"https://api.github.com/users/MBerhault/gists{/gist_id}","starred_url":"https://api.github.com/users/MBerhault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MBerhault/subscriptions","organizations_url":"https://api.github.com/users/MBerhault/orgs","repos_url":"https://api.github.com/users/MBerhault/repos","events_url":"https://api.github.com/users/MBerhault/events{/privacy}","received_events_url":"https://api.github.com/users/MBerhault/received_events","type":"User","site_admin":false},"body":"This RFC describes the application of various configurations to the\r\nstructured data representation.\r\nWe address storage, distribution, and modification.","created_at":"2015-08-20T15:00:22Z","updated_at":"2015-08-20T15:31:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"26f2d542354ce1912efe02d38cbfe672bad94f3d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/2183/commits","review_comments_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/2183/comments","review_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/2183/comments","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/cd3b8ab74901a41690c3a72fe3bb6a4cd9c56911","head":{"label":"cockroachdb:marc/RFC_structured_configs","ref":"marc/RFC_structured_configs","sha":"cd3b8ab74901a41690c3a72fe3bb6a4cd9c56911","user":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"repo":{"id":16563587,"name":"cockroach","full_name":"cockroachdb/cockroach","owner":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockroachdb/cockroach","description":"A Scalable, Geo-Replicated, Transactional Datastore","fork":false,"url":"https://api.github.com/repos/cockroachdb/cockroach","forks_url":"https://api.github.com/repos/cockroachdb/cockroach/forks","keys_url":"https://api.github.com/repos/cockroachdb/cockroach/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockroachdb/cockroach/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockroachdb/cockroach/teams","hooks_url":"https://api.github.com/repos/cockroachdb/cockroach/hooks","issue_events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/events{/number}","events_url":"https://api.github.com/repos/cockroachdb/cockroach/events","assignees_url":"https://api.github.com/repos/cockroachdb/cockroach/assignees{/user}","branches_url":"https://api.github.com/repos/cockroachdb/cockroach/branches{/branch}","tags_url":"https://api.github.com/repos/cockroachdb/cockroach/tags","blobs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockroachdb/cockroach/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockroachdb/cockroach/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/{sha}","languages_url":"https://api.github.com/repos/cockroachdb/cockroach/languages","stargazers_url":"https://api.github.com/repos/cockroachdb/cockroach/stargazers","contributors_url":"https://api.github.com/repos/cockroachdb/cockroach/contributors","subscribers_url":"https://api.github.com/repos/cockroachdb/cockroach/subscribers","subscription_url":"https://api.github.com/repos/cockroachdb/cockroach/subscription","commits_url":"https://api.github.com/repos/cockroachdb/cockroach/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockroachdb/cockroach/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockroachdb/cockroach/contents/{+path}","compare_url":"https://api.github.com/repos/cockroachdb/cockroach/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockroachdb/cockroach/merges","archive_url":"https://api.github.com/repos/cockroachdb/cockroach/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockroachdb/cockroach/downloads","issues_url":"https://api.github.com/repos/cockroachdb/cockroach/issues{/number}","pulls_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls{/number}","milestones_url":"https://api.github.com/repos/cockroachdb/cockroach/milestones{/number}","notifications_url":"https://api.github.com/repos/cockroachdb/cockroach/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/labels{/name}","releases_url":"https://api.github.com/repos/cockroachdb/cockroach/releases{/id}","created_at":"2014-02-06T00:18:47Z","updated_at":"2015-08-20T06:56:13Z","pushed_at":"2015-08-20T15:17:34Z","git_url":"git://github.com/cockroachdb/cockroach.git","ssh_url":"git@github.com:cockroachdb/cockroach.git","clone_url":"https://github.com/cockroachdb/cockroach.git","svn_url":"https://github.com/cockroachdb/cockroach","homepage":null,"size":49862,"stargazers_count":5016,"watchers_count":5016,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":398,"mirror_url":null,"open_issues_count":149,"forks":398,"open_issues":149,"watchers":5016,"default_branch":"master"}},"base":{"label":"cockroachdb:master","ref":"master","sha":"f8cadadf48eaa45ce3f2f01b49cc8757682c0af0","user":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"repo":{"id":16563587,"name":"cockroach","full_name":"cockroachdb/cockroach","owner":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockroachdb/cockroach","description":"A Scalable, Geo-Replicated, Transactional Datastore","fork":false,"url":"https://api.github.com/repos/cockroachdb/cockroach","forks_url":"https://api.github.com/repos/cockroachdb/cockroach/forks","keys_url":"https://api.github.com/repos/cockroachdb/cockroach/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockroachdb/cockroach/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockroachdb/cockroach/teams","hooks_url":"https://api.github.com/repos/cockroachdb/cockroach/hooks","issue_events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/events{/number}","events_url":"https://api.github.com/repos/cockroachdb/cockroach/events","assignees_url":"https://api.github.com/repos/cockroachdb/cockroach/assignees{/user}","branches_url":"https://api.github.com/repos/cockroachdb/cockroach/branches{/branch}","tags_url":"https://api.github.com/repos/cockroachdb/cockroach/tags","blobs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockroachdb/cockroach/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockroachdb/cockroach/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/{sha}","languages_url":"https://api.github.com/repos/cockroachdb/cockroach/languages","stargazers_url":"https://api.github.com/repos/cockroachdb/cockroach/stargazers","contributors_url":"https://api.github.com/repos/cockroachdb/cockroach/contributors","subscribers_url":"https://api.github.com/repos/cockroachdb/cockroach/subscribers","subscription_url":"https://api.github.com/repos/cockroachdb/cockroach/subscription","commits_url":"https://api.github.com/repos/cockroachdb/cockroach/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockroachdb/cockroach/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockroachdb/cockroach/contents/{+path}","compare_url":"https://api.github.com/repos/cockroachdb/cockroach/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockroachdb/cockroach/merges","archive_url":"https://api.github.com/repos/cockroachdb/cockroach/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockroachdb/cockroach/downloads","issues_url":"https://api.github.com/repos/cockroachdb/cockroach/issues{/number}","pulls_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls{/number}","milestones_url":"https://api.github.com/repos/cockroachdb/cockroach/milestones{/number}","notifications_url":"https://api.github.com/repos/cockroachdb/cockroach/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/labels{/name}","releases_url":"https://api.github.com/repos/cockroachdb/cockroach/releases{/id}","created_at":"2014-02-06T00:18:47Z","updated_at":"2015-08-20T06:56:13Z","pushed_at":"2015-08-20T15:17:34Z","git_url":"git://github.com/cockroachdb/cockroach.git","ssh_url":"git@github.com:cockroachdb/cockroach.git","clone_url":"https://github.com/cockroachdb/cockroach.git","svn_url":"https://github.com/cockroachdb/cockroach","homepage":null,"size":49862,"stargazers_count":5016,"watchers_count":5016,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":398,"mirror_url":null,"open_issues_count":149,"forks":398,"open_issues":149,"watchers":5016,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/2183"},"html":{"href":"https://github.com/cockroachdb/cockroach/pull/2183"},"issue":{"href":"https://api.github.com/repos/cockroachdb/cockroach/issues/2183"},"comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach/issues/2183/comments"},"review_comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/2183/comments"},"review_comment":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/2183/commits"},"statuses":{"href":"https://api.github.com/repos/cockroachdb/cockroach/statuses/cd3b8ab74901a41690c3a72fe3bb6a4cd9c56911"}}}}