Hey,

I'm trying to come up with an solution to writing child objects where the
parent will be reference by some secondary index.

The data model contains a list of devices, each with a list of messages
beneath them.

Currently I have a hierarchical scheme where devices are stored under
(devices, <addr>) and messages under (messages/<addr>, <id>). This works
fine fine and i can write incoming messages without retrieving the device
first.

Now I want to add support for replacing devices, that means multiple
devices can have the same address. I was thinking to add <addr> as a
secondary index to the device object, but then i need to do a index query
to get the real device id.

I intend to keep a secondary index containing the device address, and
activation status. The question then, can i somehow reference that index
and rewrite the bucket when storing the object?

There are a few problems that comes to mind:

1) There might be multiple active devices, this is fine multiple writes can
be issued
2) Riak would have to know how to rewrite the bucket name, which should be
client logic.

One way to solve this issue would be to keep the list of <addr> -> <id>
mappings in the connection handler. This could work all changes to devices
can be propagated to the all the API endpoints, there won't be an issue
with API endpoints running out of memory either as it would only amount to
100's of MB's for 10k+ connections.

Another approach would be to to have pre-commit hook rewriting the the
bucket name, that would require a fetch (possibly from other nodes in the
system) so it does not really change anything.

Is there any other approaches i'm missing that could be better? for
instance it seems logical - at least to me - that one could alias an object
by using links; but i'm not aware of such a method.

Cheers,
Olav

-- 
Med Vennlig Hilsen
Olav Frengstad

Systemutvikler // FWT
+47 920 42 090
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to