mirror of https://github.com/ledisdb/ledisdb.git
move bin log to replication package
This commit is contained in:
parent
2b106981ba
commit
8cc62ad89f
|
@ -43,14 +43,6 @@ var (
|
|||
ErrZSetMemberSize = errors.New("invalid zset member size")
|
||||
)
|
||||
|
||||
const (
|
||||
MaxBinLogFileSize int = 1024 * 1024 * 1024
|
||||
MaxBinLogFileNum int = 10000
|
||||
|
||||
DefaultBinLogFileSize int = MaxBinLogFileSize
|
||||
DefaultBinLogFileNum int = 10
|
||||
)
|
||||
|
||||
const (
|
||||
BinLogTypeDeletion uint8 = 0x0
|
||||
BinLogTypePut uint8 = 0x1
|
||||
|
|
|
@ -4,13 +4,14 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/siddontang/go-leveldb/leveldb"
|
||||
"github.com/siddontang/ledisdb/replication"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
DataDB leveldb.Config `json:"data_db"`
|
||||
|
||||
BinLog BinLogConfig `json:"binlog"`
|
||||
BinLog replication.BinLogConfig `json:"binlog"`
|
||||
}
|
||||
|
||||
type DB struct {
|
||||
|
@ -32,7 +33,7 @@ type Ledis struct {
|
|||
ldb *leveldb.DB
|
||||
dbs [MaxDBNumber]*DB
|
||||
|
||||
binlog *BinLog
|
||||
binlog *replication.BinLog
|
||||
}
|
||||
|
||||
func Open(configJson json.RawMessage) (*Ledis, error) {
|
||||
|
@ -55,7 +56,7 @@ func OpenWithConfig(cfg *Config) (*Ledis, error) {
|
|||
l.ldb = ldb
|
||||
|
||||
if len(cfg.BinLog.Path) > 0 {
|
||||
l.binlog, err = NewBinLogWithConfig(&cfg.BinLog)
|
||||
l.binlog, err = replication.NewBinLogWithConfig(&cfg.BinLog)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package ledis
|
|||
|
||||
import (
|
||||
"github.com/siddontang/go-leveldb/leveldb"
|
||||
"github.com/siddontang/ledisdb/replication"
|
||||
"sync"
|
||||
)
|
||||
|
||||
|
@ -11,7 +12,7 @@ type tx struct {
|
|||
l *Ledis
|
||||
wb *leveldb.WriteBatch
|
||||
|
||||
binlog *BinLog
|
||||
binlog *replication.BinLog
|
||||
batch [][]byte
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package ledis
|
||||
package replication
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
@ -14,6 +14,14 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
MaxBinLogFileSize int = 1024 * 1024 * 1024
|
||||
MaxBinLogFileNum int = 10000
|
||||
|
||||
DefaultBinLogFileSize int = MaxBinLogFileSize
|
||||
DefaultBinLogFileNum int = 10
|
||||
)
|
||||
|
||||
/*
|
||||
index file format:
|
||||
ledis-bin.00001
|
|
@ -1,4 +1,4 @@
|
|||
package ledis
|
||||
package replication
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
|
@ -0,0 +1,4 @@
|
|||
package replication
|
||||
|
||||
type RelayLog struct {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package replication
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRelayLog(t *testing.T) {
|
||||
|
||||
}
|
Loading…
Reference in New Issue