-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
Co-authored-by: raulk <raul@protocol.ai>
There was a problem hiding this 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.
There was a problem hiding this 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.
ping @magik6k for final call / merge. |
There was a problem hiding this 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.
a59177f
to
a1da1da
Compare
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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Approved, but #4995 needs to land first for the tests to pass. |
…snake_context_through_blockstore_init Snake a context through the Chain-blockstore creation
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.