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
96b0d78f
Commit
96b0d78f
authored
May 16, 2017
by
casualet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
able to show ordered onion meta
parent
d17a467f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
4 deletions
+46
-4
.cdb_test.cc.swp
main/.cdb_test.cc.swp
+0
-0
cdb_test.cc
main/cdb_test.cc
+31
-2
dbobject.hh
main/dbobject.hh
+1
-0
schema.hh
main/schema.hh
+14
-2
No files found.
main/.cdb_test.cc.swp
0 → 100644
View file @
96b0d78f
File added
main/cdb_test.cc
View file @
96b0d78f
...
@@ -353,12 +353,41 @@ void batchTogether(std::string client, std::string curQuery,unsigned long long _
...
@@ -353,12 +353,41 @@ void batchTogether(std::string client, std::string curQuery,unsigned long long _
}
}
static
void
processOnionMeta
(
OnionMeta
&
om
){
std
::
cout
<<
"om.getAnonOnionName(): "
<<
om
.
getAnonOnionName
()
<<
std
::
endl
;
}
static
void
processFieldMeta
(
const
FieldMeta
&
field
){
static
void
processFieldMeta
(
const
FieldMeta
&
field
){
std
::
cout
<<
GREEN_BEGIN
<<
"PRINT FieldMeta"
<<
COLOR_END
<<
std
::
endl
;
//Process general info
if
(
field
.
getHasSalt
()){
std
::
cout
<<
"this field has salt"
<<
std
::
endl
;
}
std
::
cout
<<
"field.getFieldName(): "
<<
field
.
getFieldName
()
<<
std
::
endl
;
std
::
cout
<<
"field.getSaltName(): "
<<
field
.
getSaltName
()
<<
std
::
endl
;
std
::
cout
<<
"field.serialize(): "
<<
field
.
serialize
(
field
)
<<
std
::
endl
;
for
(
std
::
pair
<
const
OnionMetaKey
*
,
OnionMeta
*>
&
ompair
:
field
.
orderedOnionMetas
()){
processOnionMeta
(
*
ompair
.
second
);
}
//Process Onions
if
(
field
.
hasOnion
(
oDET
)){
field
.
getOnionMeta
(
oDET
);
}
if
(
field
.
hasOnion
(
oOPE
)){
field
.
getOnionMeta
(
oOPE
);
}
if
(
field
.
hasOnion
(
oAGG
)){
field
.
getOnionMeta
(
oAGG
);
}
return
;
//iterate over onions
for
(
const
std
::
pair
<
const
OnionMetaKey
,
std
::
unique_ptr
<
OnionMeta
>
>
&
onion
:
field
.
getChildren
()){
for
(
const
std
::
pair
<
const
OnionMetaKey
,
std
::
unique_ptr
<
OnionMeta
>
>
&
onion
:
field
.
getChildren
()){
std
::
cout
<<
onion
.
second
->
getDatabaseID
()
<<
":"
<<
onion
.
first
.
getValue
()
<<
std
::
endl
;
std
::
cout
<<
onion
.
second
->
getDatabaseID
()
<<
":"
<<
onion
.
first
.
getValue
()
<<
std
::
endl
;
}
}
std
::
cout
<<
GREEN_BEGIN
<<
"end FieldMeta"
<<
COLOR_END
<<
std
::
endl
;
}
}
static
void
processTableMeta
(
const
TableMeta
&
table
){
static
void
processTableMeta
(
const
TableMeta
&
table
){
...
...
main/dbobject.hh
View file @
96b0d78f
...
@@ -19,6 +19,7 @@ public:
...
@@ -19,6 +19,7 @@ public:
}
}
};
};
//we have onionMetaKey,UIntMetaKey and IdentityMetaKey for metadata hierachy
template
<
typename
KeyType
>
template
<
typename
KeyType
>
class
MetaKey
:
public
AbstractMetaKey
{
class
MetaKey
:
public
AbstractMetaKey
{
const
KeyType
key_data
;
const
KeyType
key_data
;
...
...
main/schema.hh
View file @
96b0d78f
...
@@ -82,15 +82,18 @@ private:
...
@@ -82,15 +82,18 @@ private:
class
FieldMeta
:
public
MappedDBMeta
<
OnionMeta
,
OnionMetaKey
>
,
class
FieldMeta
:
public
MappedDBMeta
<
OnionMeta
,
OnionMetaKey
>
,
public
UniqueCounter
{
public
UniqueCounter
{
public
:
public
:
// New.
// New a fieldmeta, Create_field and unique are used for determin the characteristics of the new
//fieldmeta, they are not part of fieldmeta.
FieldMeta
(
const
Create_field
&
field
,
const
AES_KEY
*
const
mKey
,
FieldMeta
(
const
Create_field
&
field
,
const
AES_KEY
*
const
mKey
,
SECURITY_RATING
sec_rating
,
unsigned
long
uniq_count
,
SECURITY_RATING
sec_rating
,
unsigned
long
uniq_count
,
bool
unique
);
bool
unique
);
// Restore (WARN: Creates an incomplete type as it will not have it's
// Restore (WARN: Creates an incomplete type as it will not have it's
// OnionMetas until they are added by the caller).
// OnionMetas until they are added by the caller).
static
std
::
unique_ptr
<
FieldMeta
>
static
std
::
unique_ptr
<
FieldMeta
>
deserialize
(
unsigned
int
id
,
const
std
::
string
&
serial
);
deserialize
(
unsigned
int
id
,
const
std
::
string
&
serial
);
//从数据库中读取serial数据, 反序列化以后, 就可以使用这个构造函数构造一个新的fieldmeta
//read serialized data, deserialize it, and then construct new fieldmeta
FieldMeta
(
unsigned
int
id
,
const
std
::
string
&
fname
,
bool
has_salt
,
FieldMeta
(
unsigned
int
id
,
const
std
::
string
&
fname
,
bool
has_salt
,
const
std
::
string
&
salt_name
,
onionlayout
onion_layout
,
const
std
::
string
&
salt_name
,
onionlayout
onion_layout
,
SECURITY_RATING
sec_rating
,
unsigned
long
uniq_count
,
SECURITY_RATING
sec_rating
,
unsigned
long
uniq_count
,
...
@@ -102,19 +105,26 @@ public:
...
@@ -102,19 +105,26 @@ public:
counter
(
counter
),
has_default
(
has_default
),
counter
(
counter
),
has_default
(
has_default
),
default_value
(
default_value
)
{
default_value
(
default_value
)
{
}
}
~
FieldMeta
()
{;}
~
FieldMeta
()
{;}
std
::
string
serialize
(
const
DBObject
&
parent
)
const
;
std
::
string
serialize
(
const
DBObject
&
parent
)
const
;
std
::
string
stringify
()
const
;
std
::
string
stringify
()
const
;
std
::
vector
<
std
::
pair
<
const
OnionMetaKey
*
,
OnionMeta
*>>
std
::
vector
<
std
::
pair
<
const
OnionMetaKey
*
,
OnionMeta
*>>
orderedOnionMetas
()
const
;
orderedOnionMetas
()
const
;
std
::
string
getSaltName
()
const
;
std
::
string
getSaltName
()
const
;
unsigned
long
getUniq
()
const
{
return
uniq_count
;}
unsigned
long
getUniq
()
const
{
return
uniq_count
;}
OnionMeta
*
getOnionMeta
(
onion
o
)
const
;
OnionMeta
*
getOnionMeta
(
onion
o
)
const
;
TYPENAME
(
"fieldMeta"
);
TYPENAME
(
"fieldMeta"
);
SECURITY_RATING
getSecurityRating
()
const
{
return
sec_rating
;}
SECURITY_RATING
getSecurityRating
()
const
{
return
sec_rating
;}
bool
hasOnion
(
onion
o
)
const
;
bool
hasOnion
(
onion
o
)
const
;
bool
hasDefault
()
const
{
return
has_default
;}
bool
hasDefault
()
const
{
return
has_default
;}
std
::
string
defaultValue
()
const
{
return
default_value
;}
std
::
string
defaultValue
()
const
{
return
default_value
;}
...
@@ -134,10 +144,12 @@ private:
...
@@ -134,10 +144,12 @@ private:
const
std
::
string
default_value
;
const
std
::
string
default_value
;
SECLEVEL
getOnionLevel
(
onion
o
)
const
;
SECLEVEL
getOnionLevel
(
onion
o
)
const
;
static
onionlayout
determineOnionLayout
(
const
AES_KEY
*
const
m_key
,
static
onionlayout
determineOnionLayout
(
const
AES_KEY
*
const
m_key
,
const
Create_field
&
f
,
const
Create_field
&
f
,
SECURITY_RATING
sec_rating
);
SECURITY_RATING
sec_rating
);
static
bool
determineHasDefault
(
const
Create_field
&
cf
);
static
bool
determineHasDefault
(
const
Create_field
&
cf
);
static
std
::
string
determineDefaultValue
(
bool
has_default
,
static
std
::
string
determineDefaultValue
(
bool
has_default
,
const
Create_field
&
cf
);
const
Create_field
&
cf
);
uint64_t
&
getCounter_
()
{
return
counter
;}
uint64_t
&
getCounter_
()
{
return
counter
;}
...
...
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