mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fixes
This commit is contained in:
parent
d63c5231ac
commit
5d86b50782
|
@ -83,7 +83,7 @@ func dirAssignHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
fid, count, dn, err := topo.PickForWrite(rt, c)
|
||||
if err == nil {
|
||||
writeJson(w, r, map[string]interface{}{"fid": fid, "url": dn.Url(), "count": count})
|
||||
writeJson(w, r, map[string]interface{}{"fid": fid, "url": dn.Url(), "publicUrl":dn.PublicUrl, "count": count})
|
||||
} else {
|
||||
writeJson(w, r, map[string]string{"error": err.Error()})
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ var cmdVolume = &Command{
|
|||
var (
|
||||
vport = cmdVolume.Flag.Int("port", 8080, "http listen port")
|
||||
volumeFolder = cmdVolume.Flag.String("dir", "/tmp", "directory to store data files")
|
||||
ip = cmdVolume.Flag.String("ip", "", "ip or server name")
|
||||
ip = cmdVolume.Flag.String("ip", "localhost", "ip or server name")
|
||||
publicUrl = cmdVolume.Flag.String("publicUrl", "", "Publicly accessible <ip|server_name>:<port>")
|
||||
masterNode = cmdVolume.Flag.String("mserver", "localhost:9333", "master server location")
|
||||
vpulse = cmdVolume.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
|
||||
|
@ -229,6 +229,10 @@ func runVolume(cmd *Command, args []string) bool {
|
|||
perm := fileInfo.Mode().Perm()
|
||||
log.Println("Volume Folder permission:", perm)
|
||||
|
||||
if *publicUrl == "" {
|
||||
*publicUrl = *ip + ":" + strconv.Itoa(*vport)
|
||||
}
|
||||
|
||||
store = storage.NewStore(*vport, *ip, *publicUrl, *volumeFolder, *maxVolumeCount)
|
||||
defer store.Close()
|
||||
http.HandleFunc("/", storeHandler)
|
||||
|
|
|
@ -15,6 +15,7 @@ type UploadResult struct {
|
|||
}
|
||||
|
||||
func Upload(uploadUrl string, filename string, reader io.Reader) (*UploadResult, error) {
|
||||
println("uploading to", uploadUrl)
|
||||
body_buf := bytes.NewBufferString("")
|
||||
body_writer := multipart.NewWriter(body_buf)
|
||||
file_writer, err := body_writer.CreateFormFile("file", filename)
|
||||
|
@ -31,6 +32,7 @@ func Upload(uploadUrl string, filename string, reader io.Reader) (*UploadResult,
|
|||
return nil, err
|
||||
}
|
||||
var ret UploadResult
|
||||
println("upload response to", uploadUrl, resp_body)
|
||||
err = json.Unmarshal(resp_body, &ret)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
|
|
|
@ -89,7 +89,6 @@ func (n *Needle) Append(w io.Writer) uint32 {
|
|||
w.Write(n.Data)
|
||||
rest := 8 - ((n.Size + 16 + 4) % 8)
|
||||
util.Uint32toBytes(header[0:4], n.Checksum.Value())
|
||||
println("writing checksum", n.Checksum.Value(), "=>", util.BytesToUint32(header[0:4]), "for", n.Id)
|
||||
w.Write(header[0 : rest+4])
|
||||
return n.Size
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue