summaryrefslogtreecommitdiffstats
path: root/storage/src/tests/persistence/persistencetestutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'storage/src/tests/persistence/persistencetestutils.cpp')
-rw-r--r--storage/src/tests/persistence/persistencetestutils.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/storage/src/tests/persistence/persistencetestutils.cpp b/storage/src/tests/persistence/persistencetestutils.cpp
index d8da1a63e9e..0fd5a30d8bd 100644
--- a/storage/src/tests/persistence/persistencetestutils.cpp
+++ b/storage/src/tests/persistence/persistencetestutils.cpp
@@ -4,12 +4,14 @@
#include <vespa/storageapi/message/persistence.h>
#include <tests/persistence/persistencetestutils.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
+#include <vespa/persistence/spi/test.h>
#include <vespa/document/update/assignvalueupdate.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/exceptions.h>
using document::DocumentType;
using storage::framework::defaultimplementation::AllocationLogic;
+using storage::spi::test::makeBucket;
namespace storage {
@@ -78,7 +80,7 @@ PersistenceTestUtils::~PersistenceTestUtils()
std::string
PersistenceTestUtils::dumpBucket(const document::BucketId& bid,
uint16_t disk) {
- return dynamic_cast<spi::dummy::DummyPersistence&>(_env->_node.getPersistenceProvider()).dumpBucket(spi::Bucket(bid, spi::PartitionId(disk)));
+ return dynamic_cast<spi::dummy::DummyPersistence&>(_env->_node.getPersistenceProvider()).dumpBucket(makeBucket(bid, spi::PartitionId(disk)));
}
void
@@ -166,7 +168,7 @@ PersistenceTestUtils::doPutOnDisk(
{
document::Document::SP doc(createRandomDocumentAtLocation(
location, timestamp, minSize, maxSize));
- spi::Bucket b(document::BucketId(16, location), spi::PartitionId(disk));
+ spi::Bucket b(makeBucket(document::BucketId(16, location), spi::PartitionId(disk)));
spi::Context context(defaultLoadType, spi::Priority(0),
spi::Trace::TraceLevel(0));
@@ -190,12 +192,12 @@ PersistenceTestUtils::doRemoveOnDisk(
spi::Trace::TraceLevel(0));
if (persistRemove) {
spi::RemoveResult result = getPersistenceProvider().removeIfFound(
- spi::Bucket(bucketId, spi::PartitionId(disk)),
+ makeBucket(bucketId, spi::PartitionId(disk)),
timestamp, docId, context);
return result.wasFound();
}
spi::RemoveResult result = getPersistenceProvider().remove(
- spi::Bucket(bucketId, spi::PartitionId(disk)),
+ makeBucket(bucketId, spi::PartitionId(disk)),
timestamp, docId, context);
return result.wasFound();
@@ -211,7 +213,7 @@ PersistenceTestUtils::doUnrevertableRemoveOnDisk(
spi::Context context(defaultLoadType, spi::Priority(0),
spi::Trace::TraceLevel(0));
spi::RemoveResult result = getPersistenceProvider().remove(
- spi::Bucket(bucketId, spi::PartitionId(disk)),
+ makeBucket(bucketId, spi::PartitionId(disk)),
timestamp, docId, context);
return result.wasFound();
}
@@ -229,7 +231,7 @@ PersistenceTestUtils::doGetOnDisk(
if (headerOnly) {
fieldSet.reset(new document::HeaderFields());
}
- return getPersistenceProvider().get(spi::Bucket(
+ return getPersistenceProvider().get(makeBucket(
bucketId, spi::PartitionId(disk)), *fieldSet, docId, context);
}
@@ -305,7 +307,7 @@ PersistenceTestUtils::doPut(const document::Document::SP& doc,
spi::Timestamp time,
uint16_t disk)
{
- spi::Bucket b(bid, spi::PartitionId(disk));
+ spi::Bucket b(makeBucket(bid, spi::PartitionId(disk)));
spi::Context context(defaultLoadType, spi::Priority(0),
spi::Trace::TraceLevel(0));
getPersistenceProvider().createBucket(b, context);
@@ -321,7 +323,7 @@ PersistenceTestUtils::doUpdate(document::BucketId bid,
spi::Context context(defaultLoadType, spi::Priority(0),
spi::Trace::TraceLevel(0));
return getPersistenceProvider().update(
- spi::Bucket(bid, spi::PartitionId(disk)), time, update, context);
+ makeBucket(bid, spi::PartitionId(disk)), time, update, context);
}
void
@@ -337,10 +339,10 @@ PersistenceTestUtils::doRemove(const document::DocumentId& id, spi::Timestamp ti
spi::Trace::TraceLevel(0));
if (unrevertableRemove) {
getPersistenceProvider().remove(
- spi::Bucket(bucket, spi::PartitionId(disk)), time, id, context);
+ makeBucket(bucket, spi::PartitionId(disk)), time, id, context);
} else {
spi::RemoveResult result = getPersistenceProvider().removeIfFound(
- spi::Bucket(bucket, spi::PartitionId(disk)), time, id, context);
+ makeBucket(bucket, spi::PartitionId(disk)), time, id, context);
if (!result.wasFound()) {
throw vespalib::IllegalStateException(
"Attempted to remove non-existing doc " + id.toString(),