From 176189a55e35efd781bb7a5f1b666750221d016f Mon Sep 17 00:00:00 2001 From: Andrey Mironov Date: Tue, 10 Feb 2015 16:23:37 +0300 Subject: [PATCH] dbms: remove const on IDictionary::getSource return type, add commentaries --- dbms/include/DB/Dictionaries/IDictionary.h | 2 +- dbms/include/DB/Dictionaries/IDictionarySource.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dbms/include/DB/Dictionaries/IDictionary.h b/dbms/include/DB/Dictionaries/IDictionary.h index 088c9901912..acba332d7eb 100644 --- a/dbms/include/DB/Dictionaries/IDictionary.h +++ b/dbms/include/DB/Dictionaries/IDictionary.h @@ -28,7 +28,7 @@ public: virtual void reload() {} virtual DictionaryPtr clone() const = 0; - virtual const IDictionarySource * const getSource() const = 0; + virtual const IDictionarySource * getSource() const = 0; virtual const DictionaryLifetime & getLifetime() const = 0; diff --git a/dbms/include/DB/Dictionaries/IDictionarySource.h b/dbms/include/DB/Dictionaries/IDictionarySource.h index 50404cc682c..3a0eea143db 100644 --- a/dbms/include/DB/Dictionaries/IDictionarySource.h +++ b/dbms/include/DB/Dictionaries/IDictionarySource.h @@ -9,12 +9,28 @@ namespace DB class IDictionarySource; using DictionarySourcePtr = std::unique_ptr; +/** Data-provider interface for external dictionaries, +* abstracts out the data source (file, MySQL, ClickHouse, external program, network request et cetera) +* from the presentation and memory layout (the dictionary itself). +*/ class IDictionarySource { public: + /// returns an input stream with all the data available from this source virtual BlockInputStreamPtr loadAll() = 0; + + /** Indicates whether this source supports "random access" loading of data + * loadId and loadIds can only be used if this function returns true. + */ + virtual bool supportsSelectiveLoad() const = 0; + + /// returns an input stream with the data for the requested identifier virtual BlockInputStreamPtr loadId(const std::uint64_t id) = 0; + + /// returns an input stream with the data for a collection of identifiers virtual BlockInputStreamPtr loadIds(const std::vector ids) = 0; + + /// indicates whether the source has been modified since last load* operation virtual bool isModified() const = 0; virtual DictionarySourcePtr clone() const = 0;