diff --git a/node/delete_bucket.go b/node/delete_bucket.go index 750fd30..a3ed528 100644 --- a/node/delete_bucket.go +++ b/node/delete_bucket.go @@ -15,7 +15,7 @@ import ( "github.com/gin-gonic/gin" ) -func (n *Node) Delete_bucket(c *gin.Context) { +func (n *Node) DeleteBucket(c *gin.Context) { if !checkDeOSSStatus(n, c) { return } @@ -44,7 +44,7 @@ func (n *Node) Delete_bucket(c *gin.Context) { return } - blockHash, err := n.DeleteBucket(pkey, bucketName) + blockHash, err := n.ChainClient.DeleteBucket(pkey, bucketName) if err != nil { n.Logdel("err", clientIp+" DeleteBucket failed: "+err.Error()) c.JSON(http.StatusBadRequest, err.Error()) diff --git a/node/delete_file.go b/node/delete_file.go index c247cfa..6bd6e43 100644 --- a/node/delete_file.go +++ b/node/delete_file.go @@ -15,7 +15,7 @@ import ( ) // delHandle is used to delete buckets or files -func (n *Node) Delete_file(c *gin.Context) { +func (n *Node) DeleteFile(c *gin.Context) { if !checkDeOSSStatus(n, c) { return } @@ -39,7 +39,7 @@ func (n *Node) Delete_file(c *gin.Context) { return } - blockHash, err := n.DeleteFile(pkey, fid) + blockHash, err := n.ChainClient.DeleteFile(pkey, fid) if err != nil { n.Logdel("err", clientIp+" DeleteFile failed: "+err.Error()) c.JSON(http.StatusBadRequest, err.Error()) diff --git a/node/download_file.go b/node/download_file.go index 2fda80c..6968960 100644 --- a/node/download_file.go +++ b/node/download_file.go @@ -31,7 +31,7 @@ func init() { } } -func (n *Node) Download_file(c *gin.Context) { +func (n *Node) DownloadFile(c *gin.Context) { if _, ok := <-max_concurrent_get_ch; !ok { c.JSON(http.StatusTooManyRequests, "server is busy, please try again later.") return diff --git a/node/get_location.go b/node/get_location.go index fc3ad74..32fae48 100644 --- a/node/get_location.go +++ b/node/get_location.go @@ -34,7 +34,7 @@ type Location struct { Latitude float64 `json:"latitude"` } -func (n *Node) Get_location(c *gin.Context) { +func (n *Node) GetFileLocation(c *gin.Context) { fid := c.Param(HTTP_ParameterName_Fid) clientIp := c.Request.Header.Get("X-Forwarded-For") diff --git a/node/get_metadata.go b/node/get_metadata.go index 5467fd8..011d059 100644 --- a/node/get_metadata.go +++ b/node/get_metadata.go @@ -28,7 +28,7 @@ type RtnUserBrief struct { BucketName string `json:"bucket_name"` } -func (n *Node) Get_metadata(c *gin.Context) { +func (n *Node) GetFileMetadata(c *gin.Context) { clientIp := c.Request.Header.Get("X-Forwarded-For") if clientIp == "" { clientIp = c.ClientIP() diff --git a/node/node.go b/node/node.go index 12233cb..798a890 100644 --- a/node/node.go +++ b/node/node.go @@ -75,20 +75,20 @@ func (n *Node) Run() { n.Engine.GET("/version", n.Get_version) n.Engine.GET("/bucket", n.Get_bucket) - n.Engine.GET(fmt.Sprintf("/metadata/:%s", HTTP_ParameterName_Fid), n.Get_metadata) - n.Engine.GET(fmt.Sprintf("/download/:%s", HTTP_ParameterName_Fid), n.Download_file) + n.Engine.GET(fmt.Sprintf("/metadata/:%s", HTTP_ParameterName_Fid), n.GetFileMetadata) + n.Engine.GET(fmt.Sprintf("/download/:%s", HTTP_ParameterName_Fid), n.DownloadFile) n.Engine.GET(fmt.Sprintf("/canfiles/:%s", HTTP_ParameterName_Fid), n.GetCanFileHandle) - n.Engine.GET(fmt.Sprintf("/open/:%s", HTTP_ParameterName_Fid), n.Preview_file) - n.Engine.GET(fmt.Sprintf("/location/:%s", HTTP_ParameterName_Fid), n.Get_location) + n.Engine.GET(fmt.Sprintf("/open/:%s", HTTP_ParameterName_Fid), n.PreviewFile) + n.Engine.GET(fmt.Sprintf("/location/:%s", HTTP_ParameterName_Fid), n.GetFileLocation) - n.Engine.PUT("/bucket", n.Put_bucket) - n.Engine.PUT("/file", n.Put_file) - n.Engine.PUT("/object", n.Put_object) + n.Engine.PUT("/bucket", n.PutBucket) + n.Engine.PUT("/file", n.PutFile) + n.Engine.PUT("/object", n.PutObject) n.Engine.PUT(fmt.Sprintf("/resume/:%s", HTTP_ParameterName), n.ResumeUpload) n.Engine.PUT("/chunks", n.PutChunksHandle) - n.Engine.DELETE(fmt.Sprintf("/file/:%s", HTTP_ParameterName), n.Delete_file) - n.Engine.DELETE(fmt.Sprintf("/bucket/:%s", HTTP_ParameterName), n.Delete_bucket) + n.Engine.DELETE(fmt.Sprintf("/file/:%s", HTTP_ParameterName), n.DeleteFile) + n.Engine.DELETE(fmt.Sprintf("/bucket/:%s", HTTP_ParameterName), n.DeleteBucket) n.Engine.GET("/favicon.ico", func(c *gin.Context) { c.Header("Cache-Control", "public, max-age=31536000") diff --git a/node/open_file.go b/node/open_file.go index 8a7cf86..880cab0 100644 --- a/node/open_file.go +++ b/node/open_file.go @@ -24,7 +24,7 @@ import ( "github.com/gin-gonic/gin" ) -func (n *Node) Preview_file(c *gin.Context) { +func (n *Node) PreviewFile(c *gin.Context) { if _, ok := <-max_concurrent_get_ch; !ok { c.JSON(http.StatusTooManyRequests, "server is busy, please try again later.") return diff --git a/node/put_bucket.go b/node/put_bucket.go index 71ecf48..ac66f2e 100644 --- a/node/put_bucket.go +++ b/node/put_bucket.go @@ -19,7 +19,7 @@ import ( "github.com/pkg/errors" ) -func (n *Node) Put_bucket(c *gin.Context) { +func (n *Node) PutBucket(c *gin.Context) { defer c.Request.Body.Close() account := c.Request.Header.Get(HTTPHeader_Account) diff --git a/node/put_file.go b/node/put_file.go index c96c1a5..15ab96b 100644 --- a/node/put_file.go +++ b/node/put_file.go @@ -36,7 +36,7 @@ func init() { } } -func (n *Node) Put_file(c *gin.Context) { +func (n *Node) PutFile(c *gin.Context) { defer c.Request.Body.Close() account := c.Request.Header.Get(HTTPHeader_Account) diff --git a/node/put_object.go b/node/put_object.go index 5033f17..b3327f1 100644 --- a/node/put_object.go +++ b/node/put_object.go @@ -24,7 +24,7 @@ import ( "github.com/pkg/errors" ) -func (n *Node) Put_object(c *gin.Context) { +func (n *Node) PutObject(c *gin.Context) { defer c.Request.Body.Close() account := c.Request.Header.Get(HTTPHeader_Account)