• 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__']
    
  • 相关阅读:
    GIT基础详解
    JS进阶解析
    JS基础解析
    CSS布局模型解析
    02.CentOS Linux 7.7 系统配置文档
    docker 创建bridge网络和修改默认网段
    selenium浏览器自动化测试工具 进阶使用
    前端导出Excel和打印介绍
    stm32使用gmtime()转换timestamp为日期,出的结果是乱的,不符合预期。改为localtime正常输出
    .net core api action 不能用作 httpget注释的参数名
  • 原文地址:https://www.cnblogs.com/bergus/p/python-leveldb-wen-dang.html
Copyright © 2020-2023  润新知