ClickHouse/src/Storages/StorageRedis.h

53 lines
1.3 KiB
C++
Raw Normal View History

2023-05-17 02:42:52 +00:00
#pragma once
#include <Poco/Redis/Redis.h>
#include <Storages/IStorage.h>
#include <Dictionaries/RedisSource.h>
namespace DB
{
/* Implements storage in the Redis.
2023-05-20 03:48:57 +00:00
* Use ENGINE = Redis(host:port, db_index, password, storage_type);
2023-05-17 02:42:52 +00:00
* Read only.
*/
class StorageRedis : public IStorage
{
public:
StorageRedis(
const StorageID & table_id_,
2023-05-20 03:48:57 +00:00
const RedisConfiguration & configuration_,
2023-05-17 02:42:52 +00:00
const ColumnsDescription & columns_,
const ConstraintsDescription & constraints_,
const String & comment_);
std::string getName() const override { return "Redis"; }
Pipe read(
const Names & column_names,
const StorageSnapshotPtr & storage_snapshot,
SelectQueryInfo & query_info,
ContextPtr context,
QueryProcessingStage::Enum processed_stage,
size_t max_block_size,
size_t num_streams) override;
SinkToStoragePtr write(
const ASTPtr & query,
const StorageMetadataPtr & /*metadata_snapshot*/,
ContextPtr context) override;
2023-05-20 03:48:57 +00:00
static RedisConfiguration getConfiguration(ASTs engine_args, ContextPtr context);
2023-05-17 02:42:52 +00:00
private:
StorageID table_id;
2023-05-20 03:48:57 +00:00
RedisConfiguration configuration;
2023-05-17 02:42:52 +00:00
ColumnsDescription columns;
ConstraintsDescription constraints;
2023-05-20 03:48:57 +00:00
String comment;
RedisPoolPtr pool;
2023-05-17 02:42:52 +00:00
};
}