system databases #9

Closed
benoitc opened this Issue May 18, 2012 · 2 comments

2 participants

@benoitc

Hi all,

I would like to introduce a new kind of databases in the couch core. This database would take care about databases metadata, users, hooks, replications tasks and such. Something similar to postgres system catalogs:

http://www.postgresql.org/docs/8.2/static/catalogs.html

Such databases would be only accessible by admins and HTTP resources. Normal users won't have direct access to them. Only through the HTTP API.

I'm looking for a way to name them. I don't want to prefix them by "_" to distinct db resources from normal paths.

After discussing on IRC, current choices are available:

  1. rc_* : rc for rcouch.
  2. sys_
  3. rcouch/ : wwith the problem that such path will need to be encoded for admins accessing at api level (not a big problem though)

So far 1 & 3 have my preferences. Having branding ini the name is a better than a generic name like sys there. Maybe 3 should be choosed over the 1 because it gives more informations and doesn't pollute other namespaces.

Thoughs? Please +1 your solution or provides an another :)

@benoitc benoitc was assigned May 18, 2012
@ghost

'+ 1' for rc_*

I don't like idea or url encoding the slash or giving anymore meaning to db name

@nrdufour

I like small prefixes so +1 for rc_* as well.

@benoitc benoitc added a commit that closed this issue May 18, 2012
@benoitc benoitc support system dbs. close #9 .
Systems databases are databases only available and visible by admins.
All systems databases are prefixed by `rc_` .

Ex:

    $ curl -XPUT http://127.0.0.1:5984/rc_somesystemdb
    {"error":"unauthorized","reason":"You are not a server admin."}
    $ curl -XPUT http://admin:test@127.0.0.1:5984/rc_somesystemdb
    {"ok":true}
    $ curl http://admin:test@127.0.0.1:5984/_all_dbs
    ["_replicator","_users","rc_somesystemdb"]
    $ curl http://127.0.0.1:5984/_all_dbs
    ["_replicator","_users"]
    $ curl -XPUT http://admin:test@127.0.0.1:5984/rc_somesystemdb -d'{}'
    {"error":"file_exists","reason":"The database could not be created,
the file already exists."}
    $ curl -XPUT http://admin:test@127.0.0.1:5984/rc_somesystemdb/test
-d'{}'
    {"ok":true,"id":"test","rev":"1-967a00dff5e02add41819138abb3284d"}
    $ curl -XPUT http://127.0.0.1:5984/rc_somesystemdb/test1
-d'{}'{"error":"unauthorized","reason":"You are not authorized to access
this db."}
    $ curl
http://127.0.0.1:5984/rc_somesystemdb/_all_docs{"error":"unauthorized","reason":"You
are not authorized to access this db."}
    $ curl http://admin:test@127.0.0.1:5984/rc_somesystemdb/_all_docs
    {"total_rows":1,"offset":0,"rows":[
    {"id":"test","key":"test","value":{"rev":"1-967a00dff5e02add41819138abb3284d"}}
    ]}
29560d9
@benoitc benoitc closed this in 29560d9 May 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment