zoukankan      html  css  js  c++  java
  • python leveldb 文档

    标签(空格分隔): python leveldb


    import leveldb
    
    db = leveldb.LevelDB('./db')
    
    db.Put('hello', 'world') 
    print db.Get('hello')
    
    db.Delete('hello') 
    print db.Get('hello')
    
    batch = leveldb.WriteBatch() 
    batch.Put('hello', 'world') 
    batch.Put('hello again', 'world') 
    batch.Delete('hello')
    db.Write(batch, sync = True)
    
    
    class LevelDB(builtin.object) | LevelDB(filename, **kwargs) -> leveldb object | 
    | Open a LevelDB database, from the given directory. | 
    | Only the parameter filename is mandatory. | 
    | filename the database directory | create_if_missing (default: True) if True, creates a new database if none exists | error_if_exists (default: False) if True, raises and error if the database already exists | paranoid_checks (default: False) if True, raises an error as soon as an internal corruption is detected | block_cache_size (default: 8 * (2 << 20)) maximum allowed size for the block cache in bytes | write_buffer_size (default 2 * (2 << 20)) 
    | block_size (default: 4096) unit of transfer for the block cache in bytes | max_open_files: (default: 1000) | block_restart_interval 
    | 
    | Snappy compression is used, if available. | 
    | Some methods support the following parameters, having these semantics: | 
    | verify_checksum: iff True, the operation will check for checksum mismatches | fill_cache: iff True, the operation will fill the cache with the data read | sync: iff True, the operation will be guaranteed to sync the operation to disk | 
    
    | Methods supported are: | 
    
    | Get(key, verify_checksums = False, fill_cache = True): get value, raises KeyError if key not found | 
    
    | key: the query key | 
    | Put(key, value, sync = False): put key/value pair | 
    | key: the key | value: the value | 
    | Delete(key, sync = False): delete key/value pair, raises no error kf key not found | 
    
    | key: the key | 
    | Write(write_batch, sync = False): apply multiple put/delete operations atomatically | 
    | write_batch: the WriteBatch object holding the operations | 
    | RangeIter(key_from = None, key_to = None, include_value = True, verify_checksums = False, fill_cache = True): return iterator | 
    | key_from: if not None: defines lower bound (inclusive) for iterator | key_to: if not None: defined upper bound (inclusive) for iterator | include_value: if True, iterator returns key/value 2-tuples, otherwise, just keys | 
    | GetStats(): get a string of runtime information
    
    class WriteBatch(builtin.object) | WriteBatch() -> write batch object | 
    | Create an object, which can hold a list of database operations, which | can be applied atomically. | 
    | Methods supported are: | 
    | Put(key, value): add put operation to batch | 
    | key: the key | value: the value | 
    | Delete(key): add delete operation to batch | 
    | key: the key |
    
    'CompactRange',
     'CreateSnapshot',
     'Delete',
     'Get',
     'GetStats',
     'Put',
     'RangeIter',//通过Key进行切片处理,因为所有的存储都是有序的
     'Write',
     '__class__',
     '__delattr__',
     '__doc__',
     '__format__',
     '__getattribute__',
     '__hash__',
     '__init__',
     '__new__',
     '__reduce__',
     '__reduce_ex__',
     '__repr__',
     '__setattr__',
     '__sizeof__',
     '__str__',
     '__subclasshook__']
    
  • 相关阅读:
    配置好fastfds和nginx,eclipse用代码上传图片失败
    安装redis集群出错
    解决eclipse打不开
    centos常用命令
    搜索引擎高效搜索
    POJ1067 取石子游戏 威佐夫博弈 博弈论
    伤逝——shoebill关于noip2017的手记
    JZYZOJ1530 [haoi2013]开关控制 状压 dfs 折半搜索
    JZYZOJ1457 [NOIP2016]换教室 期望dp 动态规划 floyd算法 最短路
    JZYZOJ1454 NOIP2015 D2T3_运输计划 二分 差分数组 lca tarjan 树链剖分
  • 原文地址:https://www.cnblogs.com/bergus/p/python-leveldb-wen-dang.html
Copyright © 2011-2022 走看看