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

Introduce factory classes to instantiate storage and transaction #276

Merged

Conversation

brfrn169
Copy link
Collaborator

@brfrn169 brfrn169 commented Aug 17, 2021

I think we can introduce factory classes to instantiate storage and transaction objects rather than expose the Guice dependency.

For example:

The original way to get a DistributedStorage instance, which exposes the Guice dependency:

Injector injector = Guice.createInjector(new StorageModule(new DatabaseConfig(props)));
StorageService storage = injector.getInstance(StorageService.class);

The new way to get a DistributedStorage instance:

StorageFactory factory = new StorageFactory(databaseConfig);
DistributedStorage storage = factory.getStorage();

Please take a look!

@brfrn169 brfrn169 added the enhancement New feature or request label Aug 17, 2021
@brfrn169 brfrn169 self-assigned this Aug 17, 2021
Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, Thank you.

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM! Thank you.

@feeblefakie feeblefakie merged commit 44bac7e into master Aug 18, 2021
@feeblefakie feeblefakie deleted the introduce-factory-classes-for-storage-and-transaction branch August 18, 2021 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants