Skip to content

Feature/routing#1

Merged
auxten merged 27 commits into
developfrom
feature/routing
Apr 26, 2018
Merged

Feature/routing#1
auxten merged 27 commits into
developfrom
feature/routing

Conversation

@auxten
Copy link
Copy Markdown
Contributor

@auxten auxten commented Apr 25, 2018

consistent hash RPC works now

@xq262144
Copy link
Copy Markdown
Contributor

sofa

@auxten
Copy link
Copy Markdown
Contributor Author

auxten commented Apr 25, 2018

need some gofmt

@auxten auxten closed this Apr 25, 2018
@auxten auxten reopened this Apr 25, 2018
@auxten auxten closed this Apr 25, 2018
@auxten auxten reopened this Apr 25, 2018
@auxten
Copy link
Copy Markdown
Contributor Author

auxten commented Apr 25, 2018

ONLY UNITTEST WORKS SO FAR

@zeqing-guo
Copy link
Copy Markdown
Contributor

please add more comments next time

Comment thread consistent/consistent.go
}

func (c *Consistent) Members() []Node {
c.RLock()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Consistent.Members should be of the form "Members ..."

Comment thread consistent/consistent_test.go Outdated
"github.com/thunderdb/ThunderDB/utils"
)

func NewNodeFromId(id string) Node {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
func NewNodeFromId should be NewNodeFromID

Comment thread proto/proto.go Outdated
@@ -0,0 +1,12 @@
package proto

type NodeId string
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported type NodeID should have comment or be unexported

Comment thread proto/proto.go
package proto

type NodeId string
type NodeKey uint64
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported type NodeKey should have comment or be unexported

Comment thread proto/proto.go
type NodeId string
type NodeKey uint64

type Node struct {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported type Node should have comment or be unexported

Comment thread rpc/session.go Outdated
}
}

func (s *Session) Close() {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Session.Close should have comment or be unexported

Comment thread utils/test.go

import "testing"

func CheckNum(num, expected int, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckNum should have comment or be unexported

Comment thread utils/test.go
}
}

func CheckStr(str, expected string, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckStr should have comment or be unexported

return s.session.LocalAddr()
}

// LocalAddr returns the remote address
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Stream.RemoteAddr should be of the form "RemoteAddr ..."

// opened inbound
ErrDuplicateStream = fmt.Errorf("duplicate stream initiated")

// ErrReceiveWindowExceeded indicates the window was exceeded
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported var ErrRecvWindowExceeded should be of the form "ErrRecvWindowExceeded ..."

Comment thread route/dht.go Outdated
"net"
)

func InitDhtServer(l net.Listener) (server *rpc.Server, err error) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function InitDHTerver should have comment or be unexported

Comment thread route/service.go Outdated
hashRing *consistent.Consistent
}

func NewDhtService() *DhtService {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function NewDHTService should have comment or be unexported

Comment thread utils/test.go

import "testing"

func CheckNum(num, expected int, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckNum should have comment or be unexported

Comment thread utils/test.go
}
}

func CheckStr(str, expected string, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckStr should have comment or be unexported

return s.session.LocalAddr()
}

// LocalAddr returns the remote address
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Stream.RemoteAddr should be of the form "RemoteAddr ..."

// opened inbound
ErrDuplicateStream = fmt.Errorf("duplicate stream initiated")

// ErrReceiveWindowExceeded indicates the window was exceeded
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported var ErrRecvWindowExceeded should be of the form "ErrRecvWindowExceeded ..."

Comment thread route/dht.go Outdated
"net"
)

func InitDhtServer(l net.Listener) (server *rpc.Server, err error) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function InitDHTerver should have comment or be unexported

Comment thread route/service.go Outdated
}

func NewDhtService() *DhtService {
return &DhtService{
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function NewDHTService should have comment or be unexported

Comment thread route/service.go Outdated
}

type GetNeighborsReq struct {
NodeId proto.NodeId
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported type GetNeighborsReq should have comment or be unexported

Comment thread route/service.go
}

type GetNeighborsResp struct {
Nodes []proto.Node
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported type GetNeighborsResp should have comment or be unexported

Comment thread route/service.go Outdated
}

func (dht *DhtService) GetNeighbors(req *GetNeighborsReq, resp *GetNeighborsResp) (err error) {
resp.Nodes, err = dht.hashRing.GetN(string(req.NodeId), req.Count)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method DHTService.GetNeighbors should have comment or be unexported

Comment thread route/service.go Outdated
}

func (dht *DhtService) AddNode(req *AddNodeReq, resp *AddNodeResp) (err error) {
dht.hashRing.Add(req.Node)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method DHTService.AddNode should have comment or be unexported

Comment thread utils/test.go

import "testing"

func CheckNum(num, expected int, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckNum should have comment or be unexported

Comment thread utils/test.go
}
}

func CheckStr(str, expected string, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckStr should have comment or be unexported

return s.session.LocalAddr()
}

// LocalAddr returns the remote address
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Stream.RemoteAddr should be of the form "RemoteAddr ..."

// opened inbound
ErrDuplicateStream = fmt.Errorf("duplicate stream initiated")

// ErrReceiveWindowExceeded indicates the window was exceeded
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported var ErrRecvWindowExceeded should be of the form "ErrRecvWindowExceeded ..."

Comment thread route/dht.go Outdated
"net"
)

func InitDhtServer(l net.Listener) (server *rpc.Server, err error) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function InitDHTerver should have comment or be unexported

Comment thread utils/test.go

import "testing"

func CheckNum(num, expected int, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckNum should have comment or be unexported

Comment thread utils/test.go
}
}

func CheckStr(str, expected string, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckStr should have comment or be unexported

return s.session.LocalAddr()
}

// LocalAddr returns the remote address
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Stream.RemoteAddr should be of the form "RemoteAddr ..."

// opened inbound
ErrDuplicateStream = fmt.Errorf("duplicate stream initiated")

// ErrReceiveWindowExceeded indicates the window was exceeded
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported var ErrRecvWindowExceeded should be of the form "ErrRecvWindowExceeded ..."

Comment thread route/dht.go Outdated
"net"
)

func InitDhtServer(l net.Listener) (server *rpc.Server, err error) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported function InitDHTserver should be of the form "InitDHTserver ..."

Comment thread rpc/server.go
}

func NewServer() *Server {
return &Server{
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function NewServer should have comment or be unexported

Comment thread rpc/server.go
}

func NewServerWithService(serviceMap ServiceMap) (server *Server, err error) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function NewServerWithService should have comment or be unexported

Comment thread rpc/server.go Outdated
}

func (s *Server) serveRpc(sess *yamux.Session) {
conn, err := sess.Accept()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Server.SetListener should have comment or be unexported

Comment thread rpc/server.go Outdated

func (s *Server) Serve(l net.Listener) {
serverLoop:
for {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Server.RegisterService should have comment or be unexported

Comment thread rpc/server.go Outdated
select {
case <-s.stopCh:
log.Info("Stopping Server Loop")
break serverLoop
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Server.Serve should have comment or be unexported

Comment thread utils/test.go

import "testing"

func CheckNum(num, expected int, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckNum should have comment or be unexported

Comment thread utils/test.go
}
}

func CheckStr(str, expected string, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckStr should have comment or be unexported

return s.session.LocalAddr()
}

// LocalAddr returns the remote address
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Stream.RemoteAddr should be of the form "RemoteAddr ..."

// opened inbound
ErrDuplicateStream = fmt.Errorf("duplicate stream initiated")

// ErrReceiveWindowExceeded indicates the window was exceeded
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported var ErrRecvWindowExceeded should be of the form "ErrRecvWindowExceeded ..."

Comment thread route/dht.go Outdated
"net"
)

// InitDHTserver
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported function InitDHTserver should be of the form "InitDHTserver ..."

Comment thread rpc/server.go
listener net.Listener
}

func NewServer() *Server {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function NewServer should have comment or be unexported

Comment thread rpc/server.go
return server, nil
}

func (s *Server) SetListener(l net.Listener) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Server.SetListener should have comment or be unexported

Comment thread rpc/server.go Outdated
log.Debugf("%s closed connection", conn.RemoteAddr())
}

func (s *Server) RegisterService(name string, service interface{}) error {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Server.RegisterService should have comment or be unexported

Comment thread rpc/server.go Outdated
return s.rpcServer.RegisterName(name, service)
}

func (s *Server) Serve() {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Server.Serve should have comment or be unexported

Comment thread utils/test.go

import "testing"

func CheckNum(num, expected int, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckNum should have comment or be unexported

Comment thread utils/test.go
}
}

func CheckStr(str, expected string, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckStr should have comment or be unexported

return s.session.LocalAddr()
}

// LocalAddr returns the remote address
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Stream.RemoteAddr should be of the form "RemoteAddr ..."

// opened inbound
ErrDuplicateStream = fmt.Errorf("duplicate stream initiated")

// ErrReceiveWindowExceeded indicates the window was exceeded
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported var ErrRecvWindowExceeded should be of the form "ErrRecvWindowExceeded ..."

Comment thread utils/test.go

import "testing"

func CheckNum(num, expected int, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckNum should have comment or be unexported

Comment thread utils/test.go
}
}

func CheckStr(str, expected string, t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function CheckStr should have comment or be unexported

return s.session.LocalAddr()
}

// LocalAddr returns the remote address
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Stream.RemoteAddr should be of the form "RemoteAddr ..."

// opened inbound
ErrDuplicateStream = fmt.Errorf("duplicate stream initiated")

// ErrReceiveWindowExceeded indicates the window was exceeded
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported var ErrRecvWindowExceeded should be of the form "ErrRecvWindowExceeded ..."

Comment thread utils/test.go
}

func CheckStr(str, expected string, t *testing.T) {
if str != expected {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported function CheckStr should be of the form "CheckStr ..."

return s.session.LocalAddr()
}

// LocalAddr returns the remote address
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Stream.RemoteAddr should be of the form "RemoteAddr ..."

// opened inbound
ErrDuplicateStream = fmt.Errorf("duplicate stream initiated")

// ErrReceiveWindowExceeded indicates the window was exceeded
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported var ErrRecvWindowExceeded should be of the form "ErrRecvWindowExceeded ..."

Comment thread utils/test.go Outdated
}
}

// ChechStr make string assertion
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported function CheckStr should be of the form "CheckStr ..."

return s.session.LocalAddr()
}

// LocalAddr returns the remote address
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Stream.RemoteAddr should be of the form "RemoteAddr ..."

// opened inbound
ErrDuplicateStream = fmt.Errorf("duplicate stream initiated")

// ErrReceiveWindowExceeded indicates the window was exceeded
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported var ErrRecvWindowExceeded should be of the form "ErrRecvWindowExceeded ..."

return s.session.LocalAddr()
}

// LocalAddr returns the remote address
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Stream.RemoteAddr should be of the form "RemoteAddr ..."

// opened inbound
ErrDuplicateStream = fmt.Errorf("duplicate stream initiated")

// ErrReceiveWindowExceeded indicates the window was exceeded
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported var ErrRecvWindowExceeded should be of the form "ErrRecvWindowExceeded ..."

@auxten auxten requested review from leventeliu and xq262144 April 26, 2018 10:39
Copy link
Copy Markdown
Contributor

@leventeliu leventeliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@auxten auxten merged commit 91c9886 into develop Apr 26, 2018
auxten pushed a commit that referenced this pull request Dec 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants