func NewCluster(cluster QueryCluster, options ...ClusterOption) *Cluster {
	opts := newClusterOptions()
	for _, option := range options {
		option(opts)
	}
	return &Cluster{
		cluster:           cluster,
		clusterTxProvider: opts.clusterTxProvider,
		transaction:       opts.transaction,
		logger:            opts.logger,
		clock:             opts.clock,
		sleeper:           opts.sleeper,
	}
}
NewCluster creates a new Cluster object.
package db
import (
	"fmt"
	"sync"
	"time"
	"github.com/CanonicalLtd/go-dqlite"
	"github.com/go-kit/kit/log"
	"github.com/go-kit/kit/log/level"
	"github.com/pkg/errors"
	"github.com/spoke-d/thermionic/internal/clock"
	"github.com/spoke-d/thermionic/internal/db/cluster"
	"github.com/spoke-d/thermionic/internal/db/database"
	q "github.com/spoke-d/thermionic/internal/db/query"
)
type ClusterTransactioner interface {
	Transaction(f func(*ClusterTx) error) error
}
type ClusterOpener interface {
	Open(cluster.ServerStore, string, string, time.Duration, ...dqlite.DriverOption) error
}
type ClusterExclusiveLocker interface {
	EnterExclusive() error
	ExitExclusive(func(*ClusterTx) error) error
}
var ErrSomeNodesAreBehind = errors.Errorf("some nodes are behind this node's version")
type QueryCluster interface {
	database.DBAccessor
	Open(cluster.ServerStore, ...dqlite.DriverOption) error
	EnsureSchema(string, string) (bool, error)
	SchemaVersion() int
}
type ClusterTxProvider interface {
	New(database.Tx, int64) *ClusterTx
}
type Cluster struct {
	cluster           QueryCluster  
	clusterTxProvider ClusterTxProvider
	nodeID            int64  
	mu                sync.RWMutex
	transaction       Transaction  
	logger            log.Logger
	clock             clock.Clock
	sleeper           clock.Sleeper
}