Skip to content

Commit 3ec0c4b

Browse files
fix: remove unused parseSize function (lint)
1 parent bcbdb75 commit 3ec0c4b

1 file changed

Lines changed: 0 additions & 32 deletions

File tree

cmd/hypercache/main.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -253,38 +253,6 @@ func main() {
253253
logging.Info(ctx, logging.ComponentMain, logging.ActionStop, "HyperCache shutdown complete")
254254
}
255255

256-
// Helper function to parse size strings (e.g., "100MB") into int64 bytes
257-
func parseSize(sizeStr string) int64 {
258-
if sizeStr == "" {
259-
return 0
260-
}
261-
262-
multipliers := map[string]int64{
263-
"B": 1,
264-
"KB": 1024,
265-
"MB": 1024 * 1024,
266-
"GB": 1024 * 1024 * 1024,
267-
"TB": 1024 * 1024 * 1024 * 1024,
268-
}
269-
270-
var size int64
271-
var unit string
272-
273-
n, err := fmt.Sscanf(sizeStr, "%d%s", &size, &unit)
274-
if err != nil || n != 2 {
275-
logging.Warn(nil, logging.ComponentConfig, logging.ActionValidation, "Invalid size format, defaulting to 0", map[string]interface{}{"input": sizeStr})
276-
return 0
277-
}
278-
279-
multiplier, exists := multipliers[unit]
280-
if !exists {
281-
logging.Warn(nil, logging.ComponentConfig, logging.ActionValidation, "Unknown unit in size, defaulting to bytes", map[string]interface{}{"unit": unit, "input": sizeStr})
282-
multiplier = 1
283-
}
284-
285-
return size * multiplier
286-
}
287-
288256
// HTTP API Server for REST endpoints
289257
func startHTTPServer(ctx context.Context, coordinator cluster.CoordinatorService, storeManager *storage.StoreManager, port int, nodeID string, cfg *config.Config) error {
290258
mux := http.NewServeMux()

0 commit comments

Comments
 (0)