Skip to content

Commit 79d2cfb

Browse files
author
Tim Vaillancourt
committed
filename simplifying for ReplsetHandler.py and ShardingHandler.py
1 parent 0f3a9e2 commit 79d2cfb

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

MongoBackup/Backup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from Methods import Mongodumper
1414
from Notify import NotifyNSCA
1515
from Oplog import OplogTailer, OplogResolver
16-
from ReplsetHandler import ReplsetHandler, ReplsetHandlerSharded
17-
from ShardingHandler import ShardingHandler
16+
from Replset import Replset, ReplsetSharded
17+
from Sharding import Sharding
1818
from Upload import UploadS3
1919

2020

@@ -185,7 +185,7 @@ def run(self):
185185

186186
# get shard secondary
187187
try:
188-
self.replset = ReplsetHandler(
188+
self.replset = Replset(
189189
self.db,
190190
self.user,
191191
self.password,
@@ -221,7 +221,7 @@ def run(self):
221221

222222
# connect to balancer and stop it
223223
try:
224-
self.sharding = ShardingHandler(
224+
self.sharding = Sharding(
225225
self.db,
226226
self.user,
227227
self.password,
@@ -236,7 +236,7 @@ def run(self):
236236

237237
# get shard secondaries
238238
try:
239-
self.replset = ReplsetHandlerSharded(
239+
self.replset = ReplsetSharded(
240240
self.sharding,
241241
self.db,
242242
self.user,

MongoBackup/ReplsetHandler.py renamed to MongoBackup/Replset.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
from time import mktime
55

66
from Common import DB
7-
from ShardingHandler import ShardingHandler
7+
from Sharding import Sharding
88

99

10-
class ReplsetHandler:
10+
class Replset:
1111
def __init__(self, db, user, password, authdb, max_lag_secs):
1212
self.db = db
1313
self.user = user
@@ -120,7 +120,7 @@ def find_secondary(self):
120120
return secondary
121121

122122

123-
class ReplsetHandlerSharded:
123+
class ReplsetSharded:
124124
def __init__(self, sharding, db, user, password, authdb, max_lag_secs):
125125
self.sharding = sharding
126126
self.db = db
@@ -131,9 +131,9 @@ def __init__(self, sharding, db, user, password, authdb, max_lag_secs):
131131

132132
self.replset = None
133133

134-
# Check ShardingHandler class:
135-
if not self.sharding.__class__.__name__ == "ShardingHandler":
136-
raise Exception, "'sharding' field is an instance of %s, not 'ShardingHandler'!" % self.sharding.__class__.__name__, None
134+
# Check Sharding class:
135+
if not self.sharding.__class__.__name__ == "Sharding":
136+
raise Exception, "'sharding' field is an instance of %s, not 'Sharding'!" % self.sharding.__class__.__name__, None
137137

138138
# Get a DB connection
139139
try:
@@ -155,7 +155,7 @@ def find_secondaries(self):
155155
host, port = members.split(',')[0].split(":")
156156

157157
db = DB(host, port, self.user, self.password, self.authdb)
158-
self.replset = ReplsetHandler(db, self.user, self.password, self.authdb, self.max_lag_secs)
158+
self.replset = Replset(db, self.user, self.password, self.authdb, self.max_lag_secs)
159159
secondary = self.replset.find_secondary()
160160
shard_secondaries[shard_name] = secondary
161161

MongoBackup/ShardingHandler.py renamed to MongoBackup/Sharding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from time import sleep
44

55

6-
class ShardingHandler:
6+
class Sharding:
77
def __init__(self, db, user=None, password=None, authdb='admin', balancer_wait_secs=300, balancer_sleep=10):
88
self.db = db
99
self.user = user

0 commit comments

Comments
 (0)