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

Snake a context through the Chain-blockstore creation #5282

Merged
merged 6 commits into from
Jan 30, 2021

Conversation

ribasushi
Copy link
Collaborator

@ribasushi ribasushi commented Jan 4, 2021

This sends through the startup daemon context for alternative blockstores that could benefit from it.

EDIT (by @raulk)

Context: one datastore that will benefit from this is the Postgres-backed datastore. Since it is not an embedded datastore and needs to set up a network connection on initialisation, a context is tremendously useful.

node/repo/interface.go Show resolved Hide resolved
node/repo/interface.go Outdated Show resolved Hide resolved
Co-authored-by: raulk <raul@protocol.ai>
@raulk raulk self-assigned this Jan 12, 2021
Copy link
Member

@raulk raulk left a comment

Choose a reason for hiding this comment

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

Signalling blockage until we even out the API, as per review comments. I'll take care of it.

@raulk raulk self-requested a review January 26, 2021 10:07
Copy link
Member

@raulk raulk left a comment

Choose a reason for hiding this comment

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

The interfaces are levelled out now. I'm good to merge. Thanks @ribasushi.

@raulk
Copy link
Member

raulk commented Jan 26, 2021

ping @magik6k for final call / merge.

Copy link
Member

@raulk raulk left a comment

Choose a reason for hiding this comment

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

Not yet, I forgot to push a commit.

@raulk raulk force-pushed the chore/snake_context_through_blockstore_init branch from a59177f to a1da1da Compare January 26, 2021 11:01
@raulk
Copy link
Member

raulk commented Jan 26, 2021

Depends on #4995 to fix the build-lotus-soup CI job.

ds, err := r.Datastore("/staging")
func StagingMultiDatastore(lc fx.Lifecycle, mctx helpers.MetricsCtx, r repo.LockedRepo) (dtypes.StagingMultiDstore, error) {
ctx := helpers.LifecycleCtx(mctx, lc)
ds, err := r.Datastore(ctx, "/staging")
Copy link
Contributor

Choose a reason for hiding this comment

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

Doc for the Datastore says that ctx is only for startup, here we are passing a lifecycle context from start to the end of Lotus runtime.

Copy link
Member

Choose a reason for hiding this comment

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

The Datastore() constructor should not retain the context. It should only be used for the start operation, and this is the only context that we have that is cancelled if the startup is cancelled.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, we should be using the context from OnStart here, but it makes everything way harder.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that would be unnecessarily complex IMO.

@raulk
Copy link
Member

raulk commented Jan 28, 2021

Approved, but #4995 needs to land first for the tests to pass.

@magik6k magik6k merged commit a541a25 into master Jan 30, 2021
@magik6k magik6k deleted the chore/snake_context_through_blockstore_init branch January 30, 2021 10:55
bibibong pushed a commit to EpiK-Protocol/go-epik that referenced this pull request Feb 22, 2021
…snake_context_through_blockstore_init

Snake a context through the Chain-blockstore creation
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.

4 participants