Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize plugin packages. #1317

Merged
merged 2 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/handlers_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/base64"
"fmt"
test2 "github.com/sirupsen/logrus/hooks/test"
"io/ioutil"
"net/http"
"net/http/httptest"
Expand All @@ -15,6 +14,7 @@ import (

"github.com/labstack/echo/v4"
"github.com/sirupsen/logrus"
test2 "github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand All @@ -29,10 +29,10 @@ import (
"github.com/algorand/go-algorand/rpcs"

"github.com/algorand/indexer/api/generated/v2"
"github.com/algorand/indexer/conduit/plugins/processors/blockprocessor"
"github.com/algorand/indexer/idb"
"github.com/algorand/indexer/idb/postgres"
pgtest "github.com/algorand/indexer/idb/postgres/testing"
"github.com/algorand/indexer/processors/blockprocessor"
"github.com/algorand/indexer/util/test"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/algorand-indexer/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (
"github.com/algorand/indexer/api/generated/v2"
"github.com/algorand/indexer/conduit"
"github.com/algorand/indexer/conduit/pipeline"
_ "github.com/algorand/indexer/conduit/plugins/exporters/postgresql"
_ "github.com/algorand/indexer/conduit/plugins/importers/algod"
_ "github.com/algorand/indexer/conduit/plugins/processors/blockprocessor"
"github.com/algorand/indexer/config"
_ "github.com/algorand/indexer/exporters/postgresql"
"github.com/algorand/indexer/fetcher"
"github.com/algorand/indexer/idb"
_ "github.com/algorand/indexer/importers/algod"
_ "github.com/algorand/indexer/processors/blockprocessor"
iutil "github.com/algorand/indexer/util"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/conduit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
"github.com/algorand/indexer/util/metrics"

// We need to import these so that the package wide init() function gets called
_ "github.com/algorand/indexer/exporters/all"
_ "github.com/algorand/indexer/importers/all"
_ "github.com/algorand/indexer/processors/all"
_ "github.com/algorand/indexer/conduit/plugins/exporters/all"
_ "github.com/algorand/indexer/conduit/plugins/importers/all"
_ "github.com/algorand/indexer/conduit/plugins/processors/all"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion conduit/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"strings"

"github.com/algorand/go-algorand/util"
"github.com/spf13/pflag"

"github.com/algorand/go-algorand/util"
)

// DefaultConfigName is the default conduit configuration filename.
Expand Down
3 changes: 2 additions & 1 deletion conduit/hooks.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package conduit

import (
"github.com/algorand/indexer/data"
"github.com/prometheus/client_golang/prometheus"

"github.com/algorand/indexer/data"
)

// OnCompleteFunc is the signature for the Completed functional interface.
Expand Down
6 changes: 3 additions & 3 deletions conduit/pipeline/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package pipeline

import (
"github.com/algorand/indexer/conduit"
"github.com/algorand/indexer/exporters"
"github.com/algorand/indexer/importers"
"github.com/algorand/indexer/processors"
"github.com/algorand/indexer/conduit/plugins/exporters"
"github.com/algorand/indexer/conduit/plugins/importers"
"github.com/algorand/indexer/conduit/plugins/processors"
)

// AllMetadata gets a slice with metadata from all registered plugins.
Expand Down
8 changes: 4 additions & 4 deletions conduit/pipeline/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
)

import (
_ "github.com/algorand/indexer/exporters/all"
_ "github.com/algorand/indexer/exporters/example"
_ "github.com/algorand/indexer/importers/all"
_ "github.com/algorand/indexer/processors/all"
_ "github.com/algorand/indexer/conduit/plugins/exporters/all"
_ "github.com/algorand/indexer/conduit/plugins/exporters/example"
_ "github.com/algorand/indexer/conduit/plugins/importers/all"
_ "github.com/algorand/indexer/conduit/plugins/processors/all"
)

// TestSamples ensures that all plugins contain a sample file with valid yaml.
Expand Down
8 changes: 4 additions & 4 deletions conduit/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import (
"gopkg.in/yaml.v3"

"github.com/algorand/indexer/conduit"
"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/exporters"
"github.com/algorand/indexer/conduit/plugins/importers"
"github.com/algorand/indexer/conduit/plugins/processors"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/exporters"
"github.com/algorand/indexer/importers"
"github.com/algorand/indexer/plugins"
"github.com/algorand/indexer/processors"
"github.com/algorand/indexer/util"
"github.com/algorand/indexer/util/metrics"
)
Expand Down
11 changes: 6 additions & 5 deletions conduit/pipeline/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ import (
"testing"
"time"

"github.com/algorand/go-algorand/crypto"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/data/bookkeeping"

"github.com/algorand/indexer/conduit"
"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/exporters"
"github.com/algorand/indexer/conduit/plugins/importers"
"github.com/algorand/indexer/conduit/plugins/processors"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/exporters"
"github.com/algorand/indexer/importers"
"github.com/algorand/indexer/plugins"
"github.com/algorand/indexer/processors"
)

// TestPipelineConfigValidity tests the Valid() function for the Config
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions conduit/plugins/exporters/all/all.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package all

import (
// Call package wide init function
_ "github.com/algorand/indexer/conduit/plugins/exporters/filewriter"
_ "github.com/algorand/indexer/conduit/plugins/exporters/noop"
_ "github.com/algorand/indexer/conduit/plugins/exporters/postgresql"
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/algorand/go-algorand/data/bookkeeping"

"github.com/algorand/indexer/conduit"
"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/exporters"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/exporters"
"github.com/algorand/indexer/plugins"
)

// This is our exporter object. It should store all the in memory data required to run the Exporter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"context"
"testing"

"github.com/algorand/indexer/data"
"github.com/algorand/indexer/exporters"
"github.com/stretchr/testify/assert"

"github.com/algorand/indexer/conduit/plugins/exporters"
"github.com/algorand/indexer/data"
)

var exCons = exporters.ExporterConstructorFunc(func() exporters.Exporter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/sirupsen/logrus"

"github.com/algorand/indexer/conduit"
"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/plugins"
)

// Exporter defines the interface for plugins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"gopkg.in/yaml.v3"

"github.com/algorand/indexer/conduit"
"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/exporters"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/exporters"
"github.com/algorand/indexer/plugins"
"github.com/algorand/indexer/util"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"github.com/algorand/go-algorand/data/bookkeeping"
"github.com/algorand/go-algorand/ledger/ledgercore"

"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/exporters"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/exporters"
"github.com/algorand/indexer/plugins"
"github.com/algorand/indexer/util"
testutil "github.com/algorand/indexer/util/test"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"github.com/algorand/go-algorand/data/bookkeeping"

"github.com/algorand/indexer/conduit"
"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/exporters"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/exporters"
"github.com/algorand/indexer/plugins"
)

var implementationName = "noop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import (
"context"
"testing"

"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"

"github.com/algorand/go-algorand/data/bookkeeping"

"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/exporters"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/exporters"
"github.com/algorand/indexer/plugins"
testutil "github.com/algorand/indexer/util/test"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
)

var nc = exporters.ExporterConstructorFunc(func() exporters.Exporter {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import (
"github.com/algorand/go-algorand/ledger/ledgercore"

"github.com/algorand/indexer/conduit"
"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/exporters"
"github.com/algorand/indexer/conduit/plugins/exporters/postgresql/util"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/exporters"
"github.com/algorand/indexer/exporters/util"
"github.com/algorand/indexer/idb"
"github.com/algorand/indexer/importer"
// Necessary to ensure the postgres implementation has been registered in the idb factory
_ "github.com/algorand/indexer/idb/postgres"
"github.com/algorand/indexer/plugins"
)

const exporterName = "postgresql"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package postgresql

import "github.com/algorand/indexer/exporters/util"
import (
"github.com/algorand/indexer/conduit/plugins/exporters/postgresql/util"
)

// serde for converting an ExporterConfig to/from a PostgresqlExporterConfig

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"testing"

"github.com/algorand/indexer/exporters"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/assert"
Expand All @@ -16,10 +15,12 @@ import (
"github.com/algorand/go-algorand/data/bookkeeping"
"github.com/algorand/go-algorand/data/transactions"
"github.com/algorand/go-algorand/ledger/ledgercore"

"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/exporters"
"github.com/algorand/indexer/conduit/plugins/exporters/postgresql/util"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/exporters/util"
_ "github.com/algorand/indexer/idb/dummy"
"github.com/algorand/indexer/plugins"
testutil "github.com/algorand/indexer/util/test"
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import (
"testing"
"time"

"github.com/algorand/indexer/idb"
"github.com/algorand/indexer/idb/postgres"
pgtest "github.com/algorand/indexer/idb/postgres/testing"
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/assert"

"github.com/algorand/indexer/idb"
"github.com/algorand/indexer/idb/postgres"
pgtest "github.com/algorand/indexer/idb/postgres/testing"
)

var logger *logrus.Logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"github.com/algorand/go-algorand/rpcs"

"github.com/algorand/indexer/conduit"
"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/importers"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/importers"
"github.com/algorand/indexer/plugins"
)

const importerName = "algod"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"os"
"testing"

"github.com/algorand/indexer/importers"
"github.com/algorand/indexer/plugins"
"github.com/algorand/indexer/util/test"

"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"

"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/importers"
"github.com/algorand/indexer/util/test"
)

var (
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions conduit/plugins/importers/all/all.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package all

import (
// Call package wide init function
_ "github.com/algorand/indexer/conduit/plugins/importers/algod"
_ "github.com/algorand/indexer/conduit/plugins/importers/filereader"
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
"github.com/algorand/go-algorand/data/bookkeeping"

"github.com/algorand/indexer/conduit"
"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/exporters/filewriter"
"github.com/algorand/indexer/conduit/plugins/importers"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/exporters/filewriter"
"github.com/algorand/indexer/importers"
"github.com/algorand/indexer/plugins"
"github.com/algorand/indexer/util"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
"github.com/algorand/go-algorand/data/transactions"
"github.com/algorand/go-algorand/ledger/ledgercore"

"github.com/algorand/indexer/conduit/plugins"
"github.com/algorand/indexer/conduit/plugins/exporters/filewriter"
"github.com/algorand/indexer/conduit/plugins/importers"
"github.com/algorand/indexer/data"
"github.com/algorand/indexer/exporters/filewriter"
"github.com/algorand/indexer/importers"
"github.com/algorand/indexer/plugins"
"github.com/algorand/indexer/util"
)

Expand Down
Loading