aboutsummaryrefslogtreecommitdiff
path: root/go/storage/needle.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/storage/needle.go')
-rw-r--r--go/storage/needle.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/go/storage/needle.go b/go/storage/needle.go
index daede321b..11610dd80 100644
--- a/go/storage/needle.go
+++ b/go/storage/needle.go
@@ -1,11 +1,9 @@
package storage
import (
- "github.com/chrislusf/weed-fs/go/glog"
- "github.com/chrislusf/weed-fs/go/images"
- "github.com/chrislusf/weed-fs/go/util"
"encoding/hex"
"errors"
+ "fmt"
"io/ioutil"
"mime"
"net/http"
@@ -13,6 +11,10 @@ import (
"strconv"
"strings"
"time"
+
+ "github.com/chrislusf/weed-fs/go/glog"
+ "github.com/chrislusf/weed-fs/go/images"
+ "github.com/chrislusf/weed-fs/go/util"
)
const (
@@ -23,6 +25,7 @@ const (
)
/*
+* A Needle means a uploaded and stored file.
* Needle file size is limited to 4GB for now.
*/
type Needle struct {
@@ -44,6 +47,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 {