@@ -40,7 +40,7 @@ export type LiveMapObjectData = ObjectIdObjectData | ValueObjectData;
4040
4141export interface LiveMapEntry {
4242 tombstone : boolean ;
43- tombstonedAt : number | undefined ;
43+ tombstonedAt : number | undefined ; // RTLM3a1
4444 timeserial : string | undefined ;
4545 data : LiveMapObjectData | undefined ;
4646}
@@ -300,6 +300,7 @@ export class LiveMap<T extends API.LiveMapType> extends LiveObject<LiveMapData,
300300 get < TKey extends keyof T & string > ( key : TKey ) : T [ TKey ] | undefined {
301301 this . _objects . throwIfInvalidAccessApiConfiguration ( ) ; // RTLM5b, RTLM5c
302302
303+ // RTLM5e
303304 if ( this . isTombstoned ( ) ) {
304305 return undefined as T [ TKey ] ;
305306 }
@@ -429,7 +430,7 @@ export class LiveMap<T extends API.LiveMapType> extends LiveObject<LiveMapData,
429430 this . _siteTimeserials [ opSiteCode ] = opSerial ; // RTLM15c
430431
431432 if ( this . isTombstoned ( ) ) {
432- // this object is tombstoned so the operation cannot be applied
433+ // RTLM15e - this object is tombstoned so the operation cannot be applied
433434 return ;
434435 }
435436
@@ -461,7 +462,7 @@ export class LiveMap<T extends API.LiveMapType> extends LiveObject<LiveMapData,
461462 break ;
462463
463464 case ObjectOperationAction . OBJECT_DELETE :
464- update = this . _applyObjectDelete ( msg ) ;
465+ update = this . _applyObjectDelete ( msg ) ; // RTLM15d5, RTLM15d5a
465466 break ;
466467
467468 default :
@@ -534,14 +535,14 @@ export class LiveMap<T extends API.LiveMapType> extends LiveObject<LiveMapData,
534535 this . _siteTimeserials = objectState . siteTimeserials ?? { } ; // RTLM6a
535536
536537 if ( this . isTombstoned ( ) ) {
537- // this object is tombstoned. this is a terminal state which can't be overridden. skip the rest of object state message processing
538- return { noop : true } ;
538+ // RTLM6e - this object is tombstoned. this is a terminal state which can't be overridden. skip the rest of object state message processing
539+ return { noop : true } ; // RTLM6e1
539540 }
540541
541542 const previousDataRef = this . _dataRef ;
542543 if ( objectState . tombstone ) {
543544 // tombstone this object and ignore the data from the object state message
544- this . tombstone ( objectMessage ) ;
545+ this . tombstone ( objectMessage ) ; // RTLM6f
545546 } else {
546547 // override data for this object with data from the object state
547548 this . _createOperationIsMerged = false ; // RTLM6b
@@ -553,19 +554,21 @@ export class LiveMap<T extends API.LiveMapType> extends LiveObject<LiveMapData,
553554
554555 // if object got tombstoned, the update object will include all data that got cleared.
555556 // otherwise it is a diff between previous value and new value from object state.
556- return this . _updateFromDataDiff ( previousDataRef , this . _dataRef ) ;
557+ return this . _updateFromDataDiff ( previousDataRef , this . _dataRef ) ; // RTLM6f1
557558 }
558559
559560 /**
560561 * @internal
562+ * @spec RTLM19
561563 */
562564 onGCInterval ( ) : void {
563565 // should remove any tombstoned entries from the underlying map data that have exceeded the GC grace period
564566
567+ // RTLM19a
565568 const keysToDelete : string [ ] = [ ] ;
566569 for ( const [ key , value ] of this . _dataRef . data . entries ( ) ) {
567570 if ( value . tombstone === true && Date . now ( ) - value . tombstonedAt ! >= this . _objects . gcGracePeriod ) {
568- keysToDelete . push ( key ) ;
571+ keysToDelete . push ( key ) ; // RTLM19a1
569572 }
570573 }
571574
@@ -764,14 +767,14 @@ export class LiveMap<T extends API.LiveMapType> extends LiveObject<LiveMapData,
764767 if ( existingEntry ) {
765768 // RTLM7a2
766769 existingEntry . tombstone = false ; // RTLM7a2c
767- existingEntry . tombstonedAt = undefined ;
770+ existingEntry . tombstonedAt = undefined ; // RTLM7a2d
768771 existingEntry . timeserial = opSerial ; // RTLM7a2b
769772 existingEntry . data = liveData ; // RTLM7a2a
770773 } else {
771774 // RTLM7b, RTLM7b1
772775 const newEntry : LiveMapEntry = {
773776 tombstone : false , // RTLM7b2
774- tombstonedAt : undefined ,
777+ tombstonedAt : undefined , // RTLM7b3
775778 timeserial : opSerial ,
776779 data : liveData ,
777780 } ;
@@ -789,7 +792,7 @@ export class LiveMap<T extends API.LiveMapType> extends LiveObject<LiveMapData,
789792 private _applyMapRemove (
790793 op : ObjectsMapOp < ObjectData > , // RTLM8c1
791794 opSerial : string | undefined , // RTLM8c2
792- opTimestamp : number | undefined ,
795+ opTimestamp : number | undefined , // RTLM8c3
793796 ) : LiveMapUpdate < T > | LiveObjectUpdateNoop {
794797 const existingEntry = this . _dataRef . data . get ( op . key ) ;
795798 // RTLM8a
@@ -804,30 +807,33 @@ export class LiveMap<T extends API.LiveMapType> extends LiveObject<LiveMapData,
804807 return { noop : true } ;
805808 }
806809
810+ // RTLM8f
807811 let tombstonedAt : number ;
808812 if ( opTimestamp != null ) {
809- tombstonedAt = opTimestamp ;
813+ tombstonedAt = opTimestamp ; // RTLM8f1
810814 } else {
815+ // RTLM8f2a
811816 this . _client . Logger . logAction (
812817 this . _client . logger ,
813818 this . _client . Logger . LOG_MINOR ,
814819 'LiveMap._applyMapRemove()' ,
815820 `map key has been removed but no "serialTimestamp" found in the message, using local clock instead; key="${ op . key } ", objectId=${ this . getObjectId ( ) } ` ,
816821 ) ;
822+ // RTLM8f2
817823 tombstonedAt = Date . now ( ) ; // best-effort estimate since no timestamp provided by the server
818824 }
819825
820826 if ( existingEntry ) {
821827 // RTLM8a2
822828 existingEntry . tombstone = true ; // RTLM8a2c
823- existingEntry . tombstonedAt = tombstonedAt ;
829+ existingEntry . tombstonedAt = tombstonedAt ; // RTLM8a2d
824830 existingEntry . timeserial = opSerial ; // RTLM8a2b
825831 existingEntry . data = undefined ; // RTLM8a2a
826832 } else {
827833 // RTLM8b, RTLM8b1
828834 const newEntry : LiveMapEntry = {
829835 tombstone : true , // RTLM8b2
830- tombstonedAt : tombstonedAt ,
836+ tombstonedAt : tombstonedAt , // RTLM8b3
831837 timeserial : opSerial ,
832838 data : undefined ,
833839 } ;
@@ -896,14 +902,16 @@ export class LiveMap<T extends API.LiveMapType> extends LiveObject<LiveMapData,
896902 let tombstonedAt : number | undefined ;
897903 if ( entry . tombstone === true ) {
898904 if ( entry . serialTimestamp != null ) {
899- tombstonedAt = entry . serialTimestamp ;
905+ tombstonedAt = entry . serialTimestamp ; // RTLM6c1a
900906 } else {
907+ // RTLM6c1b1
901908 this . _client . Logger . logAction (
902909 this . _client . logger ,
903910 this . _client . Logger . LOG_MINOR ,
904911 'LiveMap._liveMapDataFromMapEntries()' ,
905912 `map key is removed but no "serialTimestamp" found, using local clock instead; key="${ key } ", objectId=${ this . getObjectId ( ) } ` ,
906913 ) ;
914+ // RTLM6c1b
907915 tombstonedAt = Date . now ( ) ; // best-effort estimate since no timestamp provided by the server
908916 }
909917 }
@@ -913,7 +921,7 @@ export class LiveMap<T extends API.LiveMapType> extends LiveObject<LiveMapData,
913921 data : liveData ,
914922 // consider object as tombstoned only if we received an explicit flag stating that. otherwise it exists
915923 tombstone : entry . tombstone === true ,
916- tombstonedAt,
924+ tombstonedAt, // RTLM6c1
917925 } ;
918926
919927 liveMapData . data . set ( key , liveDataEntry ) ;
@@ -950,7 +958,7 @@ export class LiveMap<T extends API.LiveMapType> extends LiveObject<LiveMapData,
950958 }
951959
952960 if ( refObject . isTombstoned ( ) ) {
953- // tombstoned objects must not be surfaced to the end users
961+ // RTLM5d2f3 - tombstoned objects must not be surfaced to the end users
954962 return undefined ;
955963 }
956964
@@ -973,7 +981,7 @@ export class LiveMap<T extends API.LiveMapType> extends LiveObject<LiveMapData,
973981
974982 if ( refObject ?. isTombstoned ( ) ) {
975983 // entry that points to tombstoned object should be considered tombstoned as well
976- return true ;
984+ return true ; // RTLM14c
977985 }
978986 }
979987
0 commit comments