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__']
python leveldb 文档的更多相关文章
- 如何在命令行模式下查看Python帮助文档---dir、help、__doc__
如何在命令行模式下查看Python帮助文档---dir.help.__doc__ 1.dir函数式可以查看对象的属性,使用方法很简单,举str类型为例,在Python命令窗口输入 dir(str) 即 ...
- python统计文档中词频
python统计文档中词频的小程序 python版本2.7 效果如下: 程序如下,测试文件与完整程序在我的github中 #统计空格数与单词数 本函数只返回了空格数 需要的可以自己返回多个值 def ...
- 在命令行模式下查看Python帮助文档---dir、help、__doc__
在命令行模式下查看Python帮助文档---dir.help.__doc__ 1.dir函数式可以查看对象的属性,使用方法很简单,举str类型为例,在Python命令窗口输入 dir(str) 即 ...
- Python帮助文档中Iteration iterator iterable 的理解
iteration这个单词,是循环,迭代的意思.也就是说,一次又一次地重复做某件事,叫做iteration.所以很多语言里面,循环的循环变量叫i,就是因为这个iteration. iteration指 ...
- 使用Python对文档单词进行计数
做hacker.org上面的题目时,遇到了一个题目需要对RFC3280种长度为9的单词进行计数,并找出这些单词中出现次数最多的那个:Didactic Byte RFC3280文档有7000多行,靠人工 ...
- 三言两语聊Python模块–文档测试模块doctest
doctest是属于测试模块里的一种,对注释文档里的示例进行检测. 给出一个例子: splitter.pydef split(line, types=None, delimiter=None): &q ...
- python 本地文档查看
本地安装Python文档本地查看,在命令行中运行: python -m pydoc -p 1234 在浏览器中访问如下链接,就可以访问到本地文档: http://localhost:1234/ 本地文 ...
- 使用Sphinx生成本地的Python帮助文档
第一步:安装Sphinx 首先我们需要安装Sphinx,如果已经安装了Anaconda,那么只需要使用如下命令即可安装,关于其中的参数 -c anaconda,可以在链接[1]中查看: conda i ...
- Python asyncio文档阅读摘要
文档地址:https://docs.python.org/3/library/asyncio.html 文档第一句话说得很明白,asyncio是单线程并发,这种event loop架构是很多新型异步并 ...
随机推荐
- iOS/Swift Tips 1
1.重写hitTest方法,干预iOS事件传递过程 如下所示,view上有一个button,button一半的frame在父类view bounds之外, 按照iOS系统默认的处理逻辑, 如果点击按钮 ...
- Mac连接Linux服务器
1.终端命令 a).打开Mac的命令终端 b).输入ssh -p 22 root@101.200.86.233 它会提示你输入密码,输入正确的密码之后,你就发现已经登陆成功了.(22: 端口号 roo ...
- MySQL 5.7修改root密码的4种方法
sometimes we will forget our password of root in MySQL DB server.so,there're several methods ...
- Django学习笔记3-静态文件调用
1.settings.py 静态文件相关示例代码及说明: # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.c ...
- Sass变量及嵌套
1. 变量:SASS允许使用变量,所有变量以$开头. 变量声明:$highlight-color: #000; 注意:变量可以在css规则块定义之外存在.如下例子: $nav-color: #F90; ...
- PHP 使用GD库合成带二维码的海报步骤以及源码实现
PHP 使用GD库合成带二维码的海报步骤以及源码实现 在做微信项目开发过程中,经常会遇到图片合成的问题,比如将用户的二维码合成到宣传海报中,那么,遇到这种情况,利用PHP的GD库也是很容易实现的,实现 ...
- 四、分离分层的 platform驱动
学习目标: 学习实现platform机制的分层分离,并基于platform机制,编写led设备和驱动程序: 一.分离分层 输入子系统.usb设备比驱动以及platform类型的驱动等都体现出分离分层机 ...
- 『Python题库 - 填空题』151道Python笔试填空题
『Python题库 - 填空题』Python笔试填空题 part 1. Python语言概述和Python开发环境配置 part 2. Python语言基本语法元素(变量,基本数据类型, 基础运算) ...
- 浅显易懂的Sysnchronizd用法
<编程思想之多线程与多进程(1)——以操作系统的角度述说线程与进程>一文详细讲述了线程.进程的关系及在操作系统中的表现,这是多线程学习必须了解的基础.本文将接着讲一下Java线程同步中的一 ...
- 后端系统开发利器之gflags
gflags是Google的一个开源项目,用于解析程序运行参数.gflags简单易用,它的好处在于统一配置格式,减少开发工作量.在工程实践中,gflags在简化开发和测试方面表现非常出色,它还有一个很 ...