1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-30 19:42:05 +03:00

KCC: shift ReplInfo, MAX_DWORD from kcc.kcc_utils to kcc.graph

They are only used in graph.py.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall
2015-05-05 11:12:30 +12:00
committed by Andrew Bartlett
parent a6b7a9abc3
commit 004a9ba6b1
2 changed files with 29 additions and 24 deletions

View File

@ -28,8 +28,35 @@ from samba.dcerpc import misc
from samba.kcc.debug import DEBUG, DEBUG_FN
from samba.kcc.kcc_utils import MAX_DWORD
from samba.kcc.kcc_utils import ReplInfo, total_schedule
MAX_DWORD = 2 ** 32 - 1
class ReplInfo(object):
def __init__(self):
self.cost = 0
self.interval = 0
self.options = 0
self.schedule = None
def total_schedule(schedule):
"""Return the total number of 15 minute windows in which the schedule
is set to replicate in a week. If the schedule is None it is
assumed that the replication will happen in every 15 minute
window.
This is essentially a bit population count.
"""
if schedule is None:
return 84 * 8 # 84 bytes = 84 * 8 bits
total = 0
for byte in schedule:
while byte != 0:
total += byte & 1
byte >>= 1
return total
def convert_schedule_to_repltimes(schedule):

View File

@ -2111,19 +2111,9 @@ class KCCFailedObject(object):
self.dns_name = dns_name
class ReplInfo(object):
def __init__(self):
self.cost = 0
self.interval = 0
self.options = 0
self.schedule = None
##################################################
# Global Functions and Variables
##################################################
MAX_DWORD = 2 ** 32 - 1
def get_dsa_config_rep(dsa):
# Find configuration NC replica for the DSA
@ -2140,18 +2130,6 @@ def sort_dsa_by_guid(dsa1, dsa2):
return cmp(ndr_pack(dsa1.dsa_guid), ndr_pack(dsa2.dsa_guid))
def total_schedule(schedule):
if schedule is None:
return 84 * 8 # 84 bytes = 84 * 8 bits
total = 0
for byte in schedule:
while byte != 0:
total += byte & 1
byte >>= 1
return total
def new_connection_schedule():
"""Create a default schedule for an NTDSConnection or Sitelink. This
is packed differently from the repltimes schedule used elsewhere