summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-05 16:23:14 +0300
committerWolfy-J <[email protected]>2018-06-05 16:23:14 +0300
commit76ff8d1c95e087749d559ee5a4f8f0348feafffa (patch)
tree112630d2d2cfe41d809065034c13b1066b8e05c2 /utils
parent3c86132f90ef6473b4073a8b1500d01b6114fc30 (diff)
Cs and refactoring
Diffstat (limited to 'utils')
-rw-r--r--utils/size.go28
-rw-r--r--utils/workers.go37
2 files changed, 0 insertions, 65 deletions
diff --git a/utils/size.go b/utils/size.go
deleted file mode 100644
index 176cc9e1..00000000
--- a/utils/size.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package utils
-
-import (
- "strconv"
- "strings"
-)
-
-func ParseSize(size string) int64 {
- if len(size) == 0 {
- return 0
- }
-
- s, err := strconv.Atoi(size[:len(size)-1])
- if err != nil {
- return 0
- }
-
- switch strings.ToLower(size[len(size)-1:]) {
- case "k", "kb":
- return int64(s * 1024)
- case "m", "mb":
- return int64(s * 1024 * 1024)
- case "g", "gb":
- return int64(s * 1024 * 1024 * 1024)
- }
-
- return 0
-}
diff --git a/utils/workers.go b/utils/workers.go
deleted file mode 100644
index 0c4f778f..00000000
--- a/utils/workers.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package utils
-
-import "github.com/spiral/roadrunner"
-
-// Worker provides information about specific worker.
-type Worker struct {
- // Pid contains process id.
- Pid int `json:"pid"`
-
- // Status of the worker.
- Status string `json:"status"`
-
- // Number of worker executions.
- NumExecs uint64 `json:"numExecs"`
-
- // Created is unix nano timestamp of worker creation time.
- Created int64 `json:"created"`
-
- // Updated is unix nano timestamp of last worker execution.
- Updated int64 `json:"updated"`
-}
-
-// FetchWorkers fetches list of workers from RR Server.
-func FetchWorkers(srv *roadrunner.Server) (result []Worker) {
- for _, w := range srv.Workers() {
- state := w.State()
- result = append(result, Worker{
- Pid: *w.Pid,
- Status: state.String(),
- NumExecs: state.NumExecs(),
- Created: w.Created.UnixNano(),
- Updated: state.Updated().UnixNano(),
- })
- }
-
- return
-}