Skip to content

Instantly share code, notes, and snippets.

@PharkMillups
Created June 30, 2010 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PharkMillups/458672 to your computer and use it in GitHub Desktop.
Save PharkMillups/458672 to your computer and use it in GitHub Desktop.
BrianTheCoder # so I have a link hear that points to another doc, but when I try and
link-walk to the original doc, it doesn't return the doc
bingeldac # links aren't both ways. links are uni-directional
BrianTheCoder # I know. so I have a request doc with a link to an hours doc
but when I get the hours doc and try and link walk to the request
it returns null
BrianTheCoder # and I'm just doing a simple walk of requests,_,1
bingeldac # it has the links in the header for that doc?
BrianTheCoder # it actually has several of them (with different tags)
</riak/hours/2010_06_28_17>; riaktag="minutes%3A17"
probably need to change the separator
you can have many of the same link with different tags, right?
bingeldac # yes
BrianTheCoder # then I'm out of ideas
I mean that's the link
BrianTheCoder # and the doc is /riak/hours/2010_06_28_17
bingeldac # if you ask it for all links does it return any?
not just the links for the one bucket your linking too..
BrianTheCoder # what do you mean?
bingeldac # _,_,_
BrianTheCoder # just an empty walk?
bingeldac # yeah
BrianTheCoder # wait are links parent -> child or child -> parent?
bingeldac # neither really. they are from the doc you have to the doc you link to.
. so I guess parent to child but you can do the converse as wellif you want to do a
bunch of curl commands to illustrate the issue I would be more than happy to try it here
BrianTheCoder # well but I mean if I want to link the hours do to the request, I
need to have a link from the hours to request doc, not just the request doc to the hour?
bingeldac # when I get back. yes
BrianTheCoder # hrmm
:(
bingeldac # that sounds right
BrianTheCoder # damn
that's a lot less efficient than what I was hoping for
BrianTheCoder # so to walk a link the source doc has to have a link to the child doc?
seancribbs # BrianTheCoder: yes, links are stored on the origin side
BrianTheCoder # drat
seancribbs # let me guess you wanted to detect incoming links
BrianTheCoder # well I wanted to have a child -> parent relationship
seancribbs # so, when you establish the relationship, write links on both sides
BrianTheCoder # so I could do something link /days/2010_6_28/articles and just
have the article doc link to the day doc
well it makes the storage costs go up exponentially more
whereas the other method has a fixed growth
seancribbs # yes, there are a number of other options too but none of it is free
seancribbs # it's just where you decide to take the hit
BrianTheCoder # gotcha
so what are my other options?
seancribbs # so… depending on how many children there are, you could put them
in a bucket named by some aspect of the parent
seancribbs # then the data is encapsulated in the bucket name
so maybe days/2010-06-28 becomes 2010-06-28-articles/*
BrianTheCoder # how would that be better/different than just storing all the links in the parent?
seancribbs # no links at all
BrianTheCoder # but then I'd have to replicate the same data to hours,minutes,years
seancribbs # well, i didn't say you'd have efficient time-series… just that it
can be used to represent hierarchical relationships
BrianTheCoder # gotcha
seancribbs # it's always going to be easiest when you can derive the bucket/key
with minimal a priori knowledge
BrianTheCoder # yeah
seancribbs # i mean, we have links and map-reduce, but it's always easiest to do simple key-fetches
and fastest
BrianTheCoder # but I mean when I'm storing a list of the buckets for a given
time series, it would make more sense to use something like redis sets for that
at least to me
seancribbs # sure, that makes sense. no reason why riak has to be a 100% solution
that's what NoSQL is trying to get away from, heh
BrianTheCoder # gotcha just trying to figure out the best way. can you do a multi-fetch?
seancribbs # only with map-reduce, really
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment