forked from Decentrala/lgit
rename pull functions to fetch and add new pull function
This commit is contained in:
parent
334716f370
commit
e19fc234f4
43
lgit.py
43
lgit.py
@ -256,8 +256,8 @@ l dc values from base
|
||||
|
||||
return basecopy
|
||||
|
||||
def pullfrom(self, source)->int:
|
||||
pulled = 0
|
||||
def fetchfrom(self, source)->int:
|
||||
fetched = 0
|
||||
basecopy = self.getbasecopy(source)
|
||||
|
||||
self.refreshtotal(basecopy)
|
||||
@ -273,9 +273,9 @@ l dc values from base
|
||||
attributes = log['attributes']
|
||||
|
||||
self.setlog(attributes, basecopy)
|
||||
pulled += 1
|
||||
fetched += 1
|
||||
|
||||
return pulled
|
||||
return fetched
|
||||
|
||||
def applyfrom(self, source)->int:
|
||||
basecopy = self.getbasecopy(source)
|
||||
@ -284,6 +284,12 @@ l dc values from base
|
||||
|
||||
return appliedlogs
|
||||
|
||||
def pullfrom(self, source)->int:
|
||||
self.fetchfrom(source)
|
||||
applied = self.applyfrom(source)
|
||||
|
||||
return applied
|
||||
|
||||
def lastpwchangenow(self):
|
||||
'''
|
||||
Return time of last password change for the user set to current time
|
||||
@ -304,22 +310,22 @@ class lgit():
|
||||
self.servers.remove(log_server)
|
||||
return self.servers
|
||||
|
||||
def pullfromall(self, log_server: logserver)->int:
|
||||
pulledlogs = 0
|
||||
def fetchfromall(self, log_server: logserver)->int:
|
||||
fetchedlogs = 0
|
||||
|
||||
for source in self.servers:
|
||||
if source != log_server:
|
||||
pulledlogs += log_server.pullfrom(source)
|
||||
fetchedlogs += log_server.fetchedfrom(source)
|
||||
|
||||
return pulledlogs
|
||||
|
||||
def pull(self)->int:
|
||||
pulledlogs = 0
|
||||
def fetch(self)->int:
|
||||
fetchedlogs = 0
|
||||
|
||||
for server in self.servers:
|
||||
pulledlogs += self.pullfromall(server)
|
||||
fetchedlogs += self.fetchfromall(server)
|
||||
|
||||
return pulledlogs
|
||||
return fetchedlogs
|
||||
|
||||
def applyfromall(self, log_server: logserver)->int:
|
||||
appliedlogs = 0
|
||||
@ -338,8 +344,19 @@ class lgit():
|
||||
|
||||
return appliedlogs
|
||||
|
||||
def pullfromall(self, log_server: logserver)->int:
|
||||
self.fetchfromall(log_server)
|
||||
pulled = self.applyfromall(log_server)
|
||||
|
||||
return pulled
|
||||
|
||||
def pull(self)->int:
|
||||
self.fetch()
|
||||
pulled = self.apply()
|
||||
|
||||
return pulled
|
||||
|
||||
def sync(self)->int:
|
||||
pulledlogs = self.pull()
|
||||
appliedlogs = self.apply()
|
||||
|
||||
return appliedlogs
|
||||
return pulledlogs
|
||||
|
Loading…
Reference in New Issue
Block a user