From 68414597e6596d421670b151c07bb29d65f60eb5 Mon Sep 17 00:00:00 2001 From: Parikshit Gothwal Date: Thu, 3 Oct 2024 21:34:57 +0530 Subject: [PATCH] small changes --- client.go | 29 +++++++++++++++-------------- config.go | 1 + 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/client.go b/client.go index 8ec61ca..9d3770c 100644 --- a/client.go +++ b/client.go @@ -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 diff --git a/config.go b/config.go index 54b177e..8a6838c 100644 --- a/config.go +++ b/config.go @@ -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 }