Eliminación de JSON anidado en ShareJS

Actualmente estoy experimentando con el CompartirJS implementación para transformación operativa (the JSON API in particular). The wiki was not very clear on what would happen if I deleted a parent JSON object, and another operation came in which was inserting into a child JSON. Will the parent JSON be recreated, or will it be a no-op?

P.ej

{"aa":
  {"bb":
    {"cc":"dd"}
  }
}
//Operation A and B comes in carrying the same version number
//Op A deletes "aa", Op B modifies "cc"
//What happens? (assuming A comes in slightly earlier and is processed first)

preguntado el 04 de julio de 12 a las 02:07

1 Respuestas

Just checked it myself:

op1 = [{p: ["aa"], od: {"bb": {"cc":"dd"}} }] // Deletes "aa"
op2 = [{p: ["aa", "bb", "cc"], od: "dd", oi: "ee"}] // Modifies "cc"
console.log(json.transform(op2, op1, 'left'))
>> []

This means, that when op2 is transformed over op1, it becomes no-op -> no object will be recreated.

Respondido el 09 de Septiembre de 12 a las 16:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.