Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xxdk-wasm
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
xxdk-wasm
Commits
bfc9784e
Commit
bfc9784e
authored
2 years ago
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
pull in indexedDb refactor
parent
32b16d75
No related branches found
No related tags found
2 merge requests
!60
Revert "Fail a test to be sure it works"
,
!32
Admin Commands
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indexedDb/channels/implementation.go
+11
-7
11 additions, 7 deletions
indexedDb/channels/implementation.go
with
11 additions
and
7 deletions
indexedDb/channels/implementation.go
+
11
−
7
View file @
bfc9784e
...
...
@@ -289,7 +289,7 @@ func (w *wasmModel) UpdateFromMessageID(messageID cryptoChannel.MessageID,
defer
w
.
updateMux
.
Unlock
()
msgIDStr
:=
base64
.
StdEncoding
.
EncodeToString
(
messageID
.
Marshal
())
currentMsgObj
,
err
:=
w
.
g
etIndex
(
messageStoreName
,
currentMsgObj
,
err
:=
indexedDb
.
G
etIndex
(
w
.
db
,
messageStoreName
,
messageStoreMessageIndex
,
js
.
ValueOf
(
msgIDStr
))
if
err
!=
nil
{
jww
.
ERROR
.
Printf
(
"%+v"
,
errors
.
WithMessagef
(
parentErr
,
...
...
@@ -506,20 +506,24 @@ func (w *wasmModel) GetMessage(messageID cryptoChannel.MessageID) (channels.Mode
},
nil
}
// msgIDLookup gets the UUID of the Message with the given messageID.
func
(
w
*
wasmModel
)
msgIDLookup
(
messageID
cryptoChannel
.
MessageID
)
(
uint64
,
func
(
w
*
wasmModel
)
msgIDLookup
(
messageID
cryptoChannel
.
MessageID
)
(
*
Message
,
error
)
{
msgIDStr
:=
js
.
ValueOf
(
base64
.
StdEncoding
.
EncodeToString
(
messageID
.
Bytes
()))
resultObj
,
err
:=
indexedDb
.
GetIndex
(
w
.
db
,
messageStoreName
,
messageStoreMessageIndex
,
msgIDStr
)
if
err
!=
nil
{
return
0
,
err
return
nil
,
err
}
else
if
resultObj
.
IsUndefined
()
{
return
nil
,
errors
.
Errorf
(
"no message for %s found"
,
msgIDStr
)
}
uuid
:=
uint64
(
0
)
if
!
resultObj
.
IsUndefined
()
{
uuid
=
uint64
(
resultObj
.
Get
(
"id"
)
.
Int
())
// Process result into string
resultMsg
:=
&
Message
{}
err
=
json
.
Unmarshal
([]
byte
(
utils
.
JsToJson
(
resultObj
)),
resultMsg
)
if
err
!=
nil
{
return
nil
,
err
}
return
resultMsg
,
nil
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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