cleanup to satisfy linter

This commit is contained in:
Maxim Merzhanov authored and Maxim committed 2019-12-27 17:26:48 +03:00
1 parent 11f91b67a8
commit 0222dfd865
15 files changed
+58 -63

No files matched your search

+3 -7
View File
@@ -15,7 +15,7 @@ import (
"isp-config-service/store/state"
)
func (h *socketEventHandler) handleModuleReady(conn etp.Conn, data []byte) []byte {
func (h *SocketEventHandler) handleModuleReady(conn etp.Conn, data []byte) []byte {
moduleName, _ := Parameters(conn) // REMOVE
log.Debugf(0, "handleModuleReady moduleName: %s", moduleName) // REMOVE
declaration := structure.BackendDeclaration{}
@@ -37,7 +37,7 @@ func (h *socketEventHandler) handleModuleReady(conn etp.Conn, data []byte) []byt
return []byte(utils.WsOkResponse)
}
func (h *socketEventHandler) handleModuleRequirements(conn etp.Conn, data []byte) []byte {
func (h *SocketEventHandler) handleModuleRequirements(conn etp.Conn, data []byte) []byte {
moduleName, err := Parameters(conn)
log.Debugf(0, "handleModuleRequirements moduleName: %s", moduleName) // REMOVE
if err != nil {
@@ -59,7 +59,7 @@ func (h *socketEventHandler) handleModuleRequirements(conn etp.Conn, data []byte
return []byte(utils.WsOkResponse)
}
func (h *socketEventHandler) handleConfigSchema(conn etp.Conn, data []byte) []byte {
func (h *SocketEventHandler) handleConfigSchema(conn etp.Conn, data []byte) []byte {
moduleName, err := Parameters(conn)
log.Debugf(0, "handleConfigSchema moduleName: %s", moduleName) // REMOVE
if err != nil {
@@ -115,7 +115,3 @@ func (h *socketEventHandler) handleConfigSchema(conn etp.Conn, data []byte) []by
}
return []byte(utils.WsOkResponse)
}
func (h *socketEventHandler) handleRequestConfig(conn etp.Conn, data []byte) []byte {
panic("not implemented")
}
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"isp-config-service/holder"
)
func (h *socketEventHandler) applyCommandOnLeader(_ etp.Conn, cmd []byte) []byte {
func (h *SocketEventHandler) applyCommandOnLeader(_ etp.Conn, cmd []byte) []byte {
cmdCopy := make([]byte, len(cmd))
copy(cmdCopy, cmd)
obj, err := holder.ClusterClient.SyncApplyOnLeader(cmdCopy)
-1
View File
@@ -14,7 +14,6 @@ type connectionState struct {
func IsConfigClusterNode(conn etp.Conn) bool {
isCluster := conn.URL().Query().Get(cluster.ClusterParam)
return isCluster == "true"
}
func Parameters(conn etp.Conn) (moduleName string, err error) {
+7 -7
View File
@@ -18,12 +18,12 @@ var (
json = jsoniter.ConfigFastest
)
type socketEventHandler struct {
type SocketEventHandler struct {
server etp.Server
store *store.Store
}
func (h *socketEventHandler) SubscribeAll() {
func (h *SocketEventHandler) SubscribeAll() {
h.server.
OnConnect(h.handleConnect).
OnDisconnect(h.handleDisconnect).
@@ -34,7 +34,7 @@ func (h *socketEventHandler) SubscribeAll() {
OnWithAck(utils.ModuleSendConfigSchema, h.handleConfigSchema)
}
func (h *socketEventHandler) handleConnect(conn etp.Conn) {
func (h *SocketEventHandler) handleConnect(conn etp.Conn) {
isClusterNode := IsConfigClusterNode(conn)
moduleName, err := Parameters(conn)
log.Debugf(0, "handleConnect: %s", moduleName) // REMOVE
@@ -79,7 +79,7 @@ func (h *socketEventHandler) handleConnect(conn etp.Conn) {
EmitConn(conn, utils.ConfigSendConfigWhenConnected, data)
}
func (h *socketEventHandler) handleDisconnect(conn etp.Conn, disconnectErr error) {
func (h *SocketEventHandler) handleDisconnect(conn etp.Conn, disconnectErr error) {
moduleName, _ := Parameters(conn)
log.Debugf(0, "handleDisconnect: %s", moduleName) // REMOVE
if moduleName != "" {
@@ -105,12 +105,12 @@ func (h *socketEventHandler) handleDisconnect(conn etp.Conn, disconnectErr error
}
}
func (h *socketEventHandler) handleError(_ etp.Conn, err error) {
func (h *SocketEventHandler) handleError(_ etp.Conn, err error) {
log.Warnf(codes.WebsocketError, "isp-etp: %v", err)
}
func NewSocketEventHandler(server etp.Server, store *store.Store) *socketEventHandler {
return &socketEventHandler{
func NewSocketEventHandler(server etp.Server, store *store.Store) *SocketEventHandler {
return &SocketEventHandler{
server: server,
store: store,
}