Hi Nico, Links are great when small in number, but run into issues when more numerous, including HTTP header size limitations, plus the extra storage overhead of bucket+key+tag on disk. I recommend using secondary indexes for this problem, but you will need to be using the LevelDB storage engine.
Another possibility is to use an OR-set (CRDT) in a secondary key, as you suggest. The difference between an OR-set and a flat list is that the former will converge easily when there are conflicts. Sean Cribbs On Feb 5, 2012, at 7:36 AM, Nicolas Petton <[email protected]> wrote: > Hi! > > We're working on a replacement of the old Smalltalk project hosting > website http://squeaksource.com/ > > For this app we'd like to use Riak, using the Smalltalk client > http://www.squeaksource.com/Phriak > > You can think of SqueakSource as a Github-like app specific to Smalltalk > code. > > Now, my problem is we have a following/followers feature in the new app: > users can follow projects. > Some projects may have thousands of followers. We need to be able to get > followers of a projects *and* projects followed by an user quickly. > > Typically, an user will follow a few projects, so this part is easily > solved with links. It becomes more complicated when it comes to getting > all users following a specific project, since it can be thousands, using > links looks like a bad idea. > > I thought of the following solution, but I may be completely off the > tracks: > > - users have links to projects they follow. > - projects don't have links to the users following them, but a link to > 'following/projectKey'. This object represents the relationship itself, > and contains the list of the names of users following the project in a > JSON array. > > This means following a project represents 2 writes, the user with the > link, and the 'following object'. > > Does that seem reasonable? > > Thanks, > Nico > > > _______________________________________________ > riak-users mailing list > [email protected] > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com _______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
