• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.uint64_to_hex函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utils.uint64_to_hex函数的典型用法代码示例。如果您正苦于以下问题:Python uint64_to_hex函数的具体用法?Python uint64_to_hex怎么用?Python uint64_to_hex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _insert_values

  def _insert_values(self, vttablet, id_offset, msg, keyspace_id, num_values):
    """Inserts values into MySQL along with the required routing comments.

    Args:
      vttablet: the Tablet instance to modify.
      id_offset: offset for the value of `id` column.
      msg: the value of `msg` column.
      keyspace_id: the value of `keyspace_id` column.
      num_values: number of rows to be inserted.
    """

    # For maximum performance, multiple values are inserted in one statement.
    # However, when the statements are too long, queries will timeout and
    # vttablet will kill them. Therefore, we chunk it into multiple statements.
    def chunks(full_list, n):
      """Yield successive n-sized chunks from full_list."""
      for i in xrange(0, len(full_list), n):
        yield full_list[i:i+n]

    max_chunk_size = 100*1000
    k = utils.uint64_to_hex(keyspace_id)
    for chunk in chunks(range(1, num_values+1), max_chunk_size):
      logging.debug('Inserting values for range [%d, %d].', chunk[0], chunk[-1])
      values_str = ''
      for i in chunk:
        if i != chunk[0]:
          values_str += ','
        values_str += "(%d, '%s', 0x%x)" % (id_offset + i, msg, keyspace_id)
      vttablet.mquery(
          'vt_test_keyspace', [
              'begin',
              'insert into worker_test(id, msg, keyspace_id) values%s '
              '/* vtgate:: keyspace_id:%s */' % (values_str, k),
              'commit'],
          write=True)
开发者ID:DalianDragon,项目名称:vitess,代码行数:35,代码来源:worker.py


示例2: _insert_multi_value

  def _insert_multi_value(self, tablet_obj, table, mids, msgs, keyspace_ids):
    """Generate multi-shard insert statements."""
    comma_sep = ','
    querystr = ('insert into %s(parent_id, id, msg, custom_ksid_col) values'
                %(table))
    values_str = ''
    id_str = '/* id:'
    ksid_str = ''

    for mid, msg, keyspace_id in zip(mids, msgs, keyspace_ids):
      ksid_str += utils.uint64_to_hex(keyspace_id)+comma_sep
      values_str += ('(%d, %d, "%s", 0x%x)' %
                     (fixed_parent_id, mid, msg, keyspace_id) + comma_sep)
      id_str += '%d' % (mid) + comma_sep

    values_str = values_str.rstrip(comma_sep)
    values_str += '/* vtgate:: keyspace_id:%s */ ' %(ksid_str.rstrip(comma_sep))
    values_str += id_str.rstrip(comma_sep) + '*/'

    querystr += values_str
    tablet_obj.mquery(
        'vt_test_keyspace',
        ['begin',
         querystr,
         'commit'],
        write=True)
开发者ID:alainjobart,项目名称:vitess,代码行数:26,代码来源:base_sharding.py


示例3: _insert_value

 def _insert_value(self, tablet, table, id, msg, keyspace_id):
   k = utils.uint64_to_hex(keyspace_id)
   tablet.mquery(
       'vt_test_keyspace',
       ['begin',
        'insert into %s(id, msg, keyspace_id) '
        'values(%d, "%s", 0x%x) /* vtgate:: keyspace_id:%s */ /* user_id:%d */' %
        (table, id, msg, keyspace_id, k, id),
        'commit'],
       write=True)
开发者ID:richarwu,项目名称:vitess,代码行数:10,代码来源:initial_sharding.py


示例4: _insert_value

 def _insert_value(self, tablet_obj, table, mid, msg, keyspace_id):
   k = utils.uint64_to_hex(keyspace_id)
   tablet_obj.mquery(
       'vt_test_keyspace',
       ['begin',
        'insert into %s(id, msg, custom_ksid_col) '
        'values(%d, "%s", 0x%x) /* vtgate:: keyspace_id:%s */ '
        '/* id:%d */' %
        (table, mid, msg, keyspace_id, k, mid),
        'commit'],
       write=True)
开发者ID:CowLeo,项目名称:vitess,代码行数:11,代码来源:base_sharding.py


示例5: _insert_value

 def _insert_value(self, tablet, table, id, msg, keyspace_id):
     k = utils.uint64_to_hex(keyspace_id)
     tablet.mquery(
         "vt_test_keyspace",
         [
             "begin",
             "insert into %s(id, msg, keyspace_id) "
             'values(%d, "%s", 0x%x) /* vtgate:: keyspace_id:%s */ /* user_id:%d */'
             % (table, id, msg, keyspace_id, k, id),
             "commit",
         ],
         write=True,
     )
开发者ID:hadoop835,项目名称:vitess,代码行数:13,代码来源:resharding.py


示例6: __init__

  def __init__(self, tablet, object_name, user_id, keyspace_id):
    threading.Thread.__init__(self)
    self.tablet = tablet
    self.object_name = object_name
    self.user_id = user_id
    self.keyspace_id = keyspace_id
    self.str_keyspace_id = utils.uint64_to_hex(keyspace_id)
    self.done = False

    self.tablet.mquery(
        'vt_test_keyspace',
        ['begin',
         'insert into timestamps(name, time_milli, keyspace_id) '
         "values('%s', %d, 0x%x) /* vtgate:: keyspace_id:%s */ /* user_id:%d */" %
         (self.object_name, long(time.time() * 1000), self.keyspace_id,
          self.str_keyspace_id, self.user_id),
         'commit'],
        write=True, user='vt_app')
    self.start()
开发者ID:richarwu,项目名称:vitess,代码行数:19,代码来源:resharding.py


示例7: __init__

  def __init__(self, tablet_obj, thread_name, thread_id, user_id,
               keyspace_id):
    threading.Thread.__init__(self)
    self.tablet = tablet_obj
    self.thread_name = thread_name
    self.thread_id = thread_id
    self.user_id = user_id
    self.keyspace_id = keyspace_id
    self.str_keyspace_id = utils.uint64_to_hex(keyspace_id)
    self.done = False

    self.tablet.mquery(
        'vt_test_keyspace',
        ['begin',
         'insert into timestamps(id, time_milli, custom_ksid_col) '
         'values(%d, %d, 0x%x) '
         '/* vtgate:: keyspace_id:%s */ /* user_id:%d */' %
         (self.thread_id, long(time.time() * 1000), self.keyspace_id,
          self.str_keyspace_id, self.user_id),
         'commit'],
        write=True, user='vt_app')
    self.start()
开发者ID:CowLeo,项目名称:vitess,代码行数:22,代码来源:resharding.py


示例8: __init__

    def __init__(self, tablet_obj, object_name, user_id, keyspace_id):
        threading.Thread.__init__(self)
        self.tablet = tablet_obj
        self.object_name = object_name
        self.user_id = user_id
        self.keyspace_id = keyspace_id
        self.str_keyspace_id = utils.uint64_to_hex(keyspace_id)
        self.done = False

        self.tablet.mquery(
            "vt_test_keyspace",
            [
                "begin",
                "insert into timestamps(name, time_milli, keyspace_id) "
                "values('%s', %d, 0x%x) "
                "/* vtgate:: keyspace_id:%s */ /* user_id:%d */"
                % (self.object_name, long(time.time() * 1000), self.keyspace_id, self.str_keyspace_id, self.user_id),
                "commit",
            ],
            write=True,
            user="vt_app",
        )
        self.start()
开发者ID:hadmagic,项目名称:vitess,代码行数:23,代码来源:resharding.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.unParseTable函数代码示例发布时间:2022-05-26
下一篇:
Python utils.tuplize函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap