Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
metadata_exporter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
IA2
metadata_exporter
Commits
7b57cba0
Commit
7b57cba0
authored
11 years ago
by
Marco De Marco
Browse files
Options
Downloads
Patches
Plain Diff
Fill response method added
parent
2b338a89
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/DBManager.cpp
+8
-4
8 additions, 4 deletions
src/DBManager.cpp
src/DBManager.h
+3
-1
3 additions, 1 deletion
src/DBManager.h
src/ProtocolManager.cpp
+36
-2
36 additions, 2 deletions
src/ProtocolManager.cpp
src/ProtocolManager.h
+4
-1
4 additions, 1 deletion
src/ProtocolManager.h
with
51 additions
and
8 deletions
src/DBManager.cpp
+
8
−
4
View file @
7b57cba0
...
...
@@ -114,12 +114,12 @@ DBManager::InformationList DBManager::retrieveInformation(std::string schema,
}
//==============================================================================
// DBManager::retrieve
Information
()
// DBManager::retrieve
NewTuples
()
//==============================================================================
soci
::
rowset
<
soci
::
row
>
DBManager
::
search
NewTuples
(
std
::
string
schema
,
soci
::
rowset
<
soci
::
row
>
DBManager
::
retrieve
NewTuples
(
std
::
string
schema
,
std
::
string
table
,
std
::
tm
update_time
)
throw
(
soci
::
soci_error
)
{
DEBUG_STREAM
<<
"DBManager::
search
NewTuples()"
<<
endl
;
DEBUG_STREAM
<<
"DBManager::
retrieve
NewTuples()"
<<
endl
;
soci
::
session
session
(
*
m_connectionPool_sp
);
...
...
@@ -127,7 +127,11 @@ soci::rowset<soci::row> DBManager::searchNewTuples(std::string schema,
<<
schema
<<
"."
<<
table
<<
" where update_time>=:timestamp"
,
soci
::
use
(
update_time
,
"timestamp"
));
return
rows
;
MetadataList
metadataList
;
std
::
copy
(
rows
.
begin
(),
rows
.
end
(),
std
::
back_inserter
(
metadataList
));
return
metadataList
;
}
}
//namespace
This diff is collapsed.
Click to expand it.
src/DBManager.h
+
3
−
1
View file @
7b57cba0
...
...
@@ -75,7 +75,9 @@ public:
//------------------------------------------------------------------------------
// [Public] Search new tuple method
//------------------------------------------------------------------------------
virtual
soci
::
rowset
<
soci
::
row
>
searchNewTuples
(
std
::
string
,
std
::
string
,
typedef
std
::
vector
<
soci
::
row
>
MetadataList
;
virtual
MetadataList
retrieveNewTuples
(
std
::
string
,
std
::
string
,
std
::
tm
)
throw
(
soci
::
soci_error
);
protected
:
...
...
This diff is collapsed.
Click to expand it.
src/ProtocolManager.cpp
+
36
−
2
View file @
7b57cba0
...
...
@@ -187,6 +187,9 @@ ResponseSP ProtocolManager::prepareValidation(RequestSP request_sp)
}
catch
(
std
::
runtime_error
&
ex
)
{
WARN_STREAM
<<
"ProtocolManager::prepareValidation() "
<<
ex
.
what
()
<<
" from "
<<
m_remoteEndpoint
<<
endl
;
validationRes
->
set_state
(
Response
::
Validation
::
REJECTED
);
validationRes
->
set_status
(
ex
.
what
());
}
...
...
@@ -244,17 +247,39 @@ ResponseSP ProtocolManager::prepareMetadata(RequestSP request_sp)
<<
"schema "
<<
schema
<<
" table "
<<
table
<<
" timestamp "
<<
asctime
(
&
timestamp
)
<<
" from "
<<
m_remoteEndpoint
<<
endl
;
try
{
DBManager
::
MetadataList
metadataList
=
m_dBManager_sp
->
retrieveNewTuples
(
schema
,
table
,
timestamp
);
fillResponse
(
metadataRes
,
metadataList
);
metadataRes
->
set_state
(
Response
::
Metadata
::
ACCEPTED
);
metadataRes
->
set_status
(
"Metadata ready"
);
}
catch
(
std
::
runtime_error
&
ex
)
{
WARN_STREAM
<<
"ProtocolManager::prepareMetadata() "
<<
ex
.
what
()
<<
" from "
<<
m_remoteEndpoint
<<
endl
;
metadataRes
->
set_state
(
Response
::
Metadata
::
REJECTED
);
metadataRes
->
set_status
(
ex
.
what
());
}
}
else
{
WARN_STREAM
<<
"ProtocolManager::prepareMetadata() "
<<
"Not validated from "
<<
m_remoteEndpoint
<<
endl
;
metadataRes
->
set_state
(
Response
::
Metadata
::
REJECTED
);
metadataRes
->
set_status
(
"Not validated"
);
}
}
else
{
WARN_STREAM
<<
"ProtocolManager::prepareMetadata() "
<<
"Not authorised from "
<<
m_remoteEndpoint
<<
endl
;
metadataRes
->
set_state
(
Response
::
Metadata
::
REJECTED
);
metadataRes
->
set_status
(
"Not authorised"
);
}
...
...
@@ -324,4 +349,13 @@ void ProtocolManager::validateColumn(const Request::Validation::Column& column,
}
}
//==============================================================================
// ProtocolManager::fillResponse()
//==============================================================================
void
ProtocolManager
::
fillResponse
(
const
Response
::
Metadata
&
metadataRes
,
DBManager
::
MetadataList
metadataList
)
throw
(
std
::
runtime_error
)
{
DEBUG_STREAM
<<
"ProtocolManager::fillResponse()"
<<
endl
;
}
}
//namespace
This diff is collapsed.
Click to expand it.
src/ProtocolManager.h
+
4
−
1
View file @
7b57cba0
...
...
@@ -78,6 +78,9 @@ protected:
virtual
void
validateColumn
(
const
Request
::
Validation
::
Column
&
,
DBManager
::
InformationList
&
)
throw
(
std
::
runtime_error
);
virtual
void
fillResponse
(
const
Response
::
Metadata
&
,
DBManager
::
MetadataList
)
throw
(
std
::
runtime_error
);
//------------------------------------------------------------------------------
// [Protected] Class variables
//------------------------------------------------------------------------------
...
...
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