Skip to content

Commit a7661a4

Browse files
committed
add api for object limit
1 parent 88e40a4 commit a7661a4

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

code/go/0chain.net/blobbercore/handler/handler.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import (
66
"encoding/json"
77
"errors"
88
"fmt"
9-
"github.com/0chain/gosdk/core/zcncrypto"
109
"net/http"
1110
"os"
1211
"runtime/pprof"
1312
"strconv"
1413
"strings"
1514
"time"
1615

16+
"github.com/0chain/gosdk/core/zcncrypto"
17+
1718
"github.com/0chain/blobber/code/go/0chain.net/core/transaction"
1819

1920
"github.com/go-openapi/runtime/middleware"
@@ -222,7 +223,7 @@ func setupHandlers(s *mux.Router) {
222223
s.HandleFunc("/_config", common.AuthenticateAdmin(common.ToJSONResponse(GetConfig)))
223224
// s.HandleFunc("/_config", RateLimitByCommmitRL(common.ToJSONResponse(GetConfig)))
224225
// s.HandleFunc("/_stats", common.AuthenticateAdmin(StatsHandler)))
225-
s.HandleFunc("/_stats", RateLimitByCommmitRL(StatsHandler))
226+
s.HandleFunc("/objectlimit", RateLimitByCommmitRL(common.ToJSONResponse(GetObjectLimit)))
226227

227228
s.HandleFunc("/_logs", RateLimitByCommmitRL(common.ToJSONResponse(GetLogs)))
228229

@@ -1630,6 +1631,16 @@ func GetConfig(ctx context.Context, r *http.Request) (interface{}, error) {
16301631
return config.Configuration, nil
16311632
}
16321633

1634+
func GetObjectLimit(ctx context.Context, r *http.Request) (interface{}, error) {
1635+
var objLimit struct {
1636+
MaxAllocationDirFiles int
1637+
MaxObjectsInDir int
1638+
}
1639+
objLimit.MaxAllocationDirFiles = config.Configuration.MaxAllocationDirFiles
1640+
objLimit.MaxObjectsInDir = config.Configuration.MaxObjectsInDir
1641+
return objLimit, nil
1642+
}
1643+
16331644
func GetLogs(ctx context.Context, r *http.Request) (interface{}, error) {
16341645
return transaction.Last50Transactions, nil
16351646
}

0 commit comments

Comments
 (0)