fix code style issues: missing comments

Signed-off-by: Steven Zou <szou@vmware.com>
This commit is contained in:
Steven Zou 2019-04-19 14:16:08 +08:00
parent f8feaa192e
commit 38e6df4edb
9 changed files with 17 additions and 17 deletions

View File

@ -216,7 +216,7 @@ func (dh *DefaultHandler) HandleJobLogReq(w http.ResponseWriter, req *http.Reque
w.Write(logData)
}
// HandleJobLogReq is implementation of method defined in interface 'Handler'
// HandlePeriodicExecutions is implementation of method defined in interface 'Handler'
func (dh *DefaultHandler) HandlePeriodicExecutions(w http.ResponseWriter, req *http.Request) {
// Get param
vars := mux.Vars(req)

View File

@ -103,9 +103,9 @@ func (s *Server) Start() error {
if s.config.Protocol == config.JobServiceProtocolHTTPS {
return s.httpServer.ListenAndServeTLS(s.config.Cert, s.config.Key)
} else {
return s.httpServer.ListenAndServe()
}
return s.httpServer.ListenAndServe()
}
// Stop server gracefully.

View File

@ -19,9 +19,9 @@ const (
DefaultPageSize uint = 25
// QueryParamKeyPage defines query param key of page number
QueryParamKeyPage = "page_number"
// QueryParamKeyPage defines query param key of page size
// QueryParamKeyPageSize defines query param key of page size
QueryParamKeyPageSize = "page_size"
// QueryParamKeyPage defines query param key of querying non stopped periodic executions
// QueryParamKeyNonStoppedOnly defines query param key of querying non stopped periodic executions
QueryParamKeyNonStoppedOnly = "non_dead_only"
// ExtraParamKeyNonStoppedOnly defines extra parameter key for querying non stopped periodic executions
ExtraParamKeyNonStoppedOnly = "NonDeadOnly"

View File

@ -29,13 +29,11 @@ import (
"strings"
)
// CtlContextKey is used to keep controller reference in the system context
type CtlContextKey string
// NodeIDContextKey is used to keep node ID in the system context
type NodeIDContextKey string
const (
// NodeID is const of the ID context key
NodeID NodeIDContextKey = "node_id"
)
@ -155,7 +153,7 @@ func DeSerializeJob(jobBytes []byte) (*work.Job, error) {
return &j, err
}
// Get the local hostname and IP
// ResolveHostnameAndIP gets the local hostname and IP
func ResolveHostnameAndIP() (string, error) {
host, err := os.Hostname()
if err != nil {

View File

@ -70,5 +70,5 @@ type Context interface {
Tracker() Tracker
}
// JobContextInitializer is a func to initialize the concrete job context
type JobContextInitializer func(ctx context.Context) (Context, error)
// ContextInitializer is a func to initialize the concrete job context
type ContextInitializer func(ctx context.Context) (Context, error)

View File

@ -15,8 +15,10 @@
package job
const (
// StopCommand is const for stop command
StopCommand OPCommand = "stop"
NilCommand OPCommand = "nil"
// NilCommand is const for a nil command
NilCommand OPCommand = "nil"
)
// OPCommand is the type of job operation commands

View File

@ -53,11 +53,11 @@ var JobService = &Bootstrap{}
// Bootstrap is coordinating process to help load and start the other components to serve.
type Bootstrap struct {
jobConextInitializer job.JobContextInitializer
jobConextInitializer job.ContextInitializer
}
// SetJobContextInitializer set the job context initializer
func (bs *Bootstrap) SetJobContextInitializer(initializer job.JobContextInitializer) {
func (bs *Bootstrap) SetJobContextInitializer(initializer job.ContextInitializer) {
if initializer != nil {
bs.jobConextInitializer = initializer
}

View File

@ -13,7 +13,7 @@ import (
"github.com/gomodule/redigo/redis"
)
// redisDeDuplicator is designed to handle the uniqueness of the job.
// DeDuplicator is designed to handle the uniqueness of the job.
// Once a job is declared to be unique, the job can be enqueued only if
// no same job (same job name and parameters) in the queue or running in progress.
// Adopt the same unique mechanism with the upstream framework.

View File

@ -14,12 +14,12 @@
package worker
// Info represents the healthy and status of all the running worker pools.
// Stats represents the healthy and status of all the running worker pools.
type Stats struct {
Pools []*StatsData `json:"worker_pools"`
}
// JobPoolStatsData represent the healthy and status of the worker worker.
// StatsData represents the healthy and status of the worker worker.
type StatsData struct {
WorkerPoolID string `json:"worker_pool_id"`
StartedAt int64 `json:"started_at"`