-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: implement distributed lock by gorm #1366
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
Open
everfid-ever
wants to merge
12
commits into
apache:develop
Choose a base branch
from
everfid-ever:feat/gorm_lock
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9f0e521
feat: implement distributed lock by gorm
everfid-ever 64929e8
fix
everfid-ever c83ecf6
add license header
everfid-ever bac7de4
add err code
everfid-ever a7647f4
fix
everfid-ever 9badfef
fix
everfid-ever c3e506f
refactor: improve lock factory design with registry pattern
everfid-ever e6599d1
refactor: decouple lock factory from StoreComponent
everfid-ever c6f0e0a
fix ci
everfid-ever 963cd61
add RequiredDependencies
everfid-ever fb4a7a9
refactor
everfid-ever 7405ccb
Merge branch 'develop' into feat/gorm_lock
everfid-ever File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package constants | ||
|
|
||
| import "time" | ||
|
|
||
| const ( | ||
| // DefaultLockTimeout is the default timeout for distributed lock operations | ||
| // This timeout applies to lock acquisition, renewal, and release operations | ||
| DefaultLockTimeout = 30 * time.Second | ||
|
|
||
| // DefaultAutoRenewThreshold is the TTL threshold above which auto-renewal is enabled | ||
| // Locks with TTL longer than this value will be automatically renewed | ||
| DefaultAutoRenewThreshold = 10 * time.Second | ||
|
|
||
| // DefaultUnlockTimeout is the timeout for unlock operations in deferred cleanup | ||
| DefaultUnlockTimeout = 5 * time.Second | ||
|
|
||
| // DefaultRenewTimeout is the timeout for lock renewal operations | ||
| DefaultRenewTimeout = 5 * time.Second | ||
|
|
||
| // DefaultLockRetryInterval is the interval between lock acquisition retry attempts | ||
| DefaultLockRetryInterval = 100 * time.Millisecond | ||
|
|
||
| // DefaultCleanupInterval is the interval for periodic expired lock cleanup | ||
| DefaultCleanupInterval = 5 * time.Minute | ||
|
|
||
| // DefaultCleanupTimeout is the timeout for cleanup operations | ||
| DefaultCleanupTimeout = 30 * time.Second | ||
| ) | ||
|
|
||
| // Lock key prefixes for different resource types | ||
| const ( | ||
| // TagRouteKeyPrefix is the prefix for tag route lock keys | ||
| TagRouteKeyPrefix = "tag_route" | ||
|
|
||
| // ConfiguratorRuleKeyPrefix is the prefix for configurator rule lock keys | ||
| ConfiguratorRuleKeyPrefix = "configurator_rule" | ||
|
|
||
| // ConditionRuleKeyPrefix is the prefix for condition rule lock keys | ||
| ConditionRuleKeyPrefix = "condition_rule" | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.