Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sgxwallet
Project
Project
Details
Activity
Releases
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
董子豪
sgxwallet
Commits
591d503b
Unverified
Commit
591d503b
authored
Dec 09, 2020
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3023 add all keys info method
parent
f5925b11
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
4 deletions
+31
-4
LevelDB.cpp
LevelDB.cpp
+24
-1
LevelDB.h
LevelDB.h
+1
-1
SGXInfoServer.cpp
SGXInfoServer.cpp
+1
-1
sgx_util
sgx_util
+0
-0
sgx_util.cpp
sgx_util.cpp
+5
-1
No files found.
LevelDB.cpp
View file @
591d503b
...
...
@@ -27,6 +27,7 @@
#include <iostream>
#include "leveldb/db.h"
#include <jsonrpccpp/client.h>
#include "sgxwallet_common.h"
#include "SGXException.h"
...
...
@@ -167,10 +168,32 @@ void LevelDB::writeDataUnique(const string & name, const string &value) {
}
stringstream
LevelDB
::
getAllKeys
()
{
stringstream
result
;
leveldb
::
Iterator
*
it
=
db
->
NewIterator
(
readOptions
);
uint64_t
counter
=
0
;
for
(
it
->
SeekToFirst
();
it
->
Valid
();
it
->
Next
())
{
++
counter
;
string
key
=
it
->
key
().
ToString
();
string
value
;
if
(
it
->
value
().
ToString
()[
0
]
==
'{'
)
{
// new style keys
Json
::
Value
key_data
;
Json
::
Reader
reader
;
reader
.
parse
(
it
->
value
().
ToString
().
c_str
(),
key_data
);
value
=
" VALUE: "
+
key_data
[
"value"
].
asString
()
+
", TIMESTAMP: "
+
key_data
[
"timestamp"
].
asString
();
}
else
{
// old style keys
value
=
" VALUE: "
+
it
->
value
().
ToString
();
}
result
<<
"KEY: "
<<
key
<<
','
<<
value
<<
'\n'
;
}
result
<<
"TOTAL NUMBER OF KEYS: "
<<
counter
<<
'\n'
;
return
result
;
}
pair
<
string
,
uint64_t
>
LevelDB
::
getLastCreatedKey
()
{
pair
<
string
,
uint64_t
>
LevelDB
::
getLa
te
stCreatedKey
()
{
}
...
...
LevelDB.h
View file @
591d503b
...
...
@@ -72,7 +72,7 @@ public:
stringstream
getAllKeys
();
pair
<
string
,
uint64_t
>
getLastCreatedKey
();
pair
<
string
,
uint64_t
>
getLa
te
stCreatedKey
();
void
writeString
(
const
string
&
key1
,
const
string
&
value1
);
...
...
SGXInfoServer.cpp
View file @
591d503b
...
...
@@ -60,7 +60,7 @@ Json::Value SGXInfoServer::getLastCreatedKey() {
Json
::
Value
result
;
try
{
pair
<
string
,
uint64_t
>
key
=
LevelDB
::
getLevelDb
()
->
getLastCreatedKey
();
pair
<
string
,
uint64_t
>
key
=
LevelDB
::
getLevelDb
()
->
getLa
te
stCreatedKey
();
result
[
"keyName"
]
=
key
.
first
;
result
[
"creationTime"
]
=
key
.
second
;
}
HANDLE_SGX_EXCEPTION
(
result
)
...
...
sgx_util
deleted
100755 → 0
View file @
f5925b11
File deleted
sgx_util.cpp
View file @
591d503b
...
...
@@ -93,9 +93,13 @@ int main(int argc, char *argv[]) {
if
(
argc
==
1
)
{
std
::
cout
<<
"You may use following flags:"
<<
std
::
endl
;
std
::
cout
<<
" -p
print all unsigned csr hashes "
<<
std
::
endl
;
std
::
cout
<<
" -p print all unsigned csr hashes "
<<
std
::
endl
;
std
::
cout
<<
" -s [hash] sign csr by hash"
<<
std
::
endl
;
std
::
cout
<<
" -r [hash] reject csr by hash"
<<
std
::
endl
;
std
::
cout
<<
" -a print all keys"
<<
std
::
endl
;
std
::
cout
<<
" -l print latest created key"
<<
std
::
endl
;
std
::
cout
<<
" -c print server's config"
<<
std
::
endl
;
std
::
cout
<<
" -i [name] check if key with such name presents in database"
<<
std
::
endl
;
exit
(
0
);
}
std
::
string
hash
;
...
...
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