On 27/12/2008, at 3:16 PM, Chris Anderson wrote:

<database_dir>/
  376256767374932aafbad43539978a53.couch/
    data
    name
  fe58718fe13cd483f4c66fb4b2c512b1.couch/
    data
    name
    views/    <-- views go in here
      b84dd25a153afb4a7412ab9c20413210.view/
        data
        name

Sure.

The small benefit of two separate directories is that it's slightly easier to script the copying of the database directory as a whole, without the derived data i.e all you need for a backup. It might look like this:

<database_dir>/
  <slug>-fe58718fe13cd483f4c66fb4b2c512b1.couch/
    data
    name
  <slug>-fe58718fe13cd483f4c66fb4b2c512b1.cache/
    <slug>-b84dd25a153afb4a7412ab9c20413210.view/
      data
      name

A useful additional feature would be for an external to have access to the (cache) directory for a given database. A very useful application of _external is for maintaining secondary indexes, and maintaining that data in the same place as the views would be convenient. Having access to the name-munging algorithm in an external would also be useful for the same reason that it's useful in the core e.g. per- database files.

Probably the lowest-impact way to do this would be to provide an http end-point that encodes names. I suggest having the dbinfo also provide the location of the directory/ies associated with the database, even though the external code could work it out using the config call and the encoder, because it's one less detail to expose. Many externals wouldn't need to use the encoder because their file names would be fixed, and as long as they avoid e.g. 'data'/'name'/'*.couch'/'*.view'/'*.cache' (which I admit could be made into a better rule), there would be a guarantee of no collisions.

Or, in a single directory you might have a dedicated directory for _externals

<database_dir>/
  376256767374932aafbad43539978a53.couch/
    data
    name
  fe58718fe13cd483f4c66fb4b2c512b1.couch/
    data
    name
    views/    <-- views go in here
      b84dd25a153afb4a7412ab9c20413210.view/
        data
        name
    externals/
      ... data managed by externals ...

Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

He who would make his own liberty secure, must guard even his enemy from repression.
  -- Thomas Paine


Reply via email to