cleaned up debug log messages
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
helper "git.kapelle.org/niklas/s3browser/internal/helper"
|
||||
"git.kapelle.org/niklas/s3browser/internal/loader"
|
||||
types "git.kapelle.org/niklas/s3browser/internal/types"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func deleteMutation(ctx context.Context, id types.ID) error {
|
||||
@@ -20,6 +21,7 @@ func deleteMutation(ctx context.Context, id types.ID) error {
|
||||
return fmt.Errorf("Failed to get s3Client from context")
|
||||
}
|
||||
|
||||
log.Debug("S3 'RemoveObject': ", id)
|
||||
// TODO: it is posible to remove multiple objects with a single call.
|
||||
// Is it better to batch this?
|
||||
err := s3Client.RemoveObject(ctx, id.Bucket, id.Key, minio.RemoveObjectOptions{})
|
||||
@@ -47,6 +49,7 @@ func copyMutation(ctx context.Context, src, dest types.ID) (*types.File, error)
|
||||
dest.Key += helper.GetFilenameFromKey(src.Key)
|
||||
}
|
||||
|
||||
log.Debug("S3 'CopyObject': ", src, "-->", dest)
|
||||
info, err := s3Client.CopyObject(ctx, minio.CopyDestOptions{
|
||||
Bucket: dest.Bucket,
|
||||
Object: dest.Key,
|
||||
@@ -103,6 +106,7 @@ func moveDirMutation(ctx context.Context, src, dest types.ID) ([]*types.File, er
|
||||
}
|
||||
newID.Normalize()
|
||||
|
||||
log.Debug("S3 'CopyObject': ", src, "-->", dest)
|
||||
_, err := s3Client.CopyObject(ctx, minio.CopyDestOptions{
|
||||
Bucket: dest.Bucket,
|
||||
Object: newID.Key,
|
||||
@@ -139,6 +143,7 @@ func moveFileMutation(ctx context.Context, src, dest types.ID) (*types.File, err
|
||||
dest.Key += helper.GetFilenameFromKey(src.Key)
|
||||
}
|
||||
|
||||
log.Debug("S3 'CopyObject': ", src, "-->", dest)
|
||||
// There is no (spoon) move. Only copy and delete
|
||||
info, err := s3Client.CopyObject(ctx, minio.CopyDestOptions{
|
||||
Bucket: dest.Bucket,
|
||||
@@ -180,6 +185,7 @@ func createDirectory(ctx context.Context, id types.ID) (*types.Directory, error)
|
||||
return nil, fmt.Errorf("Failed to get s3Client from context")
|
||||
}
|
||||
|
||||
log.Debug("S3 'PutObject': ", id)
|
||||
info, err := s3Client.PutObject(ctx, id.Bucket, id.Key, strings.NewReader(""), 0, minio.PutObjectOptions{
|
||||
ContentType: "application/x-directory",
|
||||
})
|
||||
@@ -241,6 +247,7 @@ func deleteDirectory(ctx context.Context, id types.ID) error {
|
||||
// This is at least the behavior when working with minio as s3 backend
|
||||
// TODO: check if this is normal behavior when working with s3
|
||||
if len(files) == 0 {
|
||||
log.Debug("S3 'RemoveObject': ", id)
|
||||
err := s3Client.RemoveObject(ctx, id.Bucket, id.Key, minio.RemoveObjectOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user