From 381bcf92a33fa6b23ba4b376df65fc5e5719af42 Mon Sep 17 00:00:00 2001 From: twmht Date: Tue, 28 May 2019 21:46:50 +0800 Subject: [PATCH] update --- _sources/index.rst.txt | 8 +++---- _sources/tutorial/index.rst.txt | 37 ++++++++++++++++----------------- index.html | 8 +++---- searchindex.js | 2 +- tutorial/index.html | 37 ++++++++++++++++----------------- 5 files changed, 45 insertions(+), 47 deletions(-) diff --git a/_sources/index.rst.txt b/_sources/index.rst.txt index 4f9b338..111f4b6 100644 --- a/_sources/index.rst.txt +++ b/_sources/index.rst.txt @@ -16,16 +16,16 @@ Python bindings to the C++ interface of http://rocksdb.org/ using pybind11:: assert(s.ok()) # put opts = pyrocksdb.WriteOptions() - s = db.put(opts, "key1", "value1") + s = db.put(opts, b"key1", b"value1") assert (s.ok()) # get opts = pyrocksdb.ReadOptions() - blob = db.get(opts, "key1") - print (blob.data) # value1 + blob = db.get(opts, b"key1") + print (blob.data) # b"value1" print (blob.status.ok()) # true #delete opts = pyrocksdb.WriteOptions() - s = db.delete(opts, "key1") + s = db.delete(opts, b"key1") assert(s.ok()) db.close() diff --git a/_sources/tutorial/index.rst.txt b/_sources/tutorial/index.rst.txt index 3f81087..a74c622 100644 --- a/_sources/tutorial/index.rst.txt +++ b/_sources/tutorial/index.rst.txt @@ -10,9 +10,9 @@ apply them in a single operation :: update = pyrocksdb.WriteBatch() # collect the operations - update.put('key1', 'value1') - update.put('key2', 'value2') - update.delete('key1') + update.put(b'key1', b'value1') + update.put(b'key2', b'value2') + update.delete(b'key1') opts = pyrocksdb.WriteOptions() # Apply these operatios in a single operation @@ -20,11 +20,11 @@ apply them in a single operation :: assert s.ok() opts = pyrocksdb.ReadOptions() - blob = db.get(opts, 'key1') + blob = db.get(opts, b'key1') assert blob.status.is_not_found() - blob = db.get(opts, 'key2') + blob = db.get(opts, b'key2') assert blob.status.ok() - assert blob.data == 'value2' + assert blob.data == b'value2' db.close() @@ -35,36 +35,35 @@ Iterators behave slightly different than expected. Per default they are not valid. So you have to call one of its seek methods first :: opts = pyrocksdb.WriteOptions() - s = {'key1': 'value1', 'key2': 'value2', 'key3': 'value3'} + s = {b'key1': b'value1', b'key2': b'value2', b'key3': b'value3'} for k, v in s.items(): db.put(opts, k, v) opts = pyrocksdb.ReadOptions() it = db.iterator(opts) - # call this first it.seek_to_first() assert it.status().ok() assert it.valid() for k, v in s.items(): - assert it.key().data() == k - assert it.value().data() == v + assert it.key() == k + assert it.value() == v it.next() assert not it.valid() - it.seek('key1') + it.seek(b'key1') assert it.valid() - assert it.key().data() == 'key1' - assert it.value().data() == 'value1' - it.seek('key2') + assert it.key() == b'key1' + assert it.value() == b'value1' + it.seek(b'key2') assert it.valid() - assert it.key().data() == 'key2' - assert it.value().data() == 'value2' + assert it.key() == b'key2' + assert it.value() == b'value2' - it.seek('key4') + it.seek(b'key4') assert not it.valid() - it.seek_for_prev('key0') + it.seek_for_prev(b'key0') assert not it.valid() - it.seek_for_prev('key4') + it.seek_for_prev(b'key4') assert it.valid() diff --git a/index.html b/index.html index 0ce5d1a..25059da 100644 --- a/index.html +++ b/index.html @@ -47,16 +47,16 @@ assert(s.ok()) # put opts = pyrocksdb.WriteOptions() -s = db.put(opts, "key1", "value1") +s = db.put(opts, b"key1", b"value1") assert (s.ok()) # get opts = pyrocksdb.ReadOptions() -blob = db.get(opts, "key1") -print (blob.data) # value1 +blob = db.get(opts, b"key1") +print (blob.data) # b"value1" print (blob.status.ok()) # true #delete opts = pyrocksdb.WriteOptions() -s = db.delete(opts, "key1") +s = db.delete(opts, b"key1") assert(s.ok()) db.close() diff --git a/searchindex.js b/searchindex.js index d929ac5..9cf3949 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["changelog","index","installation","tutorial/index"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.todo":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["changelog.rst","index.rst","installation.rst","tutorial/index.rst"],objects:{},objnames:{},objtypes:{},terms:{"default":[0,3],"import":[0,1],"true":[0,1],Added:0,For:0,With:[],access:0,accord:0,activ:[],add:0,advanc:0,all:0,allow:0,allow_mmap_read:0,allow_mmap_writ:0,also:[0,3],alwai:0,anymor:0,api:0,appli:3,apt:[],argument:0,assert:[1,3],automat:0,avail:0,batch:1,becaus:0,behav:3,bin:[],bind:1,blob:[1,3],block_restart_interv:0,block_siz:0,block_size_devi:0,blockbasedtablefactori:0,bloom_bits_per_kei:0,bloom_bits_per_prefix:0,bottommost_level_compact:0,builder:0,bunch:0,call:[0,3],can:1,change_level:0,changelog:1,clone:2,close:[1,3],code:0,collect:3,com:[0,2],compact:0,compact_rang:0,compaction_options_univers:0,compaction_styl:0,compactrang:0,compressiontyp:0,could:0,creat:1,create_if_miss:1,data:[1,3],databas:0,db_stats_log_interv:0,delet:[1,3],dev:[],dict:0,differ:3,disable_seek_compact:0,distro:[],document:0,drop:0,enabl:0,end:0,ensur:0,expect:3,facebook:0,fals:0,feel:1,first:3,fix:0,follow:0,fork:1,format:0,found:1,free:1,from:[0,1],gather:3,get:[0,1,3],get_properti:0,git:2,github:[0,1,2],have:[0,3],how:[0,1],http:[0,1,2],increaseparallel:1,index:1,init:0,initi:0,instal:1,instruct:1,interfac:1,is_not_found:3,issu:[0,1],item:[0,3],iter:[0,1],iteritem:0,iterkei:0,itertool:0,itervalu:0,its:3,kei:[0,3],key0:3,key1:[1,3],key2:3,key3:3,key4:3,key_may_exist:0,keyword:0,lambda:0,level0_slowdown_writes_trigg:0,level0_stop_writes_trigg:0,librocksdb:[],like:0,list:0,lrucach:0,lz4_compress:0,lz4hc_compress:0,make:0,max_background_flush:0,max_open_fil:0,mean:0,memori:0,memtabl:0,memtable_factori:0,method:3,modif:3,modul:1,more:0,move:0,multi:1,multi_get:0,name:0,need:0,newer:0,newtotalorderplaintablefactori:0,next:3,no_block_cach:0,now:0,one:3,onli:0,open:1,oper:3,operatio:3,opt:[1,3],optim:0,optimizelevelstylecompact:1,option:[0,1],org:1,own:0,packag:[],page:[0,1],paramet:0,paranoid_check:0,path:1,per:3,persist:0,pip:[],plaintabl:0,plaintablefactori:0,pointer:0,possibl:[0,3],prefix:0,prefix_extractor:0,prefix_seek:0,print:[0,1],properti:0,publish:0,pull:1,put:[1,3],pybind11:[1,2],pypi:0,pyrocksdb:[0,1,3],python3:1,raw:0,readopt:[0,1,3],realiz:0,recurs:2,reduce_level:0,relat:0,remov:0,renam:0,repair_db:0,represent:0,request:1,requir:[],rm_scan_count_limit:0,rocksdb:0,row_cach:0,search:1,seek:[0,3],seek_for_prev:3,seek_to_first:3,self:0,send:1,set:0,setup:2,singl:3,slightli:3,smart:0,solut:0,sourc:1,sst:0,stai:0,startswith:0,statu:[1,3],style:0,support:0,tabl:0,table_cache_remove_scan_count_limit:0,table_factori:0,takewhil:0,test:1,than:3,thei:3,them:3,thi:[0,3],thread:1,too:0,tracker:1,tutori:1,twmht:2,univers:0,updat:[0,3],use:0,uses:0,using:1,valid:3,valu:[0,3],value1:[1,3],value2:3,value3:3,venv:[],verify_checksums_in_compact:0,version:1,virtualenv:[],walk:0,were:0,which:0,whole_key_filt:0,wiki:0,within:0,work:0,write:[0,3],writebatch:3,writebatchiter:0,writeopt:[1,3],wrtie:1,you:[0,3],your:0},titles:["Changelog","Welcome to python-rocksdb\u2019s documentation!","Installing","Basic Usage of python-rocksdb"],titleterms:{"new":0,With:[],backward:0,basic:3,batch:3,build:2,chang:0,changelog:0,contribut:1,distro:[],document:1,from:2,incompat:0,indic:1,instal:2,iter:3,overview:1,packag:[],pypi:[],python:[1,2,3],rocksdb:[1,2,3],sourc:2,tabl:1,usag:3,version:0,welcom:1,wrtie:3}}) \ No newline at end of file +Search.setIndex({docnames:["changelog","index","installation","tutorial/index"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.todo":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["changelog.rst","index.rst","installation.rst","tutorial/index.rst"],objects:{},objnames:{},objtypes:{},terms:{"default":[0,3],"import":[0,1],"true":[0,1],Added:0,For:0,With:[],access:0,accord:0,activ:[],add:0,advanc:0,all:0,allow:0,allow_mmap_read:0,allow_mmap_writ:0,also:[0,3],alwai:0,anymor:0,api:0,appli:3,apt:[],argument:0,assert:[1,3],automat:0,avail:0,batch:1,becaus:0,behav:3,bin:[],bind:1,blob:[1,3],block_restart_interv:0,block_siz:0,block_size_devi:0,blockbasedtablefactori:0,bloom_bits_per_kei:0,bloom_bits_per_prefix:0,bottommost_level_compact:0,builder:0,bunch:0,call:[0,3],can:1,change_level:0,changelog:1,clone:2,close:[1,3],code:0,collect:3,com:[0,2],compact:0,compact_rang:0,compaction_options_univers:0,compaction_styl:0,compactrang:0,compressiontyp:0,could:0,creat:1,create_if_miss:1,data:[1,3],databas:0,db_stats_log_interv:0,delet:[1,3],dev:[],dict:0,differ:3,disable_seek_compact:0,distro:[],document:0,drop:0,enabl:0,end:0,ensur:0,expect:3,facebook:0,fals:0,feel:1,first:3,fix:0,follow:0,fork:1,format:0,found:1,free:1,from:[0,1],gather:3,get:[0,1,3],get_properti:0,git:2,github:[0,1,2],have:[0,3],how:[0,1],http:[0,1,2],increaseparallel:1,index:1,init:0,initi:0,instal:1,instruct:1,interfac:1,is_not_found:3,issu:[0,1],item:[0,3],iter:[0,1],iteritem:0,iterkei:0,itertool:0,itervalu:0,its:3,kei:[0,3],key0:3,key1:[1,3],key2:3,key3:3,key4:3,key_may_exist:0,keyword:0,lambda:0,level0_slowdown_writes_trigg:0,level0_stop_writes_trigg:0,librocksdb:[],like:0,list:0,lrucach:0,lz4_compress:0,lz4hc_compress:0,make:0,max_background_flush:0,max_open_fil:0,mean:0,memori:0,memtabl:0,memtable_factori:0,method:3,modif:3,modul:1,more:0,move:0,multi:1,multi_get:0,name:0,need:0,newer:0,newtotalorderplaintablefactori:0,next:3,no_block_cach:0,now:0,one:3,onli:0,open:1,oper:3,operatio:3,opt:[1,3],optim:0,optimizelevelstylecompact:1,option:[0,1],org:1,own:0,packag:[],page:[0,1],paramet:0,paranoid_check:0,path:1,per:3,persist:0,pip:[],plaintabl:0,plaintablefactori:0,pointer:0,possibl:[0,3],prefix:0,prefix_extractor:0,prefix_seek:0,print:[0,1],properti:0,publish:0,pull:1,put:[1,3],pybind11:[1,2],pypi:0,pyrocksdb:[0,1,3],python3:1,raw:0,readopt:[0,1,3],realiz:0,recurs:2,reduce_level:0,relat:0,remov:0,renam:0,repair_db:0,represent:0,request:1,requir:[],rm_scan_count_limit:0,rocksdb:0,row_cach:0,search:1,seek:[0,3],seek_for_prev:3,seek_to_first:3,self:0,send:1,set:0,setup:2,singl:3,slightli:3,smart:0,solut:0,sourc:1,sst:0,stai:0,startswith:0,statu:[1,3],style:0,support:0,tabl:0,table_cache_remove_scan_count_limit:0,table_factori:0,takewhil:0,test:1,than:3,thei:3,them:3,thi:0,thread:1,too:0,tracker:1,tutori:1,twmht:2,univers:0,updat:[0,3],use:0,uses:0,using:1,valid:3,valu:[0,3],value1:[1,3],value2:3,value3:3,venv:[],verify_checksums_in_compact:0,version:1,virtualenv:[],walk:0,were:0,which:0,whole_key_filt:0,wiki:0,within:0,work:0,write:[0,3],writebatch:3,writebatchiter:0,writeopt:[1,3],wrtie:1,you:[0,3],your:0},titles:["Changelog","Welcome to python-rocksdb\u2019s documentation!","Installing","Basic Usage of python-rocksdb"],titleterms:{"new":0,With:[],backward:0,basic:3,batch:3,build:2,chang:0,changelog:0,contribut:1,distro:[],document:1,from:2,incompat:0,indic:1,instal:2,iter:3,overview:1,packag:[],pypi:[],python:[1,2,3],rocksdb:[1,2,3],sourc:2,tabl:1,usag:3,version:0,welcom:1,wrtie:3}}) \ No newline at end of file diff --git a/tutorial/index.html b/tutorial/index.html index 3cba352..6e18914 100644 --- a/tutorial/index.html +++ b/tutorial/index.html @@ -41,9 +41,9 @@ apply them in a single operation

update = pyrocksdb.WriteBatch()
 
 # collect the operations
-update.put('key1', 'value1')
-update.put('key2', 'value2')
-update.delete('key1')
+update.put(b'key1', b'value1')
+update.put(b'key2', b'value2')
+update.delete(b'key1')
 
 opts = pyrocksdb.WriteOptions()
 # Apply these operatios in a single operation
@@ -51,11 +51,11 @@ apply them in a single operation

assert s.ok() opts = pyrocksdb.ReadOptions() -blob = db.get(opts, 'key1') +blob = db.get(opts, b'key1') assert blob.status.is_not_found() -blob = db.get(opts, 'key2') +blob = db.get(opts, b'key2') assert blob.status.ok() -assert blob.data == 'value2' +assert blob.data == b'value2' db.close()
@@ -66,38 +66,37 @@ apply them in a single operation

Iterators behave slightly different than expected. Per default they are not valid. So you have to call one of its seek methods first

opts = pyrocksdb.WriteOptions()
-s = {'key1': 'value1', 'key2': 'value2', 'key3': 'value3'}
+s = {b'key1': b'value1', b'key2': b'value2', b'key3': b'value3'}
 for k, v in s.items():
     db.put(opts, k, v)
 
 opts = pyrocksdb.ReadOptions()
 it = db.iterator(opts)
-# call this first
 it.seek_to_first()
 assert it.status().ok()
 assert it.valid()
 for k, v in s.items():
-    assert it.key().data() == k
-    assert it.value().data() == v
+    assert it.key() == k
+    assert it.value() == v
     it.next()
 
 assert not it.valid()
 
-it.seek('key1')
+it.seek(b'key1')
 assert it.valid()
-assert it.key().data() == 'key1'
-assert it.value().data() == 'value1'
-it.seek('key2')
+assert it.key() == b'key1'
+assert it.value() == b'value1'
+it.seek(b'key2')
 assert it.valid()
-assert it.key().data() == 'key2'
-assert it.value().data() == 'value2'
+assert it.key() == b'key2'
+assert it.value() == b'value2'
 
-it.seek('key4')
+it.seek(b'key4')
 assert not it.valid()
 
-it.seek_for_prev('key0')
+it.seek_for_prev(b'key0')
 assert not it.valid()
-it.seek_for_prev('key4')
+it.seek_for_prev(b'key4')
 assert it.valid()