Skip to content

Commit

Permalink
database: Remove unused DeleteOperationDoc method
Browse files Browse the repository at this point in the history
Operation documents have a limited time-to-live and are never
explicitly deleted.
  • Loading branch information
Matthew Barnes committed Feb 3, 2025
1 parent 5f4bb84 commit 5aca60c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
17 changes: 0 additions & 17 deletions internal/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ type DBClient interface {
GetOperationDoc(ctx context.Context, operationID string) (*OperationDocument, error)
CreateOperationDoc(ctx context.Context, doc *OperationDocument) error
UpdateOperationDoc(ctx context.Context, operationID string, callback func(*OperationDocument) bool) (bool, error)
DeleteOperationDoc(ctx context.Context, operationID string) error
ListOperationDocs(subscriptionID string) DBClientIterator[OperationDocument]
ListAllOperationDocs() DBClientIterator[OperationDocument]

Expand Down Expand Up @@ -405,22 +404,6 @@ func (d *CosmosDBClient) UpdateOperationDoc(ctx context.Context, operationID str
return false, err
}

// DeleteOperationDoc deletes the asynchronous operation document for the given
// operation ID from the "operations" container
func (d *CosmosDBClient) DeleteOperationDoc(ctx context.Context, operationID string) error {
// Make sure lookup keys are lowercase.
operationID = strings.ToLower(operationID)

pk := azcosmos.NewPartitionKeyString(operationsPartitionKey)

_, err := d.operations.DeleteItem(ctx, pk, operationID, nil)
if err != nil && !isResponseError(err, http.StatusNotFound) {
return fmt.Errorf("failed to delete Operations container item for '%s': %w", operationID, err)
}

return nil
}

func (d *CosmosDBClient) ListOperationDocs(subscriptionID string) DBClientIterator[OperationDocument] {
pk := azcosmos.NewPartitionKeyString(operationsPartitionKey)

Expand Down
14 changes: 0 additions & 14 deletions internal/mocks/dbclient.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5aca60c

Please sign in to comment.