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

Expose required internal libs #58

Merged
merged 1 commit into from
Aug 5, 2024
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
10 changes: 5 additions & 5 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"fmt"

"github.com/spf13/viper"
"github.com/xataio/pgstream/internal/backoff"
"github.com/xataio/pgstream/internal/kafka"
"github.com/xataio/pgstream/internal/tls"
"github.com/xataio/pgstream/pkg/backoff"
"github.com/xataio/pgstream/pkg/kafka"
pgschemalog "github.com/xataio/pgstream/pkg/schemalog/postgres"
"github.com/xataio/pgstream/pkg/stream"
"github.com/xataio/pgstream/pkg/tls"
kafkacheckpoint "github.com/xataio/pgstream/pkg/wal/checkpointer/kafka"
kafkalistener "github.com/xataio/pgstream/pkg/wal/listener/kafka"
kafkaprocessor "github.com/xataio/pgstream/pkg/wal/processor/kafka"
Expand Down Expand Up @@ -245,8 +245,8 @@ func parseTranslatorConfig() *translator.Config {
}
}

func parseTLSConfig(prefix string) *tls.Config {
return &tls.Config{
func parseTLSConfig(prefix string) tls.Config {
return tls.Config{
Enabled: viper.GetBool(fmt.Sprintf("%s_TLS_ENABLED", prefix)),
CaCertFile: viper.GetString(fmt.Sprintf("%s_TLS_CA_CERT_FILE", prefix)),
ClientCertFile: viper.GetString(fmt.Sprintf("%s_TLS_CLIENT_CERT_FILE", prefix)),
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package mocks

import "github.com/xataio/pgstream/internal/backoff"
import "github.com/xataio/pgstream/pkg/backoff"

type Backoff struct {
RetryNotifyFn func(backoff.Operation, backoff.Notify) error
Expand Down
4 changes: 2 additions & 2 deletions internal/kafka/config.go → pkg/kafka/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

package kafka

import tlslib "github.com/xataio/pgstream/internal/tls"
import tlslib "github.com/xataio/pgstream/pkg/tls"

type ConnConfig struct {
Servers []string
Topic TopicConfig
TLS *tlslib.Config
TLS tlslib.Config
}

type TopicConfig struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/kafka/conn.go → pkg/kafka/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import (
"strconv"
"time"

tlslib "github.com/xataio/pgstream/internal/tls"
tlslib "github.com/xataio/pgstream/pkg/tls"

"github.com/segmentio/kafka-go"
)

// withConnection creates a connection that can be used by the kafka operation
// passed in the parameters. This ensures the cleanup of all connection resources.
func withConnection(config *ConnConfig, kafkaOperation func(conn *kafka.Conn) error) error {
dialer, err := buildDialer(config.TLS)
dialer, err := buildDialer(&config.TLS)
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
"time"

"github.com/xataio/pgstream/internal/kafka"
"github.com/xataio/pgstream/pkg/kafka"

"go.opentelemetry.io/otel/metric"
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewReader(config ReaderConfig, logger loglib.Logger) (*Reader, error) {
return nil, fmt.Errorf("unsupported start offset [%s], must be one of [%s, %s]", config.ConsumerGroupStartOffset, earliestOffset, latestOffset)
}

dialer, err := buildDialer(config.Conn.TLS)
dialer, err := buildDialer(&config.Conn.TLS)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/kafka/kafka_writer.go → pkg/kafka/kafka_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"time"

"github.com/segmentio/kafka-go"
tlslib "github.com/xataio/pgstream/internal/tls"
loglib "github.com/xataio/pgstream/pkg/log"
tlslib "github.com/xataio/pgstream/pkg/tls"
)

type MessageWriter interface {
Expand Down Expand Up @@ -56,7 +56,7 @@ func NewWriter(config WriterConfig, logger loglib.Logger) (*Writer, error) {
}
}

transport, err := buildTransport(config.Conn.TLS)
transport, err := buildTransport(&config.Conn.TLS)
if err != nil {
return nil, err
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package mocks

import "github.com/xataio/pgstream/internal/kafka"
import "github.com/xataio/pgstream/pkg/kafka"

type OffsetParser struct {
ToStringFn func(o *kafka.Offset) string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package mocks
import (
"context"

"github.com/xataio/pgstream/internal/kafka"
"github.com/xataio/pgstream/pkg/kafka"
)

type Reader struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"context"
"sync/atomic"

"github.com/xataio/pgstream/internal/kafka"
"github.com/xataio/pgstream/pkg/kafka"
)

type Writer struct {
Expand Down
6 changes: 3 additions & 3 deletions pkg/stream/integration/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
"testing"

"github.com/stretchr/testify/require"
kafkalib "github.com/xataio/pgstream/internal/kafka"
"github.com/xataio/pgstream/internal/log/zerolog"
pglib "github.com/xataio/pgstream/internal/postgres"
"github.com/xataio/pgstream/internal/tls"
kafkalib "github.com/xataio/pgstream/pkg/kafka"
loglib "github.com/xataio/pgstream/pkg/log"
schemalogpg "github.com/xataio/pgstream/pkg/schemalog/postgres"
"github.com/xataio/pgstream/pkg/stream"
"github.com/xataio/pgstream/pkg/tls"
"github.com/xataio/pgstream/pkg/wal"
kafkacheckpoint "github.com/xataio/pgstream/pkg/wal/checkpointer/kafka"
kafkalistener "github.com/xataio/pgstream/pkg/wal/listener/kafka"
Expand Down Expand Up @@ -174,7 +174,7 @@ func testKafkaCfg() kafkalib.ConnConfig {
Name: "integration-tests",
AutoCreate: true,
},
TLS: &tls.Config{
TLS: tls.Config{
Enabled: false,
},
}
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions pkg/wal/checkpointer/kafka/wal_kafka_checkpointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"fmt"
"time"

"github.com/xataio/pgstream/internal/backoff"
"github.com/xataio/pgstream/internal/kafka"
"github.com/xataio/pgstream/pkg/backoff"
"github.com/xataio/pgstream/pkg/kafka"
loglib "github.com/xataio/pgstream/pkg/log"
"github.com/xataio/pgstream/pkg/wal"
)
Expand Down
8 changes: 4 additions & 4 deletions pkg/wal/checkpointer/kafka/wal_kafka_checkpointer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (

"github.com/stretchr/testify/require"

"github.com/xataio/pgstream/internal/backoff"
backoffmocks "github.com/xataio/pgstream/internal/backoff/mocks"
"github.com/xataio/pgstream/internal/kafka"
kafkamocks "github.com/xataio/pgstream/internal/kafka/mocks"
"github.com/xataio/pgstream/pkg/backoff"
backoffmocks "github.com/xataio/pgstream/pkg/backoff/mocks"
"github.com/xataio/pgstream/pkg/kafka"
kafkamocks "github.com/xataio/pgstream/pkg/kafka/mocks"
loglib "github.com/xataio/pgstream/pkg/log"
"github.com/xataio/pgstream/pkg/wal"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/listener/kafka/wal_kafka_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"fmt"
"runtime/debug"

"github.com/xataio/pgstream/internal/kafka"
"github.com/xataio/pgstream/pkg/kafka"
loglib "github.com/xataio/pgstream/pkg/log"
"github.com/xataio/pgstream/pkg/wal"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/wal/listener/kafka/wal_kafka_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"time"

"github.com/stretchr/testify/require"
"github.com/xataio/pgstream/internal/kafka"
kafkamocks "github.com/xataio/pgstream/internal/kafka/mocks"
"github.com/xataio/pgstream/pkg/kafka"
kafkamocks "github.com/xataio/pgstream/pkg/kafka/mocks"
loglib "github.com/xataio/pgstream/pkg/log"
"github.com/xataio/pgstream/pkg/wal"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/processor/kafka/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"time"

"github.com/xataio/pgstream/internal/kafka"
"github.com/xataio/pgstream/pkg/kafka"
)

type Config struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/wal/processor/kafka/wal_kafka_batch_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"runtime/debug"
"time"

"github.com/xataio/pgstream/internal/kafka"
kafkainstrumentation "github.com/xataio/pgstream/internal/kafka/instrumentation"
synclib "github.com/xataio/pgstream/internal/sync"
"github.com/xataio/pgstream/pkg/kafka"
kafkainstrumentation "github.com/xataio/pgstream/pkg/kafka/instrumentation"
loglib "github.com/xataio/pgstream/pkg/log"
"github.com/xataio/pgstream/pkg/wal"
"github.com/xataio/pgstream/pkg/wal/checkpointer"
Expand Down
4 changes: 2 additions & 2 deletions pkg/wal/processor/kafka/wal_kafka_batch_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"time"

"github.com/stretchr/testify/require"
"github.com/xataio/pgstream/internal/kafka"
kafkamocks "github.com/xataio/pgstream/internal/kafka/mocks"
synclib "github.com/xataio/pgstream/internal/sync"
syncmocks "github.com/xataio/pgstream/internal/sync/mocks"
"github.com/xataio/pgstream/pkg/kafka"
kafkamocks "github.com/xataio/pgstream/pkg/kafka/mocks"
loglib "github.com/xataio/pgstream/pkg/log"
"github.com/xataio/pgstream/pkg/schemalog"
"github.com/xataio/pgstream/pkg/wal"
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/processor/kafka/wal_kafka_msg_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package kafka

import (
"github.com/xataio/pgstream/internal/kafka"
"github.com/xataio/pgstream/pkg/kafka"
"github.com/xataio/pgstream/pkg/wal"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/processor/search/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package search
import (
"time"

"github.com/xataio/pgstream/internal/backoff"
"github.com/xataio/pgstream/pkg/backoff"
)

type IndexerConfig struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/processor/search/search_schema_cleaner.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"time"

"github.com/xataio/pgstream/internal/backoff"
"github.com/xataio/pgstream/pkg/backoff"
loglib "github.com/xataio/pgstream/pkg/log"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/wal/processor/search/search_schema_cleaner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"time"

"github.com/stretchr/testify/require"
"github.com/xataio/pgstream/internal/backoff"
"github.com/xataio/pgstream/internal/backoff/mocks"
"github.com/xataio/pgstream/pkg/backoff"
"github.com/xataio/pgstream/pkg/backoff/mocks"
loglib "github.com/xataio/pgstream/pkg/log"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/processor/search/search_store_retrier.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"fmt"
"time"

"github.com/xataio/pgstream/internal/backoff"
"github.com/xataio/pgstream/pkg/backoff"
loglib "github.com/xataio/pgstream/pkg/log"
"github.com/xataio/pgstream/pkg/schemalog"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/processor/search/search_store_retrier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
"github.com/xataio/pgstream/internal/backoff"
"github.com/xataio/pgstream/pkg/backoff"
loglib "github.com/xataio/pgstream/pkg/log"
)

Expand Down