30 lines
503 B
Go
30 lines
503 B
Go
package elastic
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"elasticstream/config"
|
|
"elasticstream/opencdc"
|
|
"elasticstream/source"
|
|
|
|
"github.com/elastic/go-elasticsearch/v8"
|
|
)
|
|
|
|
type Client struct {
|
|
cfg *config.Config
|
|
es *elasticsearch.Client
|
|
offsets map[string]int
|
|
positions []source.Position
|
|
ch chan opencdc.Data
|
|
shutdown chan struct{}
|
|
wg *sync.WaitGroup
|
|
}
|
|
|
|
func NewClient() *Client {
|
|
client := &Client{
|
|
offsets: make(map[string]int),
|
|
wg: &sync.WaitGroup{},
|
|
}
|
|
return client
|
|
}
|