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

Add common interface to write exported files #215

Merged
merged 5 commits into from
Feb 22, 2024

Conversation

chowbao
Copy link
Contributor

@chowbao chowbao commented Jan 9, 2024

  • Added a common interface to write exported files to a chosen cloud provider storage service.
  • Moved utility functions out of export_ledgers
  • Added gcs to the common interface

Note: Because of the way the cmd package was written the command_utils and upload_to_gcs are at the same cmd/ directory level in order to avoid more refactoring. This is mostly due to cmdLogger (from root.go) and being embedded in a bunch of functions throughout the cmd package

@chowbao chowbao requested a review from a team as a code owner January 9, 2024 16:41
func MustGcsFlags(flags *pflag.FlagSet, logger *EtlLogger) (bucket, credentials string) {
bucket, err := flags.GetString("gcs-bucket")
// MustCloudStorageFlags gets the values of the bucket list specific flags: cloud-storage-bucket, cloud-credentials
func MustCloudStorageFlags(flags *pflag.FlagSet, logger *EtlLogger) (bucket, credentials, provider string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

By making this method required, if a user only wants to read/write the files locally and deal with transmission in another process, are they going to get a warning every time they export without specifying a storage destination?

Copy link
Contributor

Choose a reason for hiding this comment

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

I almost wonder if we make writing to a data store something you opt into, like the --testnet parameter and then pass accompanying cloud provider flags

Copy link
Contributor Author

@chowbao chowbao Jan 11, 2024

Choose a reason for hiding this comment

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

are they going to get a warning every time they export without specifying a storage destination?

They will not

Well the funny thing is the precedent in the code is to make it required but give it a default value 😆

I figured we could refactor that along with the larger txmeta change or as other tickets. Where this refactor would include updating the cmd package (actually deprecating the unused export_* commands and making root.go more extensible), updating flags, and pulling out even more randomly embedded functions into separate util_* files

Copy link
Contributor

Choose a reason for hiding this comment

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

Well the funny thing is the precedent in the code is to make it required but give it a default value 😆

yeah, yeah i know 😅

i like that idea, i'm fine incrementally improving this interface so we can clean it up once we refactor stellar-etl to use a different ledgerbackend interface (ie, reading from GCS)

Copy link
Contributor

@sydneynotthecity sydneynotthecity left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

At some point we should evaluate whether it makes sense to deprecate this entirely.

@chowbao chowbao merged commit e1e76d0 into master Feb 22, 2024
4 checks passed
@sydneynotthecity sydneynotthecity deleted the use-common-interface-for-export-files branch July 15, 2024 13:01
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