32 lines
552 B
Go
32 lines
552 B
Go
package elasticstream
|
|
|
|
import (
|
|
"github.com/elastic/go-elasticsearch/v8"
|
|
)
|
|
|
|
type Worker struct {
|
|
client *elasticsearch.Client
|
|
index string // name of the indexes worker pulls data from
|
|
from int // from where to start read data
|
|
size int // batch size
|
|
buffer chan Data
|
|
}
|
|
|
|
func NewWorker(client *elasticsearch.Client, index string, from, size int, buffer chan Data) *Worker {
|
|
w := &Worker{
|
|
client: client,
|
|
index: index,
|
|
from: from,
|
|
size: size,
|
|
buffer: buffer,
|
|
}
|
|
|
|
go w.start()
|
|
|
|
return w
|
|
}
|
|
|
|
func (w *Worker) start() {
|
|
|
|
}
|