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
69aabd72
Commit
69aabd72
authored
Jul 17, 2015
by
Tyler Neely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs for new usage.
parent
f21726e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
README.md
README.md
+4
-4
No files found.
README.md
View file @
69aabd72
...
...
@@ -36,7 +36,7 @@ rocksdb = "~0.0.7"
###### Code
```
rust
extern
crate
rocksdb
;
use
rocksdb
::
RocksDB
;
use
rocksdb
::
{
RocksDB
,
Writable
}
;
fn
main
()
{
let
mut
db
=
RocksDB
::
open_default
(
"/path/for/rocksdb/storage"
)
.unwrap
();
...
...
@@ -107,7 +107,7 @@ fn main() {
###### Rustic Merge Operator
```
rust
extern
crate
rocksdb
;
use
rocksdb
::{
RocksDBOptions
,
RocksDB
,
MergeOperands
};
use
rocksdb
::{
Options
,
RocksDB
,
MergeOperands
,
Writable
};
fn
concat_merge
(
new_key
:
&
[
u8
],
existing_val
:
Option
<&
[
u8
]
>
,
operands
:
&
mut
MergeOperands
)
->
Vec
<
u8
>
{
...
...
@@ -121,10 +121,10 @@ fn concat_merge(new_key: &[u8], existing_val: Option<&[u8]>,
fn
main
()
{
let
path
=
"/path/to/rocksdb"
;
let
opts
=
RocksDB
Options
::
new
();
let
mut
opts
=
Options
::
new
();
opts
.create_if_missing
(
true
);
opts
.add_merge_operator
(
"test operator"
,
concat_merge
);
let
mut
db
=
RocksDB
::
open
(
opts
,
path
)
.unwrap
();
let
mut
db
=
RocksDB
::
open
(
&
opts
,
path
)
.unwrap
();
let
p
=
db
.put
(
b
"k1"
,
b
"a"
);
db
.merge
(
b
"k1"
,
b
"b"
);
db
.merge
(
b
"k1"
,
b
"c"
);
...
...
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