Skip to content

Commit

Permalink
Merge unit and env persistence.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsnowcurrently committed May 19, 2016
1 parent 59caabc commit ee1a999
Show file tree
Hide file tree
Showing 8 changed files with 299 additions and 346 deletions.
10 changes: 6 additions & 4 deletions component/all/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,16 @@ func (payloads) registerState() {
return
}

newUnitPayloads := func(persist state.Persistence, unit, machine string) (state.UnitPayloads, error) {
return payloadstate.NewUnitPayloads(persist, unit, machine), nil
newUnitPayloads := func(db state.Persistence, unit, machine string) (state.UnitPayloads, error) {
persist := persistence.NewPersistence(db)
unitPersist := persistence.NewUnitPersistence(persist, unit)
return payloadstate.NewUnitPayloads(unitPersist, unit, machine), nil
}

newEnvPayloads := func(db state.Persistence) (state.EnvPayloads, error) {
envPersist := persistence.NewEnvPersistence(db)
persist := persistence.NewPersistence(db)
envPayloads := payloadstate.EnvPayloads{
Persist: envPersist,
Persist: persist,
}
return envPayloads, nil
}
Expand Down
5 changes: 3 additions & 2 deletions payload/persistence/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ func (s *BaseSuite) NewDoc(id string, pl payload.FullPayloadInfo) *payloadDoc {
MachineID: pl.Machine,
StateID: id,
Type: pl.Type,
RawID: pl.ID,
State: pl.Status,
Labels: append([]string{}, pl.Labels...),
RawID: pl.ID,
}
}

Expand All @@ -64,7 +65,7 @@ func (s *BaseSuite) RemoveDoc(name string) {
}

func (s *BaseSuite) NewPersistence() *Persistence {
return NewPersistence(s.State, s.Unit)
return NewPersistence(s.State)
}

func (s *BaseSuite) SetUnit(id string) {
Expand Down
43 changes: 0 additions & 43 deletions payload/persistence/env.go

This file was deleted.

148 changes: 0 additions & 148 deletions payload/persistence/env_test.go

This file was deleted.

Loading

0 comments on commit ee1a999

Please sign in to comment.