Skip to content

Commit

Permalink
move directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Tangui-Bitfly committed Jan 29, 2025
1 parent 80ec438 commit 3c6a22a
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
12 changes: 6 additions & 6 deletions backend/cmd/eth1indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import (
"github.com/gobitfly/beaconchain/pkg/commons/db2/database"
"github.com/gobitfly/beaconchain/pkg/commons/db2/metadataupdates"
"github.com/gobitfly/beaconchain/pkg/commons/erc20"
"github.com/gobitfly/beaconchain/pkg/commons/indexer"
"github.com/gobitfly/beaconchain/pkg/commons/log"
"github.com/gobitfly/beaconchain/pkg/commons/metrics"
"github.com/gobitfly/beaconchain/pkg/commons/rpc"
"github.com/gobitfly/beaconchain/pkg/commons/services"
"github.com/gobitfly/beaconchain/pkg/commons/types"
"github.com/gobitfly/beaconchain/pkg/commons/utils"
"github.com/gobitfly/beaconchain/pkg/commons/version"
"github.com/gobitfly/beaconchain/pkg/executionlayer"

"github.com/coocood/freecache"
"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -190,18 +190,18 @@ func Run() {
log.Fatal(err, "error connecting to bigtable", 0)
}

indxr := indexer.New(
indexer := executionlayer.NewIndexer(
data.NewStore(database.Wrap(bigtable, data.Table)),
metadataupdates.NewStore(database.Wrap(bigtable, metadataupdates.Table)),
indexer.NewTransformer(cache).All()...,
executionlayer.NewTransformer(cache).All()...,
)

if *block != 0 {
err = IndexFromNode(bt, client, *block, *block, *concurrencyBlocks, *traceMode)
if err != nil {
log.Fatal(err, "error indexing from node", 0, map[string]interface{}{"block": *block, "concurrency": *concurrencyBlocks})
}
err = bt.IndexEventsWithIndexer(*block, *block, indxr, *concurrencyData)
err = bt.IndexEventsWithIndexer(*block, *block, indexer, *concurrencyData)
if err != nil {
log.Fatal(err, "error indexing from bigtable", 0)
}
Expand Down Expand Up @@ -237,7 +237,7 @@ func Run() {
}

if *endData != 0 && *startData < *endData {
err = bt.IndexEventsWithIndexer(*startData, *endData, indxr, *concurrencyData)
err = bt.IndexEventsWithIndexer(*startData, *endData, indexer, *concurrencyData)
if err != nil {
log.Fatal(err, "error indexing from bigtable", 0)
}
Expand Down Expand Up @@ -340,7 +340,7 @@ func Run() {
endBlock = int64(lastBlockFromNode)
}

err = bt.IndexEventsWithIndexer(startBlock, endBlock, indxr, *concurrencyData)
err = bt.IndexEventsWithIndexer(startBlock, endBlock, indexer, *concurrencyData)
if err != nil {
log.Error(err, "error indexing from bigtable", 0, map[string]interface{}{"start": startBlock, "end": endBlock, "concurrency": *concurrencyData})
cache.Clear()
Expand Down
8 changes: 4 additions & 4 deletions backend/cmd/misc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ import (
"github.com/gobitfly/beaconchain/pkg/commons/db2/data"
"github.com/gobitfly/beaconchain/pkg/commons/db2/database"
"github.com/gobitfly/beaconchain/pkg/commons/db2/metadataupdates"
"github.com/gobitfly/beaconchain/pkg/commons/indexer"
"github.com/gobitfly/beaconchain/pkg/commons/log"
"github.com/gobitfly/beaconchain/pkg/commons/rpc"
"github.com/gobitfly/beaconchain/pkg/commons/types"
"github.com/gobitfly/beaconchain/pkg/commons/utils"
"github.com/gobitfly/beaconchain/pkg/commons/version"
"github.com/gobitfly/beaconchain/pkg/consapi"
"github.com/gobitfly/beaconchain/pkg/executionlayer"
edb "github.com/gobitfly/beaconchain/pkg/exporter/db"
"github.com/gobitfly/beaconchain/pkg/exporter/modules"
"github.com/gobitfly/beaconchain/pkg/exporter/services"
Expand Down Expand Up @@ -1626,12 +1626,12 @@ func indexOldEth1Blocks(startBlock uint64, endBlock uint64, batchSize uint64, co
log.Fatal(err, "error connecting to bigtable", 0)
}
cache := freecache.NewCache(100 * 1024 * 1024) // 100 MB limit
transforms, err := indexer.NewTransformer(cache).FromList(transformerList)
transforms, err := executionlayer.NewTransformer(cache).FromList(transformerList)
if err != nil {
log.Error(nil, err.Error(), 0)
return
}
indxr := indexer.New(
indexer := executionlayer.NewIndexer(
data.NewStore(database.Wrap(bigtable, data.Table)),
metadataupdates.NewStore(database.Wrap(bigtable, metadataupdates.Table)),
transforms...,
Expand Down Expand Up @@ -1659,7 +1659,7 @@ func indexOldEth1Blocks(startBlock uint64, endBlock uint64, batchSize uint64, co
toBlock := utilMath.MinU64(to, from+blockCount-1)

log.Infof("indexing blocks %v to %v in data table ...", from, toBlock)
err := bt.IndexEventsWithIndexer(int64(from), int64(toBlock), indxr, int64(concurrency))
err := bt.IndexEventsWithIndexer(int64(from), int64(toBlock), indexer, int64(concurrency))
if err != nil {
log.Error(err, "error indexing from bigtable", 0)
}
Expand Down
6 changes: 3 additions & 3 deletions backend/internal/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/gobitfly/beaconchain/pkg/commons/db2/database"
"github.com/gobitfly/beaconchain/pkg/commons/db2/database/databasetest"
"github.com/gobitfly/beaconchain/pkg/commons/db2/metadataupdates"
"github.com/gobitfly/beaconchain/pkg/commons/indexer"
"github.com/gobitfly/beaconchain/pkg/commons/rpc"
"github.com/gobitfly/beaconchain/pkg/commons/types"
"github.com/gobitfly/beaconchain/pkg/executionlayer"
)

func TestStoreWithBackend(t *testing.T) {
Expand All @@ -31,8 +31,8 @@ func TestStoreWithBackend(t *testing.T) {
backend := th.NewBackend(t)
usdtAddress, usdt := backend.DeployToken(t, "usdt", "usdt", backend.BankAccount.From)

transform := indexer.NewTransformer(indexer.NoopCache{})
indexer := indexer.New(dataStore, metadataStore, transform.All()...)
transform := executionlayer.NewTransformer(executionlayer.NoopCache{})
indexer := executionlayer.NewIndexer(dataStore, metadataStore, transform.All()...)

client, err := rpc.NewErigonClient(backend.Endpoint)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions backend/pkg/commons/db/bigtable_eth1.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import (
"time"

"github.com/gobitfly/beaconchain/pkg/commons/cache"
"github.com/gobitfly/beaconchain/pkg/commons/indexer"
"github.com/gobitfly/beaconchain/pkg/commons/log"
"github.com/gobitfly/beaconchain/pkg/commons/rpc"
"github.com/gobitfly/beaconchain/pkg/commons/types"
"github.com/gobitfly/beaconchain/pkg/commons/utils"
"github.com/gobitfly/beaconchain/pkg/executionlayer"

gcp_bigtable "cloud.google.com/go/bigtable"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -693,7 +693,7 @@ func reversePaddedBigtableTimestamp(timestamp *timestamppb.Timestamp) string {
return fmt.Sprintf("%019d", MAX_INT-timestamp.Seconds)
}

func (bigtable *Bigtable) IndexEventsWithIndexer(start, end int64, indxr *indexer.Indexer, concurrency int64) error {
func (bigtable *Bigtable) IndexEventsWithIndexer(start, end int64, indexer *executionlayer.Indexer, concurrency int64) error {
g := new(errgroup.Group)
g.SetLimit(int(concurrency))

Expand Down Expand Up @@ -728,7 +728,7 @@ func (bigtable *Bigtable) IndexEventsWithIndexer(start, end int64, indxr *indexe
for b := range blocksChan {
block := b
subG.Go(func() error {
return indxr.IndexBlock(bigtable.chainId, block)
return indexer.IndexBlock(bigtable.chainId, block)
})
}
return subG.Wait()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package indexer
package executionlayer

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package indexer
package executionlayer

import (
"fmt"
Expand All @@ -20,7 +20,7 @@ type Indexer struct {
transformers []TransformFunc
}

func New(dataStore data.Store, metadataUpdatesStore metadataupdates.Store, transformers ...TransformFunc) *Indexer {
func NewIndexer(dataStore data.Store, metadataUpdatesStore metadataupdates.Store, transformers ...TransformFunc) *Indexer {
return &Indexer{
data: dataStore,
metadataUpdates: metadataUpdatesStore,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package indexer
package executionlayer

import (
"context"
Expand Down Expand Up @@ -141,7 +141,7 @@ func TestIndexer(t *testing.T) {
defer dataBigtable.Clear()
defer metadataBigtable.Clear()

indexer := New(
indexer := NewIndexer(
data.NewStore(database.Wrap(dataBigtable, data.Table)),
metadataupdates.NewStore(database.Wrap(metadataBigtable, metadataupdates.Table)),
tt.transformers...,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package indexer
package executionlayer

import (
"bytes"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package indexer
package executionlayer

import (
"fmt"
Expand Down

0 comments on commit 3c6a22a

Please sign in to comment.