* Christian Brandoni <
christian...@gmail.com> [16/11/11 18:01]:
> Hi,
> Thanks for your help.
> More questions below:
>
> > Usually, to implement pagination in any direction, you begin with
> > offset 0, supply a necessary limit, and then continue from the
> > last key of the previous page. This is the way it works in the
> > example I pasted.
> >
> Point 2 was related to player rank, not pagination.
> I need to know the position of the player in the leader board.
> Let's say I have the following with
> 1- user a-10 points
> 2-user b 5 points
> 3-user c 4 points
> 4-user d d 3 points
> 5-user e 2 points
>
> Let's say I am user c, 4 points in the leaderboard.
> I need to show him he is rank 3. that there is user b above him and user e
> below him. I am just asking 1 rank below and above for simplicity, but in
> reality I would like to know 3 at least.
> So I would then count from the beginning of the index to get his rank:3.
> Then I would select the one below and the one above with two index scan. Do
> you think this is the most efficient way or there are better way?
What if there is more than one user with 3 points? Do they have
the same rank?
Counting the number of users with a higher rank would take a lot
of time if there are many users.
> > But today you can't use triggers to insert into spaces :(, we're
> > working on this.
> >
> Sorry I don't understand what does this mean. Isn't the trigger like any
> other tarantool lua function?
Yes.
> I can't call any box functions from there?
insert/update/delete - no, you can't.
> Or there is a bug just on space insert?
Yes, you could call it a bug. Subtransactions are
note implemented. What you could do, potentially, is put the new
tuple into a Lua table for a background fiber to work on.
> Another thing. Today talking with the node js connector dev he told me the
> protocol doesn't allow initiating the request from tarantool side.
> Is this something you are working on? It would be useful for example with
> triggers or any server side event.Right now there doesn't seem to be a way
> to talk with clients other than implementing http or sockets server or
> polling the server for updates.
You could use 'socket' Lua rock which is on board. If you need to
communicate with another Tarantool instance, you could use
net.box.
There is no pub/sub in the protocol, yes.