Skip to content

Commit

Permalink
state: add, test payloads functionality
Browse files Browse the repository at this point in the history
Removed original payload persistence component and registration.
  • Loading branch information
fwereade committed Jun 18, 2016
1 parent e60fa83 commit d36789d
Show file tree
Hide file tree
Showing 28 changed files with 1,049 additions and 2,165 deletions.
27 changes: 1 addition & 26 deletions component/all/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
internalserver "github.com/juju/juju/payload/api/private/server"
"github.com/juju/juju/payload/api/server"
"github.com/juju/juju/payload/context"
"github.com/juju/juju/payload/persistence"
payloadstate "github.com/juju/juju/payload/state"
"github.com/juju/juju/payload/status"
"github.com/juju/juju/state"
unitercontext "github.com/juju/juju/worker/uniter/runner/context"
Expand All @@ -33,7 +31,6 @@ const payloadsHookContextFacade = payload.ComponentName + "-hook-context"
type payloads struct{}

func (c payloads) registerForServer() error {
c.registerState()
c.registerPublicFacade()

c.registerHookContext()
Expand All @@ -47,7 +44,7 @@ func (c payloads) registerForClient() error {
}

func (payloads) newPublicFacade(st *state.State, resources *common.Resources, authorizer common.Authorizer) (*server.PublicAPI, error) {
up, err := st.EnvPayloads()
up, err := st.ModelPayloads()
if err != nil {
return nil, errors.Trace(err)
}
Expand Down Expand Up @@ -195,25 +192,3 @@ func (payloads) registerHookContextCommands() {
return cmd, nil
})
}

func (payloads) registerState() {
if !markRegistered(payload.ComponentName, "state") {
return
}

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) {
persist := persistence.NewPersistence(db)
envPayloads := payloadstate.EnvPayloads{
Persist: persist,
}
return envPayloads, nil
}

state.SetPayloadsComponent(newEnvPayloads, newUnitPayloads)
}
149 changes: 0 additions & 149 deletions payload/persistence/base_test.go

This file was deleted.

107 changes: 0 additions & 107 deletions payload/persistence/mongo.go

This file was deleted.

Loading

0 comments on commit d36789d

Please sign in to comment.