Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sds
sds-keyval
Commits
1d1a95d5
Commit
1d1a95d5
authored
Sep 13, 2018
by
Matthieu Dorier
Browse files
added sync mechanism
parent
b9190a2f
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/datastore/berkeleydb_datastore.cc
View file @
1d1a95d5
...
@@ -180,7 +180,11 @@ bool BerkeleyDBDataStore::erase(const ds_bulk_t &key) {
...
@@ -180,7 +180,11 @@ bool BerkeleyDBDataStore::erase(const ds_bulk_t &key) {
Dbt
db_key
((
void
*
)
key
.
data
(),
key
.
size
());
Dbt
db_key
((
void
*
)
key
.
data
(),
key
.
size
());
int
status
=
_dbm
->
del
(
NULL
,
&
db_key
,
0
);
int
status
=
_dbm
->
del
(
NULL
,
&
db_key
,
0
);
return
status
==
0
;
return
status
==
0
;
}
}
void
BerkeleyDBDataStore
::
sync
()
{
_dbm
->
sync
(
0
);
}
// In the case where Duplicates::ALLOW, this will return the first
// In the case where Duplicates::ALLOW, this will return the first
// value found using key.
// value found using key.
...
...
src/datastore/berkeleydb_datastore.h
View file @
1d1a95d5
...
@@ -39,6 +39,7 @@ class BerkeleyDBDataStore : public AbstractDataStore {
...
@@ -39,6 +39,7 @@ class BerkeleyDBDataStore : public AbstractDataStore {
virtual
void
set_no_overwrite
()
{
virtual
void
set_no_overwrite
()
{
_no_overwrite
=
true
;
_no_overwrite
=
true
;
}
}
virtual
void
sync
();
remi_fileset_t
create_and_populate_fileset
()
const
;
remi_fileset_t
create_and_populate_fileset
()
const
;
protected:
protected:
virtual
std
::
vector
<
ds_bulk_t
>
vlist_keys
(
virtual
std
::
vector
<
ds_bulk_t
>
vlist_keys
(
...
...
src/datastore/datastore.h
View file @
1d1a95d5
...
@@ -28,6 +28,7 @@ class AbstractDataStore {
...
@@ -28,6 +28,7 @@ class AbstractDataStore {
virtual
void
set_in_memory
(
bool
enable
)
=
0
;
// enable/disable in-memory mode (where supported)
virtual
void
set_in_memory
(
bool
enable
)
=
0
;
// enable/disable in-memory mode (where supported)
virtual
void
set_comparison_function
(
const
std
::
string
&
name
,
comparator_fn
less
)
=
0
;
virtual
void
set_comparison_function
(
const
std
::
string
&
name
,
comparator_fn
less
)
=
0
;
virtual
void
set_no_overwrite
()
=
0
;
virtual
void
set_no_overwrite
()
=
0
;
virtual
void
sync
()
=
0
;
virtual
remi_fileset_t
create_and_populate_fileset
()
const
=
0
;
virtual
remi_fileset_t
create_and_populate_fileset
()
const
=
0
;
const
std
::
string
&
get_path
()
const
{
const
std
::
string
&
get_path
()
const
{
...
...
src/datastore/leveldb_datastore.cc
View file @
1d1a95d5
...
@@ -35,6 +35,10 @@ LevelDBDataStore::~LevelDBDataStore() {
...
@@ -35,6 +35,10 @@ LevelDBDataStore::~LevelDBDataStore() {
//leveldb::Env::Shutdown(); // Riak version only
//leveldb::Env::Shutdown(); // Riak version only
};
};
void
LevelDBDataStore
::
sync
()
{
}
bool
LevelDBDataStore
::
openDatabase
(
const
std
::
string
&
db_name
,
const
std
::
string
&
db_path
)
{
bool
LevelDBDataStore
::
openDatabase
(
const
std
::
string
&
db_name
,
const
std
::
string
&
db_path
)
{
_name
=
db_name
;
_name
=
db_name
;
_path
=
db_path
;
_path
=
db_path
;
...
...
src/datastore/leveldb_datastore.h
View file @
1d1a95d5
...
@@ -52,6 +52,7 @@ class LevelDBDataStore : public AbstractDataStore {
...
@@ -52,6 +52,7 @@ class LevelDBDataStore : public AbstractDataStore {
virtual
void
set_no_overwrite
()
{
virtual
void
set_no_overwrite
()
{
_no_overwrite
=
true
;
_no_overwrite
=
true
;
}
}
virtual
void
sync
();
remi_fileset_t
create_and_populate_fileset
()
const
;
remi_fileset_t
create_and_populate_fileset
()
const
;
protected:
protected:
virtual
std
::
vector
<
ds_bulk_t
>
vlist_keys
(
virtual
std
::
vector
<
ds_bulk_t
>
vlist_keys
(
...
...
src/datastore/map_datastore.h
View file @
1d1a95d5
...
@@ -44,6 +44,8 @@ class MapDataStore : public AbstractDataStore {
...
@@ -44,6 +44,8 @@ class MapDataStore : public AbstractDataStore {
return
true
;
return
true
;
}
}
virtual
void
sync
()
{}
virtual
bool
put
(
const
ds_bulk_t
&
key
,
const
ds_bulk_t
&
data
)
{
virtual
bool
put
(
const
ds_bulk_t
&
key
,
const
ds_bulk_t
&
data
)
{
auto
x
=
_map
.
count
(
key
);
auto
x
=
_map
.
count
(
key
);
if
(
_no_overwrite
&&
(
x
!=
0
))
{
if
(
_no_overwrite
&&
(
x
!=
0
))
{
...
...
src/sdskv-server.cc
View file @
1d1a95d5
...
@@ -2016,7 +2016,7 @@ static void sdskv_migrate_database_ult(hg_handle_t handle)
...
@@ -2016,7 +2016,7 @@ static void sdskv_migrate_database_ult(hg_handle_t handle)
break
;
break
;
}
}
auto
database
=
it
->
second
;
auto
database
=
it
->
second
;
database
->
sync
();
/* lookup the address of the destination REMI provider */
/* lookup the address of the destination REMI provider */
hret
=
margo_addr_lookup
(
mid
,
in
.
dest_remi_addr
,
&
dest_addr
);
hret
=
margo_addr_lookup
(
mid
,
in
.
dest_remi_addr
,
&
dest_addr
);
if
(
hret
!=
HG_SUCCESS
)
{
if
(
hret
!=
HG_SUCCESS
)
{
...
...
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