This commit is contained in:
Chris Lu 2021-03-14 13:21:02 -07:00
parent 2d4c2db81d
commit 35d939a1d2
10 changed files with 13 additions and 14 deletions

View file

@ -75,7 +75,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
if err != nil {
glog.V(0).Infof("failed to talk to filer %s: %v", filerGrpcAddress, err)
glog.V(0).Infof("wait for %d seconds ...", i+1)
time.Sleep(time.Duration(i+1)*time.Second)
time.Sleep(time.Duration(i+1) * time.Second)
}
}
if err != nil {

View file

@ -44,4 +44,3 @@ type BucketAware interface {
OnBucketCreation(bucket string)
OnBucketDeletion(bucket string)
}

View file

@ -131,7 +131,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
})
entry, _ := filer_pb.GetEntry(wfs, util.FullPath(wfs.option.FilerMountRootPath))
wfs.root = &Dir{name: wfs.option.FilerMountRootPath, wfs: wfs, entry: filer.FromPbEntry(wfs.option.FilerMountRootPath,entry)}
wfs.root = &Dir{name: wfs.option.FilerMountRootPath, wfs: wfs, entry: filer.FromPbEntry(wfs.option.FilerMountRootPath, entry)}
wfs.fsNodeCache = newFsCache(wfs.root)
if wfs.option.ConcurrentWriters > 0 {

View file

@ -104,7 +104,7 @@ func SeaweedList(client SeaweedFilerClient, parentDirectoryPath, prefix string,
func doSeaweedList(client SeaweedFilerClient, fullDirPath util.FullPath, prefix string, fn EachEntryFunciton, startFrom string, inclusive bool, limit uint32) (err error) {
// Redundancy limit to make it correctly judge whether it is the last file.
redLimit := limit
if limit != math.MaxInt32 && limit != 0{
if limit != math.MaxInt32 && limit != 0 {
redLimit = limit + 1
}
request := &ListEntriesRequest{

View file

@ -54,7 +54,7 @@ func (c *commandS3CleanUploads) Do(args []string, commandEnv *CommandEnv, writer
return fmt.Errorf("list buckets under %v: %v", filerBucketsPath, err)
}
for _, bucket:= range buckets {
for _, bucket := range buckets {
c.cleanupUploads(commandEnv, writer, filerBucketsPath, bucket, *uploadedTimeAgo)
}
@ -63,7 +63,7 @@ func (c *commandS3CleanUploads) Do(args []string, commandEnv *CommandEnv, writer
}
func (c *commandS3CleanUploads) cleanupUploads(commandEnv *CommandEnv, writer io.Writer, filerBucketsPath string, bucket string, timeAgo time.Duration) error {
uploadsDir := filerBucketsPath+"/"+bucket+"/.uploads"
uploadsDir := filerBucketsPath + "/" + bucket + "/.uploads"
var staleUploads []string
now := time.Now()
err := filer_pb.List(commandEnv, uploadsDir, "", func(entry *filer_pb.Entry, isLast bool) error {
@ -77,8 +77,8 @@ func (c *commandS3CleanUploads) cleanupUploads(commandEnv *CommandEnv, writer io
return fmt.Errorf("list uploads under %v: %v", uploadsDir, err)
}
for _, staleUpload:= range staleUploads {
deleteUrl := fmt.Sprintf("http://%s:%d%s/%s?recursive=true&ignoreRecursiveError=true",commandEnv.option.FilerHost, commandEnv.option.FilerPort,uploadsDir, staleUpload)
for _, staleUpload := range staleUploads {
deleteUrl := fmt.Sprintf("http://%s:%d%s/%s?recursive=true&ignoreRecursiveError=true", commandEnv.option.FilerHost, commandEnv.option.FilerPort, uploadsDir, staleUpload)
fmt.Fprintf(writer, "purge %s\n", deleteUrl)
err = util.Delete(deleteUrl, "")
@ -89,4 +89,4 @@ func (c *commandS3CleanUploads) cleanupUploads(commandEnv *CommandEnv, writer io
return nil
}
}

View file

@ -35,7 +35,7 @@ func NewCRCwriter(w io.Writer) *CRCwriter {
return &CRCwriter{
crc: CRC(0),
w: w,
w: w,
}
}

View file

@ -73,7 +73,7 @@ func (v *Volume) StreamRead(n *needle.Needle, writer io.Writer) (err error) {
sr := &StreamReader{
readerAt: v.DataBackend,
offset: nv.Offset.ToActualOffset(),
offset: nv.Offset.ToActualOffset(),
}
bufReader := bufio.NewReader(sr)
bufReader.Discard(NeedleHeaderSize)

View file

@ -3,4 +3,4 @@
package net2
// copied from https://github.com/dropbox/godropbox/tree/master/net2
// removed other dependencies
// removed other dependencies

View file

@ -80,7 +80,7 @@ func GetLocalIPs() ([]*net.IP, error) {
// TODO(zviad): Is rest of the code really necessary?
addrs, err := net.InterfaceAddrs()
if err != nil {
return nil, fmt.Errorf( "Failed to get interface addresses: %v", err)
return nil, fmt.Errorf("Failed to get interface addresses: %v", err)
}
for _, addr := range addrs {
ipnet, ok := addr.(*net.IPNet)

View file

@ -2,4 +2,4 @@
package resource_pool
// copied from https://github.com/dropbox/godropbox/tree/master/resource_pool
// removed other dependencies
// removed other dependencies