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
0db7837d
Commit
0db7837d
authored
Dec 15, 2014
by
Tyler Neely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cache functions
parent
73696642
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
3 deletions
+30
-3
README.md
README.md
+3
-3
ffi.rs
src/ffi.rs
+6
-0
lib.rs
src/lib.rs
+1
-0
rocksdb.rs
src/rocksdb.rs
+20
-0
No files found.
README.md
View file @
0db7837d
...
...
@@ -109,14 +109,14 @@ fn tuned_for_somebody_elses_disk() -> RocksDB {
-
[
x
]
rocksdb compiled via cargo
-
[
x
]
OSX support
-
[
x
]
rustic merge operator
-
[
x
]
compaction filter, style
-
[
x
]
LRU cache
-
[
x
]
destroy/repair
-
[
]
batch
-
[
]
iterator
-
[
]
range
-
[
]
create/release snapshot
-
[
]
column family operations
-
[
]
compaction filter, style
-
[
]
LRU cache
-
[
]
destroy/repair
-
[
]
comparator
-
[
]
slicetransform
-
[
]
windows support
...
...
src/ffi.rs
View file @
0db7837d
...
...
@@ -24,6 +24,12 @@ pub fn new_bloom_filter(bits: c_int) -> RocksDBFilterPolicy {
}
}
pub
fn
new_cache
(
capacity
:
size_t
)
->
RocksDBCache
{
unsafe
{
rocksdb_cache_create_lru
(
capacity
)
}
}
#[repr(C)]
pub
enum
RocksDBCompressionType
{
RocksDBNoCompression
=
0
,
...
...
src/lib.rs
View file @
0db7837d
...
...
@@ -5,6 +5,7 @@
pub
use
ffi
as
rocksdb_ffi
;
pub
use
ffi
::{
new_bloom_filter
,
new_cache
,
RocksDBUniversalCompactionStyle
,
RocksDBCompactionStyle
,
RocksDBCompressionType
,
...
...
src/rocksdb.rs
View file @
0db7837d
...
...
@@ -101,6 +101,26 @@ impl RocksDBOptions {
}
}
pub
fn
set_cache
(
&
self
,
cache
:
rocksdb_ffi
::
RocksDBCache
)
{
unsafe
{
rocksdb_ffi
::
rocksdb_block_based_options_set_block_cache
(
self
.block_options
,
cache
);
rocksdb_ffi
::
rocksdb_options_set_block_based_table_factory
(
self
.inner
,
self
.block_options
);
}
}
pub
fn
set_cache_compressed
(
&
self
,
cache
:
rocksdb_ffi
::
RocksDBCache
)
{
unsafe
{
rocksdb_ffi
::
rocksdb_block_based_options_set_block_cache_compressed
(
self
.block_options
,
cache
);
rocksdb_ffi
::
rocksdb_options_set_block_based_table_factory
(
self
.inner
,
self
.block_options
);
}
}
pub
fn
set_max_open_files
(
&
self
,
nfiles
:
c_int
)
{
unsafe
{
rocksdb_ffi
::
rocksdb_options_set_max_open_files
(
self
.inner
,
nfiles
);
...
...
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