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

ingest: service created #14

Merged
merged 15 commits into from
May 29, 2024
Merged

ingest: service created #14

merged 15 commits into from
May 29, 2024

Conversation

daniel-burghardt
Copy link
Member

@daniel-burghardt daniel-burghardt commented May 22, 2024

What

Implements the ingestion service in the wallet backend.

Why

New feature.

Known limitations

Dockerfile still needs to be setup.

Issue that this PR addresses

[OSB Ingestion] Move service over to new repo

Checklist

PR Structure

  • It is not possible to break this PR down into smaller PRs.
  • This PR does not mix refactoring changes with feature changes.
  • This PR's title starts with name of package that is most changed in the PR, or all if the changes are broad or impact many packages.

Thoroughness

  • This PR adds tests for the new functionality or fixes.
  • All updated queries have been tested (refer to this check if the data set returned by the updated query is expected to be same as the original one).

Release

  • This is not a breaking change.
  • This is ready to be tested in development.
  • The new functionality is gated with a feature flag if this is not ready for production.

@daniel-burghardt daniel-burghardt changed the title Ingest: service created ingest: service created May 22, 2024
@daniel-burghardt daniel-burghardt marked this pull request as ready for review May 22, 2024 19:36
Copy link
Contributor

@CaioTeixeira95 CaioTeixeira95 left a comment

Choose a reason for hiding this comment

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

Thank you for the hard work! I've left some comments.

.vscode
captive-core*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this name correct?

Copy link
Member Author

@daniel-burghardt daniel-burghardt May 27, 2024

Choose a reason for hiding this comment

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

Yes, whenever you run captive core it creates a folder named like captive-core-9f8g7a9f in the application's root folder to store the ledger files it downloads. The "*" is to capture the random name given to the folder.

cmd/ingest.go Outdated
Usage: "Path to Captive Core's binary file.",
OptType: types.String,
ConfigKey: &cfg.CaptiveCoreBinPath,
FlagDefault: "/usr/local/bin/stellar-core",
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this one couldn't also point to a local directory like the captive-core-config-dir.

Copy link
Member Author

Choose a reason for hiding this comment

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

Whenever you install captive core locally using these instructions, /usr/local/bin/stellar-core will be the default install location. If we wanted it to live inside a project directory we would need to change that install path.
I thought it was easier to use the default location and set it here accordingly. What do you think?

cmd/ingest.go Outdated
Name: "captive-core-bin-path",
Usage: "Path to Captive Core's binary file.",
OptType: types.String,
ConfigKey: &cfg.CaptiveCoreBinPath,
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking about adding a CustomSetValue for it since it's a folder, we could add validations to see if the folder exists before the application starts.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good one! c81a985

cmd/ingest.go Outdated
Name: "captive-core-config-dir",
Usage: "Path to Captive Core's configuration files directory.",
OptType: types.String,
ConfigKey: &cfg.CaptiveCoreConfigDir,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here (custom set value for folders value).

Copy link
Member Author

Choose a reason for hiding this comment

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

Good one! c81a985

cmd/ingest.go Outdated
},
{
Name: "ledger-cursor-name",
Usage: "Name of last synced ledger cursor. Attention: there should never be more than one container running with a same cursor name.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you elaborate on it? Is this value an enum or should it be a unique value? We should make it more clear and, also remove the FlagDefault since it cannot have the same name.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not an enum, it's just an unique string value used as the key in the ingest_store dictionary-like table.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've made the description more clear, made it required and removed the default value. Good call, this will make people more aware that this has to be carefully configured when running parallel ingestion.

Copy link
Member Author

Choose a reason for hiding this comment

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

operation_id bigint NOT NULL,
operation_type text NOT NULL,
transaction_id bigint NOT NULL,
transaction_hash text NOT NULL,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

internal/ingest/ingest.go Show resolved Hide resolved
internal/utils/ingestion_utils.go Outdated Show resolved Hide resolved
internal/utils/utils.go Show resolved Hide resolved
internal/services/ingest.go Show resolved Hide resolved
Copy link
Contributor

@CaioTeixeira95 CaioTeixeira95 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@daniel-burghardt daniel-burghardt self-assigned this May 29, 2024
@daniel-burghardt daniel-burghardt merged commit a8ec80a into main May 29, 2024
5 checks passed
@daniel-burghardt daniel-burghardt deleted the ingest branch May 29, 2024 19:52
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