diff options
108 files changed, 455 insertions, 374 deletions
diff --git a/document/src/tests/documenttypetestcase.cpp b/document/src/tests/documenttypetestcase.cpp index 978592931ec..21b9ce69576 100644 --- a/document/src/tests/documenttypetestcase.cpp +++ b/document/src/tests/documenttypetestcase.cpp @@ -1,6 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> - #include <vespa/document/config/config-documenttypes.h> #include <vespa/document/datatype/documenttype.h> #include <vespa/document/fieldvalue/fieldvalues.h> @@ -8,9 +6,9 @@ #include <vespa/document/repo/documenttyperepo.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/testkit/test_kit.h> +#include <vespa/vespalib/util/exceptions.h> #include <sstream> -#include <string> using document::config_builder::Struct; using document::config_builder::Wset; diff --git a/document/src/tests/fieldvalue/document_test.cpp b/document/src/tests/fieldvalue/document_test.cpp index 51216c6d77a..b834b34706b 100644 --- a/document/src/tests/fieldvalue/document_test.cpp +++ b/document/src/tests/fieldvalue/document_test.cpp @@ -1,14 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. // Unit tests for document. -#include <vespa/log/log.h> -LOG_SETUP("document_test"); -#include <vespa/fastos/fastos.h> - #include <vespa/document/base/documentid.h> #include <vespa/document/base/testdocrepo.h> #include <vespa/document/fieldvalue/document.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/exceptions.h> using namespace document; diff --git a/document/src/tests/serialization/vespadocumentserializer_test.cpp b/document/src/tests/serialization/vespadocumentserializer_test.cpp index 723b9efadcf..7c534cd8efa 100644 --- a/document/src/tests/serialization/vespadocumentserializer_test.cpp +++ b/document/src/tests/serialization/vespadocumentserializer_test.cpp @@ -47,6 +47,7 @@ LOG_SETUP("vespadocumentserializer_test"); #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/document/base/exceptions.h> using document::DocumenttypesConfig; using vespalib::File; diff --git a/document/src/vespa/document/base/documentcalculator.cpp b/document/src/vespa/document/base/documentcalculator.cpp index 0d2ac7e81c5..89379dd4587 100644 --- a/document/src/vespa/document/base/documentcalculator.cpp +++ b/document/src/vespa/document/base/documentcalculator.cpp @@ -1,10 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> + #include <vespa/document/base/documentcalculator.h> #include <vespa/document/bucket/bucketidfactory.h> #include <vespa/document/select/compare.h> #include <vespa/document/select/parser.h> #include <vespa/document/select/valuenode.h> +#include <vespa/vespalib/util/exceptions.h> namespace document { diff --git a/document/src/vespa/document/base/idstring.h b/document/src/vespa/document/base/idstring.h index ec7ec3c6ecf..6cdb5f3df52 100644 --- a/document/src/vespa/document/base/idstring.h +++ b/document/src/vespa/document/base/idstring.h @@ -7,8 +7,6 @@ #pragma once -#include <vespa/fastos/fastos.h> -#include <memory> #include <vespa/vespalib/util/exception.h> #include <vespa/vespalib/util/memory.h> #include <vespa/vespalib/objects/cloneable.h> diff --git a/document/src/vespa/document/datatype/annotationreferencedatatype.cpp b/document/src/vespa/document/datatype/annotationreferencedatatype.cpp index 0da571bc4ee..2591cdbf37c 100644 --- a/document/src/vespa/document/datatype/annotationreferencedatatype.cpp +++ b/document/src/vespa/document/datatype/annotationreferencedatatype.cpp @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "annotationreferencedatatype.h" #include <vespa/document/fieldvalue/annotationreferencefieldvalue.h> +#include <ostream> using std::unique_ptr; using std::ostream; diff --git a/document/src/vespa/document/datatype/arraydatatype.cpp b/document/src/vespa/document/datatype/arraydatatype.cpp index 71fa6acd4b5..19233ec7d26 100644 --- a/document/src/vespa/document/datatype/arraydatatype.cpp +++ b/document/src/vespa/document/datatype/arraydatatype.cpp @@ -3,6 +3,7 @@ #include <vespa/document/datatype/arraydatatype.h> #include <vespa/document/fieldvalue/arrayfieldvalue.h> #include <vespa/vespalib/util/exceptions.h> +#include <ostream> namespace document { diff --git a/document/src/vespa/document/datatype/documenttype.cpp b/document/src/vespa/document/datatype/documenttype.cpp index 0a679d75e96..aa4877092ed 100644 --- a/document/src/vespa/document/datatype/documenttype.cpp +++ b/document/src/vespa/document/datatype/documenttype.cpp @@ -1,9 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/document/datatype/documenttype.h> - #include <vespa/document/fieldvalue/document.h> +#include <vespa/vespalib/util/exceptions.h> #include <iomanip> #include <vespa/log/log.h> diff --git a/document/src/vespa/document/datatype/mapdatatype.cpp b/document/src/vespa/document/datatype/mapdatatype.cpp index c56e72d1d71..1359cd7da85 100644 --- a/document/src/vespa/document/datatype/mapdatatype.cpp +++ b/document/src/vespa/document/datatype/mapdatatype.cpp @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/document/datatype/mapdatatype.h> - -#include <vespa/document/datatype/primitivedatatype.h> +#include "mapdatatype.h" +#include "primitivedatatype.h" #include <vespa/document/fieldvalue/mapfieldvalue.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <ostream> namespace document { diff --git a/document/src/vespa/document/datatype/primitivedatatype.cpp b/document/src/vespa/document/datatype/primitivedatatype.cpp index 3ac20b95b8d..821a22aad4a 100644 --- a/document/src/vespa/document/datatype/primitivedatatype.cpp +++ b/document/src/vespa/document/datatype/primitivedatatype.cpp @@ -1,9 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/document/datatype/primitivedatatype.h> - +#include "primitivedatatype.h" #include <vespa/document/fieldvalue/fieldvalues.h> +#include <vespa/vespalib/util/exceptions.h> #include <sstream> namespace document { diff --git a/document/src/vespa/document/datatype/weightedsetdatatype.cpp b/document/src/vespa/document/datatype/weightedsetdatatype.cpp index 87714221735..96dcca60976 100644 --- a/document/src/vespa/document/datatype/weightedsetdatatype.cpp +++ b/document/src/vespa/document/datatype/weightedsetdatatype.cpp @@ -1,11 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/document/datatype/weightedsetdatatype.h> +#include "weightedsetdatatype.h" -#include <vespa/document/datatype/primitivedatatype.h> +#include "primitivedatatype.h" #include <vespa/document/fieldvalue/weightedsetfieldvalue.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <ostream> namespace document { diff --git a/document/src/vespa/document/fieldvalue/annotationreferencefieldvalue.cpp b/document/src/vespa/document/fieldvalue/annotationreferencefieldvalue.cpp index 9493996b348..9863ee1c18a 100644 --- a/document/src/vespa/document/fieldvalue/annotationreferencefieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/annotationreferencefieldvalue.cpp @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "annotationreferencefieldvalue.h" +#include <ostream> using std::ostream; using std::string; diff --git a/document/src/vespa/document/fieldvalue/document.cpp b/document/src/vespa/document/fieldvalue/document.cpp index 86ca6e8a701..67134303586 100644 --- a/document/src/vespa/document/fieldvalue/document.cpp +++ b/document/src/vespa/document/fieldvalue/document.cpp @@ -13,6 +13,7 @@ #include <vespa/document/serialization/vespadocumentserializer.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/document/util/serializableexceptions.h> +#include <vespa/document/base/exceptions.h> #include <sstream> using vespalib::nbostream; diff --git a/document/src/vespa/document/fieldvalue/serializablearray.h b/document/src/vespa/document/fieldvalue/serializablearray.h index b92737b0c7c..9c0978f1476 100644 --- a/document/src/vespa/document/fieldvalue/serializablearray.h +++ b/document/src/vespa/document/fieldvalue/serializablearray.h @@ -24,6 +24,7 @@ #include <vespa/vespalib/objects/cloneable.h> #include <vespa/vespalib/stllike/hash_map.h> #include <vespa/vespalib/util/buffer.h> +#include <vespa/fastos/dynamiclibrary.h> namespace document { diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp index ab5d42868a7..3dac3123bd0 100644 --- a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/document/fieldvalue/structfieldvalue.h> + +#include "structfieldvalue.h" #include "fieldvaluewriter.h" -#include <vespa/document/fieldvalue/document.h> +#include "document.h" #include <vespa/document/repo/fixedtyperepo.h> #include <vespa/document/serialization/vespadocumentdeserializer.h> #include <vespa/document/fieldset/fieldsets.h> @@ -11,6 +11,7 @@ #include <vespa/document/datatype/positiondatatype.h> #include <vespa/vespalib/util/vstringfmt.h> #include <vespa/document/util/serializableexceptions.h> +#include <vespa/document/base/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".document.structfieldvalue"); diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.h b/document/src/vespa/document/fieldvalue/structfieldvalue.h index 444862c3b89..da29051b6a9 100644 --- a/document/src/vespa/document/fieldvalue/structfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/structfieldvalue.h @@ -9,7 +9,6 @@ // Not strictly needed to include exceptions.h, but to avoid clients needing // to to catch FieldNotFoundException -#include <vespa/document/base/exceptions.h> #include <vespa/document/datatype/structdatatype.h> #include <vespa/document/fieldvalue/structuredfieldvalue.h> #include <vespa/document/util/compressionconfig.h> diff --git a/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp b/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp index 97f46a64980..cf98399d7f8 100644 --- a/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "tensorfieldvalue.h" #include <vespa/vespalib/tensor/tensor.h> +#include <ostream> using vespalib::tensor::Tensor; diff --git a/document/src/vespa/document/select/resultlist.cpp b/document/src/vespa/document/select/resultlist.cpp index 4f630f54863..e0c8de26eb3 100644 --- a/document/src/vespa/document/select/resultlist.cpp +++ b/document/src/vespa/document/select/resultlist.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> + #include "resultlist.h" +#include <ostream> namespace document { namespace select { diff --git a/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp b/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp index 26a7e40ff95..aa4aabb8350 100644 --- a/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp +++ b/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp @@ -30,6 +30,7 @@ #include <vespa/vespalib/tensor/tensor.h> #include <vespa/vespalib/tensor/serialization/typed_binary_format.h> #include <vespa/document/util/serializableexceptions.h> +#include <vespa/document/base/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".vespadocumentdeserializer"); diff --git a/document/src/vespa/document/update/addfieldpathupdate.cpp b/document/src/vespa/document/update/addfieldpathupdate.cpp index 2d0855a44c2..be1a5e0855c 100644 --- a/document/src/vespa/document/update/addfieldpathupdate.cpp +++ b/document/src/vespa/document/update/addfieldpathupdate.cpp @@ -1,12 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> + #include <vespa/document/fieldvalue/fieldvalues.h> #include <vespa/document/repo/fixedtyperepo.h> #include <vespa/document/select/parser.h> #include <vespa/document/serialization/vespadocumentdeserializer.h> #include <vespa/document/update/addfieldpathupdate.h> -#include <vespa/log/log.h> #include <vespa/vespalib/objects/nbostream.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> using vespalib::nbostream; diff --git a/document/src/vespa/document/update/arithmeticvalueupdate.cpp b/document/src/vespa/document/update/arithmeticvalueupdate.cpp index 78614b4bc28..29c24e7140f 100644 --- a/document/src/vespa/document/update/arithmeticvalueupdate.cpp +++ b/document/src/vespa/document/update/arithmeticvalueupdate.cpp @@ -2,6 +2,7 @@ #include "arithmeticvalueupdate.h" #include <vespa/document/base/field.h> #include <vespa/document/fieldvalue/fieldvalues.h> +#include <vespa/vespalib/util/exceptions.h> using vespalib::IllegalArgumentException; using vespalib::IllegalStateException; diff --git a/document/src/vespa/document/update/assignfieldpathupdate.cpp b/document/src/vespa/document/update/assignfieldpathupdate.cpp index a17bb6b83ed..a5ca977003c 100644 --- a/document/src/vespa/document/update/assignfieldpathupdate.cpp +++ b/document/src/vespa/document/update/assignfieldpathupdate.cpp @@ -5,6 +5,7 @@ #include <vespa/document/serialization/vespadocumentdeserializer.h> #include <vespa/document/update/assignfieldpathupdate.h> #include <vespa/vespalib/objects/nbostream.h> +#include <vespa/vespalib/util/exceptions.h> #include <boost/numeric/conversion/cast.hpp> #include <vespa/log/log.h> diff --git a/document/src/vespa/document/update/assignvalueupdate.cpp b/document/src/vespa/document/update/assignvalueupdate.cpp index b389f015eb0..dcadcbf279b 100644 --- a/document/src/vespa/document/update/assignvalueupdate.cpp +++ b/document/src/vespa/document/update/assignvalueupdate.cpp @@ -1,11 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> + #include <vespa/document/base/field.h> #include <vespa/document/fieldvalue/fieldvalues.h> #include <vespa/document/repo/fixedtyperepo.h> #include <vespa/document/serialization/vespadocumentdeserializer.h> #include <vespa/document/update/assignvalueupdate.h> #include <vespa/vespalib/objects/nbostream.h> +#include <vespa/vespalib/util/exceptions.h> using vespalib::IllegalArgumentException; using vespalib::IllegalStateException; diff --git a/document/src/vespa/document/update/clearvalueupdate.cpp b/document/src/vespa/document/update/clearvalueupdate.cpp index 0b062e6bd92..13143e004ee 100644 --- a/document/src/vespa/document/update/clearvalueupdate.cpp +++ b/document/src/vespa/document/update/clearvalueupdate.cpp @@ -1,8 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> + #include <vespa/document/base/field.h> #include <vespa/document/update/clearvalueupdate.h> #include <vespa/document/fieldvalue/document.h> +#include <vespa/vespalib/util/exceptions.h> using vespalib::IllegalArgumentException; using vespalib::IllegalStateException; diff --git a/document/src/vespa/document/update/documentupdate.cpp b/document/src/vespa/document/update/documentupdate.cpp index df4410ce2eb..584616f49dd 100644 --- a/document/src/vespa/document/update/documentupdate.cpp +++ b/document/src/vespa/document/update/documentupdate.cpp @@ -12,6 +12,7 @@ #include <vespa/document/util/serializableexceptions.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/document/util/bufferexceptions.h> +#include <vespa/document/base/exceptions.h> using vespalib::IllegalArgumentException; using vespalib::IllegalStateException; diff --git a/document/src/vespa/document/util/compressor.h b/document/src/vespa/document/util/compressor.h index e4650709b96..cf3e831faa3 100644 --- a/document/src/vespa/document/util/compressor.h +++ b/document/src/vespa/document/util/compressor.h @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/fastos/fastos.h> #include <vespa/document/util/compressionconfig.h> #include <vespa/vespalib/data/databuffer.h> #include <vespa/vespalib/util/buffer.h> diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.cpp b/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.cpp index 58cda975336..bece134f33b 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.cpp @@ -1,7 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/documentapi/messagebus/messages/multioperationmessage.h> + +#include "multioperationmessage.h" #include <vespa/vdslib/container/mutabledocumentlist.h> +#include <vespa/vespalib/util/exceptions.h> namespace documentapi { diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp index 284ec714e82..3caa19f240a 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/documentapi/messagebus/policies/storagepolicy.h> -#include <vespa/log/log.h> + +#include "storagepolicy.h" #include <algorithm> #include <vespa/document/base/documentid.h> #include <vespa/messagebus/emptyreply.h> @@ -12,6 +11,8 @@ #include <vespa/vespalib/util/random.h> #include <vespa/documentapi/documentapi.h> #include <vespa/documentapi/messagebus/documentprotocol.h> +#include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/log/log.h> LOG_SETUP(".storagepolicy"); diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/environment.cpp b/memfilepersistence/src/vespa/memfilepersistence/common/environment.cpp index 6cfe2269886..5afc70179b4 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/common/environment.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/common/environment.cpp @@ -1,10 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/memfilepersistence/common/environment.h> + +#include "environment.h" #include <vespa/vespalib/util/random.h> #include <vespa/vespalib/util/vstringfmt.h> #include <vespa/config/config.h> +#include <vespa/vespalib/stllike/asciistream.h> using config::ConfigGetter; diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.cpp b/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.cpp index b3e90d53bb1..6b11d2e479d 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.cpp @@ -1,7 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/memfilepersistence/common/filespecification.h> + +#include "filespecification.h" +#include <vespa/vespalib/util/exceptions.h> namespace storage { namespace memfile { diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/types.cpp b/memfilepersistence/src/vespa/memfilepersistence/common/types.cpp index 75e1217e680..f02423cb194 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/common/types.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/common/types.cpp @@ -2,6 +2,7 @@ #include "types.h" #include <sstream> +#include <vespa/vespalib/util/exceptions.h> namespace storage { namespace memfile { diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/types.h b/memfilepersistence/src/vespa/memfilepersistence/common/types.h index 71a9b411e6c..283eb1153f4 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/common/types.h +++ b/memfilepersistence/src/vespa/memfilepersistence/common/types.h @@ -15,7 +15,6 @@ */ #pragma once -#include <iosfwd> #include <vespa/document/bucket/bucketid.h> #include <vespa/document/base/documentid.h> #include <vespa/document/fieldvalue/document.h> diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/fileinfo.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/fileinfo.cpp index 8d577c8093a..9d15890b1ab 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/fileinfo.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/fileinfo.cpp @@ -1,11 +1,47 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "fileinfo.h" -#include <sstream> +#include <vespa/vespalib/stllike/asciistream.h> namespace storage { namespace memfile { +void +MetaSlot::print(std::ostream & out) const { + vespalib::asciistream tmp; + print(tmp); + out << tmp.str(); +} + +void +MetaSlot::print(vespalib::asciistream & out) const { + out << "Slot(" << std::dec << _timestamp << ", " << _gid << ", " + << _headerPos << " - " << _headerSize << ", " << _bodyPos + << " - " << _bodySize << ", 0x" << std::hex << _flags << ", 0x" + << _checksum << ")" << std::dec; +} + +std::ostream& operator<<(std::ostream& out, const MetaSlot& slot) { + vespalib::asciistream tmp; + slot.print(tmp); + return out << tmp.str(); +} +vespalib::asciistream& operator<<(vespalib::asciistream & out, const MetaSlot& slot) { + slot.print(out); return out; +} + +void +Header::print(std::ostream& out, const std::string& indent) const { + out << indent << "SlotFileHeader(\n" + << indent << " version: " << std::hex << _version << std::dec << "\n" + << indent << " meta data list size: " << _metaDataListSize << "\n" + << indent << " header block size: " << _headerBlockSize << "b\n" + << indent << " checksum: " << std::hex << _checksum + << indent << (verify() ? " (OK)\n" : " (MISMATCH)\n") + << indent << " file checksum: " << _fileChecksum << "\n" + << indent << ")"; +} + FileInfo::FileInfo() : _metaDataListSize(0), _headerBlockSize(0), @@ -29,6 +65,8 @@ FileInfo::FileInfo(const Header& header, size_t fileSize) - sizeof(MetaSlot) * header._metaDataListSize - sizeof(Header)) { } +FileInfo::~FileInfo() { } + uint32_t FileInfo::getHeaderBlockStartIndex() const { diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/fileinfo.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/fileinfo.h index 973e1f2cd10..2db17f3846c 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/fileinfo.h +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/fileinfo.h @@ -37,17 +37,8 @@ struct MetaSlot : private Types { return (_flags & IN_USE); } - void print(std::ostream & out) const { - vespalib::asciistream tmp; - print(tmp); - out << tmp.str(); - } - void print(vespalib::asciistream & out) const { - out << "Slot(" << std::dec << _timestamp << ", " << _gid << ", " - << _headerPos << " - " << _headerSize << ", " << _bodyPos - << " - " << _bodySize << ", 0x" << std::hex << _flags << ", 0x" - << _checksum << ")" << std::dec; - } + void print(std::ostream & out) const; + void print(vespalib::asciistream & out) const; // Functions used by unit tests (avoid renaming all old func usage) void updateChecksum() { _checksum = calcSlotChecksum(); } @@ -60,14 +51,8 @@ struct MetaSlot : private Types { { _flags = (isInUse ? _flags | IN_USE : _flags & ~IN_USE); } }; -inline std::ostream& operator<<(std::ostream& out, const MetaSlot& slot) { - vespalib::asciistream tmp; - slot.print(tmp); - return out << tmp.str(); -} -inline vespalib::asciistream& operator<<(vespalib::asciistream & out, const MetaSlot& slot) { - slot.print(out); return out; -} +std::ostream& operator<<(std::ostream& out, const MetaSlot& slot); +vespalib::asciistream& operator<<(vespalib::asciistream & out, const MetaSlot& slot); /** * Represents a slotfile header. @@ -111,16 +96,7 @@ struct Header { void setMetaDataListSize(uint32_t sz) { _metaDataListSize = sz; } void setHeaderBlockSize(uint32_t sz) { _headerBlockSize = sz; } - void print(std::ostream& out, const std::string& indent = "") const { - out << indent << "SlotFileHeader(\n" - << indent << " version: " << std::hex << _version << std::dec << "\n" - << indent << " meta data list size: " << _metaDataListSize << "\n" - << indent << " header block size: " << _headerBlockSize << "b\n" - << indent << " checksum: " << std::hex << _checksum - << indent << (verify() ? " (OK)\n" : " (MISMATCH)\n") - << indent << " file checksum: " << _fileChecksum << "\n" - << indent << ")"; - } + void print(std::ostream& out, const std::string& indent = "") const; }; struct FileInfo { @@ -137,6 +113,7 @@ struct FileInfo { FileInfo(); FileInfo(uint32_t metaDataListSize, uint32_t headerBlockSize, uint32_t bodyBlockSize); FileInfo(const Header& header, size_t fileSize); + ~FileInfo(); uint32_t getBlockSize(Types::DocumentPart part) const { return (part == Types::BODY ? _bodyBlockSize : _headerBlockSize); diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.cpp index 2c683059fa5..66e263a88cf 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.cpp @@ -1,15 +1,17 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -#include <vespa/memfilepersistence/mapper/memfile_v1_serializer.h> -#include <vespa/memfilepersistence/mapper/memfile_v1_verifier.h> + +#include "memfile_v1_serializer.h" +#include "memfile_v1_verifier.h" + +#include "memfilemapper.h" +#include "locationreadplanner.h" +#include "uniqueslotgenerator.h" +#include "simplememfileiobuffer.h" #include <vespa/memfilepersistence/common/exceptions.h> -#include <vespa/memfilepersistence/mapper/memfilemapper.h> -#include <vespa/memfilepersistence/mapper/locationreadplanner.h> -#include <vespa/memfilepersistence/mapper/uniqueslotgenerator.h> -#include <vespa/memfilepersistence/mapper/simplememfileiobuffer.h> #include <vespa/memfilepersistence/spi/memfilepersistenceprovidermetrics.h> #include <vespa/vespalib/util/crc.h> +#include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/log/log.h> LOG_SETUP(".persistence.memfilev1"); diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_verifier.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_verifier.cpp index a3f22d5fafb..96295cd560b 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_verifier.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_verifier.cpp @@ -1,10 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/memfilepersistence/mapper/memfile_v1_verifier.h> + +#include "memfile_v1_verifier.h" +#include "memfilemapper.h" +#include "simplememfileiobuffer.h" +#include "buffer.h" #include <vespa/memfilepersistence/memfile/memfile.h> -#include <vespa/memfilepersistence/mapper/memfilemapper.h> -#include <vespa/memfilepersistence/mapper/simplememfileiobuffer.h> -#include <vespa/memfilepersistence/mapper/buffer.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/log/log.h> LOG_SETUP(".persistence.memfilev1.verifier"); @@ -21,8 +22,7 @@ void alignUp(uint32_t& value, uint32_t offset = 0, uint32_t block = 512) { } struct TimestampSlotOrder - : public std::binary_function<MetaSlot*, - MetaSlot*, bool> + : public std::binary_function<MetaSlot*, MetaSlot*, bool> { bool operator()(const MetaSlot* slot1, const MetaSlot* slot2) const diff --git a/metrics/src/vespa/metrics/metricsnapshot.cpp b/metrics/src/vespa/metrics/metricsnapshot.cpp index 2cb10ac2dbf..e8a50419751 100644 --- a/metrics/src/vespa/metrics/metricsnapshot.cpp +++ b/metrics/src/vespa/metrics/metricsnapshot.cpp @@ -1,8 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/metrics/metricsnapshot.h> - +#include "metricsnapshot.h" +#include "metricmanager.h" #include <vespa/log/log.h> -#include <vespa/metrics/metricmanager.h> LOG_SETUP(".metrics.snapshot"); @@ -115,7 +114,7 @@ MetricSnapshotSet::timeForAnotherSnapshot(time_t currentTime) { LOG(warning, "Metric snapshot set %s was asked if it was time for " "another snapshot, a whole period beyond when it " "should have been done (Last update was at time %" - PRIu64 ", current time is %" PRIu64" and period is %u). " + PRIu64 ", current time is %" PRIu64 " and period is %u). " "Clearing data and updating time to current time.", getName().c_str(), lastTime, currentTime, getPeriod()); reset(currentTime); diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp index fcfd8299ac1..c088026bc78 100644 --- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp +++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp @@ -6,11 +6,11 @@ #include <vespa/document/base/documentid.h> #include <vespa/document/fieldvalue/document.h> #include <vespa/vespalib/util/crc.h> -#include <vespa/vespalib/util/atomic.h> #include <vespa/vespalib/util/vstringfmt.h> #include <vespa/document/fieldset/fieldsetrepo.h> #include <vespa/vespalib/stllike/hash_set.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> using std::binary_search; diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp index 4d3109c8142..168bb7cefad 100644 --- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("feedhandler_test"); + #include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/documentapi/messagebus/messages/documentreply.h> #include <vespa/documentapi/messagebus/messages/removedocumentreply.h> @@ -23,6 +21,9 @@ LOG_SETUP("feedhandler_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP("feedhandler_test"); using document::BucketId; using document::Document; diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/search_path.cpp b/searchcore/src/vespa/searchcore/fdispatch/search/search_path.cpp index b8e0417678e..67491cc9ff7 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/search_path.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/search/search_path.cpp @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".fdispatch.search_path"); #include "search_path.h" +#include <vespa/vespalib/stllike/asciistream.h> -#include <iostream> +#include <vespa/log/log.h> +LOG_SETUP(".fdispatch.search_path"); namespace fdispatch { diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/search_path.h b/searchcore/src/vespa/searchcore/fdispatch/search/search_path.h index 706bb1bc1b9..7ed5dfd5b71 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/search_path.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/search_path.h @@ -2,10 +2,11 @@ #pragma once -#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/stllike/string.h> #include <set> - +namespace vespalib { + class asciistream; +} namespace fdispatch { class SearchPath diff --git a/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp b/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp index 74a6d97366d..0995c1f4b68 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "document_field_retriever.h" #include <vespa/document/fieldvalue/arrayfieldvalue.h> #include <vespa/document/fieldvalue/weightedsetfieldvalue.h> @@ -8,6 +7,7 @@ #include <vespa/searchcommon/attribute/attributecontent.h> #include <vespa/searchlib/tensor/tensor_attribute.h> #include <vespa/vespalib/tensor/tensor.h> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".proton.attribute.document_field_retriever"); diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summaryfieldconverter.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summaryfieldconverter.cpp index 58839cd7f04..0c4d739be79 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summaryfieldconverter.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summaryfieldconverter.cpp @@ -1,11 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.docsummary.summaryfieldconverter"); - #include "summaryfieldconverter.h" - #include "linguisticsannotation.h" #include "searchdatatype.h" #include <vespa/document/annotation/alternatespanlist.h> @@ -48,6 +43,7 @@ LOG_SETUP(".proton.docsummary.summaryfieldconverter"); #include <vespa/vespalib/data/slime/json_format.h> #include <vespa/vespalib/tensor/serialization/slime_binary_format.h> #include <vespa/searchlib/util/slime_output_raw_buf_adapter.h> +#include <vespa/vespalib/util/exceptions.h> using document::AlternateSpanList; diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.cpp index 23edd50006b..a82535c9e97 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.cpp @@ -1,10 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.metrics.legacy_documentdb_metrics"); #include "legacy_documentdb_metrics.h" #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/vespalib/util/exceptions.h> using vespalib::asciistream; using vespalib::make_string; @@ -19,23 +17,17 @@ LegacyDocumentDBMetrics::IndexMetrics::IndexMetrics(MetricSet *parent) memoryUsage("memoryusage", "", "Memory usage for memory indexes", this), docsInMemory("docsinmemory", "", "Number of documents in memory", this), diskUsage("diskusage", "", "Disk usage for disk indexes", this) -{ -} +{ } LegacyDocumentDBMetrics::DocstoreMetrics::DocstoreMetrics(MetricSet *parent) : MetricSet("docstore", "", "Document store metrics", parent), memoryUsage("memoryusage", "", "Memory usage for docstore", this), - cacheLookups("cachelookups", "", "Number of lookups in summary cache", - this), + cacheLookups("cachelookups", "", "Number of lookups in summary cache", this), hits(0), - cacheHitRate("cachehitrate", "", "Rate of cache hits in summary cache", - this), - cacheElements("cacheelements", "", "Number of elements in summary cache", - this), - cacheMemoryUsed("cachememoryused", "", "Memory used by summary cache", - this) -{ -} + cacheHitRate("cachehitrate", "", "Rate of cache hits in summary cache", this), + cacheElements("cacheelements", "", "Number of elements in summary cache", this), + cacheMemoryUsed("cachememoryused", "", "Memory used by summary cache", this) +{ } void LegacyDocumentDBMetrics::MatchingMetrics::update(const MatchingStats &stats) @@ -54,13 +46,11 @@ LegacyDocumentDBMetrics::MatchingMetrics::MatchingMetrics(MetricSet *parent) : MetricSet("matching", "", "Matching metrics", parent), docsMatched("docsmatched", "", "Number of documents matched", this), docsRanked("docsranked", "", "Number of documents ranked (first phase)", this), - docsReRanked("docsreranked", "", - "Number of documents re-ranked (second phase)", this), + docsReRanked("docsreranked", "", "Number of documents re-ranked (second phase)", this), queries("queries", "", "Number of queries executed", this), queryCollateralTime("querycollateraltime", "", "Average time spent setting up and tearing down queries", this), queryLatency("querylatency", "", "Average latency when matching a query", this) -{ -} +{ } LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::RankProfileMetrics( const std::string &name, size_t numDocIdPartitions, MetricSet *parent) @@ -81,12 +71,10 @@ LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::Do MetricSet(name, "", "DocId Partition profile metrics", parent), docsMatched("docsmatched", "", "Number of documents matched", this), docsRanked("docsranked", "", "Number of documents ranked (first phase)", this), - docsReRanked("docsreranked", "", - "Number of documents re-ranked (second phase)", this), + docsReRanked("docsreranked", "", "Number of documents re-ranked (second phase)", this), active_time("activetime", "", "Time spent doing actual work", this), wait_time("waittime", "", "Time spent waiting for other external threads and resources", this) -{ -} +{ } void LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::update(const MatchingStats::Partition &stats) @@ -104,8 +92,7 @@ LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::update(const Match queries.inc(stats.queries()); limited_queries.inc(stats.limited_queries()); matchTime.addValueBatch(stats.matchTimeAvg(), stats.matchTimeCount()); - groupingTime.addValueBatch(stats.groupingTimeAvg(), - stats.groupingTimeCount()); + groupingTime.addValueBatch(stats.groupingTimeAvg(), stats.groupingTimeCount()); rerankTime.addValueBatch(stats.rerankTimeAvg(), stats.rerankTimeCount()); if (stats.getNumPartitions() > 0) { if (stats.getNumPartitions() <= partitions.size()) { @@ -116,8 +103,7 @@ LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::update(const Match } } else { vespalib::string msg(make_string("Num partitions used '%ld' is larger than number of partitions '%ld' configured.", - stats.getNumPartitions(), - partitions.size())); + stats.getNumPartitions(), partitions.size())); throw vespalib::IllegalStateException(msg, VESPA_STRLOC); } } @@ -138,13 +124,11 @@ DocumentMetaStoreMetrics(MetricSet *parent) { } -LegacyDocumentDBMetrics::SubDBMetrics::SubDBMetrics(const vespalib::string &name, - MetricSet *parent) +LegacyDocumentDBMetrics::SubDBMetrics::SubDBMetrics(const vespalib::string &name, MetricSet *parent) : MetricSet(name, "", "Sub database metrics", parent), attributes(this), docMetaStore(this) -{ -} +{ } LegacyDocumentDBMetrics::LegacyDocumentDBMetrics(const std::string &docTypeName, size_t maxNumThreads) : MetricSet(make_string("%s", docTypeName.c_str()), "", "Document DB Metrics", 0), @@ -159,20 +143,13 @@ LegacyDocumentDBMetrics::LegacyDocumentDBMetrics(const std::string &docTypeName, ready("ready", this), notReady("notready", this), removed("removed", this), - memoryUsage("memoryusage", "", "Memory usage for this Document DB", - this), - numDocs("numdocs", "", - "Number of ready/indexed documents in this Document DB (aka number of documents in the 'ready' sub db)", this), - numActiveDocs("numactivedocs", "", - "Number of active/searchable documents in this Document DB (aka number of active/searchable documents in the 'ready' sub db)", this), - numIndexedDocs("numindexeddocs", "", - "Number of ready/indexed documents in this Document DB (aka number of documents in the 'ready' sub db)", this), - numStoredDocs("numstoreddocs", "", - "Total number of documents stored in this Document DB (aka number of documents in the 'ready' and 'notready' sub dbs)", this), - numRemovedDocs("numremoveddocs", "", - "Number of removed documents in this Document DB (aka number of documents in the 'removed' sub db)", this), - numBadConfigs("numBadConfigs", "", - "Number of bad configs for this Document DB", this), + memoryUsage("memoryusage", "", "Memory usage for this Document DB", this), + numDocs("numdocs", "", "Number of ready/indexed documents in this Document DB (aka number of documents in the 'ready' sub db)", this), + numActiveDocs("numactivedocs", "", "Number of active/searchable documents in this Document DB (aka number of active/searchable documents in the 'ready' sub db)", this), + numIndexedDocs("numindexeddocs", "", "Number of ready/indexed documents in this Document DB (aka number of documents in the 'ready' sub db)", this), + numStoredDocs("numstoreddocs", "", "Total number of documents stored in this Document DB (aka number of documents in the 'ready' and 'notready' sub dbs)", this), + numRemovedDocs("numremoveddocs", "", "Number of removed documents in this Document DB (aka number of documents in the 'removed' sub db)", this), + numBadConfigs("numBadConfigs", "", "Number of bad configs for this Document DB", this), _maxNumThreads(maxNumThreads) { memoryUsage.addMetricToSum(index.memoryUsage); diff --git a/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h b/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h index b7deb914a00..e8aeb44df3d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h +++ b/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h @@ -4,6 +4,7 @@ #include <vespa/vespalib/stllike/string.h> #include <vector> #include <vespa/searchcore/proton/attribute/attribute_usage_filter_config.h> +#include <vespa/fastos/timestamp.h> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 8abf03ecb94..da691169001 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -13,7 +13,6 @@ #include "searchcontext.h" #include "summaryadapter.h" #include "tlcproxy.h" -#include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/searchcore/proton/common/schemautil.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp index 5c9c4982f95..c485e1a1308 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp @@ -1,12 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.feedhandler"); #include "feedhandler.h" #include "feedstates.h" #include "replaypacketdispatcher.h" #include "tlcproxy.h" +#include "ddbstate.h" #include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/documentapi/messagebus/messages/documentreply.h> #include <vespa/documentapi/messagebus/messages/feedreply.h> @@ -19,7 +17,9 @@ LOG_SETUP(".proton.server.feedhandler"); #include <vespa/searchcore/proton/bucketdb/ibucketdbhandler.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h> -#include "ddbstate.h" +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.feedhandler"); using document::BucketId; using document::Document; diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstate.cpp b/searchcore/src/vespa/searchcore/proton/server/feedstate.cpp index 6cd4df5c571..1c1988ee760 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstate.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedstate.cpp @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/document/bucket/bucketid.h> + #include "feedstate.h" -#include <vespa/log/log.h> -LOG_SETUP(".feedstate"); +#include <vespa/vespalib/util/exceptions.h> using document::BucketId; using vespalib::IllegalStateException; diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp b/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp index 6ded3dd7879..1da46a63995 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "feedstates.h" #include "feedconfigstore.h" #include "ireplaypackethandler.h" @@ -7,6 +6,7 @@ #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/searchcore/proton/bucketdb/ibucketdbhandler.h> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".proton.server.feedstates"); diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstates.h b/searchcore/src/vespa/searchcore/proton/server/feedstates.h index 1bc88627377..53a7bdd0ee6 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstates.h +++ b/searchcore/src/vespa/searchcore/proton/server/feedstates.h @@ -5,7 +5,6 @@ #include <vespa/searchcore/proton/server/feedhandler.h> #include <vespa/searchcore/proton/server/feedstate.h> #include <vespa/searchcore/proton/server/ireplaypackethandler.h> -#include <vespa/documentapi/messagebus/documentprotocol.h> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index 1088c77b51a..17d83cc8324 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.proton"); #include "data_directory_upgrader.h" #include "disk_mem_usage_sampler.h" @@ -36,6 +33,9 @@ LOG_SETUP(".proton.server.proton"); #include <vespa/vespalib/util/random.h> #include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/searchcore/proton/common/hw_info_sampler.h> +#include <vespa/document/base/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.proton"); using document::DocumentTypeRepo; using vespalib::FileHeader; diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp b/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp index 75ab2181db6..16554a5c439 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp @@ -1,14 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.searchable_feed_view"); #include "searchable_feed_view.h" #include "ireplayconfig.h" -#include <vespa/documentapi/messagebus/documentprotocol.h> -#include <vespa/documentapi/messagebus/messages/documentreply.h> -#include <vespa/documentapi/messagebus/messages/removedocumentreply.h> -#include <vespa/documentapi/messagebus/messages/updatedocumentreply.h> +#include "forcecommitcontext.h" +#include "operationdonecontext.h" +#include "removedonecontext.h" #include <vespa/searchcore/proton/common/bucketfactory.h> #include <vespa/searchcore/proton/metrics/feed_metrics.h> #include <vespa/searchcore/proton/matching/match_context.h> @@ -17,20 +13,15 @@ LOG_SETUP(".proton.server.searchable_feed_view"); #include <vespa/vespalib/text/stringtokenizer.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/searchlib/common/lambdatask.h> -#include "forcecommitcontext.h" -#include "operationdonecontext.h" -#include "removedonecontext.h" +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.searchable_feed_view"); using document::BucketId; using document::Document; using document::DocumentId; using document::DocumentTypeRepo; using document::DocumentUpdate; -using documentapi::DocumentProtocol; -using documentapi::DocumentReply; -using documentapi::RemoveDocumentReply; -using documentapi::UpdateDocumentReply; -using proton::matching::ISearchContext; using proton::matching::MatchContext; using proton::matching::Matcher; using search::index::Schema; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp index b01ffc38622..31bcaca5014 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp @@ -1,14 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.storeonlyfeedview"); #include "ireplayconfig.h" #include "storeonlyfeedview.h" -#include <vespa/documentapi/messagebus/documentprotocol.h> -#include <vespa/documentapi/messagebus/messages/documentreply.h> -#include <vespa/documentapi/messagebus/messages/removedocumentreply.h> -#include <vespa/documentapi/messagebus/messages/updatedocumentreply.h> #include <vespa/searchcore/proton/common/bucketfactory.h> #include <vespa/searchcore/proton/common/commit_time_tracker.h> #include <vespa/searchcore/proton/metrics/feed_metrics.h> @@ -24,16 +17,15 @@ LOG_SETUP(".proton.server.storeonlyfeedview"); #include "putdonecontext.h" #include <vespa/searchlib/common/lambdatask.h> #include <vespa/searchlib/common/scheduletaskcallback.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.storeonlyfeedview"); using document::BucketId; using document::DocumentTypeRepo; using document::Document; using document::DocumentId; using document::DocumentUpdate; -using documentapi::DocumentProtocol; -using documentapi::DocumentReply; -using documentapi::RemoveDocumentReply; -using documentapi::UpdateDocumentReply; using search::index::Schema; using storage::spi::BucketInfoResult; using storage::spi::Timestamp; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h index 4605963bb53..78fa702f19e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h @@ -8,7 +8,6 @@ #include "replaypacketdispatcher.h" #include "searchcontext.h" #include "tlcproxy.h" -#include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/searchcore/proton/common/doctypename.h> #include <vespa/searchcore/proton/common/feeddebugger.h> #include <vespa/searchcore/proton/documentmetastore/documentmetastore.h> @@ -19,15 +18,13 @@ #include <vespa/searchlib/query/base.h> #include <vespa/vespalib/util/threadstackexecutorbase.h> -namespace search -{ +namespace search { class IDestructorCallback; } -namespace proton -{ +namespace proton { class IReplayConfig; class PerDocTypeFeedMetrics; diff --git a/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp b/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp index b4c509744f7..47889ea9cb8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp @@ -1,12 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.tlcproxy"); #include "tlcproxy.h" #include <vespa/vespalib/objects/nbostream.h> #include <vespa/searchlib/common/bitvector.h> #include <vespa/document/bucket/bucketid.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.tlcproxy"); using vespalib::nbostream; diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp index 3db3875b561..7a3d5bd5579 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".searchcorespi.index.indexmaintainer"); #include "indexmaintainer.h" #include "diskindexcleaner.h" @@ -23,6 +20,9 @@ LOG_SETUP(".searchcorespi.index.indexmaintainer"); #include <sstream> #include <vector> #include <vespa/searchcorespi/flush/closureflushtask.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP(".searchcorespi.index.indexmaintainer"); using document::Document; using search::FixedSourceSelector; diff --git a/searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.cpp b/searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.cpp index 03ed39c8d30..a4e4f994947 100644 --- a/searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.cpp +++ b/searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.cpp @@ -1,5 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/searchcorespi/plugin/factoryregistry.h> +#include <vespa/vespalib/util/exceptions.h> using vespalib::LockGuard; using vespalib::IllegalArgumentException; diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h index 631b9e11932..a4839a1a382 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.h +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h @@ -6,7 +6,6 @@ #include "iattributesavetarget.h" #include <vespa/fastlib/io/bufferedfile.h> #include <vespa/fastlib/text/normwordfolder.h> -#include <vespa/fastos/fastos.h> #include <vespa/searchcommon/attribute/config.h> #include <vespa/searchcommon/attribute/iattributevector.h> #include <vespa/searchcommon/attribute/status.h> @@ -84,14 +83,13 @@ public: return _value == rhs._value; } - friend vespalib::asciistream & - operator << (vespalib::asciistream & os, const UnWeightedType & v) { - return os << "(" << v._value << ", 1)"; - } private: T _value; }; +template <typename T> +vespalib::asciistream & operator << (vespalib::asciistream & os, const UnWeightedType<T> & v); + class IExtendAttribute { public: diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.hpp b/searchlib/src/vespa/searchlib/attribute/attributevector.hpp index 7c8b1004731..74d4c2ea6bc 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.hpp +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.hpp @@ -166,5 +166,10 @@ bool AttributeVector::remove(ChangeVectorT< ChangeTemplate<T> > & changes, DocId return retval; } +template<typename T> +vespalib::asciistream & operator << (vespalib::asciistream & os, const UnWeightedType<T> & v) { + return os << "(" << v._value << ", 1)"; +} + } diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.cpp b/searchlib/src/vespa/searchlib/attribute/integerbase.cpp index 8057b152e99..558023c54e8 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.cpp @@ -46,7 +46,12 @@ uint32_t IntegerAttribute::get(DocId doc, WeightedConstChar * v, uint32_t sz) co (void) sz; return 0; } - +const char * +IntegerAttribute::getString(DocId doc, char * s, size_t sz) const { + largeint_t v = getInt(doc); + snprintf(s, sz, "%" PRId64, v); + return s; +} uint32_t IntegerAttribute::get(DocId doc, vespalib::string * s, uint32_t sz) const { largeint_t * v = new largeint_t[sz]; diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.h b/searchlib/src/vespa/searchlib/attribute/integerbase.h index 4c60a880074..cf21c5920dd 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.h +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.h @@ -30,8 +30,8 @@ public: return AttributeVector::remove(_changes, doc, NumericChangeData<largeint_t>(v), weight); } bool apply(DocId doc, const ArithmeticValueUpdate & op); - virtual bool applyWeight(DocId doc, const FieldValue & fv, const ArithmeticValueUpdate & wAdjust); - virtual uint32_t clearDoc(DocId doc); + bool applyWeight(DocId doc, const FieldValue & fv, const ArithmeticValueUpdate & wAdjust) override; + uint32_t clearDoc(DocId doc) override; protected: IntegerAttribute(const vespalib::string & name, const Config & c); typedef ChangeTemplate<NumericChangeData<largeint_t> > Change; @@ -39,11 +39,11 @@ protected: ChangeVector _changes; private: - virtual const char * getString(DocId doc, char * s, size_t sz) const { largeint_t v = getInt(doc); snprintf(s, sz, "%" PRId64, v); return s; } - virtual uint32_t get(DocId doc, vespalib::string * v, uint32_t sz) const; - virtual uint32_t get(DocId doc, const char ** v, uint32_t sz) const; - virtual uint32_t get(DocId doc, WeightedString * v, uint32_t sz) const; - virtual uint32_t get(DocId doc, WeightedConstChar * v, uint32_t sz) const; + const char * getString(DocId doc, char * s, size_t sz) const override; + uint32_t get(DocId doc, vespalib::string * v, uint32_t sz) const override; + uint32_t get(DocId doc, const char ** v, uint32_t sz) const override; + uint32_t get(DocId doc, WeightedString * v, uint32_t sz) const override; + uint32_t get(DocId doc, WeightedConstChar * v, uint32_t sz) const override; virtual largeint_t getIntFromEnum(EnumHandle e) const = 0; }; diff --git a/searchlib/src/vespa/searchlib/common/bitvectorcache.h b/searchlib/src/vespa/searchlib/common/bitvectorcache.h index 3405adaf1fd..9a93adfe55a 100644 --- a/searchlib/src/vespa/searchlib/common/bitvectorcache.h +++ b/searchlib/src/vespa/searchlib/common/bitvectorcache.h @@ -4,6 +4,7 @@ #include <vespa/searchlib/common/condensedbitvectors.h> #include <vespa/vespalib/util/sync.h> #include <vespa/vespalib/stllike/hash_set.h> +#include <vespa/fastos/dynamiclibrary.h> namespace search { diff --git a/searchlib/src/vespa/searchlib/common/tunefileinfo.h b/searchlib/src/vespa/searchlib/common/tunefileinfo.h index d2281cd112c..8c4b415de54 100644 --- a/searchlib/src/vespa/searchlib/common/tunefileinfo.h +++ b/searchlib/src/vespa/searchlib/common/tunefileinfo.h @@ -6,6 +6,7 @@ #include <vespa/vespalib/util/stringfmt.h> #include <sys/mman.h> #include <linux/mman.h> +#include <fcntl.h> namespace search { diff --git a/searchlib/src/vespa/searchlib/datastore/buffer_type.h b/searchlib/src/vespa/searchlib/datastore/buffer_type.h index 1889b37df11..30282a19b97 100644 --- a/searchlib/src/vespa/searchlib/datastore/buffer_type.h +++ b/searchlib/src/vespa/searchlib/datastore/buffer_type.h @@ -2,6 +2,8 @@ #pragma once +#include <assert.h> + namespace search { namespace datastore { diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.h b/searchlib/src/vespa/searchlib/docstore/filechunk.h index 27cccc59290..2dc173b6d00 100644 --- a/searchlib/src/vespa/searchlib/docstore/filechunk.h +++ b/searchlib/src/vespa/searchlib/docstore/filechunk.h @@ -10,6 +10,7 @@ #include <vespa/searchlib/common/tunefileinfo.h> #include <vespa/vespalib/util/generationhandler.h> #include <vespa/vespalib/util/exceptions.h> +#include <vespa/fastos/file.h> namespace search { diff --git a/searchlib/src/vespa/searchlib/features/CMakeLists.txt b/searchlib/src/vespa/searchlib/features/CMakeLists.txt index dce31f0dc3d..f3c1742dd06 100644 --- a/searchlib/src/vespa/searchlib/features/CMakeLists.txt +++ b/searchlib/src/vespa/searchlib/features/CMakeLists.txt @@ -9,9 +9,10 @@ vespa_add_library(searchlib_features OBJECT constant_feature.cpp debug_attribute_wait.cpp debug_wait.cpp + dense_tensor_attribute_executor.cpp distancefeature.cpp distancetopathfeature.cpp - dense_tensor_attribute_executor.cpp + documenttestutils.cpp dotproductfeature.cpp element_completeness_feature.cpp element_similarity_feature.cpp @@ -57,7 +58,7 @@ vespa_add_library(searchlib_features OBJECT termfeature.cpp terminfofeature.cpp text_similarity_feature.cpp - documenttestutils.cpp + utils.cpp valuefeature.cpp weighted_set_parser.cpp DEPENDS diff --git a/searchlib/src/vespa/searchlib/features/documenttestutils.cpp b/searchlib/src/vespa/searchlib/features/documenttestutils.cpp index 4f33a6e6e2a..803aa1807f9 100644 --- a/searchlib/src/vespa/searchlib/features/documenttestutils.cpp +++ b/searchlib/src/vespa/searchlib/features/documenttestutils.cpp @@ -1,17 +1,19 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".features.utils"); + + #include "utils.h" #include <vespa/searchlib/fef/itablemanager.h> #include <vespa/searchlib/fef/properties.h> #include <vespa/searchlib/fef/itermdata.h> #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <cmath> -#include <iostream> +#include <ostream> +#include <vespa/log/log.h> +LOG_SETUP(".features.utils"); using namespace search::fef; namespace search { diff --git a/searchlib/src/vespa/searchlib/features/utils.cpp b/searchlib/src/vespa/searchlib/features/utils.cpp new file mode 100644 index 00000000000..9d9a784f14c --- /dev/null +++ b/searchlib/src/vespa/searchlib/features/utils.cpp @@ -0,0 +1,18 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "utils.hpp" + +namespace search { +namespace features { +namespace util { + +template double strToNum<double>(vespalib::stringref str); +template uint32_t strToNum<uint32_t>(vespalib::stringref str); +template uint64_t strToNum<uint64_t>(vespalib::stringref str); +template int32_t strToNum<int32_t>(vespalib::stringref str); +template int64_t strToNum<int64_t>(vespalib::stringref str); + +} // namespace util +} // namespace features +} // namespace search + diff --git a/searchlib/src/vespa/searchlib/features/utils.h b/searchlib/src/vespa/searchlib/features/utils.h index bc830aaa9d3..85c3aac4dff 100644 --- a/searchlib/src/vespa/searchlib/features/utils.h +++ b/searchlib/src/vespa/searchlib/features/utils.h @@ -3,8 +3,6 @@ #pragma once #include <limits> -#include <vespa/vespalib/stllike/asciistream.h> -#include <vespa/vespalib/util/exceptions.h> #include <string> #include <vespa/searchlib/fef/iqueryenvironment.h> #include <vespa/searchlib/fef/table.h> @@ -37,16 +35,7 @@ typedef const char * ConstCharPtr; * @return The numeric value. */ template <typename T> -T strToNum(const vespalib::stringref &str) -{ - vespalib::asciistream iss(str); - T retval = 0; - try { - iss >> retval; - } catch (const vespalib::IllegalArgumentException &) { - } - return retval; -} +T strToNum(vespalib::stringref str); template <typename T> feature_t getAsFeature(const T &value) __attribute__((__always_inline__)); diff --git a/searchlib/src/vespa/searchlib/features/utils.hpp b/searchlib/src/vespa/searchlib/features/utils.hpp new file mode 100644 index 00000000000..22b44786ef3 --- /dev/null +++ b/searchlib/src/vespa/searchlib/features/utils.hpp @@ -0,0 +1,28 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include "utils.h" +#include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/vespalib/util/exceptions.h> + +namespace search { +namespace features { +namespace util { + +template <typename T> +T strToNum(vespalib::stringref str) +{ + vespalib::asciistream iss(str); + T retval = 0; + try { + iss >> retval; + } catch (const vespalib::IllegalArgumentException &) { + } + return retval; +} + +} // namespace util +} // namespace features +} // namespace search + diff --git a/staging_vespalib/src/vespa/vespalib/util/bits.h b/staging_vespalib/src/vespa/vespalib/util/bits.h index 8926cdfec64..18c5325dc3d 100644 --- a/staging_vespalib/src/vespa/vespalib/util/bits.h +++ b/staging_vespalib/src/vespa/vespalib/util/bits.h @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/fastos/fastos.h> +#include <stdint.h> namespace vespalib { diff --git a/staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp b/staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp index 17c5a2e4a68..75d10f46262 100644 --- a/staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp @@ -3,6 +3,7 @@ #include <vespa/vespalib/util/xmlserializable.hpp> #include <vector> #include <vespa/vespalib/encoding/base64.h> +#include <vespa/vespalib/stllike/asciistream.h> namespace vespalib { namespace xml { @@ -66,7 +67,7 @@ namespace { } const std::string xmlAttributeEscape(const std::string& s) { - std::ostringstream ost; + vespalib::asciistream ost; for (uint32_t i=0, n=s.size(); i<n; ++i) { if (s[i] == '"' || s[i] == '\n' || escapedXmlChars[static_cast<uint8_t>(s[i])]) @@ -379,8 +380,8 @@ XmlAttribute::XmlAttribute(const std::string& name, const char * value, uint32_t _value(), _next() { - std::ostringstream ost; - if (flags & HEX) ost << std::hex << "0x"; + vespalib::asciistream ost; + if (flags & HEX) ost << vespalib::hex << "0x"; ost << value; _value = ost.str(); if (!isLegalName(name)) { diff --git a/staging_vespalib/src/vespa/vespalib/util/xmlserializable.h b/staging_vespalib/src/vespa/vespalib/util/xmlserializable.h index 0c064ebd43f..69a48596115 100644 --- a/staging_vespalib/src/vespa/vespalib/util/xmlserializable.h +++ b/staging_vespalib/src/vespa/vespalib/util/xmlserializable.h @@ -29,7 +29,7 @@ #pragma once -#include <ostream> +#include <iosfwd> #include <list> #include <memory> diff --git a/storage/src/tests/visiting/commandqueuetest.cpp b/storage/src/tests/visiting/commandqueuetest.cpp index 5d6da5f7ea5..2b51b8e7c8d 100644 --- a/storage/src/tests/visiting/commandqueuetest.cpp +++ b/storage/src/tests/visiting/commandqueuetest.cpp @@ -1,9 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> + #include <vespa/storageframework/defaultimplementation/clock/fakeclock.h> #include <vespa/storage/visiting/commandqueue.h> #include <vespa/storageapi/message/visitor.h> #include <vespa/vdstestlib/cppunit/macros.h> +#include <vespa/vespalib/stllike/asciistream.h> + using vespalib::string; diff --git a/storage/src/vespa/storage/common/messagebucketid.cpp b/storage/src/vespa/storage/common/messagebucketid.cpp index b3ccc1a1e0b..2135cbcd9b6 100644 --- a/storage/src/vespa/storage/common/messagebucketid.cpp +++ b/storage/src/vespa/storage/common/messagebucketid.cpp @@ -1,6 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/common/messagebucketid.h> + +#include "messagebucketid.h" +#include "statusmessages.h" +#include "bucketmessages.h" #include <vespa/storageapi/messageapi/storagemessage.h> #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/bucketsplitting.h> @@ -10,8 +12,8 @@ #include <vespa/storage/persistence/messages.h> #include <vespa/storageapi/message/stat.h> #include <vespa/storageapi/message/batch.h> -#include <vespa/storage/common/statusmessages.h> -#include <vespa/storage/common/bucketmessages.h> + +#include <vespa/vespalib/util/exceptions.h> namespace storage { diff --git a/storage/src/vespa/storage/common/statusmetricconsumer.cpp b/storage/src/vespa/storage/common/statusmetricconsumer.cpp index d81de03919d..85dc82b62af 100644 --- a/storage/src/vespa/storage/common/statusmetricconsumer.cpp +++ b/storage/src/vespa/storage/common/statusmetricconsumer.cpp @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/common/statusmetricconsumer.h> +#include "statusmetricconsumer.h" #include <boost/assign.hpp> #include <boost/lexical_cast.hpp> @@ -13,6 +12,7 @@ #include <vespa/storage/storageserver/storagemetricsset.h> #include <vespa/storageapi/messageapi/storagemessage.h> #include <vespa/vespalib/text/stringtokenizer.h> +#include <vespa/vespalib/stllike/asciistream.h> // For setlocale to print . separated numbers #include <locale.h> #include <stdio.h> diff --git a/storage/src/vespa/storage/common/storagecomponent.cpp b/storage/src/vespa/storage/common/storagecomponent.cpp index 69dc81d3bac..509b7c6f4b6 100644 --- a/storage/src/vespa/storage/common/storagecomponent.cpp +++ b/storage/src/vespa/storage/common/storagecomponent.cpp @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/common/storagecomponent.h> +#include "storagecomponent.h" #include <vespa/storage/storageserver/prioritymapper.h> #include <vespa/vespalib/util/exceptions.h> - +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vdslib/distribution/distribution.h> namespace storage { diff --git a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp index 1bcc6abafb6..a017fd9e11f 100644 --- a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -#include <vespa/storage/storageserver/storagemetricsset.h> #include <vespa/storage/distributor/operations/external/visitoroperation.h> +#include <vespa/storage/storageserver/storagemetricsset.h> #include <vespa/document/base/exceptions.h> #include <vespa/document/select/orderingselector.h> #include <vespa/document/select/parser.h> @@ -13,6 +11,8 @@ #include <vespa/storage/distributor/bucketownership.h> #include <vespa/storage/distributor/operations/external/visitororder.h> #include <vespa/storage/distributor/visitormetricsset.h> +#include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/log/log.h> namespace storage { diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp index 9445b35e222..f0f7429f1fd 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp @@ -1,6 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/frameworkimpl/status/statuswebserver.h> + +#include "statuswebserver.h" #include <vespa/document/util/stringutil.h> #include <vespa/log/log.h> @@ -10,6 +10,7 @@ #include <vespa/fastlib/net/url.h> #include <vespa/vespalib/util/host_name.h> #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/vespalib/util/exceptions.h> LOG_SETUP(".status"); diff --git a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp index ae944b00dde..06972b60cee 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp +++ b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp @@ -1,15 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/frameworkimpl/thread/deadlockdetector.h> - -#include <vespa/log/log.h> +#include "deadlockdetector.h" #include <vespa/storage/bucketdb/storbucketdb.h> #include <vespa/storageframework/storageframework.h> #include <vespa/vdslib/state/nodetype.h> -//#include <vespalib/util/htmlutils.h> #include <vespa/storage/bucketmover/htmltable.h> +#include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/log/log.h> LOG_SETUP(".deadlock.detector"); namespace storage { diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.cpp b/storage/src/vespa/storage/storageserver/communicationmanager.cpp index 0c02a4f6f69..b3ed31dcb88 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.cpp +++ b/storage/src/vespa/storage/storageserver/communicationmanager.cpp @@ -1,20 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/storageserver/communicationmanager.h> - -#include <vespa/log/log.h> -#include <queue> +#include "communicationmanager.h" +#include "storagemetricsset.h" +#include "documentapiconverter.h" #include <vespa/storageapi/message/state.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/storageapi/message/persistence.h> #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/rpcmessagebus.h> #include <vespa/messagebus/sourcesessionparams.h> -#include <vespa/storage/storageserver/documentapiconverter.h> #include <vespa/storage/config/config-stor-server.h> #include <vespa/storage/common/nodestateupdater.h> -#include <vespa/storage/storageserver/storagemetricsset.h> #include <vespa/storageframework/storageframework.h> +#include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/log/log.h> LOG_SETUP(".communication.manager"); @@ -24,15 +22,12 @@ PriorityQueue::PriorityQueue() : _queue(), _queueMonitor(), _msgCounter(0) -{ -} +{ } PriorityQueue::~PriorityQueue() -{ -} +{ } -bool PriorityQueue::getNext(std::shared_ptr<api::StorageMessage>& msg, - int timeout) +bool PriorityQueue::getNext(std::shared_ptr<api::StorageMessage>& msg, int timeout) { vespalib::MonitorGuard sync(_queueMonitor); bool first = true; diff --git a/storage/src/vespa/storage/storageserver/statemanager.cpp b/storage/src/vespa/storage/storageserver/statemanager.cpp index c55afb03788..06dd05bc8d7 100644 --- a/storage/src/vespa/storage/storageserver/statemanager.cpp +++ b/storage/src/vespa/storage/storageserver/statemanager.cpp @@ -1,10 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> +#include "statemanager.h" #include <vespa/defaults.h> -#include <vespa/storage/storageserver/statemanager.h> - -#include <vespa/log/log.h> #include <fstream> #include <vespa/metrics/jsonwriter.h> #include <vespa/metrics/metricmanager.h> @@ -16,6 +13,8 @@ #include <unistd.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/io/fileutil.h> +#include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/log/log.h> LOG_SETUP(".state.manager"); @@ -34,8 +33,7 @@ StateManager::StateManager(StorageComponentRegister& compReg, _listenerLock(), _grabbedExternalLock(false), _notifyingListeners(false), - _nodeState(new lib::NodeState( - _component.getNodeType(), lib::State::INITIALIZING)), + _nodeState(new lib::NodeState(_component.getNodeType(), lib::State::INITIALIZING)), _nextNodeState(), _systemState(new lib::ClusterState), _nextSystemState(), diff --git a/storage/src/vespa/storage/storageserver/statereporter.cpp b/storage/src/vespa/storage/storageserver/statereporter.cpp index 8cb3bdc8e35..23122d86c9f 100644 --- a/storage/src/vespa/storage/storageserver/statereporter.cpp +++ b/storage/src/vespa/storage/storageserver/statereporter.cpp @@ -1,11 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/storageserver/statereporter.h> +#include "statereporter.h" #include <vespa/metrics/jsonwriter.h> #include <vespa/metrics/metricmanager.h> #include <vespa/storage/common/nodestateupdater.h> #include <vespa/vdslib/state/nodestate.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/log/log.h> LOG_SETUP(".status.statereporter"); diff --git a/storage/src/vespa/storage/visiting/visitorthread.cpp b/storage/src/vespa/storage/visiting/visitorthread.cpp index e202e259cc9..9b1faf46ef7 100644 --- a/storage/src/vespa/storage/visiting/visitorthread.cpp +++ b/storage/src/vespa/storage/visiting/visitorthread.cpp @@ -1,24 +1,23 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/visiting/visitorthread.h> +#include "visitorthread.h" #include <vespa/document/repo/documenttyperepo.h> #include <vespa/document/select/bodyfielddetector.h> #include <vespa/document/select/orderingselector.h> #include <vespa/document/select/parser.h> -#include <vespa/log/log.h> #include <vespa/messagebus/rpcmessagebus.h> #include <vespa/storage/common/statusmessages.h> #include <vespa/storage/config/config-stor-server.h> #include <vespa/storage/visiting/messages.h> #include <vespa/storageapi/message/datagram.h> #include <vespa/storageapi/message/visitor.h> +#include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/document/base/exceptions.h> #include <algorithm> #include <locale> -#include <iostream> -#include <string> - +#include <vespa/log/log.h> LOG_SETUP(".visitor.thread"); using storage::api::ReturnCode; diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization.cpp b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization.cpp index 1cbe0d09071..1ad07387ba4 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization.cpp +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization.cpp @@ -1,9 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storageapi/mbusprot/protocolserialization4_2.h> +#include "protocolserialization4_2.h" +#include "serializationhelper.h" +#include "storagecommand.h" +#include "storagereply.h" -#include <vespa/log/log.h> #include <vespa/storageapi/messageapi/storagemessage.h> #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/bucketsplitting.h> @@ -11,11 +12,11 @@ #include <vespa/storageapi/message/multioperation.h> #include <vespa/storageapi/message/batch.h> #include <vespa/storageapi/message/removelocation.h> -#include <vespa/storageapi/mbusprot/serializationhelper.h> -#include <vespa/storageapi/mbusprot/storagecommand.h> -#include <vespa/storageapi/mbusprot/storagereply.h> +#include <vespa/vespalib/util/exceptions.h> + #include <vespa/vespalib/util/growablebytebuffer.h> +#include <vespa/log/log.h> LOG_SETUP(".storage.api.mbusprot.serialization.base"); namespace storage { diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp index 4965a6d7df9..c79d6dc1073 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp @@ -1,9 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storageapi/mbusprot/protocolserialization4_2.h> +#include "protocolserialization4_2.h" +#include "oldreturncodemapper.h" +#include "serializationhelper.h" +#include "storagecommand.h" +#include "storagereply.h" +#include "storageprotocol.h" -#include <vespa/log/log.h> #include <vespa/messagebus/blob.h> #include <vespa/messagebus/blobref.h> #include <vespa/storageapi/messageapi/storagemessage.h> @@ -12,14 +15,11 @@ #include <vespa/storageapi/message/persistence.h> #include <vespa/storageapi/message/batch.h> #include <vespa/storageapi/message/multioperation.h> -#include <vespa/storageapi/mbusprot/oldreturncodemapper.h> -#include <vespa/storageapi/mbusprot/serializationhelper.h> -#include <vespa/storageapi/mbusprot/storagecommand.h> -#include <vespa/storageapi/mbusprot/storagereply.h> -#include <vespa/storageapi/mbusprot/storageprotocol.h> + #include <vespa/storageapi/message/removelocation.h> #include <vespa/vespalib/util/growablebytebuffer.h> - +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> LOG_SETUP(".storage.api.mbusprot.serialization.4_2"); namespace storage { diff --git a/storageapi/src/vespa/storageapi/mbusprot/storagereply.cpp b/storageapi/src/vespa/storageapi/mbusprot/storagereply.cpp index f91893ea355..a655319b9db 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storagereply.cpp +++ b/storageapi/src/vespa/storageapi/mbusprot/storagereply.cpp @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storageapi/mbusprot/storagereply.h> -#include <vespa/storageapi/mbusprot/storagecommand.h> +#include "storagereply.h" +#include "storagecommand.h" +#include <vespa/vespalib/util/exceptions.h> using vespalib::alloc::Alloc; using vespalib::IllegalStateException; diff --git a/storageframework/src/vespa/storageframework/generic/clock/time.cpp b/storageframework/src/vespa/storageframework/generic/clock/time.cpp index 4a379124bda..db0c0b6697d 100644 --- a/storageframework/src/vespa/storageframework/generic/clock/time.cpp +++ b/storageframework/src/vespa/storageframework/generic/clock/time.cpp @@ -1,12 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storageframework/generic/clock/time.h> - +#include "time.hpp" +#include "clock.h" #include <iomanip> -#include <sstream> -#include <vespa/storageframework/generic/clock/clock.h> -#include <sys/time.h> #include <vector> namespace storage { @@ -83,5 +79,12 @@ getRawMicroTime(const Clock& clock) return clock.getTimeInMicros().getTime(); } +template std::ostream& operator<< <MicroSecTime, 1>(std::ostream&, const Time<MicroSecTime, 1> &); +template std::ostream& operator<< <MilliSecTime, 1000>(std::ostream&, const Time<MilliSecTime, 1000> &); +template std::ostream& operator<< <SecondTime, 1000000>(std::ostream&, const Time<SecondTime, 1000000> &); + +template vespalib::asciistream& operator<< <MicroSecTime, 1>(vespalib::asciistream &, const Time<MicroSecTime, 1> &); +template vespalib::asciistream& operator<< <MilliSecTime, 1000>(vespalib::asciistream &, const Time<MilliSecTime, 1000> &); + } // framework } // storage diff --git a/storageframework/src/vespa/storageframework/generic/clock/time.h b/storageframework/src/vespa/storageframework/generic/clock/time.h index 6e4ee615441..70004a2dfb8 100644 --- a/storageframework/src/vespa/storageframework/generic/clock/time.h +++ b/storageframework/src/vespa/storageframework/generic/clock/time.h @@ -3,9 +3,10 @@ #include <boost/operators.hpp> #include <vespa/vespalib/stllike/string.h> -#include <vespa/vespalib/stllike/asciistream.h> -#include <limits> -#include <chrono> + +namespace vespalib { + class asciistream; +} namespace storage { namespace framework { @@ -92,14 +93,10 @@ Type& operator*(Type& type, Number n) { } template<typename Type, int MPU> -std::ostream& operator<<(std::ostream& out, const Time<Type, MPU>& t) { - return out << t.getTime(); -} +std::ostream& operator<<(std::ostream& out, const Time<Type, MPU>& t); template<typename Type, int MPU> -vespalib::asciistream& operator<<(vespalib::asciistream& out, const Time<Type, MPU>& t) { - return out << t.getTime(); -} +vespalib::asciistream& operator<<(vespalib::asciistream& out, const Time<Type, MPU>& t); class MicroSecTime; class MilliSecTime; @@ -176,4 +173,3 @@ inline MicroSecTime MilliSecTime::getMicros() const { } // framework } // storage - diff --git a/storageframework/src/vespa/storageframework/generic/clock/time.hpp b/storageframework/src/vespa/storageframework/generic/clock/time.hpp new file mode 100644 index 00000000000..3e39608cf12 --- /dev/null +++ b/storageframework/src/vespa/storageframework/generic/clock/time.hpp @@ -0,0 +1,21 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#pragma once + +#include "time.h" +#include <vespa/vespalib/stllike/asciistream.h> + +namespace storage { +namespace framework { + +template<typename Type, int MPU> +std::ostream& operator<<(std::ostream& out, const Time<Type, MPU>& t) { + return out << t.getTime(); +} + +template<typename Type, int MPU> +vespalib::asciistream& operator<<(vespalib::asciistream& out, const Time<Type, MPU>& t) { + return out << t.getTime(); +} + +} // framework +} // storage diff --git a/vdslib/src/vespa/vdslib/container/parameters.cpp b/vdslib/src/vespa/vdslib/container/parameters.cpp index cbf5e3a9979..0a0fefdb255 100644 --- a/vdslib/src/vespa/vdslib/container/parameters.cpp +++ b/vdslib/src/vespa/vdslib/container/parameters.cpp @@ -1,11 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/vdslib/container/parameters.h> +#include "parameters.hpp" #include <vespa/vespalib/objects/nbostream.h> using namespace vdslib; +Parameters::Parameters() : _parameters() { } + +Parameters::Parameters(const document::DocumentTypeRepo &repo, document::ByteBuffer& buffer) + : _parameters() +{ + deserialize(repo, buffer); +} + Parameters::~Parameters() { } @@ -30,8 +37,7 @@ void Parameters::onSerialize(document::ByteBuffer& buffer) const } } -void Parameters::onDeserialize(const document::DocumentTypeRepo &repo, - document::ByteBuffer& buffer) +void Parameters::onDeserialize(const document::DocumentTypeRepo &repo, document::ByteBuffer& buffer) { (void) repo; _parameters.clear(); @@ -149,3 +155,13 @@ std::string Parameters::toString() const } return ret; } + +template void vdslib::Parameters::set(const vespalib::stringref &, int); +template void vdslib::Parameters::set(const vespalib::stringref &, long); +template void vdslib::Parameters::set(const vespalib::stringref &, double); +template void vdslib::Parameters::set(const vespalib::stringref &, const char *); +template void vdslib::Parameters::set(const vespalib::stringref &, std::string); +template int vdslib::Parameters::get(const vespalib::stringref &, int) const; +template long vdslib::Parameters::get(const vespalib::stringref &, long) const; +template double vdslib::Parameters::get(const vespalib::stringref &, double) const; +template std::string vdslib::Parameters::get(const vespalib::stringref &, std::string) const;
\ No newline at end of file diff --git a/vdslib/src/vespa/vdslib/container/parameters.h b/vdslib/src/vespa/vdslib/container/parameters.h index b687e8aa1b0..2a551d6ff39 100644 --- a/vdslib/src/vespa/vdslib/container/parameters.h +++ b/vdslib/src/vespa/vdslib/container/parameters.h @@ -16,9 +16,12 @@ #include <vespa/document/util/serializable.h> #include <vespa/document/util/xmlserializable.h> -#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/stllike/hash_map.h> +namespace vespalib { + class asciistream; +} + namespace vdslib { class Parameters : public document::Deserializable, @@ -40,15 +43,12 @@ private: ParametersMap _parameters; void onSerialize(document::ByteBuffer& buffer) const; - void onDeserialize(const document::DocumentTypeRepo &repo, - document::ByteBuffer& buffer); + void onDeserialize(const document::DocumentTypeRepo &repo, document::ByteBuffer& buffer); void printXml(document::XmlOutputStream& xos) const; public: - Parameters() : _parameters() {} - Parameters(const document::DocumentTypeRepo &repo, - document::ByteBuffer& buffer) - : _parameters() { deserialize(repo, buffer); } + Parameters(); + Parameters(const document::DocumentTypeRepo &repo, document::ByteBuffer& buffer); virtual ~Parameters(); bool operator==(const Parameters &other) const; @@ -78,11 +78,7 @@ public: * @param t The value to save. Will be converted to a string. */ template<typename T> - void set(const KeyT & id, const T& t) { - vespalib::asciistream ost; - ost << t; - _parameters[id] = ost.str(); - } + void set(const KeyT & id, T t); /** * Get the value identified by the id given, as the same type as the default @@ -94,14 +90,7 @@ public: * the default itself if value did not exist. */ template<typename T> - T get(const KeyT & id, const T& def) const { - vespalib::stringref ref; - if (!get(id, ref)) return def; - vespalib::asciistream ist(ref); - T t; - ist >> t; - return t; - } + T get(const KeyT & id, T def) const; std::string toString() const; }; diff --git a/vdslib/src/vespa/vdslib/container/parameters.hpp b/vdslib/src/vespa/vdslib/container/parameters.hpp new file mode 100644 index 00000000000..192b4c74ebe --- /dev/null +++ b/vdslib/src/vespa/vdslib/container/parameters.hpp @@ -0,0 +1,28 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#pragma once + +#include "parameters.h" +#include <vespa/vespalib/stllike/asciistream.h> + +namespace vdslib { + +template<typename T> +void +Parameters::set(const KeyT & id, T t) { + vespalib::asciistream ost; + ost << t; + _parameters[id] = ost.str(); +} + +template<typename T> +T +Parameters::get(const KeyT & id, T def) const { + vespalib::stringref ref; + if (!get(id, ref)) return def; + vespalib::asciistream ist(ref); + T t; + ist >> t; + return t; +} + +} diff --git a/vdslib/src/vespa/vdslib/container/writabledocumentlist.cpp b/vdslib/src/vespa/vdslib/container/writabledocumentlist.cpp index 818c3847a45..f90c4101c3c 100644 --- a/vdslib/src/vespa/vdslib/container/writabledocumentlist.cpp +++ b/vdslib/src/vespa/vdslib/container/writabledocumentlist.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/vdslib/container/writabledocumentlist.h> + +#include "writabledocumentlist.h" +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> diff --git a/vespalib/src/tests/alloc/allocate_and_core.cpp b/vespalib/src/tests/alloc/allocate_and_core.cpp index 63718de5ee4..8664a969031 100644 --- a/vespalib/src/tests/alloc/allocate_and_core.cpp +++ b/vespalib/src/tests/alloc/allocate_and_core.cpp @@ -1,5 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/util/alloc.h> +#include <string.h> +#include <assert.h> using namespace vespalib::alloc; diff --git a/vespalib/src/tests/exception_classes/mmap.cpp b/vespalib/src/tests/exception_classes/mmap.cpp index e8a82a412ae..8cc36c725fd 100644 --- a/vespalib/src/tests/exception_classes/mmap.cpp +++ b/vespalib/src/tests/exception_classes/mmap.cpp @@ -1,5 +1,8 @@ #include <vespa/vespalib/util/alloc.h> #include <vector> +#include <assert.h> +#include <string.h> +#include <sys/resource.h> using namespace vespalib::alloc; diff --git a/vespalib/src/vespa/vespalib/net/socket_address.cpp b/vespalib/src/vespa/vespalib/net/socket_address.cpp index 3e0399ebf50..76ae01418c6 100644 --- a/vespalib/src/vespa/vespalib/net/socket_address.cpp +++ b/vespalib/src/vespa/vespalib/net/socket_address.cpp @@ -1,11 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "socket_address.h" #include <vespa/vespalib/util/stringfmt.h> #include <sys/types.h> -#include <sys/socket.h> #include <sys/un.h> #include <arpa/inet.h> #include <netdb.h> diff --git a/vespalib/src/vespa/vespalib/net/socket_address.h b/vespalib/src/vespa/vespalib/net/socket_address.h index 369054e6885..a71b676f274 100644 --- a/vespalib/src/vespa/vespalib/net/socket_address.h +++ b/vespalib/src/vespa/vespalib/net/socket_address.h @@ -6,6 +6,7 @@ #include <vespa/vespalib/stllike/string.h> #include "socket_handle.h" #include <vector> +#include <sys/socket.h> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/net/socket_handle.h b/vespalib/src/vespa/vespalib/net/socket_handle.h index 81c1ffc6df1..a7dc44c6f2b 100644 --- a/vespalib/src/vespa/vespalib/net/socket_handle.h +++ b/vespalib/src/vespa/vespalib/net/socket_handle.h @@ -1,8 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once +#include <unistd.h> + namespace vespalib { /** diff --git a/vespalib/src/vespa/vespalib/objects/nbostream.h b/vespalib/src/vespa/vespalib/objects/nbostream.h index b868574f443..e632704f1fa 100644 --- a/vespalib/src/vespa/vespalib/objects/nbostream.h +++ b/vespalib/src/vespa/vespalib/objects/nbostream.h @@ -5,6 +5,7 @@ #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/util/array.h> #include <vespa/vespalib/util/buffer.h> +#include <arpa/inet.h> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/atomic.h b/vespalib/src/vespa/vespalib/util/atomic.h index c9259671cae..1f796482fbf 100644 --- a/vespalib/src/vespa/vespalib/util/atomic.h +++ b/vespalib/src/vespa/vespalib/util/atomic.h @@ -4,7 +4,8 @@ #pragma once -#include <vespa/fastos/fastos.h> +#include <sys/types.h> +#include <stdint.h> namespace vespalib { @@ -31,7 +32,7 @@ public: **/ struct TaggedPtr { - TaggedPtr() : _ptr(NULL), _tag(0) { } + TaggedPtr() : _ptr(nullptr), _tag(0) { } TaggedPtr(void * h, size_t t) : _ptr(h), _tag(t) { } TaggedPtr(const TaggedPtr & h) : _ptr(h._ptr), _tag(h._tag) { } TaggedPtr & operator = (const TaggedPtr & h) { if (this != &h) {_ptr = h._ptr; _tag = h._tag; }; return *this; } diff --git a/vespalib/src/vespa/vespalib/util/buffer.h b/vespalib/src/vespa/vespalib/util/buffer.h index eda3e56e6e7..88fe6359aae 100644 --- a/vespalib/src/vespa/vespalib/util/buffer.h +++ b/vespalib/src/vespa/vespalib/util/buffer.h @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/fastos/types.h> +#include <sys/types.h> namespace vespalib { @@ -11,7 +11,7 @@ namespace vespalib { class BufferRef { public: - BufferRef() : _buf(NULL), _sz(0) { } + BufferRef() : _buf(nullptr), _sz(0) { } BufferRef(void * buf, size_t sz) : _buf(buf), _sz(sz) { } const char * c_str() const { return static_cast<const char *>(_buf); } char * str() { return static_cast<char *>(_buf); } @@ -32,7 +32,7 @@ private: class ConstBufferRef { public: - ConstBufferRef() : _buf(NULL), _sz(0) { } + ConstBufferRef() : _buf(nullptr), _sz(0) { } ConstBufferRef(const void * buf, size_t sz) : _buf(buf), _sz(sz) { } ConstBufferRef(const BufferRef & rhs) : _buf(rhs.data()), _sz(rhs.size()) { } const char * c_str() const { return static_cast<const char *>(_buf); } diff --git a/vespalib/src/vespa/vespalib/util/generationhandler.h b/vespalib/src/vespa/vespalib/util/generationhandler.h index b940e2cad5f..61ef400cae0 100644 --- a/vespalib/src/vespa/vespalib/util/generationhandler.h +++ b/vespalib/src/vespa/vespalib/util/generationhandler.h @@ -4,6 +4,7 @@ #include <stdint.h> #include <atomic> +#include <assert.h> namespace vespalib { @@ -37,8 +38,7 @@ public: : _refCount(1), _generation(0), _next(0) - { - } + { } ~GenerationHold() { diff --git a/vespalib/src/vespa/vespalib/util/optimized.h b/vespalib/src/vespa/vespalib/util/optimized.h index 1791c67f10d..ec11bbb686a 100644 --- a/vespalib/src/vespa/vespalib/util/optimized.h +++ b/vespalib/src/vespa/vespalib/util/optimized.h @@ -4,7 +4,7 @@ #pragma once -#include <vespa/fastos/types.h> +#include <stdint.h> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/referencecounter.h b/vespalib/src/vespa/vespalib/util/referencecounter.h index 6d9f4ed0d56..791c29c6d7c 100644 --- a/vespalib/src/vespa/vespalib/util/referencecounter.h +++ b/vespalib/src/vespa/vespalib/util/referencecounter.h @@ -8,8 +8,8 @@ #pragma once -#include <vespa/fastos/fastos.h> #include <vespa/vespalib/util/atomic.h> +#include <assert.h> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/sync.h b/vespalib/src/vespa/vespalib/util/sync.h index ee563f1414b..a44763ec755 100644 --- a/vespalib/src/vespa/vespalib/util/sync.h +++ b/vespalib/src/vespa/vespalib/util/sync.h @@ -3,7 +3,9 @@ #pragma once -#include <vespa/fastos/fastos.h> +#include <vespa/fastos/mutex.h> +#include <vespa/fastos/cond.h> +#include <vespa/fastos/time.h> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h index 872d8bc9dc8..a72c11d583d 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h @@ -9,6 +9,7 @@ #include "sync.h" #include <memory> #include "noncopyable.hpp" +#include <vespa/fastos/thread.h> namespace vespalib { diff --git a/vsm/src/vespa/vsm/vsm/docsumfilter.cpp b/vsm/src/vespa/vsm/vsm/docsumfilter.cpp index 2b4f736f166..566e9296e0b 100644 --- a/vsm/src/vespa/vsm/vsm/docsumfilter.cpp +++ b/vsm/src/vespa/vsm/vsm/docsumfilter.cpp @@ -1,14 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".vsm.docsumfilter"); -#include <vespa/vsm/vsm/docsumfilter.h> -#include <vespa/vsm/vsm/jsondocsumwriter.h> +#include "docsumfilter.h" +#include "jsondocsumwriter.h" #include <vespa/searchsummary/docsummary/resultclass.h> #include <vespa/vespalib/util/jsonwriter.h> -#include <vespa/document/fieldvalue/fieldvalues.h> -#include <stack> +#include <vespa/document/fieldvalue/literalfieldvalue.h> +#include <vespa/document/base/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP(".vsm.docsumfilter"); using namespace search::docsummary; @@ -212,12 +211,9 @@ DocsumFilter::DocsumFilter(const DocsumToolsPtr &tools, const IDocSumCache & doc _snippetModifiers(NULL), _cachedValue(), _emptyFieldPath() -{ -} +{ } -DocsumFilter::~DocsumFilter() -{ -} +DocsumFilter::~DocsumFilter() { } void DocsumFilter::init(const FieldMap & fieldMap, const FieldPathMapT & fieldPathMap) { |