Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
Practical-Cryptdb
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
Zhaozhen
Practical-Cryptdb
Commits
aa56f06e
Commit
aa56f06e
authored
May 20, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add simple_load_new
parent
9975f197
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
448 additions
and
3 deletions
+448
-3
simple_load_new.cc
tools/simple_load_new.cc
+330
-0
simple_store_new.cc
tools/simple_store_new.cc
+1
-0
constants.cc
util/constants.cc
+1
-1
common.cc
wrapper/common.cc
+84
-0
common.hh
wrapper/common.hh
+5
-2
reuse.cc
wrapper/reuse.cc
+25
-0
reuse.hh
wrapper/reuse.hh
+2
-0
No files found.
tools/simple_load_new.cc
0 → 100644
View file @
aa56f06e
This diff is collapsed.
Click to expand it.
tools/simple_store_new.cc
View file @
aa56f06e
#include "wrapper/common.hh"
#include "wrapper/reuse.hh"
#include "util/util.hh"
#include "util/constants.hh"
static
std
::
string
embeddedDir
=
"/t/cryt/shadow"
;
//global map, for each client, we have one WrapperState which contains ProxyState.
static
std
::
map
<
std
::
string
,
WrapperState
*>
clients
;
...
...
util/constants.cc
View file @
aa56f06e
...
...
@@ -21,7 +21,7 @@ globalConstants initGlobalConstants(){
std
::
string
line
;
while
(
std
::
getline
(
infile
,
line
))
{
if
(
line
.
size
()
==
0
)
continue
;
if
(
line
[
0
]
==
'#'
)
continue
;
if
(
line
[
0
]
==
'#'
||
line
[
0
]
==
'\n'
)
continue
;
int
index
=
line
.
find
(
":"
);
std
::
string
head
=
line
.
substr
(
0
,
index
);
if
(
head
==
"loadCount"
)
{
...
...
wrapper/common.cc
View file @
aa56f06e
...
...
@@ -303,6 +303,90 @@ TableMetaTrans::serializeNew(std::string fullpath){
fclose
(
localmeta
);
}
void
TableMetaTrans
::
show
(){
std
::
cout
<<
db
<<
","
<<
table
<<
std
::
endl
;
for
(
auto
&
item
:
fts
){
item
.
show
();
}
}
void
TableMetaTrans
::
deserializeNew
(
std
::
string
filename
,
std
::
string
prefix
){
filename
=
prefix
+
db
+
"/"
+
table
+
"/"
+
filename
;
ifstream
infile
(
filename
);
string
line
;
while
(
getline
(
infile
,
line
)){
if
(
line
.
size
()
==
0
)
continue
;
if
(
line
[
0
]
==
'*'
||
line
[
0
]
==
'\n'
)
continue
;
int
index
=
line
.
find
(
":"
);
string
head
=
line
.
substr
(
0
,
index
);
if
(
head
==
"INDEX"
){
FieldMetaTrans
ft
;
fts
.
push_back
(
ft
);
}
else
if
(
head
==
"database"
){
set_db
(
line
.
substr
(
index
+
1
));
}
else
if
(
head
==
"table"
){
set_table
(
line
.
substr
(
index
+
1
));
}
else
if
(
head
==
"choosenOnionO"
){
string
onionO
=
line
.
substr
(
index
+
1
);
auto
res
=
string_to_vec_int
(
onionO
);
std
::
vector
<
onion
>
tmp
;
for
(
auto
item
:
res
){
tmp
.
push_back
(
static_cast
<
onion
>
(
item
));
}
fts
.
back
().
setChoosenOnionO
(
tmp
);
}
else
if
(
head
==
"ChoosenOnionName"
){
string
names
=
line
.
substr
(
index
+
1
);
auto
res
=
string_to_vec_str
(
names
);
fts
.
back
().
setChoosenOnionName
(
res
);
}
else
if
(
head
==
"choosenFieldTypes"
){
string
fieldTypes
=
line
.
substr
(
index
+
1
);
auto
res
=
string_to_vec_int
(
fieldTypes
);
fts
.
back
().
setChoosenFieldTypes
(
res
);
}
else
if
(
head
==
"choosenFieldLengths"
){
string
fieldLengths
=
line
.
substr
(
index
+
1
);
auto
res
=
string_to_vec_int
(
fieldLengths
);
fts
.
back
().
setChoosenFieldLengths
(
res
);
}
else
if
(
head
==
"hasSalt"
){
std
::
string
hasSaltStr
=
line
.
substr
(
index
+
1
);
if
(
hasSaltStr
==
"true"
){
fts
.
back
().
setHasSalt
(
true
);
}
else
{
fts
.
back
().
setHasSalt
(
false
);
}
}
else
if
(
head
==
"saltName"
){
std
::
string
saltName
=
line
.
substr
(
index
+
1
);
fts
.
back
().
setSaltName
(
saltName
);
}
else
if
(
head
==
"saltType"
){
std
::
string
saltTypeStr
=
line
.
substr
(
index
+
1
);
fts
.
back
().
setSaltType
(
std
::
stoi
(
saltTypeStr
));
}
else
if
(
head
==
"saltLength"
){
std
::
string
saltLengthStr
=
line
.
substr
(
index
+
1
);
fts
.
back
().
setSaltLength
(
std
::
stoi
(
saltLengthStr
));
}
else
if
(
head
==
"fieldFileFormat"
){
std
::
string
sub
=
line
.
substr
(
index
+
1
);
if
(
sub
==
"NA"
){
fts
.
back
().
setFieldStoreFormat
(
FieldMetaTrans
::
FILEFORMAT
::
NA
);
}
else
if
(
sub
==
"ESP_STRING"
){
fts
.
back
().
setFieldStoreFormat
(
FieldMetaTrans
::
FILEFORMAT
::
ESP_STRING
);
}
else
if
(
sub
==
"NUM_STRING"
){
fts
.
back
().
setFieldStoreFormat
(
FieldMetaTrans
::
FILEFORMAT
::
NUM_STRING
);
}
else
if
(
sub
==
"NUM_BINARY"
){
fts
.
back
().
setFieldStoreFormat
(
FieldMetaTrans
::
FILEFORMAT
::
NUM_BINARY
);
}
else
{
POINT
assert
(
0
);
}
}
else
{
POINT
assert
(
0
);
}
}
infile
.
close
();
}
void
TableMetaTrans
::
serialize
(
std
::
string
filename
,
std
::
string
prefix
){
FILE
*
localmeta
=
NULL
;
prefix
=
prefix
+
db
+
"/"
+
table
+
"/"
;
...
...
wrapper/common.hh
View file @
aa56f06e
...
...
@@ -69,14 +69,14 @@ public:
class
TableMetaTrans
{
string
db
,
table
;
/*plain name*/
std
::
vector
<
FieldMetaTrans
>
fts
;
string
serialize_vec_int
(
string
s
,
vector
<
int
>
vec_int
);
string
serialize_vec_str
(
string
s
,
vector
<
string
>
vec_str
);
vector
<
string
>
string_to_vec_str
(
string
line
);
vector
<
int
>
string_to_vec_int
(
string
line
);
static
bool
make_path
(
string
directory
);
public
:
TableMetaTrans
(
std
::
string
idb
,
std
::
string
itable
,
std
::
vector
<
FieldMetaTrans
>
ifts
)
:
db
(
idb
),
table
(
itable
),
fts
(
ifts
){}
TableMetaTrans
(
std
::
string
idb
,
std
::
string
itable
,
std
::
vector
<
FieldMetaTrans
>
ifts
)
:
db
(
idb
),
table
(
itable
),
fts
(
ifts
){}
TableMetaTrans
(){}
void
set_db
(
std
::
string
idb
){
db
=
idb
;}
string
get_db
(){
return
db
;}
...
...
@@ -84,11 +84,14 @@ public:
void
set_table
(
string
itable
){
table
=
itable
;}
string
get_table
(){
return
table
;}
std
::
vector
<
FieldMetaTrans
>
getFts
(){
return
fts
;}
std
::
vector
<
FieldMetaTrans
>&
getFtsRef
(){
return
fts
;}
void
set_db_table
(
string
idb
,
string
itable
){
db
=
idb
;
table
=
itable
;}
void
serialize
(
std
::
string
filename
=
"metadata.data"
,
std
::
string
prefix
=
"data/"
);
void
serializeNew
(
std
::
string
fullpath
);
void
deserializeNew
(
std
::
string
filename
=
"metadata.data"
,
std
::
string
prefix
=
"data/"
);
void
deserialize
(
std
::
string
filename
=
"metadata.data"
,
std
::
string
prefix
=
"data/"
);
void
show
();
};
...
...
wrapper/reuse.cc
View file @
aa56f06e
...
...
@@ -46,7 +46,32 @@ void FieldMeta_Wrapper::show(){
}
else
cout
<<
"do not have salt"
<<
endl
;
}
void
FieldMetaTrans
::
show
(){
std
::
cout
<<
"hasSalt:"
;
if
(
hasSalt
){
std
::
cout
<<
"true
\n
"
;
std
::
cout
<<
"saltType:"
<<
saltType
<<
std
::
endl
;
std
::
cout
<<
"saltLength:"
<<
saltLength
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"false
\n
"
;
}
std
::
cout
<<
"onionNames:"
;
for
(
auto
item
:
onionsName
)
std
::
cout
<<
item
<<
" "
;
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
"choosenOnionName:"
;
for
(
auto
item
:
choosenOnionName
)
std
::
cout
<<
item
<<
" "
;
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
"choosenFieldTypes:"
;
for
(
auto
item
:
choosenFieldTypes
)
std
::
cout
<<
item
<<
" "
;
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
"choosenFieldLengths:"
;
for
(
auto
item
:
choosenFieldLengths
)
std
::
cout
<<
item
<<
" "
;
std
::
cout
<<
std
::
endl
;
}
void
FieldMetaTrans
::
trans
(
FieldMeta
*
fm
)
{
originalFm
=
fm
;
if
(
fm
->
getHasSalt
()){
...
...
wrapper/reuse.hh
View file @
aa56f06e
...
...
@@ -74,6 +74,7 @@ struct FieldMeta_Wrapper{
class
FieldMetaTrans
{
public
:
//??
enum
class
FILEFORMAT
{
NA
,
ESP_STRING
,
NUM_STRING
,
NUM_BINARY
...
...
@@ -108,6 +109,7 @@ public:
}
std
::
cout
<<
std
::
endl
;
}
void
show
();
void
trans
(
FieldMeta
*
fm
);
void
choose
(
std
::
vector
<
onion
>
onionSet
);
void
choose
(
std
::
vector
<
int
>
onionIndexSet
);
...
...
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