func NewStore(logger *zap.Logger, config *Config) (*Store, error) {
	s := &Store{
		dataDir:                config.Dir,
		serverID:               config.ID,
		logger:                 logger,
		networkTransportConfig: config.NetworkTransportConfig,
		enforcer:               config.Enforcer,
		raftConfig:             config.RaftConfig,
	}
	return s, nil
}
NewStore return a instance of Store.
package store
import (
	"context"
	"fmt"
	"os"
	"path"
	"path/filepath"
	"time"
	"github.com/casbin/hraft-dispatcher/store/logstore"
	"github.com/cenkalti/backoff/v4"
	"github.com/pkg/errors"
	"github.com/casbin/casbin/v2"
	"github.com/casbin/hraft-dispatcher/command"
	"github.com/casbin/hraft-dispatcher/http"
	"google.golang.org/protobuf/proto"
	"github.com/hashicorp/go-multierror"
	"github.com/hashicorp/raft"
	"go.uber.org/zap"
)
const (
	raftDBName          = "raft.db"
	retainSnapshotCount = 2
	raftTimeout         = 10 * time.Second
)
var _ http.Store = &Store{}
type Store struct {
	dataDir       string
	serverAddress string
	serverID      string
	raft                   *raft.Raft
	raftConfig             *raft.Config
	networkTransportConfig *raft.NetworkTransportConfig
	transport              raft.Transport
	snapshotStore          raft.SnapshotStore
	logStore               raft.LogStore
	stableStore            raft.StableStore
	fms                    raft.FSM
	boltStore              *logstore.BoltStore
	enforcer casbin.IDistributedEnforcer
	inMemory bool
	logger *zap.Logger
}
type Config struct {
	ID                     string
	Dir                    string
	NetworkTransportConfig *raft.NetworkTransportConfig
	Enforcer               casbin.IDistributedEnforcer
	RaftConfig             *raft.Config
}