Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
corepkgv2
Commits
85bf7ab4
Commit
85bf7ab4
authored
1 year ago
by
Vijay Kumar Chauhan
Browse files
Options
Downloads
Plain Diff
Merge branch 'GetAllKeys_rewamp_prafuln' into 'coreimmudb'
rewamp GetAllKeysData method See merge request
!261
parents
dbf95942
84f72fa9
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!270
Core ImmuDB package and TOTP plugin - Implementation
,
!269
Core ImmuDB package and TOTP plugin - Implementation
,
!261
rewamp GetAllKeysData method
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dalmdl/coreimmudb/coreimmudb.go
+14
-14
dalmdl/coreimmudb/coreimmudb.go
with
14 additions
and
14 deletions
dalmdl/coreimmudb/coreimmudb.go
+
14
−
14
View file @
85bf7ab4
...
...
@@ -265,31 +265,31 @@ func (i *ImmuDAO) GetVerifiedKeyData(key []byte) (*schema.Entry, error) {
}
// GetAllKeysData - Getting all keys data
func
(
i
*
ImmuDAO
)
GetAllKeysData
(
keys
[][]
byte
)
([]
string
,
*
schema
.
Entries
,
error
)
{
/*
GetAllKeysData retrives value for provided keys,
values will be nil, for those keys which are not present in immudb
*/
func
(
i
*
ImmuDAO
)
GetAllKeysData
(
keys
[][]
byte
)
(
*
schema
.
Entries
,
error
)
{
client
,
err
:=
GetImmuDbConnection
(
i
.
HostName
)
// ImmuDB connection for the provided host
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
result
,
err
:=
client
.
GetAll
(
context
.
TODO
(),
keys
)
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
//converting and storing keys ([][]bytes) to []string
keyString
:=
[]
string
{}
for
_
,
v
:=
range
keys
{
keyString
=
append
(
keyString
,
string
(
v
))
mapEntries
:=
make
(
map
[
string
]
interface
{})
for
_
,
val
:=
range
result
.
Entries
{
mapEntries
[
string
(
val
.
Key
)]
=
val
.
Value
}
for
i
:=
0
;
i
<
len
(
keyString
);
i
++
{
for
j
:=
0
;
j
<
len
(
result
.
Entries
);
j
++
{
if
keyString
[
i
]
==
string
(
result
.
Entries
[
j
]
.
Key
)
{
//appending keys whose value not found in Immudb
keyString
=
append
(
keyString
[
:
i
],
keyString
[
i
+
1
:
]
...
)
}
for
_
,
key
:=
range
keys
{
if
_
,
ok
:=
mapEntries
[
string
(
key
)];
!
ok
{
result
.
Entries
=
append
(
result
.
Entries
,
&
schema
.
Entry
{
Key
:
key
,
Value
:
nil
})
}
}
return
keyString
,
result
,
nil
return
result
,
nil
}
// GetKeyHistory - Get history of single key
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets