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


Python ContainerBroker.is_deleted方法代码示例

本文整理汇总了Python中swift.common.db.ContainerBroker.is_deleted方法的典型用法代码示例。如果您正苦于以下问题:Python ContainerBroker.is_deleted方法的具体用法?Python ContainerBroker.is_deleted怎么用?Python ContainerBroker.is_deleted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在swift.common.db.ContainerBroker的用法示例。


在下文中一共展示了ContainerBroker.is_deleted方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: container_audit

# 需要导入模块: from swift.common.db import ContainerBroker [as 别名]
# 或者: from swift.common.db.ContainerBroker import is_deleted [as 别名]
    def container_audit(self, path):
        """
        Audits the given container path

        :param path: the path to a container db
        """
        try:
            if not path.endswith('.db'):
                return
            broker = ContainerBroker(path)
            if not broker.is_deleted():
                info = broker.get_info()
                self.container_passes += 1
                self.logger.debug(_('Audit passed for %s'), broker.db_file)
        except (Exception, Timeout):
            self.container_failures += 1
            self.logger.exception(_('ERROR Could not get container info %s'),
                (broker.db_file))
开发者ID:AnyBucket,项目名称:OpenStack-Install-and-Understand-Guide,代码行数:20,代码来源:auditor.py

示例2: container_audit

# 需要导入模块: from swift.common.db import ContainerBroker [as 别名]
# 或者: from swift.common.db.ContainerBroker import is_deleted [as 别名]
    def container_audit(self, path):
        """
        Audits the given container path

        :param path: the path to a container db
        """
        start_time = time.time()
        try:
            broker = ContainerBroker(path)
            if not broker.is_deleted():
                broker.get_info()
                self.logger.increment('passes')
                self.container_passes += 1
                self.logger.debug(_('Audit passed for %s'), broker.db_file)
        except (Exception, Timeout):
            self.logger.increment('failures')
            self.container_failures += 1
            self.logger.exception(_('ERROR Could not get container info %s'),
                                  broker.db_file)
        self.logger.timing_since('timing', start_time)
开发者ID:iBeacons,项目名称:swift,代码行数:22,代码来源:auditor.py

示例3: container_audit

# 需要导入模块: from swift.common.db import ContainerBroker [as 别名]
# 或者: from swift.common.db.ContainerBroker import is_deleted [as 别名]
    def container_audit(self, path):
        """
        Audits the given container path

        :param path: the path to a container db
        """
        start_time = time.time()
        try:
            if not path.endswith(".db"):
                return
            broker = ContainerBroker(path)
            if not broker.is_deleted():
                info = broker.get_info()
                self.logger.increment("passes")
                self.container_passes += 1
                self.logger.debug(_("Audit passed for %s"), broker.db_file)
        except (Exception, Timeout):
            self.logger.increment("failures")
            self.container_failures += 1
            self.logger.exception(_("ERROR Could not get container info %s"), (broker.db_file))
        self.logger.timing_since("timing", start_time)
开发者ID:hortonworkstest,项目名称:Hadoop-and-Swift-integration,代码行数:23,代码来源:auditor.py

示例4: get_data

# 需要导入模块: from swift.common.db import ContainerBroker [as 别名]
# 或者: from swift.common.db.ContainerBroker import is_deleted [as 别名]
    def get_data(self, db_path):
        """
        Data for generated csv has the following columns:
        Account Hash, Container Name, Object Count, Bytes Used
        This will just collect whether or not the metadata is set
        using a 1 or ''.

        :raises sqlite3.Error: does not catch errors connecting to db
        """
        line_data = None
        broker = ContainerBroker(db_path)
        if not broker.is_deleted():
            info = broker.get_info(include_metadata=bool(self.metadata_keys))
            encoded_container_name = urllib.quote(info['container'])
            line_data = '"%s","%s",%d,%d' % (
                info['account'], encoded_container_name,
                info['object_count'], info['bytes_used'])
            if self.metadata_keys:
                metadata_results = ','.join(
                    [info['metadata'].get(mkey) and '1' or ''
                     for mkey in self.metadata_keys])
                line_data += ',%s' % metadata_results
            line_data += '\n'
        return line_data
开发者ID:dellcloudedge,项目名称:slogging,代码行数:26,代码来源:db_stats_collector.py

示例5: container_sync

# 需要导入模块: from swift.common.db import ContainerBroker [as 别名]
# 或者: from swift.common.db.ContainerBroker import is_deleted [as 别名]
    def container_sync(self, path):
        """
        Checks the given path for a container database, determines if syncing
        is turned on for that database and, if so, sends any updates to the
        other container.

        :param path: the path to a container db
        """
        broker = None
        try:
            broker = ContainerBroker(path)
            info = broker.get_info()
            x, nodes = self.container_ring.get_nodes(info['account'],
                                                     info['container'])
            for ordinal, node in enumerate(nodes):
                if node['ip'] in self._myips and node['port'] == self._myport:
                    break
            else:
                return
            if not broker.is_deleted():
                sync_to = None
                sync_key = None
                sync_point1 = info['x_container_sync_point1']
                sync_point2 = info['x_container_sync_point2']
                for key, (value, timestamp) in broker.metadata.iteritems():
                    if key.lower() == 'x-container-sync-to':
                        sync_to = value
                    elif key.lower() == 'x-container-sync-key':
                        sync_key = value
                if not sync_to or not sync_key:
                    self.container_skips += 1
                    self.logger.increment('skips')
                    return
                sync_to = sync_to.rstrip('/')
                err = validate_sync_to(sync_to, self.allowed_sync_hosts)
                if err:
                    self.logger.info(
                        _('ERROR %(db_file)s: %(validate_sync_to_err)s'),
                        {'db_file': broker.db_file,
                         'validate_sync_to_err': err})
                    self.container_failures += 1
                    self.logger.increment('failures')
                    return
                stop_at = time() + self.container_time
                next_sync_point = None
                while time() < stop_at and sync_point2 < sync_point1:
                    rows = broker.get_items_since(sync_point2, 1)
                    if not rows:
                        break
                    row = rows[0]
                    if row['ROWID'] > sync_point1:
                        break
                    key = hash_path(info['account'], info['container'],
                                    row['name'], raw_digest=True)
                    # This node will only initially sync out one third of the
                    # objects (if 3 replicas, 1/4 if 4, etc.) and will skip
                    # problematic rows as needed in case of faults.
                    # This section will attempt to sync previously skipped
                    # rows in case the previous attempts by any of the nodes
                    # didn't succeed.
                    if not self.container_sync_row(row, sync_to, sync_key,
                                                   broker, info):
                        if not next_sync_point:
                            next_sync_point = sync_point2
                    sync_point2 = row['ROWID']
                    broker.set_x_container_sync_points(None, sync_point2)
                if next_sync_point:
                    broker.set_x_container_sync_points(None, next_sync_point)
                while time() < stop_at:
                    rows = broker.get_items_since(sync_point1, 1)
                    if not rows:
                        break
                    row = rows[0]
                    key = hash_path(info['account'], info['container'],
                                    row['name'], raw_digest=True)
                    # This node will only initially sync out one third of the
                    # objects (if 3 replicas, 1/4 if 4, etc.). It'll come back
                    # around to the section above and attempt to sync
                    # previously skipped rows in case the other nodes didn't
                    # succeed or in case it failed to do so the first time.
                    if unpack_from('>I', key)[0] % \
                            len(nodes) == ordinal:
                        self.container_sync_row(row, sync_to, sync_key,
                                                broker, info)
                    sync_point1 = row['ROWID']
                    broker.set_x_container_sync_points(sync_point1, None)
                self.container_syncs += 1
                self.logger.increment('syncs')
        except (Exception, Timeout) as err:
            self.container_failures += 1
            self.logger.increment('failures')
            self.logger.exception(_('ERROR Syncing %s'),
                                  broker.db_file if broker else path)
开发者ID:Awingu,项目名称:swift,代码行数:95,代码来源:sync.py

示例6: container_sync

# 需要导入模块: from swift.common.db import ContainerBroker [as 别名]
# 或者: from swift.common.db.ContainerBroker import is_deleted [as 别名]
    def container_sync(self, path):
        """
        Checks the given path for a container database, determines if syncing
        is turned on for that database and, if so, sends any updates to the
        other container.

        :param path: the path to a container db
        """
        try:
            if not path.endswith(".db"):
                return
            broker = ContainerBroker(path)
            info = broker.get_info()
            x, nodes = self.container_ring.get_nodes(info["account"], info["container"])
            for ordinal, node in enumerate(nodes):
                if node["ip"] in self._myips and node["port"] == self._myport:
                    break
            else:
                return
            if not broker.is_deleted():
                sync_to = None
                sync_key = None
                sync_point1 = info["x_container_sync_point1"]
                sync_point2 = info["x_container_sync_point2"]
                for key, (value, timestamp) in broker.metadata.iteritems():
                    if key.lower() == "x-container-sync-to":
                        sync_to = value
                    elif key.lower() == "x-container-sync-key":
                        sync_key = value
                if not sync_to or not sync_key:
                    self.container_skips += 1
                    return
                sync_to = sync_to.rstrip("/")
                err = validate_sync_to(sync_to, self.allowed_sync_hosts)
                if err:
                    self.logger.info(
                        _("ERROR %(db_file)s: %(validate_sync_to_err)s"),
                        {"db_file": broker.db_file, "validate_sync_to_err": err},
                    )
                    self.container_failures += 1
                    return
                stop_at = time() + self.container_time
                while time() < stop_at and sync_point2 < sync_point1:
                    rows = broker.get_items_since(sync_point2, 1)
                    if not rows:
                        break
                    row = rows[0]
                    if row["ROWID"] >= sync_point1:
                        break
                    key = hash_path(info["account"], info["container"], row["name"], raw_digest=True)
                    # This node will only intially sync out one third of the
                    # objects (if 3 replicas, 1/4 if 4, etc.). This section
                    # will attempt to sync previously skipped rows in case the
                    # other nodes didn't succeed.
                    if unpack_from(">I", key)[0] % len(nodes) != ordinal:
                        if not self.container_sync_row(row, sync_to, sync_key, broker, info):
                            return
                    sync_point2 = row["ROWID"]
                    broker.set_x_container_sync_points(None, sync_point2)
                while time() < stop_at:
                    rows = broker.get_items_since(sync_point1, 1)
                    if not rows:
                        break
                    row = rows[0]
                    key = hash_path(info["account"], info["container"], row["name"], raw_digest=True)
                    # This node will only intially sync out one third of the
                    # objects (if 3 replicas, 1/4 if 4, etc.). It'll come back
                    # around to the section above and attempt to sync
                    # previously skipped rows in case the other nodes didn't
                    # succeed.
                    if unpack_from(">I", key)[0] % len(nodes) == ordinal:
                        if not self.container_sync_row(row, sync_to, sync_key, broker, info):
                            return
                    sync_point1 = row["ROWID"]
                    broker.set_x_container_sync_points(sync_point1, None)
                self.container_syncs += 1
        except (Exception, Timeout), err:
            self.container_failures += 1
            self.logger.exception(_("ERROR Syncing %s"), (broker.db_file))
开发者ID:Nupta,项目名称:swift,代码行数:81,代码来源:sync.py


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