dapr / components-contrib

Community driven, reusable components for distributed apps
Apache License 2.0
548 stars 480 forks source link

Added clickhouse state store #3598

Open middt opened 1 week ago

middt commented 1 week ago

Description

This PR adds a new state store component for ClickHouse, a column-oriented database management system. The ClickHouse state store component provides the following features:

Key implementation details:

Implementation Details

The component includes:

  1. State store implementation (clickhouse.go)

    • Full CRUD operations
    • Bulk operations
    • TTL support
    • ETag support
    • Authentication support
  2. Tests (clickhouse_test.go)

    • Integration tests for CRUD operations
    • Metadata validation tests
    • Authentication tests
    • Cleanup handling
  3. Configuration options:

    apiVersion: dapr.io/v1alpha1
    kind: Component
    metadata:
     name: statestore
     namespace: default
    spec:
     type: state.clickhouse
     version: v1
     metadata:
     - name: clickhouseURL
       value: "tcp://localhost:9000"
     - name: databaseName
       value: "dapr_state"
     - name: tableName
       value: "state_store"
     - name: username
       value: "default"
     - name: password
       value: ""

Checklist

Testing Done

  1. Unit tests for metadata validation
  2. Integration tests for:
    • Basic CRUD operations
    • TTL functionality
    • ETag support
    • Bulk operations
    • Authentication
    • Error handling

Tests were run against ClickHouse v23.8 using the official Go driver.

Additional Notes