forked from mirror/ledisdb
remove relay log
This commit is contained in:
parent
8d76a58e5e
commit
c05a66a47c
|
@ -11,8 +11,7 @@ import (
|
|||
type Config struct {
|
||||
DataDB leveldb.Config `json:"data_db"`
|
||||
|
||||
BinLog replication.BinLogConfig `json:"binlog"`
|
||||
RelayLog replication.RelayLogConfig `json:"relaylog"`
|
||||
BinLog replication.BinLogConfig `json:"binlog"`
|
||||
}
|
||||
|
||||
type DB struct {
|
||||
|
@ -36,8 +35,7 @@ type Ledis struct {
|
|||
ldb *leveldb.DB
|
||||
dbs [MaxDBNumber]*DB
|
||||
|
||||
binlog *replication.Log
|
||||
relaylog *replication.Log
|
||||
binlog *replication.Log
|
||||
|
||||
quit chan struct{}
|
||||
}
|
||||
|
@ -73,15 +71,6 @@ func OpenWithConfig(cfg *Config) (*Ledis, error) {
|
|||
l.binlog = nil
|
||||
}
|
||||
|
||||
if len(cfg.RelayLog.Path) > 0 {
|
||||
l.relaylog, err = replication.NewRelayLogWithConfig(&cfg.RelayLog)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
l.relaylog = nil
|
||||
}
|
||||
|
||||
for i := uint8(0); i < MaxDBNumber; i++ {
|
||||
l.dbs[i] = newDB(l, i)
|
||||
}
|
||||
|
@ -117,11 +106,6 @@ func (l *Ledis) Close() {
|
|||
l.binlog.Close()
|
||||
l.binlog = nil
|
||||
}
|
||||
|
||||
if l.relaylog != nil {
|
||||
l.relaylog.Close()
|
||||
l.relaylog = nil
|
||||
}
|
||||
}
|
||||
|
||||
func (l *Ledis) Select(index int) (*DB, error) {
|
||||
|
|
|
@ -11,8 +11,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
errInvalidBinLogEvent = errors.New("invalid binglog event")
|
||||
errRelayLogNotSupported = errors.New("write relay log not supported")
|
||||
errInvalidBinLogEvent = errors.New("invalid binglog event")
|
||||
)
|
||||
|
||||
func (l *Ledis) replicateEvent(event []byte) error {
|
||||
|
@ -131,13 +130,3 @@ func (l *Ledis) RepliateRelayLog(relayLog string, offset int64) (int64, error) {
|
|||
log.Error("can not go here")
|
||||
return offset, nil
|
||||
}
|
||||
|
||||
func (l *Ledis) WriteRelayLog(data []byte) error {
|
||||
if l.relaylog == nil {
|
||||
return errRelayLogNotSupported
|
||||
}
|
||||
|
||||
err := l.relaylog.Log(data)
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue