func NewReplicator(config ReplicatorConfig, replica *Replica, leader client) *Replicator {
	if config.MinBytes == 0 {
		config.MinBytes = 1
	}
	bo := backoff.NewExponentialBackOff()
	r := &Replicator{
		config:  config,
		replica: replica,
		leader:  leader,
		done:    make(chan struct{}, 2),
		msgs:    make(chan []byte, 2),
		backoff: bo,
	}
	return r
}
NewReplicator returns a new replicator instance.
package jocko
import (
	"time"
	"github.com/cenkalti/backoff"
	"github.com/travisjeffery/jocko/log"
	"github.com/travisjeffery/jocko/protocol"
)
type client interface {
	Fetch(fetchRequest *protocol.FetchRequest) (*protocol.FetchResponse, error)
	CreateTopics(createRequest *protocol.CreateTopicRequests) (*protocol.CreateTopicsResponse, error)
	LeaderAndISR(request *protocol.LeaderAndISRRequest) (*protocol.LeaderAndISRResponse, error)
}
type Replicator struct {
	config              ReplicatorConfig
	replica             *Replica
	highwaterMarkOffset int64
	offset              int64
	msgs                chan []byte
	done                chan struct{}
	leader              client
	backoff             *backoff.ExponentialBackOff
}
type ReplicatorConfig struct {
	MinBytes int32
	MaxWaitTime time.Duration
}