Implement logrus, fix httpFs
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
This commit is contained in:
parent
b59def4718
commit
11d501cd51
14 changed files with 138 additions and 88 deletions
|
@ -3,13 +3,13 @@ package node
|
|||
import (
|
||||
"context"
|
||||
"io"
|
||||
"log"
|
||||
"math"
|
||||
"syscall"
|
||||
|
||||
"github.com/ajnavarro/distribyted/iio"
|
||||
"github.com/hanwen/go-fuse/v2/fs"
|
||||
"github.com/hanwen/go-fuse/v2/fuse"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var _ fs.NodeGetattrer = &File{}
|
||||
|
@ -60,7 +60,7 @@ func (tr *File) Open(ctx context.Context, flags uint32) (fh fs.FileHandle, fuseF
|
|||
if tr.r == nil {
|
||||
r, err := tr.f()
|
||||
if err != nil {
|
||||
log.Println("error opening reader for file", err)
|
||||
log.WithError(err).Error("error opening reader for file")
|
||||
return nil, 0, syscall.EIO
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ func (tr *File) Read(ctx context.Context, f fs.FileHandle, dest []byte, off int6
|
|||
n, err := tr.r.ReadAt(buf, off)
|
||||
|
||||
if err != nil && err != io.EOF {
|
||||
log.Println("error read data", err)
|
||||
log.WithError(err).Error("error reading data")
|
||||
return nil, syscall.EIO
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ func (tr *File) Read(ctx context.Context, f fs.FileHandle, dest []byte, off int6
|
|||
|
||||
func (tr *File) Flush(ctx context.Context, f fs.FileHandle) syscall.Errno {
|
||||
if err := iio.CloseIfCloseable(tr.r); err != nil {
|
||||
log.Println("error closing file", err)
|
||||
log.WithError(err).Error("error closing file")
|
||||
return syscall.EIO
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"archive/zip"
|
||||
"context"
|
||||
"io"
|
||||
"log"
|
||||
"syscall"
|
||||
|
||||
"github.com/ajnavarro/distribyted/iio"
|
||||
"github.com/hanwen/go-fuse/v2/fs"
|
||||
"github.com/hanwen/go-fuse/v2/fuse"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var _ fs.NodeGetattrer = &Zip{}
|
||||
|
@ -34,12 +34,12 @@ func (z *Zip) Opendir(ctx context.Context) syscall.Errno {
|
|||
if z.files == nil {
|
||||
r, err := z.reader()
|
||||
if err != nil {
|
||||
log.Println("error opening reader for zip", err)
|
||||
log.WithError(err).Error("error opening reader for zip")
|
||||
return syscall.EIO
|
||||
}
|
||||
zr, err := zip.NewReader(r, z.size)
|
||||
if err != nil {
|
||||
log.Println("error getting zip reader from reader", err)
|
||||
log.WithError(err).Error("error getting zip reader from reader")
|
||||
return syscall.EIO
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ func (z *Zip) Opendir(ctx context.Context) syscall.Errno {
|
|||
func() (io.ReaderAt, error) {
|
||||
zfr, err := f.Open()
|
||||
if err != nil {
|
||||
log.Println("ERROR OPENING ZIP", err)
|
||||
log.WithError(err).Error("error opening zip file")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue