Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
rust-rocksdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangzongwu
rust-rocksdb
Commits
64bf4689
Commit
64bf4689
authored
Nov 03, 2019
by
Brian Anderson
Committed by
pingcap-github-bot
Nov 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Rc-based SstFileReader iterators (#372)
parent
531392a6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
rocksdb.rs
src/rocksdb.rs
+22
-0
No files found.
src/rocksdb.rs
View file @
64bf4689
...
...
@@ -34,6 +34,7 @@ use std::io;
use
std
::
mem
;
use
std
::
ops
::
Deref
;
use
std
::
path
::{
Path
,
PathBuf
};
use
std
::
rc
::
Rc
;
use
std
::
str
::
from_utf8
;
use
std
::
sync
::
Arc
;
use
std
::{
fs
,
ptr
,
slice
};
...
...
@@ -2143,6 +2144,27 @@ impl SstFileReader {
}
}
/// Create an iterator out of a reference-counted SstFileReader.
///
/// This exists due to restrictions on lifetimes in associated types.
/// See RocksSstIterator in TiKV's engine_rocks.
pub
fn
iter_rc
(
this
:
Rc
<
Self
>
)
->
DBIterator
<
Rc
<
Self
>>
{
Self
::
iter_opt_rc
(
this
,
ReadOptions
::
new
())
}
pub
fn
iter_opt_rc
(
this
:
Rc
<
Self
>
,
readopts
:
ReadOptions
)
->
DBIterator
<
Rc
<
Self
>>
{
unsafe
{
DBIterator
{
inner
:
crocksdb_ffi
::
crocksdb_sstfilereader_new_iterator
(
this
.inner
,
readopts
.get_inner
(),
),
_db
:
this
,
_readopts
:
readopts
,
}
}
}
pub
fn
read_table_properties
<
F
:
FnOnce
(
&
TableProperties
)
>
(
&
self
,
mut
action
:
F
)
{
extern
"C"
fn
callback
<
F
:
FnOnce
(
&
TableProperties
)
>
(
ctx
:
*
mut
c_void
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment