Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactoring] Moving SP initialization and avoid circular dependencies #3877

Conversation

fhibf
Copy link
Contributor

@fhibf fhibf commented May 27, 2024

  • Removing dependencies to IStoredProcedureInstaller from CollectionUpgradeManager.
  • Moving Stored Procedure installation to DataPlaneCollectionSetup.
  • Refactoring tests as needed.

@fhibf fhibf requested a review from a team as a code owner May 27, 2024 18:32
@fhibf fhibf changed the title [Refactoring] Refactoring to avoid circle dependencies [Refactoring] Refactoring to avoid circular dependencies May 27, 2024
@fhibf fhibf changed the title [Refactoring] Refactoring to avoid circular dependencies [Refactoring] Moving SP initialization and avoid circular dependencies May 27, 2024
@mahajan-xor mahajan-xor merged commit 1d53f73 into personal/anilm/fhir-cosmosdbinitialization-newassembly May 29, 2024
4 checks passed
@mahajan-xor mahajan-xor deleted the user/fernfe/smallRefac branch May 29, 2024 15:09
mahajan-xor added a commit that referenced this pull request Jul 4, 2024
* a)Changes done on existing Microsoft.Health.Fhir.CosmosDb Project
1.Icollectionupdater copied to Istoreprocedure in cosmos db old project
2.older Istoreprocedure logic moved to new project with filename IStoredProcedureInstaller
3.StoredProcedureInstaller.cs removed from old db(Microsoft.Health.Fhir.CosmosDb) and moved this logic to new project with filename DataPlaneStoredProcedureInstaller.cs
4.Configs folder contains classes like CosmosDataStoreConfiguration,CosmosCollectionConfiguration moved to Microsoft.Health.Fhir.CosmosDb.Core project
5.Following classes moved to Microsoft.Health.Fhir.CosmosDb.Core project
   -SystemData
   -KnownDocumentProperties
   -ICollectionUpdater
   -CollectionVersion
   -CollectionUpgradeManager
   -IUpgradeManager
   -CollectionInitializer : we have removed depenedancy for RetryExceptionPolicyFactory in constructor
   -ICollectionInitializer
   -CosmosClientExtensions
   -ICosmosDbDistributedLock
   -ICosmosDbDistributedLockFactory
   -ICosmosClientTestProvider

6. Following existing Classes/interfaces modified
   -ICosmosClientInitializer
   -FhirCosmosClientInitializer
   -CosmosDbFhirStorageTestsFixture
          // TODO: TODO: need modify this class to call new CosmosDB .Initialization functions
          // now some existing call are commented
   -CosmosContainerProvider
           // TODO: TODO: need modify this class to call new CosmosDB .Initialization functions
          // now some existing call are commented

b) New Microsoft.Health.Fhir.CosmosDb.Initialization project added
   -Initialization of cosmos DB functionality moved here
   - Moved Storeprocedure installation logic here Added classes like
     DataPlaneStoredProcedureInstaller,StoredProcedureMetadataBase
   - Also we have DataPlaneCollectionSetup class which will implement following methods
       -CreateDatabaseAsync
       - CreateCollection
       -UpdateFhirCollectionSettings

c)Unit Test Project Added Microsoft.Health.Fhir.CosmosDb.Initialization.UnitTests project

d)Also Added Microsoft.Health.Fhir.CosmosDb.Core project
  - We have moved common functionalities from Microsoft.Health.Fhir.CosmosDb project

#User Story 112343: [Cosmos][OSS] Move Cosmos DB initialization logic to a new assembly

* versions updated for some packages

* Moved to CosmosDB.Core
 -StoredProcedureBase
 -IStoredProcedure
 -IStoredProcedureMetadata
 -StoredProcedureMetadata

Moved to CosmosDB.Initialization:
 -UpdateUnsupportedSearchParameters
 -FhirCollectionSettingsUpdater

* 1. Added ICollectionDataUpdater interface in cosmosdb project
2.Replaced ICollectionUpdater with ICollectionDataUpdater in CosmosDbSearchParameterStatusInitializer
3.moved else part logic from FhirCollectionSettingsUpdater to CosmosDbSearchParameterStatusInitializer
4.FhirCollectionSettingsUpdater  is removed from solution

* worked on code review comments

* worked on review comments and cleaned up code

* done with end to end flow testing with CosmosDbFhirStorageTestsFixture class

* resolved installed storeprocedure issue

* Unit test cases updated . DataPlaneCosmosDbRegistarionExtensions issue is resolved

* resolved build issue for hardDelete

* identity package updated to latest version to solve vulnerability issue

* Solve the test failures in PR
Disconnect ICollectionSetup from CosmosClient and Container.

* fixed review comments

* solved issues with unit test

* Added new project refrences to docker file

* updated docker file

* removed extra call to fhircollectionsetting updater

* Refactoring to avoid circle dependency (#3877)

* merging refatoring changes with local branch

* solved merge issues

* fixes namespace issue for Core.Resources

* resolves unit test issue for FHIRCosmosClientInitializer

* Resolves unite test issues

* added missing decorators on DataPlaneCollectionSetupTests

* work on review comments

* Adds classification attibutes

* -Adding newly added project references to R4.slnf and R5.slnf
-Adding simple threadsafe logic for creating CosmosClient instance

* refactoring CreateCosmosClient logic to have validation logic

---------

Co-authored-by: Fernando Henrique Inocêncio Borba Ferreira <fernfe@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants