Skip to content

Commit

Permalink
Move member type to types
Browse files Browse the repository at this point in the history
  • Loading branch information
vcastellm committed Feb 25, 2024
1 parent 794a178 commit a0717ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
13 changes: 3 additions & 10 deletions dkron/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"strconv"
"time"

"github.com/distribworks/dkron/v4/types"
"github.com/gin-contrib/cors"
"github.com/gin-contrib/expvar"
"github.com/gin-gonic/gin"
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/serf/serf"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/sirupsen/logrus"
"github.com/tidwall/buntdb"
Expand Down Expand Up @@ -420,18 +420,11 @@ func (h *HTTPTransport) executionHandler(c *gin.Context) {
}
}

type MId struct {
serf.Member

Id string `json:"id"`
StatusText string `json:"statusText"`
}

func (h *HTTPTransport) membersHandler(c *gin.Context) {
mems := []*MId{}
mems := []*types.Member{}
for _, m := range h.agent.serf.Members() {
id, _ := uuid.GenerateUUID()
mid := &MId{m, id, m.Status.String()}
mid := &types.Member{m, id, m.Status.String()}
mems = append(mems, mid)
}
c.Header("X-Total-Count", strconv.Itoa(len(mems)))
Expand Down
10 changes: 10 additions & 0 deletions types/member.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package types

import "github.com/hashicorp/serf/serf"

type Member struct {
serf.Member

Id string `json:"id"`
StatusText string `json:"statusText"`
}

0 comments on commit a0717ae

Please sign in to comment.