Skip to content

Commit 1842248

Browse files
author
Arthur Gautier
committed
gtid: implement various evaluation methods for gtidset
Signed-off-by: Arthur Gautier <baloo@gandi.net>
1 parent 022fd34 commit 1842248

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pymysqlreplication/gtid.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ def merge_gtid(self, gtid):
287287
self.gtids = new_gtids
288288

289289
def __contains__(self, other):
290+
if isinstance(other, GtidSet):
291+
return all(other_gtid in self.gtids for other_gtid in other.gtids)
290292
if isinstance(other, Gtid):
291293
return any(other in x for x in self.gtids)
292294
raise NotImplementedError
@@ -296,6 +298,13 @@ def __add__(self, other):
296298
new = GtidSet(self.gtids)
297299
new.merge_gtid(other)
298300
return new
301+
302+
if isinstance(other, GtidSet):
303+
new = GtidSet(self.gtids)
304+
for gtid in other.gtids:
305+
new.merge_gtid(gtid)
306+
return new
307+
299308
raise NotImplementedError
300309

301310
def __str__(self):

0 commit comments

Comments
 (0)