Yes, I've thought of this but as I understand it there is a bit of a problem 
attaching a large amount of links to a key which
would be necessary here am I right? If I had 10 000 files in riak that would 
mean 10 000 links attached to the "listing" key.

4 sep 2010 kl. 20.44 skrev Matthew Scott:

> 
> On Sat, Sep 4, 2010 at 11:31, John Axel Eriksson <j...@insane.se> wrote:
> Listing keys in a bucket has been described as "bad" and something you use in 
> development but
> not in production. I'm just starting out on Riak so I'm a newbie...
> 
> I'm thinking of building an application using Riak as filestorage and 
> possibly much more than that, but it would
> at least store lots of files with, perhaps, metadata attached. How would I 
> then list files for display in a webapp if
> I don't use key listing?
> 
> I'm still very much a Riak newb myself, but I'll take a shot at answering 
> this one by suggesting the use of links.
> 
> From what I understand, links some quantity limits when you attach a large 
> number, but adding and removing them is an inexpensive operation.  (Someone 
> fact check me on that please :)
> 
> - Create a key called 'listing', perhaps even in its own bucket to prevent 
> namespace collision.
> 
> - Create links from that 'listing' key to metadata keys.  Remember that you 
> can attach a tag to each link to differentiate different types of links, such 
> as "metadata".
> 
> - The metadata keys' values would contain file metadata in JSON form, and in 
> turn have a link to the file contents key, tagged "contents".
> 
> - Remember to attach the proper mime type to the key containing your file 
> contents.
> 
> - To get a file listing, do a map/reduce starting at "listing", following its 
> "metadata" links and grabbing those values, then reduce to sort by a key.
> 
> - To get file contents, follow the "contents" link from the metadata key.
> 
> --
> Matthew Scott
> ElevenCraft, Inc.
> http://11craft.com/
> +1 360 389-2512
> 
>  

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to