diff --git a/textile/objects-features.textile b/textile/objects-features.textile index abffa805..ac0305ad 100644 --- a/textile/objects-features.textile +++ b/textile/objects-features.textile @@ -317,11 +317,13 @@ h3(#livecounter). LiveCounter *** @(RTLC6e1)@ Return a @LiveCounterUpdate@ object with @LiveCounterUpdate.noop@ set to @true@, indicating that no update was made to the object ** @(RTLC6f)@ If @ObjectState.tombstone@ is @true@, tombstone the current @LiveCounter@ using "@LiveObject.tombstone@":#RTLO4e, passing in the outer @ObjectMessage@ for the @ObjectState@. Finish processing the @ObjectState@ *** @(RTLC6f1)@ Return a @LiveCounterUpdate@ object with @LiveCounterUpdate.update.amount@ set to the negative @data@ value that this @LiveCounter@ had before being tombstoned +** @(RTLC6g)@ Store the current @data@ value as @previousData@ for use in "RTLC6h":#RTLC6h ** @(RTLC6b)@ Set the private flag @createOperationIsMerged@ to @false@ ** @(RTLC6c)@ Set @data@ to the value of @ObjectState.counter.count@, or to 0 if it does not exist -** @(RTLC6d)@ If @ObjectState.createOp@ is present, merge the initial value into the @LiveCounter@ as described in "RTLC10":#RTLC10, passing in the @ObjectState.createOp@ instance +** @(RTLC6d)@ If @ObjectState.createOp@ is present, merge the initial value into the @LiveCounter@ as described in "RTLC10":#RTLC10, passing in the @ObjectState.createOp@ instance. Discard the @LiveCounterUpdate@ object returned by the merge operation *** @(RTLC6d1)@ This clause has been replaced by "RTLC10a":#RTLC10a *** @(RTLC6d2)@ This clause has been replaced by "RTLC10b":#RTLC10b +** @(RTLC6h)@ Calculate the diff between @previousData@ from "RTLC6g":#RTLC6g and the current @data@ per "RTLC14":#RTLC14, and return the resulting @LiveCounterUpdate@ object * @(RTLC7)@ An @ObjectOperation@ from @ObjectMessage.operation@ can be applied to a @LiveCounter@ by performing the following actions in order: ** @(RTLC7a)@ A client library may choose to implement this logic as a convenience method named @applyOperation@, which accepts an @ObjectMessage@ instance with an existing @ObjectMessage.operation@ object, with @ObjectMessage.operation.objectId@ matching the Object ID of this @LiveCounter@. This @ObjectMessage@ represents the operation to be applied to this @LiveCounter@ ** @(RTLC7b)@ If @ObjectMessage.operation@ cannot be applied based on the result of "@LiveObject.canApplyOperation@":#RTLO4a, log a debug or trace message indicating that the operation cannot be applied because its serial value is not newer than the object's, and discard the @ObjectMessage@ without taking any further action @@ -354,6 +356,11 @@ h3(#livecounter). LiveCounter ** @(RTLC10b)@ Set the private flag @createOperationIsMerged@ to @true@ ** @(RTLC10c)@ If @ObjectOperation.counter.count@ exists, return a @LiveCounterUpdate@ object with @LiveCounterUpdate.update.amount@ set to @ObjectOperation.counter.count@ ** @(RTLC10d)@ If @ObjectOperation.counter.count@ does not exist, return a @LiveCounterUpdate@ object with @LiveCounterUpdate.noop@ set to @true@ +* @(RTLC14)@ The diff between two @LiveCounter@ data values can be calculated in the following way: +** @(RTLC14a)@ Expects the following arguments: +*** @(RTLC14a1)@ @previousData@ @Number@ - the previous @data@ value +*** @(RTLC14a2)@ @newData@ @Number@ - the new @data@ value +** @(RTLC14b)@ Return a @LiveCounterUpdate@ object with @LiveCounterUpdate.update.amount@ set to @newData - previousData@ h3(#livemap). LiveMap @@ -446,17 +453,19 @@ h3(#livemap). LiveMap *** @(RTLM6e1)@ Return a @LiveMapUpdate@ object with @LiveMapUpdate.noop@ set to @true@, indicating that no update was made to the object ** @(RTLM6f)@ If @ObjectState.tombstone@ is @true@, tombstone the current @LiveMap@ using "@LiveObject.tombstone@":#RTLO4e, passing in the outer @ObjectMessage@ for the @ObjectState@. Finish processing the @ObjectState@ *** @(RTLM6f1)@ Return a @LiveMapUpdate@ object with @LiveMapUpdate.update@ consisting of entries for the keys that were removed as a result of the object being tombstoned, each set to @removed@ +** @(RTLM6g)@ Store the current @data@ value as @previousData@ for use in "RTLM6h":#RTLM6h ** @(RTLM6b)@ Set the private flag @createOperationIsMerged@ to @false@ ** @(RTLM6c)@ Set @data@ to @ObjectState.map.entries@, or to an empty map if it does not exist *** @(RTLM6c1)@ For each @ObjectsMapEntry@ with @ObjectsMapEntry.tombstone@ equal to @true@, additionally set the @ObjectsMapEntry.tombstonedAt@ field as follows: **** @(RTLM6c1a)@ Set it equal to @ObjectsMapEntry.serialTimestamp@ if it exists **** @(RTLM6c1b)@ Otherwise, set it to the current time using the local clock ***** @(RTLM6c1b1)@ Log a debug or trace message indicating that @ObjectsMapEntry.serialTimestamp@ was not provided and the local clock is being used instead for the tombstone timestamp -** @(RTLM6d)@ If @ObjectState.createOp@ is present, merge the initial value into the @LiveMap@ as described in "RTLM17":#RTLM17, passing in the @ObjectState.createOp@ instance +** @(RTLM6d)@ If @ObjectState.createOp@ is present, merge the initial value into the @LiveMap@ as described in "RTLM17":#RTLM17, passing in the @ObjectState.createOp@ instance. Discard the @LiveMapUpdate@ object returned by the merge operation *** @(RTLM6d1)@ This clause has been replaced by "RTLM17a":#RTLM17a **** @(RTLM6d1a)@ This clause has been replaced by "RTLM17a1":#RTLM17a1 **** @(RTLM6d1b)@ This clause has been replaced by "RTLM17a2":#RTLM17a2 *** @(RTLM6d2)@ This clause has been replaced by "RTLM17b":#RTLM17b +** @(RTLM6h)@ Calculate the diff between @previousData@ from "RTLM6g":#RTLM6g and the current @data@ per "RTLM22":#RTLM22, and return the resulting @LiveMapUpdate@ object * @(RTLM15)@ An @ObjectOperation@ from @ObjectMessage.operation@ can be applied to a @LiveMap@ by performing the following actions in order: ** @(RTLM15a)@ A client library may choose to implement this logic as a convenience method named @applyOperation@, which accepts an @ObjectMessage@ instance with an existing @ObjectMessage.operation@ object, with @ObjectMessage.operation.objectId@ matching the Object ID of this @LiveMap@. This @ObjectMessage@ represents the operation to be applied to this @LiveMap@ ** @(RTLM15b)@ If @ObjectMessage.operation@ cannot be applied based on the result of "@LiveObject.canApplyOperation@":#RTLO4a, log a debug or trace message indicating that the operation cannot be applied because its serial value is not newer than the object's, and discard the @ObjectMessage@ without taking any further action @@ -536,6 +545,14 @@ h3(#livemap). LiveMap * @(RTLM19)@ The @LiveMap@ can be checked to determine whether it should release resources for its tombstoned @ObjectsMapEntry@ entries as follows: ** @(RTLM19a)@ For each @ObjectsMapEntry@ in the internal @data@: *** @(RTLM19a1)@ If @ObjectsMapEntry.tombstone@ is @true@, and the difference between the current time and @ObjectsMapEntry.tombstonedAt@ is greater than or equal to the "grace period":#RTO10b, remove the entry from the internal @data@ map and release resources for the corresponding @ObjectsMapEntry@ entity to allow it to be garbage collected +* @(RTLM22)@ The diff between two @LiveMap@ data values can be calculated in the following way: +** @(RTLM22a)@ Expects the following arguments: +*** @(RTLM22a1)@ @previousData@ @Dict@ - the previous @data@ value +*** @(RTLM22a2)@ @newData@ @Dict@ - the new @data@ value +** @(RTLM22b)@ Return a @LiveMapUpdate@ object where @LiveMapUpdate.update@ is calculated by considering only the non-tombstoned entries from @previousData@ and @newData@. An entry is non-tombstoned if its @ObjectsMapEntry.tombstone@ field is @false@. The update is populated as follows: +*** @(RTLM22b1)@ For each key that exists in the non-tombstoned entries of @previousData@ but does not exist in the non-tombstoned entries of @newData@, add the key to @LiveMapUpdate.update@ with the value @removed@ +*** @(RTLM22b2)@ For each key that exists in the non-tombstoned entries of @newData@ but does not exist in the non-tombstoned entries of @previousData@, add the key to @LiveMapUpdate.update@ with the value @updated@ +*** @(RTLM22b3)@ For each key that exists in the non-tombstoned entries of both @previousData@ and @newData@, perform a deep comparison of the entry data from @previousData@ and @newData@. If the data values differ, add the key to @LiveMapUpdate.update@ with the value @updated@ h2(#idl). Interface Definition