feat(storage): add SQLite search backend - #853
Draft
Fhatu12 wants to merge 1 commit into
Draft
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
@elliotxx Could you please help with the FOSSA License Compliance check for PR #853? It currently reports “4 issues found”, but the public GitHub status does not expose the individual findings. Could you please share the four issues from FOSSA, ideally including the affected component, detected licence, issue/policy type, and affected path? PR head: I want to make the smallest correct attribution, metadata, or dependency fix rather than guessing or suppressing the policy. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
sqlitethrough the existing search storage provider/factory/options/server config path.Architecture
pkg/infra/search/storage/sqlitepackage implementsSearchStorage,ResourceStorage,ResourceGroupRuleStorage, andGeneralStoragethrough oneStoragetype.SQLite Driver Rationale / CGO=0 Compatibility
modernc.org/sqlite v1.36.1, a pure-Godatabase/sqlSQLite driver.github.com/mattn/go-sqlite3because it requiresCGO_ENABLED=1and a C compiler, while Karpor defaults release builds toCGO_ENABLED=0.Search Safety Model
github.com/xwb1989/sqlparserdependency and compiled to SQLite SQL.Supported Query Semantics
SELECT ... FROM resources.WHERE,AND,OR, parentheses,=,!=,>,<,>=,<=,LIKE,NOT LIKE,IN,NOT IN,BETWEEN,NOT BETWEEN,contains(field, 'value'), ordering, and pagination.labels.<key>andannotations.<key>using safe JSON extraction.deleted=falsebehavior when a query does not explicitly referencedeleted.SearchByTermsandAggregateByTermsfor existing Karpor manager/topology paths.Configuration
--search-storage-type=sqlite--sqlite-dsn=<dsn>; defaults tofile:karpor-search.db?mode=rwcwhen omitted.Test Plan / Results
go test ./pkg/infra/search/storage/sqlite ./pkg/kubernetes/registry/search ./cmd/karpor/app/options ./pkg/core/manager/resourcegroup ./pkg/core/handler/resourcegroup ./pkg/core/handler/resourcegrouprulego test ./pkg/infra/search/storage/... ./pkg/kubernetes/registry/search ./cmd/karpor/app/optionsgo test ./cmd/karpor ./pkg/core/handler/search ./pkg/core/manager/resourcegroup ./pkg/util/sql2esCGO_ENABLED=0 go test ./pkg/infra/search/storage/sqliteCGO_ENABLED=0 go build ./cmd/karporgo test -race ./pkg/infra/search/storage/sqlitemake testPATH=/home/fhatu/go/bin:$PATH make lintwith golangci-lint v1.62.0SKIP_UI_BUILD=true make buildmake covertotal coverage: 64.8%; SQLite package coverage: 71.4%git diff --checkKnown Limitations
DSLPatternTypein this pass; it returns a clear unsupported-pattern error.karpor syncercommand still constructs Elasticsearch storage directly and remains a follow-up design surface.AI Assistance Disclosure
Fixes #230