-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#18783 from manadart/dqlite-removal-domain
juju#18783 Adds the skeleton service, state and factory method for the `removal` domain. There is no domain functionality at this point.
- Loading branch information
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2025 Canonical Ltd. | ||
// Licensed under the AGPLv3, see LICENCE file for details. | ||
|
||
package service | ||
|
||
import ( | ||
"github.com/juju/juju/core/changestream" | ||
"github.com/juju/juju/core/logger" | ||
"github.com/juju/juju/core/watcher" | ||
"github.com/juju/juju/core/watcher/eventsource" | ||
) | ||
|
||
// State describes retrieval and persistence methods for entity removal. | ||
type State interface{} | ||
|
||
// WatcherFactory describes methods for creating watchers. | ||
type WatcherFactory interface { | ||
// NewNamespaceWatcher returns a new namespace watcher | ||
// for events based on the input change mask. | ||
NewNamespaceWatcher(string, changestream.ChangeType, eventsource.NamespaceQuery) (watcher.StringsWatcher, error) | ||
} | ||
|
||
// Service provides the API for working with entity removal. | ||
type Service struct { | ||
st State | ||
logger logger.Logger | ||
} | ||
|
||
// WatchableService provides the API for working with entity removal, | ||
// including the ability to create watchers. | ||
type WatchableService struct { | ||
Service | ||
watcherFactory WatcherFactory | ||
} | ||
|
||
// NewWatchableService creates a new WatchableService | ||
// for working with entity removal. | ||
func NewWatchableService( | ||
st State, | ||
watcherFactory WatcherFactory, | ||
logger logger.Logger, | ||
) *WatchableService { | ||
return &WatchableService{ | ||
Service: Service{ | ||
st: st, | ||
logger: logger, | ||
}, | ||
watcherFactory: watcherFactory, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2025 Canonical Ltd. | ||
// Licensed under the AGPLv3, see LICENCE file for details. | ||
|
||
package state | ||
|
||
import ( | ||
"github.com/juju/juju/core/database" | ||
"github.com/juju/juju/core/logger" | ||
"github.com/juju/juju/domain" | ||
) | ||
|
||
// State provides persistence and retrieval associated with entity removal. | ||
type State struct { | ||
*domain.StateBase | ||
logger logger.Logger | ||
} | ||
|
||
// NewState returns a new state reference. | ||
func NewState(factory database.TxnRunnerFactory, logger logger.Logger) *State { | ||
return &State{ | ||
StateBase: domain.NewStateBase(factory), | ||
logger: logger, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters