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
8f810943
Commit
8f810943
authored
Jan 18, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
able to use new version of load and store with the strategy funciont for load in wrapper/reuse.cc
parent
fc14f7df
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
14 deletions
+30
-14
storetemp.cc
debug/storetemp.cc
+5
-14
.reuse.cc.swp
wrapper/.reuse.cc.swp
+0
-0
reuse.cc
wrapper/reuse.cc
+20
-0
reuse.hh
wrapper/reuse.hh
+5
-0
No files found.
debug/storetemp.cc
View file @
8f810943
...
...
@@ -6,10 +6,6 @@ static std::map<std::string, WrapperState*> clients;
//This connection mimics the behaviour of MySQL-Proxy
Connect
*
globalConn
;
//must be static, or we get "no previous declaration"
//execute the query and get the rawReturnVale, this struct can be copied.
static
void
init
(){
std
::
string
client
=
"192.168.1.1:1234"
;
//one Wrapper per user.
...
...
@@ -66,8 +62,6 @@ static void write_meta(rawMySQLReturnValue& resraw,std::vector<FieldMetaTrans> &
mf
.
serialize
();
}
static
void
write_raw_data_to_files
(
rawMySQLReturnValue
&
resraw
,
std
::
vector
<
FieldMetaTrans
>
&
res
,
string
db
,
string
table
){
//write metafiles
...
...
@@ -80,16 +74,16 @@ static void store(std::string db, std::string table){
std
::
unique_ptr
<
SchemaInfo
>
schema
=
myLoadSchemaInfo
(
embeddedDir
);
//get all the fields in the tables
std
::
vector
<
FieldMeta
*>
fms
=
getFieldMeta
(
*
schema
,
db
,
table
);
//transform the field so that selected onions can be used
std
::
vector
<
FieldMetaTrans
>
res
;
for
(
auto
i
=
0u
;
i
<
fms
.
size
();
i
++
){
FieldMetaTrans
ft
;
res
.
push_back
(
ft
);
res
.
back
().
trans
(
fms
[
i
]);
std
::
vector
<
int
>
in
{
0
};
//this is our strategy !!!!!
res
.
back
().
choose
(
in
);
}
storeStrategies
(
res
);
//generate the backup query and then fetch the tuples
std
::
string
backup_query
=
getTestQuery
(
*
schema
,
res
,
db
,
table
);
rawMySQLReturnValue
resraw
=
executeAndGetResultRemote
(
globalConn
,
backup_query
);
...
...
@@ -97,17 +91,14 @@ static void store(std::string db, std::string table){
//then we should set the type and length of FieldMetaTrans
auto
types
=
resraw
.
fieldTypes
;
auto
lengths
=
resraw
.
lengths
;
int
base_types
=
0
;
int
base_lengths
=
0
;
for
(
auto
&
item
:
res
){
vector
<
int
>
tempTypes
;
vector
<
int
>
tempLengths
;
for
(
unsigned
int
i
=
0u
;
i
<
item
.
getChoosenOnionName
().
size
();
i
++
){
tempTypes
.
push_back
(
types
[
base_types
]);
tempLengths
.
push_back
(
lengths
[
base_lengths
]);
base_types
++
;
base_lengths
++
;
tempTypes
.
push_back
(
types
[
base_types
++
]);
tempLengths
.
push_back
(
lengths
[
base_lengths
++
]);
}
item
.
setChoosenFieldTypes
(
tempTypes
);
item
.
setChoosenFieldLengths
(
tempLengths
);
...
...
wrapper/.reuse.cc.swp
deleted
100644 → 0
View file @
fc14f7df
File deleted
wrapper/reuse.cc
View file @
8f810943
...
...
@@ -380,3 +380,23 @@ write_row_data(rawMySQLReturnValue& resraw,std::string db,std::string table,std:
fclose
(
item
);
}
}
STORE_STRATEGY
currentStrategy
=
STORE_STRATEGY
::
FIRST
;
/*storage used when we store*/
void
storeStrategies
(
std
::
vector
<
FieldMetaTrans
>&
res
){
if
(
currentStrategy
==
STORE_STRATEGY
::
FIRST
){
std
::
vector
<
int
>
in
{
0
};
for
(
auto
&
item
:
res
){
item
.
choose
(
in
);
}
}
else
if
(
currentStrategy
==
STORE_STRATEGY
::
ALL
){
}
else
{
exit
(
0
);
}
}
wrapper/reuse.hh
View file @
8f810943
...
...
@@ -146,4 +146,9 @@ executeAndGetResultRemote(Connect * curConn,std::string query);
void
write_row_data
(
rawMySQLReturnValue
&
resraw
,
std
::
string
db
,
std
::
string
table
,
std
::
string
prefix
=
"data/"
);
void
storeStrategies
(
std
::
vector
<
FieldMetaTrans
>&
res
);
enum
class
STORE_STRATEGY
{
FIRST
,
ALL
};
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