From 7d1f13f9d7879f011614b896e67d1410dec12006 Mon Sep 17 00:00:00 2001 From: siddontang Date: Wed, 24 Sep 2014 09:46:36 +0800 Subject: [PATCH] rename package --- bootstrap.sh | 7 +++---- ledis/batch.go | 2 +- ledis/dump.go | 2 +- ledis/ledis.go | 2 +- ledis/replication.go | 2 +- ledis/util.go | 4 ++++ rpl/file_store.go | 2 +- rpl/rpl.go | 2 +- server/accesslog.go | 2 +- server/client_http.go | 4 ++-- server/client_resp.go | 2 +- server/cmd_replication.go | 2 +- server/info.go | 15 ++++++++++++++- server/replication.go | 4 ++-- 14 files changed, 34 insertions(+), 18 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index a93c219..4a12258 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -2,9 +2,6 @@ . ./dev.sh -go get github.com/siddontang/go-log/log -go get github.com/siddontang/go-snappy/snappy - go get github.com/siddontang/goleveldb/leveldb go get github.com/szferi/gomdb @@ -14,6 +11,8 @@ go get github.com/boltdb/bolt go get github.com/ugorji/go/codec go get github.com/BurntSushi/toml -go get github.com/siddontang/go-bson/bson +go get github.com/siddontang/go/bson +go get github.com/siddontang/go/log +go get github.com/siddontang/go/snappy go get github.com/siddontang/go/num diff --git a/ledis/batch.go b/ledis/batch.go index 0d7f2d6..4ed3bac 100644 --- a/ledis/batch.go +++ b/ledis/batch.go @@ -1,7 +1,7 @@ package ledis import ( - "github.com/siddontang/go-log/log" + "github.com/siddontang/go/log" "github.com/siddontang/ledisdb/rpl" "github.com/siddontang/ledisdb/store" "sync" diff --git a/ledis/dump.go b/ledis/dump.go index bf40571..436e707 100644 --- a/ledis/dump.go +++ b/ledis/dump.go @@ -4,7 +4,7 @@ import ( "bufio" "bytes" "encoding/binary" - "github.com/siddontang/go-snappy/snappy" + "github.com/siddontang/go/snappy" "github.com/siddontang/ledisdb/store" "io" "os" diff --git a/ledis/ledis.go b/ledis/ledis.go index 2660701..2669c3a 100644 --- a/ledis/ledis.go +++ b/ledis/ledis.go @@ -2,7 +2,7 @@ package ledis import ( "fmt" - "github.com/siddontang/go-log/log" + "github.com/siddontang/go/log" "github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/rpl" "github.com/siddontang/ledisdb/store" diff --git a/ledis/replication.go b/ledis/replication.go index ee219a6..e3002a7 100644 --- a/ledis/replication.go +++ b/ledis/replication.go @@ -3,7 +3,7 @@ package ledis import ( "bytes" "errors" - "github.com/siddontang/go-log/log" + "github.com/siddontang/go/log" "github.com/siddontang/ledisdb/rpl" "io" "time" diff --git a/ledis/util.go b/ledis/util.go index b245f64..49e78a9 100644 --- a/ledis/util.go +++ b/ledis/util.go @@ -110,6 +110,10 @@ func StrPutInt64(v int64) []byte { return strconv.AppendInt(nil, v, 10) } +func StrPutUint64(v uint64) []byte { + return strconv.AppendUint(nil, v, 10) +} + func MinUInt32(a uint32, b uint32) uint32 { if a > b { return b diff --git a/rpl/file_store.go b/rpl/file_store.go index 51ca293..df51b03 100644 --- a/rpl/file_store.go +++ b/rpl/file_store.go @@ -2,7 +2,7 @@ package rpl import ( "fmt" - "github.com/siddontang/go-log/log" + "github.com/siddontang/go/log" "io/ioutil" "os" "path" diff --git a/rpl/rpl.go b/rpl/rpl.go index 8227371..f7324c8 100644 --- a/rpl/rpl.go +++ b/rpl/rpl.go @@ -2,7 +2,7 @@ package rpl import ( "encoding/binary" - "github.com/siddontang/go-log/log" + "github.com/siddontang/go/log" "github.com/siddontang/ledisdb/config" "os" "path" diff --git a/server/accesslog.go b/server/accesslog.go index 9e517a8..4c41f1e 100644 --- a/server/accesslog.go +++ b/server/accesslog.go @@ -1,7 +1,7 @@ package server import ( - "github.com/siddontang/go-log/log" + "github.com/siddontang/go/log" ) const ( diff --git a/server/client_http.go b/server/client_http.go index 28ce7d1..445790c 100644 --- a/server/client_http.go +++ b/server/client_http.go @@ -3,8 +3,8 @@ package server import ( "encoding/json" "fmt" - "github.com/siddontang/go-bson/bson" - "github.com/siddontang/go-log/log" + "github.com/siddontang/go/bson" + "github.com/siddontang/go/log" "github.com/siddontang/ledisdb/ledis" "github.com/ugorji/go/codec" "io" diff --git a/server/client_resp.go b/server/client_resp.go index 5d9604c..1651c88 100644 --- a/server/client_resp.go +++ b/server/client_resp.go @@ -3,7 +3,7 @@ package server import ( "bufio" "errors" - "github.com/siddontang/go-log/log" + "github.com/siddontang/go/log" "github.com/siddontang/ledisdb/ledis" "io" "net" diff --git a/server/cmd_replication.go b/server/cmd_replication.go index 36ee248..100244c 100644 --- a/server/cmd_replication.go +++ b/server/cmd_replication.go @@ -2,7 +2,7 @@ package server import ( "fmt" - "github.com/siddontang/go-snappy/snappy" + "github.com/siddontang/go/snappy" "github.com/siddontang/ledisdb/ledis" "io/ioutil" "os" diff --git a/server/info.go b/server/info.go index 0680c20..119c6d3 100644 --- a/server/info.go +++ b/server/info.go @@ -150,9 +150,22 @@ func (i *info) dumpReplication(buf *bytes.Buffer) { buf.WriteString("# Replication\r\n") p := []infoPair{} + slaves := make([]string, 0, len(i.app.slaves)) for s, _ := range i.app.slaves { - p = append(p, infoPair{"slave", s.remoteAddr}) + slaves = append(slaves, s.remoteAddr) } + + p = append(p, infoPair{"readonly", i.app.ldb.IsReadOnly()}) + + if len(slaves) > 0 { + p = append(p, infoPair{"slave", strings.Join(slaves, ",")}) + } + + s, _ := i.app.ldb.ReplicationStat() + p = append(p, infoPair{"last_log_id", s.LastID}) + p = append(p, infoPair{"first_log_id", s.FirstID}) + p = append(p, infoPair{"commit_log_id", s.CommitID}) + i.dumpPairs(buf, p...) } diff --git a/server/replication.go b/server/replication.go index 6ccbced..2bbc1c2 100644 --- a/server/replication.go +++ b/server/replication.go @@ -5,8 +5,8 @@ import ( "bytes" "errors" "fmt" - "github.com/siddontang/go-log/log" - "github.com/siddontang/go-snappy/snappy" + "github.com/siddontang/go/log" + "github.com/siddontang/go/snappy" "github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/rpl" "net"