-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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(store): add new api LatestVersion #22305
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,10 @@ func (cdsa commitDBStoreAdapter) LastCommitID() types.CommitID { | |
} | ||
} | ||
|
||
func (cdsa commitDBStoreAdapter) LatestVersion() int64 { | ||
return -1 | ||
} | ||
Comment on lines
+39
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider revising the The current implementation of Consider the following suggestions:
Here's a potential improvement: func (cdsa commitDBStoreAdapter) LatestVersion() (int64, error) {
// TODO: Implement logic to get the actual latest version
return -1, errors.New("latest version not available")
} This change would require updating the interface and other implementations as well. |
||
|
||
func (cdsa commitDBStoreAdapter) WorkingHash() []byte { | ||
return commithash | ||
} | ||
|
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.
💡 Codebase verification
Standardize
LatestVersion()
Method Across StoresThe
LatestVersion()
method instore/mem/store.go
currently returns anint64
, whereas other store implementations returnuint64
. This inconsistency can lead to type mismatches and potential bugs.To ensure consistency and prevent type-related issues:
int64
oruint64
) for theLatestVersion()
method across all store implementations.LatestVersion()
method instore/mem/store.go
to return the actual latest version instead of the zero value.GetLatestVersion
,LoadLatestVersion
, etc.) are clearly defined and consistently named to reflect their functionality.🔗 Analysis chain
Implement the
LatestVersion()
methodThe
LatestVersion()
method has been added as per the PR objectives, but it currently has an empty implementation. This doesn't fulfill the intended purpose of returning the latest version of the store.Please implement the method to return the actual latest version. Consider the following:
Store
struct?Also, add a comment explaining the purpose of this method. For example:
To ensure this method is used correctly throughout the codebase, let's check its usage:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 3891