Permalink
Please sign in to comment.
Browse files
Replace ITermTable with ITermTable2
Also replaces TermInfo with RowIdSequence.
- Loading branch information...
Showing
with
2,440 additions
and 2,131 deletions.
- +1 −0 CMakeLists.txt
- +1 −0 inc/BitFunnel/IInterface.h
- +6 −1 inc/BitFunnel/Index/DocumentHandle.h
- +17 −10 inc/BitFunnel/Index/Factories.h
- +7 −1 inc/BitFunnel/Index/IIngestor.h
- +20 −5 inc/BitFunnel/Index/ISimpleIndex.h
- +43 −0 inc/BitFunnel/Index/ITermTableCollection.h
- +3 −0 src/Common/Utilities/src/ThreadManager.cpp
- +4 −4 src/Common/Utilities/src/ThreadManager.h
- +2 −0 src/Index/src/CMakeLists.txt
- +20 −43 src/Index/src/DocumentHandleInternal.cpp
- +31 −18 src/Index/src/Ingestor.cpp
- +7 −6 src/Index/src/Ingestor.h
- +22 −9 src/Index/src/RowTableDescriptor.cpp
- +6 −6 src/Index/src/RowTableDescriptor.h
- +81 −67 src/Index/src/Shard.cpp
- +10 −17 src/Index/src/Shard.h
- +64 −25 src/Index/src/SimpleIndex.cpp
- +13 −5 src/Index/src/SimpleIndex.h
- +20 −1 src/Index/src/TermTable.cpp
- +9 −0 src/Index/src/TermTableBuilder.cpp
- +86 −0 src/Index/src/TermTableCollection.cpp
- +49 −0 src/Index/src/TermTableCollection.h
- +1 −1 src/Index/test/CMakeLists.txt
- +413 −413 src/Index/test/DocumentHandleTest.cpp
- +310 −310 src/Index/test/IngestorTest.cpp
- +377 −375 src/Index/test/RowTableDescriptorTest.cpp
- +202 −202 src/Index/test/ShardTest.cpp
- +460 −460 src/Index/test/SliceTest.cpp
- +11 −4 src/Index/test/TermTableBuilderTest.cpp
- +26 −13 test/Shared/IndexUtils.cpp
- +29 −13 test/Shared/IndexUtils.h
- +55 −18 tools/IngestAndQuery/Commands.cpp
- +7 −0 tools/IngestAndQuery/Commands.h
- +8 −10 tools/IngestAndQuery/Environment.cpp
- +1 −0 tools/IngestAndQuery/Environment.h
- +18 −94 tools/StatisticsBuilder/main.cpp
1
CMakeLists.txt
1
inc/BitFunnel/IInterface.h
7
inc/BitFunnel/Index/DocumentHandle.h
27
inc/BitFunnel/Index/Factories.h
8
inc/BitFunnel/Index/IIngestor.h
25
inc/BitFunnel/Index/ISimpleIndex.h
43
inc/BitFunnel/Index/ITermTableCollection.h
| @@ -0,0 +1,43 @@ | ||
| +// The MIT License (MIT) | ||
| + | ||
| +// Copyright (c) 2016, Microsoft | ||
| + | ||
| +// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| +// of this software and associated documentation files (the "Software"), to deal | ||
| +// in the Software without restriction, including without limitation the rights | ||
| +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| +// copies of the Software, and to permit persons to whom the Software is | ||
| +// furnished to do so, subject to the following conditions: | ||
| + | ||
| +// The above copyright notice and this permission notice shall be included in | ||
| +// all copies or substantial portions of the Software. | ||
| + | ||
| +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| +// THE SOFTWARE. | ||
| + | ||
| +#pragma once | ||
| + | ||
| +#include <cstddef> // size_t return value. | ||
| + | ||
| +#include <BitFunnel/BitFunnelTypes.h> // ShardId parameter. | ||
| +#include <BitFunnel/IInterface.h> // Base class. | ||
| + | ||
| + | ||
| +namespace BitFunnel | ||
| +{ | ||
| + class ITermTable2; | ||
| + | ||
| + // IInterface is a base class for all interfaces in BitFunnel.Library. | ||
| + // Its sole purpose is to define an empty virtual destructor. | ||
| + class ITermTableCollection | ||
| + { | ||
| + public: | ||
| + virtual ITermTable2 & GetTermTable(ShardId shard) const = 0; | ||
| + virtual size_t size() const = 0; | ||
| + }; | ||
| +} |
3
src/Common/Utilities/src/ThreadManager.cpp
8
src/Common/Utilities/src/ThreadManager.h
2
src/Index/src/CMakeLists.txt
63
src/Index/src/DocumentHandleInternal.cpp
49
src/Index/src/Ingestor.cpp
13
src/Index/src/Ingestor.h
31
src/Index/src/RowTableDescriptor.cpp
12
src/Index/src/RowTableDescriptor.h
148
src/Index/src/Shard.cpp
27
src/Index/src/Shard.h
89
src/Index/src/SimpleIndex.cpp
18
src/Index/src/SimpleIndex.h
21
src/Index/src/TermTable.cpp
9
src/Index/src/TermTableBuilder.cpp
86
src/Index/src/TermTableCollection.cpp
| @@ -0,0 +1,86 @@ | ||
| +// The MIT License (MIT) | ||
| + | ||
| +// Copyright (c) 2016, Microsoft | ||
| + | ||
| +// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| +// of this software and associated documentation files (the "Software"), to deal | ||
| +// in the Software without restriction, including without limitation the rights | ||
| +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| +// copies of the Software, and to permit persons to whom the Software is | ||
| +// furnished to do so, subject to the following conditions: | ||
| + | ||
| +// The above copyright notice and this permission notice shall be included in | ||
| +// all copies or substantial portions of the Software. | ||
| + | ||
| +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| +// THE SOFTWARE. | ||
| + | ||
| +#include <istream> | ||
| + | ||
| +#include "BitFunnel/IFileManager.h" | ||
| +#include "BitFunnel/Index/Factories.h" | ||
| +#include "BitFunnel/ITermTable2.h" | ||
| +#include "TermTable.h" | ||
| +#include "TermTableCollection.h" | ||
| + | ||
| + | ||
| +namespace BitFunnel | ||
| +{ | ||
| + std::unique_ptr<ITermTableCollection> | ||
| + Factories::CreateTermTableCollection(ShardId shardCount) | ||
| + { | ||
| + return std::unique_ptr<ITermTableCollection>( | ||
| + new TermTableCollection(shardCount)); | ||
| + } | ||
| + | ||
| + | ||
| + std::unique_ptr<ITermTableCollection> | ||
| + Factories::CreateTermTableCollection(IFileManager & fileManager, ShardId shardCount) | ||
| + { | ||
| + return std::unique_ptr<ITermTableCollection>( | ||
| + new TermTableCollection(fileManager, shardCount)); | ||
| + } | ||
| + | ||
| + | ||
| + TermTableCollection::TermTableCollection(ShardId shardCount) | ||
| + { | ||
| + for (ShardId shard = 0; shard < shardCount; ++shard) | ||
| + { | ||
| + std::unique_ptr<ITermTable2> termTable(new TermTable()); | ||
| + | ||
| + // TermTable must be sealed before it can be used. | ||
| + termTable->Seal(); | ||
| + | ||
| + m_termTables.push_back(std::move(termTable)); | ||
| + } | ||
| + } | ||
| + | ||
| + | ||
| + TermTableCollection::TermTableCollection(IFileManager & fileManager, | ||
| + ShardId shardCount) | ||
| + { | ||
| + for (ShardId shard = 0; shard < shardCount; ++shard) | ||
| + { | ||
| + auto input = fileManager.TermTable(0).OpenForRead(); | ||
| + m_termTables.emplace_back( | ||
| + std::unique_ptr<ITermTable2>(new TermTable(*input))); | ||
| + } | ||
| + } | ||
| + | ||
| + | ||
| + ITermTable2 & TermTableCollection::GetTermTable(ShardId shard) const | ||
| + { | ||
| + return *m_termTables.at(shard); | ||
| + } | ||
| + | ||
| + | ||
| + size_t TermTableCollection::size() const | ||
| + { | ||
| + return m_termTables.size(); | ||
| + } | ||
| +} |
49
src/Index/src/TermTableCollection.h
| @@ -0,0 +1,49 @@ | ||
| +// The MIT License (MIT) | ||
| + | ||
| +// Copyright (c) 2016, Microsoft | ||
| + | ||
| +// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| +// of this software and associated documentation files (the "Software"), to deal | ||
| +// in the Software without restriction, including without limitation the rights | ||
| +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| +// copies of the Software, and to permit persons to whom the Software is | ||
| +// furnished to do so, subject to the following conditions: | ||
| + | ||
| +// The above copyright notice and this permission notice shall be included in | ||
| +// all copies or substantial portions of the Software. | ||
| + | ||
| +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| +// THE SOFTWARE. | ||
| + | ||
| +#pragma once | ||
| + | ||
| +#include <memory> // std::unique_ptr embedded. | ||
| +#include <vector> // std::vector embedded. | ||
| + | ||
| +#include "BitFunnel/BitFunnelTypes.h" // ShardId parameter. | ||
| +#include "BitFunnel/Index/ITermTableCollection.h" // Base class. | ||
| + | ||
| + | ||
| +namespace BitFunnel | ||
| +{ | ||
| + class IFileManager; | ||
| + class ITermTable2; | ||
| + | ||
| + class TermTableCollection : public ITermTableCollection | ||
| + { | ||
| + public: | ||
| + TermTableCollection(ShardId shardCount); | ||
| + TermTableCollection(IFileManager & fileManager, ShardId shardCount); | ||
| + | ||
| + virtual ITermTable2 & GetTermTable(ShardId shard) const override; | ||
| + virtual size_t size() const override; | ||
| + | ||
| + private: | ||
| + std::vector<std::unique_ptr<ITermTable2>> m_termTables; | ||
| + }; | ||
| +} |
2
src/Index/test/CMakeLists.txt
826
src/Index/test/DocumentHandleTest.cpp
620
src/Index/test/IngestorTest.cpp
752
src/Index/test/RowTableDescriptorTest.cpp
404
src/Index/test/ShardTest.cpp
920
src/Index/test/SliceTest.cpp
15
src/Index/test/TermTableBuilderTest.cpp
39
test/Shared/IndexUtils.cpp
42
test/Shared/IndexUtils.h
73
tools/IngestAndQuery/Commands.cpp
7
tools/IngestAndQuery/Commands.h
18
tools/IngestAndQuery/Environment.cpp
1
tools/IngestAndQuery/Environment.h
112
tools/StatisticsBuilder/main.cpp
0 comments on commit
a13fc71