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) 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) { func (dh *DefaultHandler) HandlePeriodicExecutions(w http.ResponseWriter, req *http.Request) {
// Get param // Get param
vars := mux.Vars(req) vars := mux.Vars(req)

View File

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

View File

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

View File

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

View File

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

View File

@ -15,7 +15,9 @@
package job package job
const ( const (
// StopCommand is const for stop command
StopCommand OPCommand = "stop" StopCommand OPCommand = "stop"
// NilCommand is const for a nil command
NilCommand OPCommand = "nil" NilCommand OPCommand = "nil"
) )

View File

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

View File

@ -13,7 +13,7 @@ import (
"github.com/gomodule/redigo/redis" "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 // 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. // no same job (same job name and parameters) in the queue or running in progress.
// Adopt the same unique mechanism with the upstream framework. // Adopt the same unique mechanism with the upstream framework.

View File

@ -14,12 +14,12 @@
package worker 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 { type Stats struct {
Pools []*StatsData `json:"worker_pools"` 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 { type StatsData struct {
WorkerPoolID string `json:"worker_pool_id"` WorkerPoolID string `json:"worker_pool_id"`
StartedAt int64 `json:"started_at"` StartedAt int64 `json:"started_at"`