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

feat: client support credentialsProvider #216

Merged
merged 8 commits into from
Aug 29, 2023

Conversation

crimson-gao
Copy link
Collaborator

No description provided.

README.md Outdated Show resolved Hide resolved
client_interface.go Outdated Show resolved Hide resolved
credentials.go Outdated Show resolved Hide resolved
if now >= t.expirationInMills {
return true
}
duration := (float64)(t.expirationInMills-t.lastUpdatedInMills) * t.expiredFactor
Copy link
Collaborator

Choose a reason for hiding this comment

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

即使 < 0 也没关系,一样会return true

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这里主要是担心客户端时间不严格有序

credentials_provider.go Outdated Show resolved Hide resolved
credentials_provider.go Outdated Show resolved Hide resolved
credentials_provider.go Outdated Show resolved Hide resolved
credentials_provider.go Outdated Show resolved Hide resolved
credentials_provider.go Outdated Show resolved Hide resolved
producer/producer_config.go Show resolved Hide resolved
@@ -166,116 +174,16 @@ func (adp *UpdateFuncProviderAdapter) GetCredentials() (Credentials, error) {
// Returns true if no credentials ever fetched or credentials expired,
// or credentials will be expired soon
func (adp *UpdateFuncProviderAdapter) shouldRefresh() bool {
adp.mutex.RLock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

不要用mutex,和atomic相比性能相差几十、上百倍,参考:https://github.com/uber-go/atomic

return accessKeyID != "" && accessKeySecret != "" && expirationTime.UnixMilli() > 0
}

const ECS_RAM_ROLE_URL_PREFIX = "http://100.100.100.200/latest/meta-data/ram/security-credentials/"
Copy link
Collaborator

Choose a reason for hiding this comment

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

我的意思并不是直接不要ECS RAM ROLE的功能,而是没必要再写一次冗余的ECS..Provider代码,其他的还是可以留着

NoRetryStatusCodeList []int
StsTokenShutDown chan struct{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

StsTokenShutDown 也要挪下来

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