Can keys have slashes?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Can keys have slashes?

John Lynch
I have not been able to get Riak to accept slashes in keys (i.e.  "foo/bar"). If this were possible it would be nice to be able to simulate a directory structure, say for example to serve a Javascript Ajax app (complete with css and image directories) directly out of Riak.  Is such a thing possible?


Regards,

John Lynch, CTO
Rigel Group, LLC
[hidden email]
Mobile: 760-515-2653

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Can keys have slashes?

bryan-basho
Administrator
On Sun, Feb 21, 2010 at 9:23 PM, John Lynch <[hidden email]> wrote:
> I have not been able to get Riak to accept slashes in keys (i.e.
> "foo/bar"). If this were possible it would be nice to be able to simulate a
> directory structure, say for example to serve a Javascript Ajax app
> (complete with css and image directories) directly out of Riak.  Is such a
> thing possible?

Hi, John.  Riak, proper, can accept slashes in keys.  However, the
HTTP interface uses Webmachine's dispatcher, which considers slashes
significant, and it also provides the ability to use link-walking URL
syntax after the bucket and key.  It also brings up the question of
whether the URL "/raw/foo/bar/baz/quux" points to the "bar/baz/quux"
object in the "foo" bucket or to the "quux" object in the
"foo/bar/baz" bucket.

The best way to use "slashes" in keys right now is to URL-encode them to "%2F".

-Bryan

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Can keys have slashes?

John Lynch
Thanks Bryan.  The link-walking syntax is nice, but the way Riak stores data, with the REST interface and remembering content-type, it is a shame that we can't directly use filesystem-like URLs to access data. It would open up a lot of use cases without the added complexity of putting proxys in front of Riak to rewrite URLs.  A Rails "routes" type mechanism would be really useful.

Anyway, just my 2 cents, I really appreciate the work Basho has done on Riak, and for letting us play with your toys. 

- John

On Mon, Feb 22, 2010 at 6:36 AM, Bryan Fink <[hidden email]> wrote:
On Sun, Feb 21, 2010 at 9:23 PM, John Lynch <[hidden email]> wrote:
> I have not been able to get Riak to accept slashes in keys (i.e.
> "foo/bar"). If this were possible it would be nice to be able to simulate a
> directory structure, say for example to serve a Javascript Ajax app
> (complete with css and image directories) directly out of Riak.  Is such a
> thing possible?

Hi, John.  Riak, proper, can accept slashes in keys.  However, the
HTTP interface uses Webmachine's dispatcher, which considers slashes
significant, and it also provides the ability to use link-walking URL
syntax after the bucket and key.  It also brings up the question of
whether the URL "/raw/foo/bar/baz/quux" points to the "bar/baz/quux"
object in the "foo" bucket or to the "quux" object in the
"foo/bar/baz" bucket.

The best way to use "slashes" in keys right now is to URL-encode them to "%2F".

-Bryan


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com