Skip to content

Feature/add mis endpoints in col #695

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
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

bluepal-prasanthi-moparthi
Copy link
Collaborator

This includes the following collection-related endpoints:

  1. GET – /_db/{database-name}/_api/collection/{collection-name}/figures
  2. PUT – /_db/{database-name}/_api/collection/{collection-name}/responsibleShard
  3. GET – /_db/{database-name}/_api/collection/{collection-name}/revision
  4. GET – /_db/{database-name}/_api/collection/{collection-name}/checksum
  5. GET – /_db/{database-name}/_api/key-generators
  6. PUT – /_db/{database-name}/_api/collection/{collection-name}/loadIndexesIntoMemory
  7. PUT – /_db/{database-name}/_api/collection/{collection-name}/rename
  8. PUT – /_db/{database-name}/_api/collection/{collection-name}/recalculateCount
  9. PUT – /_db/{database-name}/_api/collection/{collection-name}/compact

Copy link
Collaborator

@jwierzbo jwierzbo left a comment

Choose a reason for hiding this comment

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

Please add note to the Changelog.md

@bluepal-prasanthi-moparthi bluepal-prasanthi-moparthi force-pushed the feature/add_mis_endpoints_in_col branch from 8751904 to 307a260 Compare July 31, 2025 05:55
@jwierzbo jwierzbo requested a review from Copilot August 5, 2025 12:14
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds several missing collection-related API endpoints to the v2 client library, expanding collection management capabilities. The implementation includes 9 new endpoints for collection statistics, revision tracking, checksum calculations, shard management, index operations, renaming, count recalculation, and compaction.

  • Implements collection statistics, revision, checksum, and shard management endpoints
  • Adds index loading, collection renaming, count recalculation, and compaction operations
  • Includes comprehensive test coverage for all new endpoints with proper environment validation

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
v2/arangodb/collection.go Adds method signatures for 8 new collection operations
v2/arangodb/collection_impl.go Implements the collection endpoint methods with proper HTTP handling
v2/arangodb/collection_opts.go Defines request/response structs for new collection operations
v2/arangodb/database.go Adds KeyGenerators method to Database interface
v2/arangodb/database_impl.go Implements KeyGenerators endpoint for database
v2/arangodb/database_opts.go Defines KeyGeneratorsResponse struct
v2/tests/database_collection_operations_test.go Comprehensive test coverage for all new collection endpoints
v2/tests/database_transactions_test.go Test for database KeyGenerators endpoint
v2/tests/graph_helper_test.go Updates graph helper to include database name in graph naming
v2/CHANGELOG.md Documents the addition of missing collection endpoints
Comments suppressed due to low confidence (1)

v2/arangodb/collection_opts.go:400

  • [nitpick] The struct ResponsibleShardRequest has a field 'Key' but the JSON tag is '_key'. This inconsistency could be confusing. Consider renaming the field to match the JSON convention or vice versa.
	Key string `json:"_key,omitempty"`

Comment on lines 277 to 280
if *withRevisions {
modifiers = append(modifiers, connection.WithQuery("withRevisions", boolToString(*withRevisions)))
}
if *withData {
Copy link
Preview

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

Potential nil pointer dereference. The function should check if withRevisions is nil before dereferencing it.

Suggested change
if *withRevisions {
modifiers = append(modifiers, connection.WithQuery("withRevisions", boolToString(*withRevisions)))
}
if *withData {
if withRevisions != nil && *withRevisions {
modifiers = append(modifiers, connection.WithQuery("withRevisions", boolToString(*withRevisions)))
}
if withData != nil && *withData {

Copilot uses AI. Check for mistakes.

Comment on lines 277 to 280
if *withRevisions {
modifiers = append(modifiers, connection.WithQuery("withRevisions", boolToString(*withRevisions)))
}
if *withData {
Copy link
Preview

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

Potential nil pointer dereference. The function should check if withData is nil before dereferencing it.

Suggested change
if *withRevisions {
modifiers = append(modifiers, connection.WithQuery("withRevisions", boolToString(*withRevisions)))
}
if *withData {
if withRevisions != nil && *withRevisions {
modifiers = append(modifiers, connection.WithQuery("withRevisions", boolToString(*withRevisions)))
}
if withData != nil && *withData {

Copilot uses AI. Check for mistakes.


result, err := col.Compact(ctx)
require.NoError(t, err)
fmt.Printf("Compacted Collection: %s, ID: %s, Status: %d\n", result.Name, result.ID, result.Status)
Copy link
Preview

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

Using fmt.Printf in tests is not recommended. Consider using t.Logf() instead for proper test logging.

Suggested change
fmt.Printf("Compacted Collection: %s, ID: %s, Status: %d\n", result.Name, result.ID, result.Status)
t.Logf("Compacted Collection: %s, ID: %s, Status: %d", result.Name, result.ID, result.Status)

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants