| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Copyright (C) 2020 HERE Europe B.V. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * License-Filename: LICENSE | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <olp/core/cache/KeyValueCache.h> | ||
| #include <rapidjson/document.h> | ||
|
|
||
| namespace olp { | ||
| namespace parser { | ||
| template <typename T> | ||
| inline T parse(const cache::KeyValueCache::ValueType& cached_json) { | ||
| rapidjson::Document doc; | ||
| T result{}; | ||
| if (!cached_json.empty()) { | ||
| auto* data = static_cast<const void*>(cached_json.data()); | ||
| doc.Parse(static_cast<const char*>(data), cached_json.size()); | ||
| if (doc.IsObject() || doc.IsArray()) { | ||
| from_json(doc, result); | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| } // namespace parser | ||
| } // namespace olp |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| * Copyright (C) 2020 HERE Europe B.V. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * License-Filename: LICENSE | ||
| */ | ||
|
|
||
| #include "VersionInfosSerializer.h" | ||
|
|
||
| #include <olp/core/generated/serializer/SerializerWrapper.h> | ||
|
|
||
| namespace olp { | ||
| namespace serializer { | ||
|
|
||
| void to_json(const dataservice::read::model::VersionDependency& x, | ||
| rapidjson::Value& value, | ||
| rapidjson::Document::AllocatorType& allocator) { | ||
| value.SetObject(); | ||
| serialize("hrn", x.GetHrn(), value, allocator); | ||
| serialize("version", x.GetVersion(), value, allocator); | ||
| serialize("direct", x.GetDirect(), value, allocator); | ||
| } | ||
|
|
||
| void to_json(const dataservice::read::model::VersionInfo& x, | ||
| rapidjson::Value& value, | ||
| rapidjson::Document::AllocatorType& allocator) { | ||
| value.SetObject(); | ||
| serialize("dependencies", x.GetDependencies(), value, allocator); | ||
| serialize("timestamp", x.GetTimestamp(), value, allocator); | ||
| serialize("version", x.GetVersion(), value, allocator); | ||
| serialize("partitionCounts", x.GetPartitionCounts(), value, allocator); | ||
| } | ||
|
|
||
| void to_json(const dataservice::read::model::VersionInfos& x, | ||
| rapidjson::Value& value, | ||
| rapidjson::Document::AllocatorType& allocator) { | ||
| value.SetObject(); | ||
| serialize("versions", x.GetVersions(), value, allocator); | ||
| } | ||
| } // namespace serializer | ||
| } // namespace olp |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Copyright (C) 2020 HERE Europe B.V. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * License-Filename: LICENSE | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <rapidjson/document.h> | ||
| #include "olp/dataservice/read/model/VersionInfos.h" | ||
|
|
||
| namespace olp { | ||
| namespace serializer { | ||
|
|
||
| void to_json(const dataservice::read::model::VersionDependency& x, | ||
| rapidjson::Value& value, | ||
| rapidjson::Document::AllocatorType& allocator); | ||
|
|
||
| void to_json(const dataservice::read::model::VersionInfo& x, | ||
| rapidjson::Value& value, | ||
| rapidjson::Document::AllocatorType& allocator); | ||
|
|
||
| void to_json(const dataservice::read::model::VersionInfos& x, | ||
| rapidjson::Value& value, | ||
| rapidjson::Document::AllocatorType& allocator); | ||
| } // namespace serializer | ||
| } // namespace olp |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityPlease also add a test case for start_version = -1 as specified by the documentation:
startVersion
The beginning of the range of versions you want to get (exclusive). By convention -1 indicates the initial version before the first publication. After the first publication, the catalog version is 0.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityTest will be added to CatalogRepositoryTest
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityBut why in CatalogRepositoryTest as this will have direct implication upon the key generation, which needs to be tested that it works correctly, means that not by mistake the -1 startVersion is converted to 0 as we do not support -1 while converting to string.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.