Skip to content

Commit

Permalink
Standardize the naming of certain functions (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstaFrode authored Aug 23, 2024
1 parent 0d1414e commit c2e3ba3
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions node/delete_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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())
Expand Down
4 changes: 2 additions & 2 deletions node/delete_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion node/download_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion node/get_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion node/get_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 9 additions & 9 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion node/open_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion node/put_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion node/put_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion node/put_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c2e3ba3

Please sign in to comment.