Skip to content

Commit

Permalink
Merge pull request juju#18445 from ycliuhw/model-status-refactor-clie…
Browse files Browse the repository at this point in the history
…nt-facade

juju#18445

This PR replaces the model status Mongo state with the domain service and removes model status history code and raises a notimplemented error.

Driveby fix: add a missing clock in the domain model service.

## Checklist

- [x] Code style: imports ordered, good names, simple structure, etc
- [x] Comments saying why design decisions were made
- [x] Go unit tests, with comments saying what you're testing
- [ ] ~[Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing~
- [ ] ~[doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~

## QA steps

Unit tests (the state layer is not implemented yet).

## Documentation changes

No

## Links

**Jira card:** [JUJU-7102](https://warthogs.atlassian.net/browse/JUJU-7102)



[JUJU-7102]: https://warthogs.atlassian.net/browse/JUJU-7102?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
jujubot authored Dec 4, 2024
2 parents 316c2cc + 85bd884 commit 1a0792f
Show file tree
Hide file tree
Showing 10 changed files with 1,207 additions and 1,584 deletions.
29 changes: 0 additions & 29 deletions apiserver/facades/client/client/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/juju/mgo/v3"
"github.com/juju/names/v5"
"github.com/juju/replicaset/v3"
"github.com/juju/version/v2"

"github.com/juju/juju/apiserver/common/storagecommon"
"github.com/juju/juju/core/crossmodel"
Expand Down Expand Up @@ -38,7 +37,6 @@ type Backend interface {
HAPrimaryMachine() (names.MachineTag, error)
LatestPlaceholderCharm(*charm.URL) (*state.Charm, error)
Machine(string) (*state.Machine, error)
Model() (Model, error)
ModelTag() names.ModelTag
ModelUUID() string
RemoteApplication(string) (*state.RemoteApplication, error)
Expand All @@ -51,21 +49,6 @@ type MongoSession interface {
CurrentStatus() (*replicaset.Status, error)
}

// Model contains the state.Model methods used in this package.
type Model interface {
Name() string
Type() state.ModelType
UUID() string
Life() state.Life
CloudName() string
CloudRegion() string
CloudCredentialTag() (names.CloudCredentialTag, bool)
Owner() names.UserTag
StatusHistory(status.StatusHistoryFilter) ([]status.StatusInfo, error)
LatestToolsVersion() version.Number
Status() (status.StatusInfo, error)
}

// Application represents a state.Application.
type Application interface {
StatusHistory(status.StatusHistoryFilter) ([]status.StatusInfo, error)
Expand Down Expand Up @@ -113,14 +96,6 @@ func (s stateShim) ModelTag() names.ModelTag {
return names.NewModelTag(s.State.ModelUUID())
}

func (s stateShim) Model() (Model, error) {
m, err := s.State.Model()
if err != nil {
return nil, errors.Trace(err)
}
return &modelShim{Model: m}, nil
}

func (s stateShim) ControllerNodes() ([]state.ControllerNode, error) {
nodes, err := s.State.ControllerNodes()
if err != nil {
Expand All @@ -140,10 +115,6 @@ func (s stateShim) MongoSession() MongoSession {
return MongoSessionShim{s.State.MongoSession()}
}

type modelShim struct {
*state.Model
}

// MongoSessionShim wraps a *mgo.Session to conform to the
// MongoSession interface.
type MongoSessionShim struct {
Expand Down
Loading

0 comments on commit 1a0792f

Please sign in to comment.