summaryrefslogtreecommitdiff
path: root/staging
diff options
context:
space:
mode:
authorfisherxu <xufei40@huawei.com>2020-01-06 17:14:16 +0800
committerfisherxu <xufei40@huawei.com>2020-01-06 19:44:37 +0800
commit9255d000fb105a2a077753c454896748753125c3 (patch)
tree7712f642d4fa8d33bd4ca9dceb4846f569031585 /staging
parentadd resourceVersion for the msg (diff)
downloadkubeedge-9255d000fb105a2a077753c454896748753125c3.tar.gz
update comments in beehive
Diffstat (limited to 'staging')
-rw-r--r--staging/src/github.com/kubeedge/beehive/pkg/core/context/context.go4
-rw-r--r--staging/src/github.com/kubeedge/beehive/pkg/core/context/context_channel.go6
-rw-r--r--staging/src/github.com/kubeedge/beehive/pkg/core/context/context_factory.go2
-rw-r--r--staging/src/github.com/kubeedge/beehive/pkg/core/context/context_unixsocket.go8
-rw-r--r--staging/src/github.com/kubeedge/beehive/pkg/core/core.go4
-rw-r--r--staging/src/github.com/kubeedge/beehive/pkg/core/model/message.go22
-rw-r--r--staging/src/github.com/kubeedge/beehive/pkg/core/module.go8
7 files changed, 27 insertions, 27 deletions
diff --git a/staging/src/github.com/kubeedge/beehive/pkg/core/context/context.go b/staging/src/github.com/kubeedge/beehive/pkg/core/context/context.go
index 480b10243..6bbe22563 100644
--- a/staging/src/github.com/kubeedge/beehive/pkg/core/context/context.go
+++ b/staging/src/github.com/kubeedge/beehive/pkg/core/context/context.go
@@ -7,14 +7,14 @@ import (
"github.com/kubeedge/beehive/pkg/core/model"
)
-//ModuleContext is interface for context module management
+// ModuleContext is interface for context module management
type ModuleContext interface {
AddModule(module string)
AddModuleGroup(module, group string)
Cleanup(module string)
}
-//MessageContext is interface for message syncing
+// MessageContext is interface for message syncing
type MessageContext interface {
// async mode
Send(module string, message model.Message)
diff --git a/staging/src/github.com/kubeedge/beehive/pkg/core/context/context_channel.go b/staging/src/github.com/kubeedge/beehive/pkg/core/context/context_channel.go
index 059811800..9de6b3a72 100644
--- a/staging/src/github.com/kubeedge/beehive/pkg/core/context/context_channel.go
+++ b/staging/src/github.com/kubeedge/beehive/pkg/core/context/context_channel.go
@@ -12,7 +12,7 @@ import (
"github.com/kubeedge/beehive/pkg/core/model"
)
-//constants for channel context
+// constants for channel context
const (
ChannelSizeDefault = 1024
@@ -366,13 +366,13 @@ func (ctx *ChannelContext) addTypeChannel(module, group string, moduleCh chan mo
ctx.typeChannels[group][module] = moduleCh
}
-//AddModule adds module into module context
+// AddModule adds module into module context
func (ctx *ChannelContext) AddModule(module string) {
channel := ctx.newChannel()
ctx.addChannel(module, channel)
}
-//AddModuleGroup adds modules into module context group
+// AddModuleGroup adds modules into module context group
func (ctx *ChannelContext) AddModuleGroup(module, group string) {
if channel := ctx.getChannel(module); channel != nil {
ctx.addTypeChannel(module, group, channel)
diff --git a/staging/src/github.com/kubeedge/beehive/pkg/core/context/context_factory.go b/staging/src/github.com/kubeedge/beehive/pkg/core/context/context_factory.go
index 827261806..1419d950d 100644
--- a/staging/src/github.com/kubeedge/beehive/pkg/core/context/context_factory.go
+++ b/staging/src/github.com/kubeedge/beehive/pkg/core/context/context_factory.go
@@ -10,7 +10,7 @@ import (
"github.com/kubeedge/beehive/pkg/core/model"
)
-//define channel type
+// define channel type
const (
MsgCtxTypeChannel = "channel"
)
diff --git a/staging/src/github.com/kubeedge/beehive/pkg/core/context/context_unixsocket.go b/staging/src/github.com/kubeedge/beehive/pkg/core/context/context_unixsocket.go
index 11e2d28b3..9967ce08b 100644
--- a/staging/src/github.com/kubeedge/beehive/pkg/core/context/context_unixsocket.go
+++ b/staging/src/github.com/kubeedge/beehive/pkg/core/context/context_unixsocket.go
@@ -20,7 +20,7 @@ var (
usOnce sync.Once
)
-//GetUnixSocketContext defines and returns unix socket context object
+// GetUnixSocketContext defines and returns unix socket context object
func GetUnixSocketContext() *UnixSocketContext {
usOnce.Do(func() {
usContext = &UnixSocketContext{}
@@ -28,17 +28,17 @@ func GetUnixSocketContext() *UnixSocketContext {
return usContext
}
-//AddModule adds module to context
+// AddModule adds module to context
func (ctx *UnixSocketContext) AddModule(module string) {
}
-//AddModuleGroup adds module to module context group
+// AddModuleGroup adds module to module context group
func (ctx *UnixSocketContext) AddModuleGroup(module, group string) {
}
-//Cleanup cleans up module
+// Cleanup cleans up module
func (ctx *UnixSocketContext) Cleanup(module string) {
}
diff --git a/staging/src/github.com/kubeedge/beehive/pkg/core/core.go b/staging/src/github.com/kubeedge/beehive/pkg/core/core.go
index bae854c28..e567520cd 100644
--- a/staging/src/github.com/kubeedge/beehive/pkg/core/core.go
+++ b/staging/src/github.com/kubeedge/beehive/pkg/core/core.go
@@ -43,9 +43,9 @@ func GracefulShutdown() {
}
}
-//Run starts the modules and in the end does module cleanup
+// Run starts the modules and in the end does module cleanup
func Run() {
- //Address the module registration and start the core
+ // Address the module registration and start the core
StartModules()
// monitor system signal and shutdown gracefully
GracefulShutdown()
diff --git a/staging/src/github.com/kubeedge/beehive/pkg/core/model/message.go b/staging/src/github.com/kubeedge/beehive/pkg/core/model/message.go
index 0c451b1a7..ffc29f8cf 100644
--- a/staging/src/github.com/kubeedge/beehive/pkg/core/model/message.go
+++ b/staging/src/github.com/kubeedge/beehive/pkg/core/model/message.go
@@ -6,7 +6,7 @@ import (
"github.com/satori/go.uuid"
)
-//Constants for database operations and resource type settings
+// Constants for database operations and resource type settings
const (
InsertOperation = "insert"
DeleteOperation = "delete"
@@ -31,7 +31,7 @@ type Message struct {
Content interface{} `json:"content"`
}
-//MessageRoute contains structure of message
+// MessageRoute contains structure of message
type MessageRoute struct {
// where the message come from
Source string `json:"source,omitempty"`
@@ -44,7 +44,7 @@ type MessageRoute struct {
Resource string `json:"resource,omitempty"`
}
-//MessageHeader defines message header details
+// MessageHeader defines message header details
type MessageHeader struct {
// the message uuid
ID string `json:"msg_id"`
@@ -61,21 +61,21 @@ type MessageHeader struct {
Sync bool `json:"sync,omitempty"`
}
-//BuildRouter sets route and resource operation in message
+// BuildRouter sets route and resource operation in message
func (msg *Message) BuildRouter(source, group, res, opr string) *Message {
msg.SetRoute(source, group)
msg.SetResourceOperation(res, opr)
return msg
}
-//SetResourceOperation sets router resource and operation in message
+// SetResourceOperation sets router resource and operation in message
func (msg *Message) SetResourceOperation(res, opr string) *Message {
msg.Router.Resource = res
msg.Router.Operation = opr
return msg
}
-//SetRoute sets router source and group in message
+// SetRoute sets router source and group in message
func (msg *Message) SetRoute(source, group string) *Message {
msg.Router.Source = source
msg.Router.Group = group
@@ -93,27 +93,27 @@ func (msg *Message) IsSync() bool {
return msg.Header.Sync
}
-//GetResource returns message route resource
+// GetResource returns message route resource
func (msg *Message) GetResource() string {
return msg.Router.Resource
}
-//GetOperation returns message route operation string
+// GetOperation returns message route operation string
func (msg *Message) GetOperation() string {
return msg.Router.Operation
}
-//GetSource returns message route source string
+// GetSource returns message route source string
func (msg *Message) GetSource() string {
return msg.Router.Source
}
-//GetGroup returns message route group
+// GetGroup returns message route group
func (msg *Message) GetGroup() string {
return msg.Router.Group
}
-//GetID returns message ID
+// GetID returns message ID
func (msg *Message) GetID() string {
return msg.Header.ID
}
diff --git a/staging/src/github.com/kubeedge/beehive/pkg/core/module.go b/staging/src/github.com/kubeedge/beehive/pkg/core/module.go
index 1a1e4a584..349ea36dd 100644
--- a/staging/src/github.com/kubeedge/beehive/pkg/core/module.go
+++ b/staging/src/github.com/kubeedge/beehive/pkg/core/module.go
@@ -89,7 +89,7 @@ func (cb moduleChangeCallback) Callback(k string, v interface{}) {
newModules, deletedModules := calculateModuleChanges(currentModules)
klog.Infof("Current module list: %+v, disabledmodule: %+v addmodule: %+v deletedmodule: %+v", currentModules, disabledModules, newModules, deletedModules)
- //Remove disabled modules
+ // Remove disabled modules
for _, m := range deletedModules {
module, exist := modules[m]
if !exist {
@@ -101,7 +101,7 @@ func (cb moduleChangeCallback) Callback(k string, v interface{}) {
disabledModules[m] = module
klog.Infof("Module %s is disabled", m)
}
- //Enable new modules
+ // Enable new modules
for _, m := range newModules {
module := disabledModules[m]
if module == nil {
@@ -109,9 +109,9 @@ func (cb moduleChangeCallback) Callback(k string, v interface{}) {
break
}
Register(module)
- //Init the module
+ // Init the module
beehiveContext.AddModule(module.Name())
- //Assemble typeChannels for sendToGroup
+ // Assemble typeChannels for sendToGroup
beehiveContext.AddModuleGroup(module.Name(), module.Group())
go module.Start()
delete(disabledModules, m)