add aof-use-rdb-preamble

This commit is contained in:
xing-you-ji
2023-04-08 06:11:02 +08:00
committed by finley
parent 25bbd82da5
commit 1e767b6797
19 changed files with 338 additions and 188 deletions

View File

@@ -3,6 +3,11 @@ package cluster
import (
"fmt"
"runtime/debug"
"strings"
"github.com/hdt3213/rdb/core"
"github.com/hdt3213/godis/config"
database2 "github.com/hdt3213/godis/database"
"github.com/hdt3213/godis/datastruct/dict"
@@ -15,8 +20,6 @@ import (
"github.com/hdt3213/godis/lib/utils"
"github.com/hdt3213/godis/redis/client"
"github.com/hdt3213/godis/redis/protocol"
"runtime/debug"
"strings"
)
type PeerPicker interface {
@@ -51,8 +54,7 @@ var allowFastTransaction = true
// MakeCluster creates and starts a node of cluster
func MakeCluster() *Cluster {
cluster := &Cluster{
self: config.Properties.Self,
self: config.Properties.Self,
db: database2.NewStandaloneServer(),
transactions: dict.MakeSimple(),
peerPicker: consistenthash.New(replicas, nil),
@@ -61,6 +63,7 @@ func MakeCluster() *Cluster {
idGenerator: idgenerator.MakeGenerator(config.Properties.Self),
relayImpl: defaultRelayImpl,
}
contains := make(map[string]struct{})
nodes := make([]string, 0, len(config.Properties.Peers)+1)
for _, peer := range config.Properties.Peers {
@@ -178,3 +181,7 @@ func (cluster *Cluster) Exec(c redis.Connection, cmdLine [][]byte) (result redis
func (cluster *Cluster) AfterClientClose(c redis.Connection) {
cluster.db.AfterClientClose(c)
}
func (cluster *Cluster) LoadRDB(dec *core.Decoder) error {
return cluster.db.LoadRDB(dec)
}