当前位置: 首页>>代码示例>>Python>>正文


Python RepceClient.version方法代码示例

本文整理汇总了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))
#.........这里部分代码省略.........
开发者ID:gisayev,项目名称:glusterfs,代码行数:103,代码来源:resource.py

示例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,
                    )

#.........这里部分代码省略.........
开发者ID:hwc56,项目名称:glusterfs,代码行数:103,代码来源:resource.py


注:本文中的repce.RepceClient.version方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。