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
2f0a7279
Unverified
Commit
2f0a7279
authored
Dec 11, 2020
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3023 pretify getAllKeysInfo command
parent
dbdf3e8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
LevelDB.cpp
LevelDB.cpp
+4
-4
sgx_util.cpp
sgx_util.cpp
+2
-2
No files found.
LevelDB.cpp
View file @
2f0a7279
...
@@ -187,14 +187,14 @@ stringstream LevelDB::getAllKeys() {
...
@@ -187,14 +187,14 @@ stringstream LevelDB::getAllKeys() {
reader
.
parse
(
it
->
value
().
ToString
().
c_str
(),
key_data
);
reader
.
parse
(
it
->
value
().
ToString
().
c_str
(),
key_data
);
string
timestamp_to_date_command
=
"date -d @"
+
key_data
[
"timestamp"
].
asString
();
string
timestamp_to_date_command
=
"date -d @"
+
key_data
[
"timestamp"
].
asString
();
value
=
" VALUE: "
+
key_data
[
"value"
].
asString
()
+
", TIMESTAMP: "
+
exec
(
timestamp_to_date_command
.
c_str
());
value
=
" VALUE: "
+
key_data
[
"value"
].
asString
()
+
", TIMESTAMP: "
+
exec
(
timestamp_to_date_command
.
c_str
())
+
'\n'
;
}
else
{
}
else
{
// old style keys
// old style keys
value
=
" VALUE: "
+
it
->
value
().
ToString
();
value
=
" VALUE: "
+
it
->
value
().
ToString
();
}
}
result
<<
"KEY: "
<<
key
<<
','
<<
value
<<
std
::
endl
;
result
<<
"KEY: "
<<
key
<<
','
<<
value
;
}
}
result
<<
"TOTAL NUMBER OF KEYS: "
<<
counter
<<
'\n'
;
result
<<
"TOTAL NUMBER OF KEYS: "
<<
counter
;
return
result
;
return
result
;
}
}
...
@@ -202,7 +202,7 @@ stringstream LevelDB::getAllKeys() {
...
@@ -202,7 +202,7 @@ stringstream LevelDB::getAllKeys() {
pair
<
string
,
uint64_t
>
LevelDB
::
getLatestCreatedKey
()
{
pair
<
string
,
uint64_t
>
LevelDB
::
getLatestCreatedKey
()
{
leveldb
::
Iterator
*
it
=
db
->
NewIterator
(
readOptions
);
leveldb
::
Iterator
*
it
=
db
->
NewIterator
(
readOptions
);
u
int64_t
latest_timestamp
=
0
;
int64_t
latest_timestamp
=
0
;
string
latest_created_key_name
=
""
;
string
latest_created_key_name
=
""
;
for
(
it
->
SeekToFirst
();
it
->
Valid
();
it
->
Next
())
{
for
(
it
->
SeekToFirst
();
it
->
Valid
();
it
->
Next
())
{
if
(
it
->
value
().
ToString
()[
0
]
==
'{'
)
{
if
(
it
->
value
().
ToString
()[
0
]
==
'{'
)
{
...
...
sgx_util.cpp
View file @
2f0a7279
...
@@ -49,7 +49,7 @@ void getAllKeysInfo() {
...
@@ -49,7 +49,7 @@ void getAllKeysInfo() {
jsonrpc
::
HttpClient
client
(
"http://localhost:1030"
);
jsonrpc
::
HttpClient
client
(
"http://localhost:1030"
);
StubClient
c
(
client
,
jsonrpc
::
JSONRPC_CLIENT_V2
);
StubClient
c
(
client
,
jsonrpc
::
JSONRPC_CLIENT_V2
);
std
::
cout
<<
"Info client inited"
<<
std
::
endl
;
std
::
cout
<<
"Info client inited"
<<
std
::
endl
;
std
::
cout
<<
c
.
getAllKeysInfo
()[
"allKeys"
]
<<
std
::
endl
;
std
::
cout
<<
c
.
getAllKeysInfo
()[
"allKeys"
]
.
asString
().
c_str
()
<<
std
::
endl
;
exit
(
0
);
exit
(
0
);
}
}
...
@@ -60,7 +60,7 @@ void getLatestCreatedKey() {
...
@@ -60,7 +60,7 @@ void getLatestCreatedKey() {
Json
::
Value
lastCreatedKey
=
c
.
getLatestCreatedKey
();
Json
::
Value
lastCreatedKey
=
c
.
getLatestCreatedKey
();
std
::
cout
<<
"Last created key name: "
<<
lastCreatedKey
[
"keyName"
]
<<
std
::
endl
;
std
::
cout
<<
"Last created key name: "
<<
lastCreatedKey
[
"keyName"
]
<<
std
::
endl
;
std
::
string
timestamp_to_date_command
=
"date -d @"
+
lastCreatedKey
[
"creationTime"
].
asString
();
std
::
string
timestamp_to_date_command
=
"date -d @"
+
lastCreatedKey
[
"creationTime"
].
asString
();
std
::
cout
<<
"Last created key creation time: "
<<
exec
(
timestamp_to_date_command
.
c_str
())
<<
std
::
endl
;
std
::
cout
<<
"Last created key creation time: "
<<
exec
(
timestamp_to_date_command
.
c_str
());
exit
(
0
);
exit
(
0
);
}
}
...
...
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