small changes

This commit is contained in:
Parikshit Gothwal 2024-10-03 21:34:57 +05:30
parent 1e2975ad0f
commit 68414597e6
2 changed files with 16 additions and 14 deletions

View File

@ -14,25 +14,22 @@ func NewClient(config *Config) (*Client, error) {
client := &Client{
config: config,
}
cfg := elasticsearch.Config{
Addresses: []string{
config.Host,
},
}
es, err := elasticsearch.NewClient(cfg)
if err != nil {
return nil, err
}
client.es = es
return client, nil
}
func (c *Client) Open() error {
// Open a connection with ElasticSearch
cfg := elasticsearch.Config{
Addresses: []string{
c.config.Host,
},
}
var err error
c.es, err = elasticsearch.NewClient(cfg)
if err != nil {
return err
}
// create a buffer channel
c.ch = make(chan Data, 1)
@ -48,6 +45,10 @@ func (c *Client) Read() (Data, error) {
return Data{}, nil
}
// func (c *Client) Ack(ctx context.Context, position int) error {
// return nil
// }
// close the client
func (c *Client) Teardown() error {
return nil

View File

@ -5,4 +5,5 @@ type Config struct {
// map of index name and position from where data is to be read.
Indexes []string
BatchSize int
DBPath string
}