77from splitio .util .time import utctime_ms
88from splitio .push .sse import SSE_EVENT_ERROR , SSE_EVENT_MESSAGE
99
10-
1110class EventType (Enum ):
1211 """Event type enumeration."""
1312
@@ -326,9 +325,12 @@ def change_number(self):
326325class SplitChangeUpdate (BaseUpdate ):
327326 """Split Change notification."""
328327
329- def __init__ (self , channel , timestamp , change_number ):
328+ def __init__ (self , channel , timestamp , change_number , previous_change_number , split_definition , compression ):
330329 """Class constructor."""
331330 BaseUpdate .__init__ (self , channel , timestamp , change_number )
331+ self ._previous_change_number = previous_change_number
332+ self ._split_definition = split_definition
333+ self ._compression = compression
332334
333335 @property
334336 def update_type (self ): # pylint:disable=no-self-use
@@ -340,6 +342,36 @@ def update_type(self): # pylint:disable=no-self-use
340342 """
341343 return UpdateType .SPLIT_UPDATE
342344
345+ @property
346+ def previous_change_number (self ): # pylint:disable=no-self-use
347+ """
348+ Return previous change number
349+
350+ :returns: The previous change number
351+ :rtype: int
352+ """
353+ return self ._previous_change_number
354+
355+ @property
356+ def split_definition (self ): # pylint:disable=no-self-use
357+ """
358+ Return split definition
359+
360+ :returns: The new split definition
361+ :rtype: str
362+ """
363+ return self ._split_definition
364+
365+ @property
366+ def compression (self ): # pylint:disable=no-self-use
367+ """
368+ Return previous compression type
369+
370+ :returns: The compression type
371+ :rtype: int
372+ """
373+ return self ._compression
374+
343375 def __str__ (self ):
344376 """Return string representation."""
345377 return "SplitChange - changeNumber=%d" % (self .change_number )
@@ -472,7 +504,7 @@ def _parse_update(channel, timestamp, data):
472504 update_type = UpdateType (data ['type' ])
473505 change_number = data ['changeNumber' ]
474506 if update_type == UpdateType .SPLIT_UPDATE :
475- return SplitChangeUpdate (channel , timestamp , change_number )
507+ return SplitChangeUpdate (channel , timestamp , change_number , data . get ( 'pcn' ), data . get ( 'd' ), data . get ( 'c' ) )
476508 elif update_type == UpdateType .SPLIT_KILL :
477509 return SplitKillUpdate (channel , timestamp , change_number ,
478510 data ['splitName' ], data ['defaultTreatment' ])
0 commit comments