mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add logging
This commit is contained in:
parent
f81d43442b
commit
0eda75fa2c
|
@ -114,6 +114,7 @@ func GetEntry(ctx context.Context, filerClient FilerClient, fullFilePath string)
|
||||||
|
|
||||||
if resp.Entry != nil {
|
if resp.Entry != nil {
|
||||||
entry = resp.Entry
|
entry = resp.Entry
|
||||||
|
glog.V(3).Infof("read %s entry: %v", fullFilePath, entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -10,16 +10,18 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/net/webdav"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/operation"
|
"github.com/chrislusf/seaweedfs/weed/operation"
|
||||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||||
"github.com/chrislusf/seaweedfs/weed/util"
|
"github.com/chrislusf/seaweedfs/weed/util"
|
||||||
"golang.org/x/net/webdav"
|
|
||||||
"google.golang.org/grpc"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||||
"github.com/chrislusf/seaweedfs/weed/security"
|
"github.com/chrislusf/seaweedfs/weed/security"
|
||||||
"github.com/spf13/viper"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type WebDavOption struct {
|
type WebDavOption struct {
|
||||||
|
@ -163,7 +165,7 @@ func (fs *WebDavFileSystem) Mkdir(ctx context.Context, fullDirPath string, perm
|
||||||
|
|
||||||
func (fs *WebDavFileSystem) OpenFile(ctx context.Context, fullFilePath string, flag int, perm os.FileMode) (webdav.File, error) {
|
func (fs *WebDavFileSystem) OpenFile(ctx context.Context, fullFilePath string, flag int, perm os.FileMode) (webdav.File, error) {
|
||||||
|
|
||||||
glog.V(2).Infof("WebDavFileSystem.OpenFile %v", fullFilePath)
|
glog.V(2).Infof("WebDavFileSystem.OpenFile %v %x", fullFilePath, flag)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
if fullFilePath, err = clearName(fullFilePath); err != nil {
|
if fullFilePath, err = clearName(fullFilePath); err != nil {
|
||||||
|
@ -175,12 +177,6 @@ func (fs *WebDavFileSystem) OpenFile(ctx context.Context, fullFilePath string, f
|
||||||
if strings.HasSuffix(fullFilePath, "/") {
|
if strings.HasSuffix(fullFilePath, "/") {
|
||||||
return nil, os.ErrInvalid
|
return nil, os.ErrInvalid
|
||||||
}
|
}
|
||||||
// based directory should be exists.
|
|
||||||
dir, _ := path.Split(fullFilePath)
|
|
||||||
_, err := fs.stat(ctx, dir)
|
|
||||||
if err != nil {
|
|
||||||
return nil, os.ErrInvalid
|
|
||||||
}
|
|
||||||
_, err = fs.stat(ctx, fullFilePath)
|
_, err = fs.stat(ctx, fullFilePath)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if flag&os.O_EXCL != 0 {
|
if flag&os.O_EXCL != 0 {
|
||||||
|
@ -449,8 +445,10 @@ func (f *WebDavFile) Write(buf []byte) (int, error) {
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
glog.V(3).Infof("WebDavFileSystem.Write %v: written [%d,%d)", f.name, f.off, f.off+int64(len(buf)))
|
||||||
f.off += int64(len(buf))
|
f.off += int64(len(buf))
|
||||||
}
|
}
|
||||||
|
|
||||||
return len(buf), err
|
return len(buf), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,10 +492,13 @@ func (f *WebDavFile) Read(p []byte) (readSize int, err error) {
|
||||||
}
|
}
|
||||||
readSize = int(totalRead)
|
readSize = int(totalRead)
|
||||||
|
|
||||||
|
glog.V(3).Infof("WebDavFileSystem.Read %v: [%d,%d)", f.name, f.off, f.off+totalRead)
|
||||||
|
|
||||||
f.off += totalRead
|
f.off += totalRead
|
||||||
if readSize == 0 {
|
if readSize == 0 {
|
||||||
return 0, io.EOF
|
return 0, io.EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue