diff --git a/internal/state/state.go b/internal/state/state.go index d399747e..c253c8f8 100644 --- a/internal/state/state.go +++ b/internal/state/state.go @@ -45,7 +45,7 @@ type State interface { ClusterCert() *shared.CertInfo // Database. - Database() db.DB + Database() types.DB // Local truststore access. Truststore() types.Store @@ -144,7 +144,7 @@ func (s *InternalState) ClusterCert() *shared.CertInfo { } // Database allows access to the dqlite database. -func (s *InternalState) Database() db.DB { +func (s *InternalState) Database() types.DB { return s.InternalDatabase } diff --git a/internal/db/interface.go b/microcluster/types/db.go similarity index 89% rename from internal/db/interface.go rename to microcluster/types/db.go index c1d35214..0e64cbb6 100644 --- a/internal/db/interface.go +++ b/microcluster/types/db.go @@ -1,12 +1,10 @@ -package db +package types import ( "context" "database/sql" dqliteClient "github.com/canonical/go-dqlite/v3/client" - - "github.com/canonical/microcluster/v3/microcluster/types" ) // DB exposes the internal database for use with external projects. @@ -21,7 +19,7 @@ type DB interface { Cluster(ctx context.Context, client *dqliteClient.Client) ([]dqliteClient.NodeInfo, error) // Status returns the current status of the database. - Status() types.DatabaseStatus + Status() DatabaseStatus // IsOpen returns nil only if the DB has been opened and the schema loaded. // Otherwise, it returns an error describing why the database is offline. @@ -29,5 +27,5 @@ type DB interface { IsOpen(ctx context.Context) error // SchemaVersion returns the current internal and external schema version, as well as all API extensions in memory. - SchemaVersion() (versionInternal uint64, versionExternal uint64, apiExtensions types.Extensions) + SchemaVersion() (versionInternal uint64, versionExternal uint64, apiExtensions Extensions) }