Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cpplib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-cpplib
Commits
c8161806
Verified
Commit
c8161806
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
Moved around some code
parent
14a14b11
No related branches found
No related tags found
1 merge request
!5
F multi retrieve
Pipeline
#11414
passed
3 years ago
Stage: info
Stage: setup
Stage: test
Stage: deploy
Pipeline: caosdb-cppinttest
#11416
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
include/caosdb/transaction.h
+4
-25
4 additions, 25 deletions
include/caosdb/transaction.h
src/caosdb/configuration.cpp
+6
-5
6 additions, 5 deletions
src/caosdb/configuration.cpp
src/caosdb/transaction.cpp
+24
-1
24 additions, 1 deletion
src/caosdb/transaction.cpp
with
35 additions
and
32 deletions
CMakeLists.txt
+
1
−
1
View file @
c8161806
...
...
@@ -299,7 +299,7 @@ if(_LINTING)
else
()
message
(
STATUS
"clang-tidy:
${
clang_tidy
}
"
)
set
(
_CMAKE_CXX_CLANG_TIDY_CHECKS
"--checks=*,-fuchsia-*,-llvmlibc-*,-readability-convert-member-functions-to-static,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-hicpp-no-array-decay,-llvm-else-after-return,-readability-else-after-return,-modernize-use-trailing-return-type"
)
"--checks=*,-fuchsia-*,-llvmlibc-*,-readability-convert-member-functions-to-static,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-hicpp-no-array-decay,-llvm-else-after-return,-readability-else-after-return,-modernize-use-trailing-return-type
,-bugprone-branch-clone
"
)
set
(
_CMAKE_C_CLANG_TIDY_CHECKS
"
${
_CMAKE_CXX_CLANG_TIDY_CHECKS
}
"
)
set
(
_CMAKE_CXX_CLANG_TIDY
"
${
clang_tidy
}
"
"--header-filter=caosdb/.*[^
\(
\.pb\.h
\)
]$"
...
...
This diff is collapsed.
Click to expand it.
include/caosdb/transaction.h
+
4
−
25
View file @
c8161806
...
...
@@ -33,6 +33,7 @@
#include
"google/protobuf/util/json_util.h"
// for MessageToJsonString, Jso...
#include
<stdexcept>
#include
<iterator>
// IWYU pragma: no_include <ext/alloc_traits.h>
#include
<memory>
// for shared_ptr, unique_ptr
#include
<string>
// for string
#include
<vector>
// for vector
...
...
@@ -119,6 +120,8 @@ using caosdb::transaction::TransactionStatus;
using
WrappedResponseCase
=
caosdb
::
entity
::
v1alpha1
::
TransactionResponse
::
WrappedResponseCase
;
class
Transaction
;
static
const
std
::
string
logger_name
=
"caosdb::transaction"
;
class
ResultSet
{
...
...
@@ -131,31 +134,7 @@ public:
class
MultiResultSet
:
public
ResultSet
{
public:
~
MultiResultSet
()
=
default
;
explicit
inline
MultiResultSet
(
MultiTransactionResponse
*
response
)
{
auto
responses
=
response
->
mutable_responses
();
Entity
*
entity
=
nullptr
;
for
(
auto
sub_response
:
*
responses
)
{
switch
(
sub_response
.
wrapped_response_case
())
{
case
WrappedResponseCase
::
kRetrieveResponse
:
entity
=
new
Entity
(
sub_response
.
mutable_retrieve_response
()
->
release_entity
());
break
;
case
WrappedResponseCase
::
kInsertResponse
:
entity
=
new
Entity
(
sub_response
.
release_insert_response
());
break
;
case
WrappedResponseCase
::
kDeleteResponse
:
entity
=
new
Entity
(
sub_response
.
release_delete_response
());
break
;
default:
// TODO(tf) Updates
break
;
}
if
(
entity
)
{
this
->
entities
.
push_back
(
std
::
unique_ptr
<
Entity
>
(
entity
));
}
}
}
explicit
MultiResultSet
(
MultiTransactionResponse
*
response
);
[[
nodiscard
]]
inline
auto
Size
()
const
noexcept
->
int
override
{
return
this
->
entities
.
size
();
}
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/configuration.cpp
+
6
−
5
View file @
c8161806
...
...
@@ -39,6 +39,7 @@
#include
<cstdlib>
// for getenv
#include
<cstring>
// for strcmp
#include
<exception>
// IWYU pragma: keep
// IWYU pragma: no_include <bits/exception.h>
#include
<grpcpp/security/credentials.h>
// for SslCredentials
#include
<iterator>
// for next
#include
<map>
// for map
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/transaction.cpp
+
24
−
1
View file @
c8161806
...
...
@@ -90,6 +90,29 @@ using grpc::ClientAsyncResponseReader;
using
ProtoEntity
=
caosdb
::
entity
::
v1alpha1
::
Entity
;
using
grpc
::
CompletionQueue
;
MultiResultSet
::
MultiResultSet
(
MultiTransactionResponse
*
response
)
{
auto
*
responses
=
response
->
mutable_responses
();
for
(
auto
sub_response
:
*
responses
)
{
switch
(
sub_response
.
wrapped_response_case
())
{
case
WrappedResponseCase
::
kRetrieveResponse
:
this
->
entities
.
push_back
(
std
::
make_unique
<
Entity
>
(
sub_response
.
mutable_retrieve_response
()
->
release_entity
()));
break
;
case
WrappedResponseCase
::
kInsertResponse
:
this
->
entities
.
push_back
(
std
::
make_unique
<
Entity
>
(
sub_response
.
release_insert_response
()));
break
;
case
WrappedResponseCase
::
kDeleteResponse
:
this
->
entities
.
push_back
(
std
::
make_unique
<
Entity
>
(
sub_response
.
release_insert_response
()));
break
;
default:
// TODO(tf) Updates
break
;
}
}
}
[[
nodiscard
]]
auto
UniqueResult
::
GetEntity
()
const
->
const
Entity
&
{
const
Entity
*
result
=
this
->
entity
.
get
();
return
*
result
;
...
...
@@ -239,7 +262,7 @@ auto Transaction::WaitForIt() const noexcept -> TransactionStatus {
this
->
result_set
=
std
::
make_unique
<
UniqueResult
>
(
deletedIdResponse
);
}
break
;
default
:
// TODO(tf)
// TODO(tf)
Error and Update
break
;
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment