Skip to content

physical: use permitpool from go-secure-stdlib#29331

Merged
stevendpclark merged 4 commits intohashicorp:mainfrom
johanbrandhorst:jbrandhorst-use-permitpool
Jan 24, 2025
Merged

physical: use permitpool from go-secure-stdlib#29331
stevendpclark merged 4 commits intohashicorp:mainfrom
johanbrandhorst:jbrandhorst-use-permitpool

Conversation

@johanbrandhorst
Copy link
Copy Markdown
Contributor

@johanbrandhorst johanbrandhorst commented Jan 9, 2025

The PermitPool type is being moved to go-secure-stdlib to be shared with Boundary.

sdk/physical: use permitpool from go-secure-stdlib

physical: use permitpool from go-secure-stdlib

@johanbrandhorst johanbrandhorst requested a review from a team as a code owner January 9, 2025 17:50
@johanbrandhorst johanbrandhorst marked this pull request as draft January 9, 2025 17:51
Comment thread go.mod Outdated
@johanbrandhorst johanbrandhorst force-pushed the jbrandhorst-use-permitpool branch from 29e9c88 to aca6d4f Compare January 22, 2025 21:53
Comment thread physical/alicloudoss/alicloudoss.go Outdated
Comment on lines 126 to 128
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The permitpool now requires a context argument, so that it can unblock in the case of context cancellations. I have weaved this into the code using existing contexts where possible, otherwise using context.Background().

@johanbrandhorst johanbrandhorst marked this pull request as ready for review January 22, 2025 21:54
@johanbrandhorst johanbrandhorst force-pushed the jbrandhorst-use-permitpool branch from aca6d4f to ea2afd8 Compare January 22, 2025 21:55
@johanbrandhorst johanbrandhorst force-pushed the jbrandhorst-use-permitpool branch from ea2afd8 to 39d591e Compare January 22, 2025 21:55
Copy link
Copy Markdown
Contributor

@stevendpclark stevendpclark left a comment

Choose a reason for hiding this comment

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

Overall +1, I just have two comments/questions before approval.

Comment thread sdk/physical/physical.go
// Factory is the factory function to create a physical backend.
type Factory func(config map[string]string, logger log.Logger) (Backend, error)

// PermitPool is used to limit maximum outstanding requests
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this not be marked as deprecated and the existing NewPermitPool return the shared version for at least some backwards compatibility since this is the SDK package?

Touchy as the Acquire method has changed 🤔

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

existing NewPermitPool return the shared version sorry late in the day comment. I meant wrap the new shared implementation within itself and delegate to it internally from the existing methods.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great question, I didn't clock that this was a package users may depend on. I'm sort of worried that adding a wrapper here will just make users in this repo keep using it, but I suppose that's a risk we have to take. I'll add a wrapper.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added a wrapper which should be code-compatible, please take a look

Comment thread sdk/go.mod Outdated
Copy link
Copy Markdown
Contributor

@stevendpclark stevendpclark left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me, thanks for doing this.

@stevendpclark stevendpclark merged commit 8d83c5d into hashicorp:main Jan 24, 2025
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