Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
contract_kv_interface
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LiXiaoyu
contract_kv_interface
Commits
7ac1933a
Commit
7ac1933a
authored
Sep 13, 2018
by
LiXiaoyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gh
parent
bfb86f6f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
kv_impl_leveldb.cpp
kv_store/kv_impl_leveldb.cpp
+3
-3
No files found.
kv_store/kv_impl_leveldb.cpp
View file @
7ac1933a
...
@@ -18,7 +18,7 @@ kvImplLeveldb::init() {
...
@@ -18,7 +18,7 @@ kvImplLeveldb::init() {
//auto db = std::make_unique<leveldb::DB>();
//auto db = std::make_unique<leveldb::DB>();
options
.
create_if_missing
=
true
;
options
.
create_if_missing
=
true
;
leveldb
::
Status
status
=
leveldb
::
DB
::
Open
(
options
,
dir
.
c_str
(),
&
db
);
auto
status
=
leveldb
::
DB
::
Open
(
options
,
dir
.
c_str
(),
&
db
);
if
(
!
status
.
ok
())
{
if
(
!
status
.
ok
())
{
//todo
//todo
//LOG_ERR("db %s open failed", dir.c_str());
//LOG_ERR("db %s open failed", dir.c_str());
...
@@ -34,7 +34,7 @@ bool
...
@@ -34,7 +34,7 @@ bool
kvImplLeveldb
::
get
(
const
vector
<
char
>
&
key
,
vector
<
char
>
&
value
)
{
kvImplLeveldb
::
get
(
const
vector
<
char
>
&
key
,
vector
<
char
>
&
value
)
{
myValue
v
(
&
value
);
myValue
v
(
&
value
);
leveldb
::
Status
s
=
_db
->
Get
(
leveldb
::
ReadOptions
(),
leveldb
::
Slice
(
key
.
data
(),
key
.
size
()),
&
v
);
auto
s
=
_db
->
Get
(
leveldb
::
ReadOptions
(),
leveldb
::
Slice
(
key
.
data
(),
key
.
size
()),
&
v
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
//std::cerr << s.ToString() << '\n';
//std::cerr << s.ToString() << '\n';
//LOG_INFO
//LOG_INFO
...
@@ -45,7 +45,7 @@ kvImplLeveldb::get(const vector<char> &key, vector<char> &value) {
...
@@ -45,7 +45,7 @@ kvImplLeveldb::get(const vector<char> &key, vector<char> &value) {
bool
bool
kvImplLeveldb
::
set
(
const
vector
<
char
>
&
key
,
const
vector
<
char
>
&
value
)
{
kvImplLeveldb
::
set
(
const
vector
<
char
>
&
key
,
const
vector
<
char
>
&
value
)
{
leveldb
::
Status
s
=
_db
->
Put
(
leveldb
::
WriteOptions
(),
leveldb
::
Slice
(
key
.
data
(),
key
.
size
()),
auto
s
=
_db
->
Put
(
leveldb
::
WriteOptions
(),
leveldb
::
Slice
(
key
.
data
(),
key
.
size
()),
leveldb
::
Slice
(
value
.
data
(),
value
.
size
()));
leveldb
::
Slice
(
value
.
data
(),
value
.
size
()));
return
s
.
ok
();
return
s
.
ok
();
}
}
...
...
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