def __init__(self, record_class, sequenced_item_class=SequencedItem, contiguous_record_ids=False, application_name=None, pipeline_id=DEFAULT_PIPELINE_ID): self.record_class = record_class self.sequenced_item_class = sequenced_item_class self.field_names = SequencedItemFieldNames(self.sequenced_item_class) if hasattr(self.record_class, 'id'): self.notification_id_name = 'id' elif hasattr(self.record_class, 'notification_id'): self.notification_id_name = 'notification_id' else: self.notification_id_name = '' self.contiguous_record_ids = contiguous_record_ids and self.notification_id_name if hasattr(self.record_class, 'application_name'): assert application_name, "'application_name' not set when required" assert contiguous_record_ids, "'contiguous_record_ids' not set when required" self.application_name = application_name if hasattr(self.record_class, 'pipeline_id'): assert hasattr( self.record_class, 'application_name'), "'application_name' column not defined" self.pipeline_id = pipeline_id
def __init__( self, record_class: type, sequenced_item_class: Type[NamedTuple] = SequencedItem, # type: ignore contiguous_record_ids: bool = False, application_name: str = '', pipeline_id: int = DEFAULT_PIPELINE_ID, **kwargs: Any ): self._record_class = record_class self.sequenced_item_class = sequenced_item_class self.field_names = SequencedItemFieldNames(self.sequenced_item_class) if hasattr(self.record_class, "id"): self.notification_id_name = "id" elif hasattr(self.record_class, "notification_id"): self.notification_id_name = "notification_id" else: self.notification_id_name = "" self.contiguous_record_ids = bool( contiguous_record_ids and self.notification_id_name ) if hasattr(self.record_class, "application_name"): assert application_name, "'application_name' not set when required" assert ( contiguous_record_ids ), "'contiguous_record_ids' not set when required" self.application_name = application_name if hasattr(self.record_class, "pipeline_id"): assert hasattr( self.record_class, "application_name" ), "'application_name' column not defined" self._pipeline_id = pipeline_id
def __init__( self, sequenced_item_class: Optional[Type[NamedTuple]] = None, sequence_id_attr_name: Optional[str] = None, position_attr_name: Optional[str] = None, json_encoder_class: Optional[Type[ObjectJSONEncoder]] = None, sort_keys: bool = False, json_decoder_class: Optional[Type[ObjectJSONDecoder]] = None, cipher: Optional[AESCipher] = None, compressor: Any = None, other_attr_names: Tuple[str, ...] = (), ): if sequenced_item_class is not None: self.sequenced_item_class = sequenced_item_class else: self.sequenced_item_class = SequencedItem # type: ignore self.json_encoder_class = json_encoder_class or ObjectJSONEncoder self.json_encoder = self.json_encoder_class(sort_keys=sort_keys) self.json_decoder_class = json_decoder_class or ObjectJSONDecoder self.json_decoder = self.json_decoder_class() self.cipher = cipher self.compressor = compressor self.field_names = SequencedItemFieldNames(self.sequenced_item_class) self.sequence_id_attr_name = (sequence_id_attr_name or self.field_names.sequence_id) self.position_attr_name = position_attr_name or self.field_names.position self.other_attr_names = other_attr_names or self.field_names.other_names
def __init__(self, record_class, sequenced_item_class=SequencedItem, contiguous_record_ids=False): self.record_class = record_class self.sequenced_item_class = sequenced_item_class self.field_names = SequencedItemFieldNames(self.sequenced_item_class) self.contiguous_record_ids = contiguous_record_ids and hasattr( self.record_class, 'id')
def __init__(self, sequenced_item_class=SequencedItem, sequence_id_attr_name=None, position_attr_name=None, json_encoder_class=None, json_decoder_class=None, cipher=None, other_attr_names=()): self.sequenced_item_class = sequenced_item_class self.json_encoder_class = json_encoder_class or ObjectJSONEncoder self.json_decoder_class = json_decoder_class or ObjectJSONDecoder self.cipher = cipher self.field_names = SequencedItemFieldNames(self.sequenced_item_class) self.sequence_id_attr_name = sequence_id_attr_name or self.field_names.sequence_id self.position_attr_name = position_attr_name or self.field_names.position self.other_attr_names = other_attr_names or self.field_names.other_names
def __init__(self, sequenced_item_class, event_sequence_id_attr, event_position_attr, json_encoder_class=ObjectJSONEncoder, json_decoder_class=ObjectJSONDecoder, always_encrypt=False, cipher=None): self.sequenced_item_class = sequenced_item_class self.event_sequence_id_attr = event_sequence_id_attr self.event_position_attr = event_position_attr self.json_encoder_class = json_encoder_class self.json_decoder_class = json_decoder_class self.cipher = cipher self.always_encrypt = always_encrypt self.field_names = SequencedItemFieldNames(self.sequenced_item_class)
def __init__(self, sequenced_item_class=SequencedItem, sequence_id_attr_name=None, position_attr_name=None, json_encoder_class=ObjectJSONEncoder, json_decoder_class=ObjectJSONDecoder, always_encrypt=False, cipher=None, other_attr_names=()): self.sequenced_item_class = sequenced_item_class self.json_encoder_class = json_encoder_class self.json_decoder_class = json_decoder_class self.cipher = cipher self.always_encrypt = always_encrypt self.field_names = SequencedItemFieldNames(self.sequenced_item_class) self.sequence_id_attr_name = sequence_id_attr_name or self.field_names[self.SEQUENCE_ID_FIELD_INDEX] self.position_attr_name = position_attr_name or self.field_names[self.POSITION_FIELD_INDEX] self.other_attr_names = other_attr_names or self.field_names[4:]
def __init__(self, record_class, sequenced_item_class=SequencedItem, contiguous_record_ids=False, application_id=None, pipeline_id=-1): self.record_class = record_class self.sequenced_item_class = sequenced_item_class self.field_names = SequencedItemFieldNames(self.sequenced_item_class) self.contiguous_record_ids = contiguous_record_ids and hasattr( self.record_class, 'id') if hasattr(self.record_class, 'application_id'): assert application_id, "'application_id' not set when required" assert contiguous_record_ids, "'contiguous_record_ids' not set when required" self.application_id = application_id if hasattr(self.record_class, 'pipeline_id'): assert hasattr( self.record_class, 'application_id'), "'application_id' column not defined" self.pipeline_id = pipeline_id
def __init__(self, active_record_class, sequenced_item_class): self.active_record_class = active_record_class self.sequenced_item_class = sequenced_item_class self.field_names = SequencedItemFieldNames(self.sequenced_item_class)