aboutsummaryrefslogtreecommitdiffstats
path: root/persistence/src/vespa/persistence/spi/result.cpp
blob: 024f5595102ec2f34558fe21118a2c5c5e738bae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "result.h"
#include <vespa/document/fieldvalue/document.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <ostream>

namespace storage::spi {

Result::Result(const Result &) = default;
Result & Result::operator = (const Result &) = default;
Result::~Result() { }

vespalib::string
Result::toString() const {
    vespalib::asciistream os;
    os << "Result(" << static_cast<int>(_errorCode) << ", " << _errorMessage << ")";
    return os.str();
}

std::ostream &
operator << (std::ostream & os, const Result & r) {
    return os << r.toString();
}

std::ostream & operator << (std::ostream & os, const Result::ErrorType &errorCode) {
    return os << static_cast<int>(errorCode);
}

GetResult::GetResult(Document::UP doc, Timestamp timestamp)
    : Result(),
      _timestamp(timestamp),
      _doc(std::move(doc))
{ }

GetResult::~GetResult() { }
BucketIdListResult::~BucketIdListResult() { }

IterateResult::~IterateResult() { }

}