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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
Duniter Datapod
Commits
7dd556f3
Commit
7dd556f3
authored
1 year ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
250494e9
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+7
-3
7 additions, 3 deletions
README.md
src/indexer/start.ts
+23
-10
23 additions, 10 deletions
src/indexer/start.ts
with
30 additions
and
13 deletions
README.md
+
7
−
3
View file @
7dd556f3
...
@@ -80,13 +80,17 @@ Features
...
@@ -80,13 +80,17 @@ Features
-
[x] pubkey instead of ss58 address if we want data to be compatible across networks → ss58
-
[x] pubkey instead of ss58 address if we want data to be compatible across networks → ss58
-
[ ] add periodic sync with a list of IPNS
-
[ ] add periodic sync with a list of IPNS
-
[ ] split indexer vue app from backend indexer and improve node admin app
-
[ ] split indexer vue app from backend indexer and improve node admin app
-
[
] clarify the purpose of the the main TAMT
-
[
x
] clarify the purpose of the the main TAMT
-
[ ] clarify the adressing format in the tables
-
[ ] clarify the adressing format in the tables
-
[ ] add domain specific index for profile for example
-
[ ] add domain specific index for profile for example
-
[ ] add a refcount to count the number of documents
-
[ ] add a refcount to count the number of documents
-
[ ]
-
[ ] make the app build in prod mode
-
[ ] allow connecting the app to a custom RPC endpoint
-
[ ] manage unpin requests when user/admin wants to delete data, see refcount
-
[ ] manage unpin requests when user/admin wants to delete data, see refcount
-
[ ] document dev database change with tracking hasura console and squashing migrations
-
[ ] document dev database change with tracking hasura console and squashing migrations
-
[ ] add transaction comment
-
[ ] add transaction comment
-
[ ] add version history to database (history of index request CIDs)
-
[ ] add version history to database (history of index request CIDs)
-> not systematic
-
[ ] update description of pubkey field to ss58
-
[ ] update description of pubkey field to ss58
-
[ ] add ability to remove a node as well as its parent if it leaves it empty
-
[ ] make base custom per tree (base 16, base 32)
-
[ ]
This diff is collapsed.
Click to expand it.
src/indexer/start.ts
+
23
−
10
View file @
7dd556f3
...
@@ -11,15 +11,28 @@ import { getRootCIDfromArgs } from './utils'
...
@@ -11,15 +11,28 @@ import { getRootCIDfromArgs } from './utils'
// === HANDLERS ===
// === HANDLERS ===
// pubsub message handler
// pubsub message handler
async
function
validMessageHandler
(
cid
:
CID
,
dag
:
IndexRequest
):
Promise
<
void
>
{
async
function
validMessageHandler
(
_cid
:
CID
,
dag
:
IndexRequest
):
Promise
<
void
>
{
// re-build the index request (because the type is loosely defined)
const
ir
:
IndexRequest
=
{
kind
:
dag
.
kind
,
time
:
dag
.
time
,
data
:
dag
.
data
,
pubkey
:
dag
.
pubkey
,
sig
:
dag
.
sig
}
// then store the index request locally
kubo
.
dag
.
put
(
ir
,
{
pin
:
true
})
.
then
((
cid
)
=>
{
// cids should be the same
if
(
cid
.
toString
()
!=
_cid
.
toString
())
console
.
log
(
'
⚠️
'
+
cid
+
'
!=
'
+
_cid
)
console
.
log
(
'
adding valid index request to process queue
'
)
console
.
log
(
'
adding valid index request to process queue
'
)
// add index request to the process list
// add index request to the process list
processQueue
.
push
([
cid
,
dag
])
processQueue
.
push
([
cid
,
ir
])
// ask to process the request
// ask to process the request
events
.
emit
(
evtype
.
trigger
)
events
.
emit
(
evtype
.
trigger
)
// try pin the new data so that it is available to the indexer
})
// there might be a UND_ERR_BODY_TIMEOUT if data could not be retreived in time
.
catch
(()
=>
console
.
log
(
'
📌 could not add valid index request
'
+
_cid
))
kubo
.
pin
.
add
(
cid
,
{
recursive
:
true
}).
catch
(()
=>
console
.
log
(
'
📌 could not pin valid index request
'
+
cid
))
return
return
}
}
const
handleMessage
=
getPubSubHandler
(
validMessageHandler
)
const
handleMessage
=
getPubSubHandler
(
validMessageHandler
)
...
@@ -46,7 +59,7 @@ function handleBatch() {
...
@@ -46,7 +59,7 @@ function handleBatch() {
items
.
push
(
i
)
items
.
push
(
i
)
}
}
// convert it to a list of [key, cid] for batch insert (merge)
// convert it to a list of [key, cid] for batch insert (merge)
const
requests
=
items
.
map
(([
cid
,
dag
])
=>
[
timestampToKey
(
dag
.
time
),
cid
]).
sort
()
as
Array
<
[
string
,
CID
]
>
const
requests
=
items
.
map
(([
cid
,
ir
])
=>
[
timestampToKey
(
ir
.
time
),
cid
]).
sort
()
as
Array
<
[
string
,
CID
]
>
const
tree
=
arrayToVinode
(
requests
)
const
tree
=
arrayToVinode
(
requests
)
// insert them
// insert them
...
...
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