Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #918 from tanjunchen/fix-up-doc
Browse files Browse the repository at this point in the history
perfect the document
  • Loading branch information
starnop authored Sep 17, 2019
2 parents bdba1bd + 049eea0 commit a6bfdf9
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions supernode/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion supernode/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion supernode/daemon/mgr/cdn/cache_detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions supernode/daemon/mgr/cdn/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion supernode/daemon/mgr/cdn/piece_md5_mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions supernode/daemon/mgr/dfgettask/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion supernode/daemon/util/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

"github.com/dragonflyoss/Dragonfly/pkg/errortypes"
"github.com/dragonflyoss/Dragonfly/pkg/stringutils"

"github.com/pkg/errors"
)

Expand Down

0 comments on commit a6bfdf9

Please sign in to comment.