Skip to content

Commit c0c492e

Browse files
authored
insight indexer v2 (#297)
insight indexer v2
1 parent f66f782 commit c0c492e

File tree

109 files changed

+2998
-19343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2998
-19343
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ configs/secrets*
3333

3434
indexer
3535
main
36+
*.parquet

cmd/api.go

Lines changed: 0 additions & 139 deletions
This file was deleted.

cmd/backfill.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
"net/http"
6+
7+
"github.com/prometheus/client_golang/prometheus/promhttp"
8+
"github.com/rs/zerolog/log"
9+
"github.com/spf13/cobra"
10+
"github.com/thirdweb-dev/indexer/internal/backfill"
11+
)
12+
13+
var backfillCmd = &cobra.Command{
14+
Use: "backfill",
15+
Short: "run backfill",
16+
Long: "backfill data from old clickhouse + rpc to s3. if cannot get all blocks for a range, it will panic",
17+
Run: RunBackfill,
18+
}
19+
20+
func RunBackfill(cmd *cobra.Command, args []string) {
21+
fmt.Println("running backfill")
22+
23+
// Start Prometheus metrics server
24+
log.Info().Msg("Starting Metrics Server on port 2112")
25+
go func() {
26+
http.Handle("/metrics", promhttp.Handler())
27+
if err := http.ListenAndServe(":2112", nil); err != nil {
28+
log.Error().Err(err).Msg("Metrics server error")
29+
}
30+
}()
31+
32+
backfill.Init()
33+
backfill.RunBackfill()
34+
}

cmd/committer.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
"net/http"
6+
7+
"github.com/prometheus/client_golang/prometheus/promhttp"
8+
"github.com/rs/zerolog/log"
9+
"github.com/spf13/cobra"
10+
"github.com/thirdweb-dev/indexer/internal/committer"
11+
)
12+
13+
var committerCmd = &cobra.Command{
14+
Use: "committer",
15+
Short: "run committer",
16+
Long: "published data from s3 to kafka. if block is not found in s3, it will panic",
17+
Run: RunCommitter,
18+
}
19+
20+
func RunCommitter(cmd *cobra.Command, args []string) {
21+
fmt.Println("running committer")
22+
23+
// Start Prometheus metrics server
24+
log.Info().Msg("Starting Metrics Server on port 2112")
25+
go func() {
26+
http.Handle("/metrics", promhttp.Handler())
27+
if err := http.ListenAndServe(":2112", nil); err != nil {
28+
log.Error().Err(err).Msg("Metrics server error")
29+
}
30+
}()
31+
32+
committer.Init()
33+
committer.InitReorg()
34+
35+
go committer.RunReorgValidator()
36+
committer.CommitStreaming()
37+
}

0 commit comments

Comments
 (0)