add push and applyto functions
This commit is contained in:
parent
e19fc234f4
commit
49cb37eda2
34
lgit.py
34
lgit.py
@ -284,12 +284,25 @@ l dc values from base
|
||||
|
||||
return appliedlogs
|
||||
|
||||
def applyto(self, destination)->int:
|
||||
basecopy = destination.getbasecopy(self)
|
||||
|
||||
appliedlogs = destination.applylogs(basecopy)
|
||||
|
||||
return appliedlogs
|
||||
|
||||
def pullfrom(self, source)->int:
|
||||
self.fetchfrom(source)
|
||||
applied = self.applyfrom(source)
|
||||
|
||||
return applied
|
||||
|
||||
def pushto(self, destination)->int:
|
||||
destination.pullfrom(self)
|
||||
pushed = destination.pullfrom(self)
|
||||
|
||||
return pushed
|
||||
|
||||
def lastpwchangenow(self):
|
||||
'''
|
||||
Return time of last password change for the user set to current time
|
||||
@ -336,6 +349,15 @@ class lgit():
|
||||
|
||||
return appliedlogs
|
||||
|
||||
def applytoall(self, log_server: logserver)->int:
|
||||
appliedlogs = 0
|
||||
|
||||
for destination in self.servers:
|
||||
if destination != log_server:
|
||||
appliedlogs += log_server.applyto(destination)
|
||||
|
||||
return appliedlogs
|
||||
|
||||
def apply(self)->int:
|
||||
appliedlogs = 0
|
||||
|
||||
@ -350,12 +372,24 @@ class lgit():
|
||||
|
||||
return pulled
|
||||
|
||||
def pushtoall(self, log_server: logserver)->int:
|
||||
pushed = 0
|
||||
|
||||
for destination in self.servers:
|
||||
if destination != log_server:
|
||||
pushed += log_server.pushto(destination)
|
||||
|
||||
return pushed
|
||||
|
||||
def pull(self)->int:
|
||||
self.fetch()
|
||||
pulled = self.apply()
|
||||
|
||||
return pulled
|
||||
|
||||
def push(self)->int:
|
||||
return self.pull()
|
||||
|
||||
def sync(self)->int:
|
||||
pulledlogs = self.pull()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user