|
|
@ -397,6 +397,11 @@ class MultiWriterIdGenerator: |
|
|
|
# ... persist event ... |
|
|
|
# ... persist event ... |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If we have a list of instances that are allowed to write to this |
|
|
|
|
|
|
|
# stream, make sure we're in it. |
|
|
|
|
|
|
|
if self._writers and self._instance_name not in self._writers: |
|
|
|
|
|
|
|
raise Exception("Tried to allocate stream ID on non-writer") |
|
|
|
|
|
|
|
|
|
|
|
return _MultiWriterCtxManager(self) |
|
|
|
return _MultiWriterCtxManager(self) |
|
|
|
|
|
|
|
|
|
|
|
def get_next_mult(self, n: int): |
|
|
|
def get_next_mult(self, n: int): |
|
|
@ -406,6 +411,11 @@ class MultiWriterIdGenerator: |
|
|
|
# ... persist events ... |
|
|
|
# ... persist events ... |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If we have a list of instances that are allowed to write to this |
|
|
|
|
|
|
|
# stream, make sure we're in it. |
|
|
|
|
|
|
|
if self._writers and self._instance_name not in self._writers: |
|
|
|
|
|
|
|
raise Exception("Tried to allocate stream ID on non-writer") |
|
|
|
|
|
|
|
|
|
|
|
return _MultiWriterCtxManager(self, n) |
|
|
|
return _MultiWriterCtxManager(self, n) |
|
|
|
|
|
|
|
|
|
|
|
def get_next_txn(self, txn: LoggingTransaction): |
|
|
|
def get_next_txn(self, txn: LoggingTransaction): |
|
|
@ -416,6 +426,11 @@ class MultiWriterIdGenerator: |
|
|
|
# ... persist event ... |
|
|
|
# ... persist event ... |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If we have a list of instances that are allowed to write to this |
|
|
|
|
|
|
|
# stream, make sure we're in it. |
|
|
|
|
|
|
|
if self._writers and self._instance_name not in self._writers: |
|
|
|
|
|
|
|
raise Exception("Tried to allocate stream ID on non-writer") |
|
|
|
|
|
|
|
|
|
|
|
next_id = self._load_next_id_txn(txn) |
|
|
|
next_id = self._load_next_id_txn(txn) |
|
|
|
|
|
|
|
|
|
|
|
with self._lock: |
|
|
|
with self._lock: |
|
|
|