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

[WIP] Reorganizes the StorageInteraction code plus other improvements #15841

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

mereghost
Copy link
Contributor

@mereghost mereghost commented Jun 13, 2024

THIS IS AN EXPERIMENT

What?

We have a bunch of namespaces under Storages but some don't bring much clarity on what is their intended purpose or we gained new insight on the necessities for different service providers.

Why?

All storage supporting code lives under Peripherals (under the common/storages/ folder) and has become kind of that practical drawer where you just throw anything you wanna "hide" (under the guise of organizing) and it is slowing becoming a mess.

How?

First I'm introducing the Adapters namespace (under common/storage/adapters) where the code that is tailored goes (adapters/nextcloud, adapters/one_drive).

Each adapter structure is identical (in an ideal world) with the following namespaces / folders:

  • Commands: all commands (requests that makes changes to the remote service) go here
  • Queries: all queries (requests that only fetch remote information) go here
  • Contracts: contracts to be used with the Storage models
  • Support: any support code required for that service provider

The Adapters namespace will also have supporting code to it - Authentication Strategies, Specific Errors and also Objects defining the shape the results (success/failure) for all the required Commands and Queries.

The adapters folder/namespace also houses all the pieces used by the adapters (authentication, value objects etc)

module Commands
class CopyTemplateFolder
using Peripherals::ServiceResultRefinements
Util = Peripherals::StorageInteraction::Nextcloud::Util
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would eventually be removed when Util gets moved (and maybe split) into support

module Storages
module Adapters
module Nextcloud
class ManagedFolderIdentifier
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't exactly support (as in supporting code) but represents a concept that is storage dependent.

Should it go under a special namespace?

module Nextcloud
module Queries
class Files
Auth = Peripherals::StorageInteraction::Authentication
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Authentication will probably live under Adapters::Support::Authentication

@@ -37,7 +37,7 @@ module Peripherals
register(:file_ids, StorageInteraction::Nextcloud::FileIdsQuery)
register(:file_info, StorageInteraction::Nextcloud::FileInfoQuery)
register(:files_info, StorageInteraction::Nextcloud::FilesInfoQuery)
register(:files, StorageInteraction::Nextcloud::FilesQuery)
register(:files, Adapters::Nextcloud::Queries::Files)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Registries should be moved to their adapter folders (maybe we could add a way to auto-register? 🤔)

@mereghost mereghost force-pushed the maint/storage-module-structure branch 2 times, most recently from 84a7096 to bef03d0 Compare June 14, 2024 13:22
@mereghost mereghost force-pushed the maint/storage-module-structure branch 4 times, most recently from 9a613fa to b42de07 Compare July 2, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant