93 |
93 |
94 def init(self): |
94 def init(self): |
95 """method called by the repository once ready to handle request""" |
95 """method called by the repository once ready to handle request""" |
96 pass |
96 pass |
97 |
97 |
98 def backup_file(self, backupfile=None, timestamp=None): |
98 def backup(self, backupfile): |
99 """return a unique file name for a source's dump |
|
100 |
|
101 either backupfile or timestamp (used to generated a backup file name if |
|
102 needed) should be specified. |
|
103 """ |
|
104 if backupfile is None: |
|
105 config = self.repo.config |
|
106 return join(config.appdatahome, 'backup', |
|
107 '%s-%s-%s.dump' % (config.appid, timestamp, self.uri)) |
|
108 # backup file is the system database backup file, add uri to it if not |
|
109 # already there |
|
110 base, ext = splitext(backupfile) |
|
111 if not base.endswith('-%s' % self.uri): |
|
112 return '%s-%s%s' % (base, self.uri, ext) |
|
113 return backupfile |
|
114 |
|
115 def backup(self, confirm, backupfile=None, timestamp=None, |
|
116 askconfirm=False): |
|
117 """method called to create a backup of source's data""" |
99 """method called to create a backup of source's data""" |
118 pass |
100 pass |
119 |
101 |
120 def restore(self, confirm, backupfile=None, timestamp=None, drop=True, |
102 def restore(self, backupfile): |
121 askconfirm=False): |
|
122 """method called to restore a backup of source's data""" |
103 """method called to restore a backup of source's data""" |
123 pass |
104 pass |
124 |
105 |
125 def close_pool_connections(self): |
106 def close_pool_connections(self): |
126 for pool in self.repo.pools: |
107 for pool in self.repo.pools: |