Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

add String function for needle to print

yanyiwu089eb8ad3900
diff --git a/go/storage/needle.go b/go/storage/needle.go
index aa3206920e..5b43576148 100644
--- a/go/storage/needle.go
+++ b/go/storage/needle.go
@@ -3,6 +3,7 @@ package storage
import (
"encoding/hex"
"errors"
+ "fmt"
"io/ioutil"
"mime"
"net/http"
@@ -45,6 +46,11 @@ type Needle struct {
Padding []byte `comment:"Aligned to 8 bytes"`
}
+func (n *Needle) String() (str string) {
+ str = fmt.Sprintf("Cookie:%d, Id:%d, Size:%d, DataSize:%d, Name: %s, Mime: %s", n.Cookie, n.Id, n.Size, n.DataSize, n.Name, n.Mime)
+ return
+}
+
func ParseUpload(r *http.Request) (fileName string, data []byte, mimeType string, isGzipped bool, modifiedTime uint64, ttl *TTL, e error) {
form, fe := r.MultipartReader()
if fe != nil {