Skip to content

Commit

Permalink
feat: replace model status mongo state with domain service;
Browse files Browse the repository at this point in the history
  • Loading branch information
ycliuhw committed Dec 4, 2024
1 parent 316c2cc commit 93de92b
Show file tree
Hide file tree
Showing 9 changed files with 1,184 additions and 1,574 deletions.
25 changes: 0 additions & 25 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 Down
Loading

0 comments on commit 93de92b

Please sign in to comment.