Skip to content

Commit 973bdd9

Browse files
committed
v0.3.0 interface change
1 parent 1cdb009 commit 973bdd9

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

‎distributed/interface/main.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/GuoYuefei/DOStorage1/distributed/interface/heartbeat"
77
"github.com/GuoYuefei/DOStorage1/distributed/interface/locate"
88
"github.com/GuoYuefei/DOStorage1/distributed/interface/objects"
9+
"github.com/GuoYuefei/DOStorage1/distributed/interface/temp"
910
"github.com/GuoYuefei/DOStorage1/distributed/interface/versions"
1011
"github.com/GuoYuefei/DOStorage1/distributed/utils"
1112
"net/http"
@@ -17,6 +18,7 @@ func main() {
1718
configs() // 配置文件
1819
go heartbeat.ListenHeartbeat()
1920
http.HandleFunc("/objects/", objects.Handler)
21+
http.HandleFunc("/temp/", temp.Handler)
2022
http.HandleFunc("/locate/", locate.Handler)
2123
http.HandleFunc("/versions/", versions.Handler)
2224
utils.Log.Println(utils.Info, "interface server will run in ", config.ServerInf.LISTEN_ADDRESS)

‎distributed/interface/objects/object.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ func Handler(w http.ResponseWriter, r *http.Request) {
1111
return
1212
}
1313

14+
if m == http.MethodPut {
15+
post(w, r)
16+
return
17+
}
18+
1419
if m == http.MethodPut {
1520
put(w, r)
1621
return

‎distributed/interface/temp/temp.go‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
11
package temp
2+
3+
import "net/http"
4+
5+
func Handler(w http.ResponseWriter, r *http.Request) {
6+
m := r.Method
7+
8+
if m == http.MethodPut {
9+
put(w, r)
10+
return
11+
}
12+
13+
if m == http.MethodHead {
14+
head(w, r)
15+
return
16+
}
17+
18+
w.WriteHeader(http.StatusMethodNotAllowed)
19+
}

0 commit comments

Comments
 (0)