elasticstream/source/elastic/client.go

30 lines
503 B
Go
Raw Normal View History

2024-10-07 15:25:13 +05:30
package elastic
import (
2024-10-07 22:41:59 +05:30
"sync"
2024-10-07 16:26:41 +05:30
"elasticstream/config"
"elasticstream/opencdc"
2024-10-07 22:41:59 +05:30
"elasticstream/source"
2024-10-07 15:25:13 +05:30
"github.com/elastic/go-elasticsearch/v8"
)
type Client struct {
2024-10-07 22:41:59 +05:30
cfg *config.Config
es *elasticsearch.Client
offsets map[string]int
positions []source.Position
ch chan opencdc.Data
shutdown chan struct{}
wg *sync.WaitGroup
2024-10-07 15:25:13 +05:30
}
2024-10-07 16:26:41 +05:30
func NewClient() *Client {
2024-10-07 15:25:13 +05:30
client := &Client{
offsets: make(map[string]int),
2024-10-07 22:41:59 +05:30
wg: &sync.WaitGroup{},
2024-10-07 15:25:13 +05:30
}
return client
}