Permalink
Browse files

Abandon type ProcessName

  • Loading branch information...
1 parent a296427 commit 0b20bdbbb90975a75eacf6d3491b0951ce81527c Tomás Senart committed Sep 10, 2012
Showing with 12 additions and 14 deletions.
  1. +1 −1 app.go
  2. +1 −1 event.go
  3. +2 −2 instance.go
  4. +1 −1 instance_test.go
  5. +3 −3 proctype.go
  6. +3 −4 ticket.go
  7. +1 −2 visor.go
View
2 app.go
@@ -178,7 +178,7 @@ func (a *App) GetProcTypes() (ptys []*ProcType, err error) {
for _, processName := range pNames {
var pty *ProcType
- pty, err = GetProcType(a.Snapshot, a, ProcessName(processName))
+ pty, err = GetProcType(a.Snapshot, a, processName)
if err != nil {
return
}
View
@@ -171,7 +171,7 @@ func getEventInfo(s Snapshot, ev *Event) (info interface{}, err error) {
return
}
- info, err = GetProcType(s, app, ProcessName(e["proctype"]))
+ info, err = GetProcType(s, app, e["proctype"])
if err != nil {
fmt.Printf("error getting proctype: %s\n", err)
}
View
@@ -30,7 +30,7 @@ type Instance struct {
Name string
AppName string
RevisionName string
- ProcessName ProcessName
+ ProcessName string
ServiceName string
Host string
Port int
@@ -49,7 +49,7 @@ func NewInstance(pty string, rev string, app string, addr string, snapshot Snaps
Port: tcpAddr.Port,
ServiceName: app + "-" + pty,
AppName: app,
- ProcessName: ProcessName(pty),
+ ProcessName: pty,
RevisionName: rev,
State: InsStateInitial,
}
View
@@ -10,7 +10,7 @@ import (
"testing"
)
-func instanceSetup(addr string, pType ProcessName) (ins *Instance) {
+func instanceSetup(addr string, pType string) (ins *Instance) {
s, err := Dial(DefaultAddr, "/instance-test")
if err != nil {
panic(err)
View
@@ -14,14 +14,14 @@ import (
// ProcType represents a process type with a certain scale.
type ProcType struct {
dir
- Name ProcessName
+ Name string
App *App
Port int
}
const procsPath = "procs"
-func NewProcType(app *App, name ProcessName, s Snapshot) *ProcType {
+func NewProcType(app *App, name string, s Snapshot) *ProcType {
return &ProcType{
Name: name,
App: app,
@@ -119,7 +119,7 @@ func (p *ProcType) GetInstances() (ins []*Instance, err error) {
}
// GetProcType fetches a ProcType from the coordinator
-func GetProcType(s Snapshot, app *App, name ProcessName) (p *ProcType, err error) {
+func GetProcType(s Snapshot, app *App, name string) (p *ProcType, err error) {
path := app.dir.prefix(procsPath, string(name))
port, err := s.getFile(path+"/port", new(intCodec))
View
@@ -21,7 +21,7 @@ type Ticket struct {
Id int64
AppName string
RevisionName string
- ProcessName ProcessName
+ ProcessName string
Op OperationType
Addr net.TCPAddr
Status TicketStatus
@@ -73,8 +73,7 @@ const (
TicketStatusDone TicketStatus = "done"
)
-// procType
-func CreateTicket(appName string, revName string, pName ProcessName, op OperationType, s Snapshot) (t *Ticket, err error) {
+func CreateTicket(appName string, revName string, pName string, op OperationType, s Snapshot) (t *Ticket, err error) {
t = &Ticket{
Id: -1,
AppName: appName,
@@ -287,7 +286,7 @@ func parseTicket(snapshot Snapshot, ev *doozer.Event, body []byte) (t *Ticket, e
Id: id,
AppName: data[0],
RevisionName: data[1],
- ProcessName: ProcessName(data[2]),
+ ProcessName: data[2],
Op: NewOperationType(data[3]),
dir: dir{snapshot, p},
source: ev}
View
@@ -52,7 +52,6 @@ const (
pmDir = "/pms"
)
-type ProcessName string
type Stack string
type State string
@@ -136,7 +135,7 @@ func Scale(app string, revision string, processName string, factor int, s Snapsh
for i := 0; i < tickets; i++ {
var ticket *Ticket
- ticket, err = CreateTicket(app, revision, ProcessName(processName), op, s)
+ ticket, err = CreateTicket(app, revision, processName, op, s)
if err != nil {
return
}

0 comments on commit 0b20bdb

Please sign in to comment.