dbms: remove const on IDictionary::getSource return type, add commentaries

This commit is contained in:
Andrey Mironov 2015-02-10 16:23:37 +03:00
parent ed3c230e5d
commit 176189a55e
2 changed files with 17 additions and 1 deletions

View File

@ -28,7 +28,7 @@ public:
virtual void reload() {} virtual void reload() {}
virtual DictionaryPtr clone() const = 0; virtual DictionaryPtr clone() const = 0;
virtual const IDictionarySource * const getSource() const = 0; virtual const IDictionarySource * getSource() const = 0;
virtual const DictionaryLifetime & getLifetime() const = 0; virtual const DictionaryLifetime & getLifetime() const = 0;

View File

@ -9,12 +9,28 @@ namespace DB
class IDictionarySource; class IDictionarySource;
using DictionarySourcePtr = std::unique_ptr<IDictionarySource>; using DictionarySourcePtr = std::unique_ptr<IDictionarySource>;
/** 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 class IDictionarySource
{ {
public: public:
/// returns an input stream with all the data available from this source
virtual BlockInputStreamPtr loadAll() = 0; 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; 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<std::uint64_t> ids) = 0; virtual BlockInputStreamPtr loadIds(const std::vector<std::uint64_t> ids) = 0;
/// indicates whether the source has been modified since last load* operation
virtual bool isModified() const = 0; virtual bool isModified() const = 0;
virtual DictionarySourcePtr clone() const = 0; virtual DictionarySourcePtr clone() const = 0;