Reimplement Database and WritableDatabase
commit145503bbe4a5bf702cd13cb2e592111e8d7ca89a
authorOlly Betts <olly@survex.com>
Thu, 5 Oct 2017 03:32:26 +0000 (5 16:32 +1300)
committerOlly Betts <olly@survex.com>
Wed, 25 Oct 2017 22:46:59 +0000 (26 11:46 +1300)
treea02a8914b0cb49a237e4125677ea1781aa717c72
parenta9071a40453af10a7bf0b42a028cc3d47fc7c02e
Reimplement Database and WritableDatabase

WritableDatabase::remove_spelling() now works more sensibly with shards
- it tries to remove the spelling from each shard until all of freqdec
has been dealt with, and now returns any "unused" freqdec.  To support
this for the remote backend, the remote protocol major version has been
bumped.

Database and WritableDatabase are now reference counted handles like
most other API classes - previously they worked like a typedef to
vector<shard> which makes copying and assignment O(#shards).  The
main observable difference is that if you add a shard to a copy,
it's now added to the original (which is consistent with other API
classes, e.g. adding a document to an RSet).

WritableDatabase has supported sharding since 1.3.2, but this is now
better documented.

Adding a read-only shard to a WritableDatabase is now statically
caught at compile time in simple cases, and if the static check is
bypassed then InvalidOperationError is thrown when you attempt a
WritableDatabase operation on that shard.  Previously such a shard acted
as a black hole which quietly accepted and ignored changes.

Operations on a database with a single shard should have a bit less
overhead.

Spelling correction with multiple shards should be faster.
71 files changed:
xapian-core/api/Makefile.mk
xapian-core/api/compactor.cc
xapian-core/api/database.cc [new file with mode: 0644]
xapian-core/api/enquireinternal.h
xapian-core/api/omdatabase.cc [deleted file]
xapian-core/api/postingsource.cc
xapian-core/api/replication.cc
xapian-core/api/valueiterator.cc
xapian-core/backends/Makefile.mk
xapian-core/backends/alltermslist.cc
xapian-core/backends/alltermslist.h
xapian-core/backends/contiguousalldocspostlist.h
xapian-core/backends/database.h [deleted file]
xapian-core/backends/databaseinternal.cc [moved from xapian-core/backends/database.cc with 58% similarity]
xapian-core/backends/databaseinternal.h [new file with mode: 0644]
xapian-core/backends/dbfactory.cc
xapian-core/backends/documentinternal.cc
xapian-core/backends/documentinternal.h
xapian-core/backends/empty_database.cc [new file with mode: 0644]
xapian-core/backends/empty_database.h [new file with mode: 0644]
xapian-core/backends/glass/glass_alltermslist.cc
xapian-core/backends/glass/glass_alltermslist.h
xapian-core/backends/glass/glass_compact.cc
xapian-core/backends/glass/glass_database.cc
xapian-core/backends/glass/glass_database.h
xapian-core/backends/glass/glass_document.h
xapian-core/backends/glass/glass_metadata.cc
xapian-core/backends/glass/glass_metadata.h
xapian-core/backends/glass/glass_spelling.cc
xapian-core/backends/glass/glass_spelling.h
xapian-core/backends/glass/glass_spellingwordslist.cc
xapian-core/backends/glass/glass_spellingwordslist.h
xapian-core/backends/glass/glass_synonym.cc
xapian-core/backends/glass/glass_synonym.h
xapian-core/backends/inmemory/inmemory_alltermslist.cc
xapian-core/backends/inmemory/inmemory_alltermslist.h
xapian-core/backends/inmemory/inmemory_database.cc
xapian-core/backends/inmemory/inmemory_database.h
xapian-core/backends/inmemory/inmemory_document.h
xapian-core/backends/multi/Makefile.mk
xapian-core/backends/multi/multi_alltermslist.cc
xapian-core/backends/multi/multi_alltermslist.h
xapian-core/backends/multi/multi_database.cc [new file with mode: 0644]
xapian-core/backends/multi/multi_database.h [new file with mode: 0644]
xapian-core/backends/multi/multi_postlist.cc
xapian-core/backends/multi/multi_postlist.h
xapian-core/backends/multi/multi_termlist.cc
xapian-core/backends/multi/multi_termlist.h
xapian-core/backends/multi/multi_valuelist.cc
xapian-core/backends/multi/multi_valuelist.h [moved from xapian-core/backends/multivaluelist.h with 73% similarity]
xapian-core/backends/remote/remote-database.cc
xapian-core/backends/remote/remote-database.h
xapian-core/backends/remote/remote-document.h
xapian-core/backends/slowvaluelist.h
xapian-core/common/remoteprotocol.h
xapian-core/expand/esetinternal.cc
xapian-core/expand/termlistmerger.h [new file with mode: 0644]
xapian-core/include/xapian/database.h
xapian-core/matcher/localsubmatch.cc
xapian-core/matcher/localsubmatch.h
xapian-core/matcher/multimatch.cc
xapian-core/matcher/queryoptimiser.h
xapian-core/matcher/remotesubmatch.cc
xapian-core/matcher/remotesubmatch.h
xapian-core/matcher/synonympostlist.h
xapian-core/matcher/valuerangepostlist.h
xapian-core/matcher/valuestreamdocument.cc
xapian-core/matcher/valuestreamdocument.h
xapian-core/net/remote_protocol.rst
xapian-core/net/remoteserver.cc
xapian-core/weight/weightinternal.h