Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter Datapod
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
Duniter Datapod
Commits
0bd2d5b3
Commit
0bd2d5b3
authored
1 year ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
reproducible leaf without duplicate
parent
04b2522c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/processor.ts
+6
-1
6 additions, 1 deletion
src/processor.ts
with
6 additions
and
1 deletion
src/processor.ts
+
6
−
1
View file @
0bd2d5b3
...
@@ -81,7 +81,12 @@ async function processInode(node: IndexInode, key: string, val: CID): Promise<CI
...
@@ -81,7 +81,12 @@ async function processInode(node: IndexInode, key: string, val: CID): Promise<CI
}
}
async
function
processLeaf
(
node
:
IndexLeaf
,
val
:
CID
):
Promise
<
CID
>
{
async
function
processLeaf
(
node
:
IndexLeaf
,
val
:
CID
):
Promise
<
CID
>
{
if
(
!
node
.
leaf
.
some
((
c
)
=>
c
.
toString
()
==
val
.
toString
()))
{
// only insert if not already there (avoid duplicate)
node
.
leaf
.
push
(
val
)
node
.
leaf
.
push
(
val
)
// ensure leaf order is predictible
node
.
leaf
.
sort
((
a
,
b
)
=>
(
a
.
toString
()
<
b
.
toString
()
?
-
1
:
1
))
}
const
newCid
=
await
kubo
.
dag
.
put
(
node
)
const
newCid
=
await
kubo
.
dag
.
put
(
node
)
return
newCid
return
newCid
}
}
...
...
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