commit 034c5fcd3ff57b5410bc0bbd47377a0a5f47618d
Author: German M. Bravo <german.mb@deipi.com>
Date: Wed Feb 3 16:41:14 2016 -0600
Added get_revision_info() public method to Database class.
This is to allow implementations to get a representation of the
internal description of the current revision of a database. This can
be used to implement replication and/or sinchronization protocols
among databases.
diff --git a/xapian-core/api/omdatabase.cc b/xapian-core/api/omdatabase.cc
index 876e3ee..1f6dfc4 100644
|
a
|
b
|
Database::get_uuid() const
|
| 750 | 750 | RETURN(uuid); |
| 751 | 751 | } |
| 752 | 752 | |
| | 753 | std::string |
| | 754 | Database::get_revision_info() const |
| | 755 | { |
| | 756 | LOGCALL(API, std::string, "Database::get_revision_info", NO_ARGS); |
| | 757 | string revision_info; |
| | 758 | for (size_t i = 0; i < internal.size(); ++i) { |
| | 759 | string sub_revision_info = internal[i]->get_revision_info(); |
| | 760 | // If any of the sub-databases have no revision_info, we can't make a revision_info for |
| | 761 | // the combined database. |
| | 762 | if (sub_revision_info.empty()) |
| | 763 | RETURN(sub_revision_info); |
| | 764 | if (!revision_info.empty()) revision_info += ':'; |
| | 765 | revision_info += sub_revision_info; |
| | 766 | } |
| | 767 | RETURN(revision_info); |
| | 768 | } |
| | 769 | |
| 753 | 770 | /////////////////////////////////////////////////////////////////////////// |
| 754 | 771 | |
| 755 | 772 | WritableDatabase::WritableDatabase() : Database() |
diff --git a/xapian-core/include/xapian/database.h b/xapian-core/include/xapian/database.h
index 4a6acfc..7119d6e 100644
|
a
|
b
|
class XAPIAN_VISIBILITY_DEFAULT Database {
|
| 481 | 481 | */ |
| 482 | 482 | std::string get_uuid() const; |
| 483 | 483 | |
| | 484 | /** Get the revision info for the database. |
| | 485 | * |
| | 486 | * The revision info is a string representation describing the current |
| | 487 | * revision of the database. |
| | 488 | */ |
| | 489 | std::string get_revision_info() const; |
| | 490 | |
| 484 | 491 | /** Check the integrity of a database or database table. |
| 485 | 492 | * |
| 486 | 493 | * @param path Path to database or table |