File System Ssdb
Go HTTP Listen
File Storage to Ssdb
Gfs
|
Twemproxy
|
Ssdb (Master) ssdb (slave)
SSDB Connection protocol for Redis protocol
Generate MD5 KEY
Handle.go Code
Package Mainimport ("FMT" "Io/ioutil" "net/http" "Path") func (CTX *context) server (w http. Responsewriter, R *http. Request) {//params: = R.url. Query ()//key: = params. Get ("K")//callback: = params. Get ("CB") Path: = R.url. Pathif Path = = "/" {Home (W, R)} else {md5key: = Path[1:len (path)]fmt. Println ("Md5key:" + md5key) Ctx.store.Get ("Key") val, err: = Ctx.store.Get (Md5key) if err! = Nil {fmt. Fprint (W, "The File Not Exits!")} Fmt. Fprint (W, Val) ctx.download (W, R, Md5key)}}func Home (w http. Responsewriter, R *http. Request) {if r.method! = "GET" {http. Error (W, "Method not Allowed", 405) return}html: = ' <! DOCTYPE html>
Code hosting to GitHub
Https://github.com/dtxlink/gfs
A Go file server Ssdb