On Thu, Feb 4, 2010 at 1:31 PM, Turner <[email protected]> wrote: > > Ah, ok. So the transformer doesn't transform op streams from different > clients so much as it transforms op streams from different versions. > Is that it? >
That's right. From the server side it's [ops the client doesn't know about] x [ops the client wants me to apply] The version number just tells us which ops the client doesn't know about yet (all the newer versions). >From the client side, it's [ops I haven't sent the server yet] x [ops the server just sent me] > And the transformer operates pairwise? So, if there's a stream with > more ops than the other stream, the unmatched ops go through > unchanged, correct? And if there's a disparity of more than one > between the version numbers, the transformer will need to be called > several times on successive pairs, right? So, for instance, to bump a > client whose last known version is v6 to v8, the server would call (v6 > x v7) x v8. Do I have that right? > > In the example above, A1' = A1 X B1, B1' = B1 X A1, and so forth, > right? > Well, not quite. Here I think you need to look at the code to get a clearer picture, but I'll illustrate in a slightly different way. Let's look at the following transform: [A1, A2, A3] x [B1, B2] = [A1', A2', A3'], [B1', B2'] What we end up with is two sets of operations. [A1, A2, A3] + [B1', B2'] <-- Apply the A operations first [B1, B2] + [A1', A2', A3'] <-- Apply the B operations first (where a + indicates concatenation) This implies that transform could be imagined as a sort of matrix multiplication. A1' = (A1 x B1) x B2 <--- where we just keep the A result of each transform A2' = (A2 x B1) x B2 A3' = (A3 x B1) x B2 B1' = ((B1 x A1) x A2) x A3 <-- where we just keep the B result of each transform B2' = ((B2 x A1) x A2) x A3 What the transform is doing is asking the question, "What do the A operations look like if the B operations were already applied?" This is how you get convergence. > So, for instance, to bump a > client whose last known version is v6 to v8, the server would call (v6 > x v7) x v8. Do I have that right? The difference in version numbers just tells the server which operations need to be applied to the incoming client operations. So if the server is at v8 and the client is at v6, the transform is: ([v7] + [v8]) x [client delta] = [results to send client], [v9] More concretely, if: v7 = [A1,A2] v8 = [A3] client delta = [B1, b...@v6 Then: [A1, A2, A3] x [B1, B2] = [A1', A2', A3'], [B1', B2'] v9 = [B1', B2'] <-- the A operations were applied first by the server [results to send client] = [A1', A2', A3']...@v9 <-- the B operations were applied first by the client Does that make it clearer? -- You received this message because you are subscribed to the Google Groups "Wave Protocol" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/wave-protocol?hl=en.
