本文整理汇总了Python中repce.RepceClient.version方法的典型用法代码示例。如果您正苦于以下问题:Python RepceClient.version方法的具体用法?Python RepceClient.version怎么用?Python RepceClient.version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类repce.RepceClient
的用法示例。
在下文中一共展示了RepceClient.version方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: service_loop
# 需要导入模块: from repce import RepceClient [as 别名]
# 或者: from repce.RepceClient import version [as 别名]
def service_loop(self, *args):
"""enter service loop
- if slave given, instantiate GMaster and
pass control to that instance, which implements
master behavior
- else do that's what's inherited
"""
if args:
slave = args[0]
if gconf.local_path:
class brickserver(FILE.FILEServer):
local_path = gconf.local_path
aggregated = self.server
@classmethod
def entries(cls, path):
e = super(brickserver, cls).entries(path)
# on the brick don't mess with /.glusterfs
if path == '.':
try:
e.remove('.glusterfs')
except ValueError:
pass
return e
@classmethod
def lstat(cls, e):
""" path based backend stat """
return super(brickserver, cls).lstat(e)
@classmethod
def gfid(cls, e):
""" path based backend gfid fetch """
return super(brickserver, cls).gfid(e)
@classmethod
def linkto_check(cls, e):
return super(brickserver, cls).linkto_check(e)
if gconf.slave_id:
# define {,set_}xtime in slave, thus preempting
# the call to remote, so that it takes data from
# the local brick
slave.server.xtime = types.MethodType(
lambda _self, path, uuid: (
brickserver.xtime(path,
uuid + '.' + gconf.slave_id)
),
slave.server)
slave.server.stime = types.MethodType(
lambda _self, path, uuid: (
brickserver.stime(path,
uuid + '.' + gconf.slave_id)
),
slave.server)
slave.server.set_stime = types.MethodType(
lambda _self, path, uuid, mark: (
brickserver.set_stime(path,
uuid + '.' + gconf.slave_id,
mark)
),
slave.server)
(g1, g2, g3) = self.gmaster_instantiate_tuple(slave)
g1.master.server = brickserver
g2.master.server = brickserver
g3.master.server = brickserver
else:
(g1, g2, g3) = self.gmaster_instantiate_tuple(slave)
g1.master.server.aggregated = gmaster.master.server
g2.master.server.aggregated = gmaster.master.server
g3.master.server.aggregated = gmaster.master.server
# bad bad bad: bad way to do things like this
# need to make this elegant
# register the crawlers and start crawling
# g1 ==> Xsync, g2 ==> config.change_detector(changelog by default)
# g3 ==> changelog History
(inf, ouf, ra, wa) = gconf.rpc_fd.split(',')
os.close(int(ra))
os.close(int(wa))
changelog_agent = RepceClient(int(inf), int(ouf))
rv = changelog_agent.version()
if int(rv) != CHANGELOG_AGENT_CLIENT_VERSION:
raise GsyncdError(
"RePCe major version mismatch(changelog agent): "
"local %s, remote %s" %
(CHANGELOG_AGENT_CLIENT_VERSION, rv))
g1.register()
try:
(workdir, logfile) = g2.setup_working_dir()
# register with the changelog library
# 9 == log level (DEBUG)
# 5 == connection retries
changelog_agent.register(gconf.local_path,
workdir, logfile, 9, 5)
g2.register(changelog_agent)
g3.register(changelog_agent)
except ChangelogException as e:
logging.debug("Changelog register failed: %s - %s" %
(e.errno, e.strerror))
#.........这里部分代码省略.........
示例2: service_loop
# 需要导入模块: from repce import RepceClient [as 别名]
# 或者: from repce.RepceClient import version [as 别名]
def service_loop(self, *args):
"""enter service loop
- if slave given, instantiate GMaster and
pass control to that instance, which implements
master behavior
- else do that's what's inherited
"""
if args:
slave = args[0]
if gconf.local_path:
class brickserver(FILE.FILEServer):
local_path = gconf.local_path
aggregated = self.server
@classmethod
def entries(cls, path):
e = super(brickserver, cls).entries(path)
# on the brick don't mess with /.glusterfs
if path == ".":
try:
e.remove(".glusterfs")
except ValueError:
pass
return e
@classmethod
def lstat(cls, e):
""" path based backend stat """
return super(brickserver, cls).lstat(e)
@classmethod
def gfid(cls, e):
""" path based backend gfid fetch """
return super(brickserver, cls).gfid(e)
@classmethod
def linkto_check(cls, e):
return super(brickserver, cls).linkto_check(e)
if gconf.slave_id:
# define {,set_}xtime in slave, thus preempting
# the call to remote, so that it takes data from
# the local brick
slave.server.xtime = types.MethodType(
lambda _self, path, uuid: (brickserver.xtime(path, uuid + "." + gconf.slave_id)), slave.server
)
slave.server.stime = types.MethodType(
lambda _self, path, uuid: (brickserver.stime(path, uuid + "." + gconf.slave_id)), slave.server
)
slave.server.set_stime = types.MethodType(
lambda _self, path, uuid, mark: (
brickserver.set_stime(path, uuid + "." + gconf.slave_id, mark)
),
slave.server,
)
(g1, g2, g3) = self.gmaster_instantiate_tuple(slave)
g1.master.server = brickserver
g2.master.server = brickserver
g3.master.server = brickserver
else:
(g1, g2, g3) = self.gmaster_instantiate_tuple(slave)
g1.master.server.aggregated = gmaster.master.server
g2.master.server.aggregated = gmaster.master.server
g3.master.server.aggregated = gmaster.master.server
# bad bad bad: bad way to do things like this
# need to make this elegant
# register the crawlers and start crawling
# g1 ==> Xsync, g2 ==> config.change_detector(changelog by default)
# g3 ==> changelog History
changelog_register_failed = False
(inf, ouf, ra, wa) = gconf.rpc_fd.split(",")
os.close(int(ra))
os.close(int(wa))
changelog_agent = RepceClient(int(inf), int(ouf))
rv = changelog_agent.version()
if int(rv) != CHANGELOG_AGENT_CLIENT_VERSION:
raise GsyncdError(
"RePCe major version mismatch(changelog agent): "
"local %s, remote %s" % (CHANGELOG_AGENT_CLIENT_VERSION, rv)
)
try:
workdir = g2.setup_working_dir()
# Register only when change_detector is not set to
# xsync, else agent will generate changelog files
# in .processing directory of working dir
if gconf.change_detector != "xsync":
# register with the changelog library
# 9 == log level (DEBUG)
# 5 == connection retries
changelog_agent.register(
gconf.local_path,
workdir,
gconf.changelog_log_file,
g2.CHANGELOG_LOG_LEVEL,
g2.CHANGELOG_CONN_RETRIES,
)
#.........这里部分代码省略.........