From 049eea0e458503cb1e3b64984ea53db3b4c7680c Mon Sep 17 00:00:00 2001 From: chentanjun <2799194073@qq.com> Date: Tue, 17 Sep 2019 15:17:29 +0800 Subject: [PATCH] perfect the document Signed-off-by: chentanjun <2799194073@qq.com> --- supernode/config/config.go | 6 +++--- supernode/daemon/daemon.go | 2 +- supernode/daemon/mgr/cdn/cache_detector.go | 2 +- supernode/daemon/mgr/cdn/manager.go | 4 ++-- supernode/daemon/mgr/cdn/piece_md5_mgr.go | 2 +- supernode/daemon/mgr/dfgettask/manager.go | 4 ++-- supernode/daemon/util/filter.go | 1 - 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/supernode/config/config.go b/supernode/config/config.go index 6a2801bba..6252017c4 100644 --- a/supernode/config/config.go +++ b/supernode/config/config.go @@ -27,7 +27,7 @@ import ( "github.com/dragonflyoss/Dragonfly/pkg/fileutils" ) -// NewConfig create an instant with default values. +// NewConfig creates an instant with default values. func NewConfig() *Config { return &Config{ BaseProperties: NewBaseProperties(), @@ -84,7 +84,7 @@ func (c *Config) IsSuperPID(peerID string) bool { return peerID == c.superNodePID } -// NewBaseProperties create an instant with default values. +// NewBaseProperties creates an instant with default values. func NewBaseProperties() *BaseProperties { home := filepath.Join(string(filepath.Separator), "home", "admin", "supernode") return &BaseProperties{ @@ -207,7 +207,7 @@ type BaseProperties struct { // PeerGCDelay is the delay time to execute the GC after the peer has reported the offline. PeerGCDelay time.Duration `yaml:"peerGCDelay"` - // cIDPrefix s a prefix string used to indicate that the CID is supernode. + // cIDPrefix is a prefix string used to indicate that the CID is supernode. cIDPrefix string // superNodePID is the ID of supernode, which is the same as peer ID of dfget. diff --git a/supernode/daemon/daemon.go b/supernode/daemon/daemon.go index 29b66712b..292ef3938 100644 --- a/supernode/daemon/daemon.go +++ b/supernode/daemon/daemon.go @@ -59,7 +59,7 @@ func New(cfg *config.Config, dfgetLogger *logrus.Logger) (*Daemon, error) { }, nil } -// RegisterSuperNode register the supernode as a peer. +// RegisterSuperNode registers the supernode as a peer. func (d *Daemon) RegisterSuperNode() error { // construct the PeerCreateRequest for supernode. // TODO: add supernode version diff --git a/supernode/daemon/mgr/cdn/cache_detector.go b/supernode/daemon/mgr/cdn/cache_detector.go index 328af7c7e..7c6c44060 100644 --- a/supernode/daemon/mgr/cdn/cache_detector.go +++ b/supernode/daemon/mgr/cdn/cache_detector.go @@ -55,7 +55,7 @@ func (cd *cacheDetector) detectCache(ctx context.Context, task *types.TaskInfo) checkSameFile(task, metaData) { breakNum = cd.parseBreakNum(ctx, task, metaData) } - logrus.Infof("taskID: %s, detect cache breakNum: %d", task.ID, breakNum) + logrus.Infof("taskID: %s, detects cache breakNum: %d", task.ID, breakNum) if breakNum == 0 { if metaData, err = cd.resetRepo(ctx, task); err != nil { diff --git a/supernode/daemon/mgr/cdn/manager.go b/supernode/daemon/mgr/cdn/manager.go index 0304d5637..018565318 100644 --- a/supernode/daemon/mgr/cdn/manager.go +++ b/supernode/daemon/mgr/cdn/manager.go @@ -163,12 +163,12 @@ func (cm *Manager) GetHTTPPath(ctx context.Context, taskID string) (string, erro return path.Join("/", raw.Bucket, raw.Key), nil } -// GetStatus get the status of the file. +// GetStatus gets the status of the file. func (cm *Manager) GetStatus(ctx context.Context, taskID string) (cdnStatus string, err error) { return "", nil } -// Delete the cdn meta with specified taskID. +// Delete deletes the cdn meta with specified taskID. func (cm *Manager) Delete(ctx context.Context, taskID string, force bool) error { if !force { return cm.pieceMD5Manager.removePieceMD5sByTaskID(taskID) diff --git a/supernode/daemon/mgr/cdn/piece_md5_mgr.go b/supernode/daemon/mgr/cdn/piece_md5_mgr.go index 89f03f058..4fa0b783e 100644 --- a/supernode/daemon/mgr/cdn/piece_md5_mgr.go +++ b/supernode/daemon/mgr/cdn/piece_md5_mgr.go @@ -44,7 +44,7 @@ func (pmm *pieceMD5Mgr) getPieceMD5(taskID string, pieceNum int) (pieceMD5 strin return pieceMD5s.GetAsString(strconv.Itoa(pieceNum)) } -// setPieceMD5 set the md5 for pieceRange of taskID. +// setPieceMD5 sets the md5 for pieceRange of taskID. func (pmm *pieceMD5Mgr) setPieceMD5(taskID string, pieceNum int, pieceMD5 string) (err error) { pieceMD5s, err := pmm.taskPieceMD5s.GetAsMap(taskID) if err != nil && !errortypes.IsDataNotFound(err) { diff --git a/supernode/daemon/mgr/dfgettask/manager.go b/supernode/daemon/mgr/dfgettask/manager.go index f6ea51d91..b1bbd071c 100644 --- a/supernode/daemon/mgr/dfgettask/manager.go +++ b/supernode/daemon/mgr/dfgettask/manager.go @@ -186,7 +186,7 @@ func (dtm *Manager) List(ctx context.Context, filter map[string]string) (dfgetTa return nil, nil } -// Delete a dfgetTask with clientID and taskID. +// Delete deletes a dfgetTask with clientID and taskID. func (dtm *Manager) Delete(ctx context.Context, clientID, taskID string) error { key, err := generateKey(clientID, taskID) if err != nil { @@ -204,7 +204,7 @@ func (dtm *Manager) Delete(ctx context.Context, clientID, taskID string) error { return dtm.dfgetTaskStore.Delete(key) } -// UpdateStatus update the status of dfgetTask with specified clientID and taskID. +// UpdateStatus updates the status of dfgetTask with specified clientID and taskID. func (dtm *Manager) UpdateStatus(ctx context.Context, clientID, taskID, status string) error { dfgetTask, err := dtm.getDfgetTask(clientID, taskID) if err != nil { diff --git a/supernode/daemon/util/filter.go b/supernode/daemon/util/filter.go index 9106f32b1..e78a708d4 100644 --- a/supernode/daemon/util/filter.go +++ b/supernode/daemon/util/filter.go @@ -24,7 +24,6 @@ import ( "github.com/dragonflyoss/Dragonfly/pkg/errortypes" "github.com/dragonflyoss/Dragonfly/pkg/stringutils" - "github.com/pkg/errors" )