Description
Extend the PipelineModel struct by implementing a new standalone method called BadgerDBDeletePipeline. To preserve backward compatibility and prevent breaking changes across the orchestration layer, do not change or delete the legacy etcd-based DeletePipeline implementation. This new method will introduce standalone support to remove a stored pipeline record directly from BadgerDB.
Requirements
- File Location:
internal/models/pipeline.go
- Method Signature Strategy: Introduce a new method named
BadgerDBDeletePipeline(name string) error on the PipelineModel struct.
- Transactionality: Execute both the existence verification and key deletion sequences within a single BadgerDB Update (write) transaction to guarantee state safety.
- Existence Verification & Error Handling: * Prior to running the deletion call, explicitly verify whether the key exists inside BadgerDB.
- If the key is not found (e.g., catching
badger.ErrKeyNotFound), immediately return the descriptive validation error: fmt.Errorf("pipeline not found") to match the exact query parity expected by the model handlers.
- Key Generation: Generate the target storage key using the standard format string:
/pipelines/{name}.
- Testing: Create a comprehensive unit test case inside
internal/models/pipeline_test.go to validate standalone key deletion, state cleanup verification, and missing item validation handling.
Success Criteria
Description
Extend the
PipelineModelstruct by implementing a new standalone method calledBadgerDBDeletePipeline. To preserve backward compatibility and prevent breaking changes across the orchestration layer, do not change or delete the legacy etcd-basedDeletePipelineimplementation. This new method will introduce standalone support to remove a stored pipeline record directly from BadgerDB.Requirements
internal/models/pipeline.goBadgerDBDeletePipeline(name string) erroron thePipelineModelstruct.badger.ErrKeyNotFound), immediately return the descriptive validation error:fmt.Errorf("pipeline not found")to match the exact query parity expected by the model handlers./pipelines/{name}.internal/models/pipeline_test.goto validate standalone key deletion, state cleanup verification, and missing item validation handling.Success Criteria
BadgerDBDeletePipelinemethod is added cleanly alongside legacy methods without breaking public structural boundaries.pipeline not foundvalidation error.BadgerDBDeletePipelinewith the corresponding configuration name.