Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
271825ff
Commit
271825ff
authored
5 years ago
by
Michael Davis
Browse files
Options
Downloads
Patches
Plain Diff
[cta-admin] Refactors all client-side stream command output
parent
d58953e4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cmdline/CtaAdminCmd.cpp
+20
-20
20 additions, 20 deletions
cmdline/CtaAdminCmd.cpp
cmdline/CtaAdminTextFormatter.cpp
+286
-300
286 additions, 300 deletions
cmdline/CtaAdminTextFormatter.cpp
cmdline/CtaAdminTextFormatter.hpp
+22
-22
22 additions, 22 deletions
cmdline/CtaAdminTextFormatter.hpp
with
328 additions
and
342 deletions
cmdline/CtaAdminCmd.cpp
+
20
−
20
View file @
271825ff
...
...
@@ -89,16 +89,16 @@ void IStreamBuffer<cta::xrd::Data>::DataCallback(cta::xrd::Data record) const
// Format results in a tabular format for a human
else
switch
(
record
.
data_case
())
{
case
Data
::
kAflsItem
:
formattedText
.
print
(
record
.
afls_item
());
break
;
case
Data
::
kAflsSummary
:
TextF
ormatte
r
::
print
(
record
.
afls_summary
());
break
;
case
Data
::
kFrlsItem
:
TextF
ormatte
r
::
print
(
record
.
frls_item
());
break
;
case
Data
::
kFrlsSummary
:
TextF
ormatte
r
::
print
(
record
.
frls_summary
());
break
;
case
Data
::
kLpaItem
:
TextF
ormatte
r
::
print
(
record
.
lpa_item
());
break
;
case
Data
::
kLpaSummary
:
TextF
ormatte
r
::
print
(
record
.
lpa_summary
());
break
;
case
Data
::
kLprItem
:
TextF
ormatte
r
::
print
(
record
.
lpr_item
());
break
;
case
Data
::
kLprSummary
:
TextF
ormatte
r
::
print
(
record
.
lpr_summary
());
break
;
case
Data
::
kTplsItem
:
TextF
ormatte
r
::
print
(
record
.
tpls_item
());
break
;
case
Data
::
kTalsItem
:
TextF
ormatte
r
::
print
(
record
.
tals_item
());
break
;
case
Data
::
kRelsItem
:
TextF
ormatte
r
::
print
(
record
.
rels_item
());
break
;
case
Data
::
kAflsSummary
:
f
ormatte
dText
.
print
(
record
.
afls_summary
());
break
;
case
Data
::
kFrlsItem
:
f
ormatte
dText
.
print
(
record
.
frls_item
());
break
;
case
Data
::
kFrlsSummary
:
f
ormatte
dText
.
print
(
record
.
frls_summary
());
break
;
case
Data
::
kLpaItem
:
f
ormatte
dText
.
print
(
record
.
lpa_item
());
break
;
case
Data
::
kLpaSummary
:
f
ormatte
dText
.
print
(
record
.
lpa_summary
());
break
;
case
Data
::
kLprItem
:
f
ormatte
dText
.
print
(
record
.
lpr_item
());
break
;
case
Data
::
kLprSummary
:
f
ormatte
dText
.
print
(
record
.
lpr_summary
());
break
;
case
Data
::
kTplsItem
:
f
ormatte
dText
.
print
(
record
.
tpls_item
());
break
;
case
Data
::
kTalsItem
:
f
ormatte
dText
.
print
(
record
.
tals_item
());
break
;
case
Data
::
kRelsItem
:
f
ormatte
dText
.
print
(
record
.
rels_item
());
break
;
default:
throw
std
::
runtime_error
(
"Received invalid stream data from CTA Frontend."
);
}
...
...
@@ -233,16 +233,16 @@ void CtaAdminCmd::send() const
// Print streaming response header
if
(
!
isJson
())
switch
(
response
.
show_header
())
{
case
HeaderType
::
ARCHIVEFILE_LS
:
formattedText
.
printAfLsHeader
();
break
;
case
HeaderType
::
ARCHIVEFILE_LS_SUMMARY
:
TextF
ormatte
r
::
printAfLsSummaryHeader
();
break
;
case
HeaderType
::
FAILEDREQUEST_LS
:
TextF
ormatte
r
::
printFrLsHeader
();
break
;
case
HeaderType
::
FAILEDREQUEST_LS_SUMMARY
:
TextF
ormatte
r
::
printFrLsSummaryHeader
();
break
;
case
HeaderType
::
LISTPENDINGARCHIVES
:
TextF
ormatte
r
::
printLpaHeader
();
break
;
case
HeaderType
::
LISTPENDINGARCHIVES_SUMMARY
:
TextF
ormatte
r
::
printLpaSummaryHeader
();
break
;
case
HeaderType
::
LISTPENDINGRETRIEVES
:
TextF
ormatte
r
::
printLprHeader
();
break
;
case
HeaderType
::
LISTPENDINGRETRIEVES_SUMMARY
:
TextF
ormatte
r
::
printLprSummaryHeader
();
break
;
case
HeaderType
::
TAPEPOOL_LS
:
TextF
ormatte
r
::
printTp
LsHeader
();
break
;
case
HeaderType
::
TAPE_LS
:
TextF
ormatte
r
::
printTapeLsHeader
();
break
;
case
HeaderType
::
REPACK_LS
:
TextF
ormatte
r
::
printRepackLsHeader
();
break
;
case
HeaderType
::
ARCHIVEFILE_LS_SUMMARY
:
f
ormatte
dText
.
printAfLsSummaryHeader
();
break
;
case
HeaderType
::
FAILEDREQUEST_LS
:
f
ormatte
dText
.
printFrLsHeader
();
break
;
case
HeaderType
::
FAILEDREQUEST_LS_SUMMARY
:
f
ormatte
dText
.
printFrLsSummaryHeader
();
break
;
case
HeaderType
::
LISTPENDINGARCHIVES
:
f
ormatte
dText
.
printLpaHeader
();
break
;
case
HeaderType
::
LISTPENDINGARCHIVES_SUMMARY
:
f
ormatte
dText
.
printLpaSummaryHeader
();
break
;
case
HeaderType
::
LISTPENDINGRETRIEVES
:
f
ormatte
dText
.
printLprHeader
();
break
;
case
HeaderType
::
LISTPENDINGRETRIEVES_SUMMARY
:
f
ormatte
dText
.
printLprSummaryHeader
();
break
;
case
HeaderType
::
TAPEPOOL_LS
:
f
ormatte
dText
.
printTapePool
LsHeader
();
break
;
case
HeaderType
::
TAPE_LS
:
f
ormatte
dText
.
printTapeLsHeader
();
break
;
case
HeaderType
::
REPACK_LS
:
f
ormatte
dText
.
printRepackLsHeader
();
break
;
case
HeaderType
::
NONE
:
default:
break
;
}
...
...
This diff is collapsed.
Click to expand it.
cmdline/CtaAdminTextFormatter.cpp
+
286
−
300
View file @
271825ff
This diff is collapsed.
Click to expand it.
cmdline/CtaAdminTextFormatter.hpp
+
22
−
22
View file @
271825ff
...
...
@@ -45,29 +45,29 @@ public:
// Output headers
void
printAfLsHeader
();
static
void
printAfLsSummaryHeader
();
static
void
printFrLsHeader
();
static
void
printFrLsSummaryHeader
();
static
void
printLpaHeader
();
static
void
printLpaSummaryHeader
();
static
void
printLprHeader
();
static
void
printLprSummaryHeader
();
static
void
printT
p
LsHeader
();
static
void
printTapeLsHeader
();
static
void
printRepackLsHeader
();
void
printAfLsSummaryHeader
();
void
printFrLsHeader
();
void
printFrLsSummaryHeader
();
void
printLpaHeader
();
void
printLpaSummaryHeader
();
void
printLprHeader
();
void
printLprSummaryHeader
();
void
printT
apePool
LsHeader
();
void
printTapeLsHeader
();
void
printRepackLsHeader
();
// Output records
void
print
(
const
ArchiveFileLsItem
&
afls_item
);
static
void
print
(
const
ArchiveFileLsSummary
&
afls_summary
);
static
void
print
(
const
FailedRequestLsItem
&
frls_item
);
static
void
print
(
const
FailedRequestLsSummary
&
frls_summary
);
static
void
print
(
const
ListPendingArchivesItem
&
lpa_item
);
static
void
print
(
const
ListPendingArchivesSummary
&
lpa_summary
);
static
void
print
(
const
ListPendingRetrievesItem
&
lpr_item
);
static
void
print
(
const
ListPendingRetrievesSummary
&
lpr_summary
);
static
void
print
(
const
TapePoolLsItem
&
tpls_item
);
static
void
print
(
const
TapeLsItem
&
tals_item
);
static
void
print
(
const
RepackLsItem
&
rels_item
);
void
print
(
const
ArchiveFileLsSummary
&
afls_summary
);
void
print
(
const
FailedRequestLsItem
&
frls_item
);
void
print
(
const
FailedRequestLsSummary
&
frls_summary
);
void
print
(
const
ListPendingArchivesItem
&
lpa_item
);
void
print
(
const
ListPendingArchivesSummary
&
lpa_summary
);
void
print
(
const
ListPendingRetrievesItem
&
lpr_item
);
void
print
(
const
ListPendingRetrievesSummary
&
lpr_summary
);
void
print
(
const
TapePoolLsItem
&
tpls_item
);
void
print
(
const
TapeLsItem
&
tals_item
);
void
print
(
const
RepackLsItem
&
rels_item
);
private
:
//! Add a line to the buffer
...
...
@@ -79,14 +79,14 @@ private:
if
(
m_outputBuffer
.
size
()
>=
m_bufLines
)
flush
();
}
//! Recursive variadic
function
to build a log string from an arbitrary number of items of arbitrary type
//! Recursive variadic
method
to build a log string from an arbitrary number of items of arbitrary type
template
<
typename
T
,
typename
...
Args
>
void
buildVector
(
std
::
vector
<
std
::
string
>
&
line
,
const
T
&
item
,
Args
...
args
)
{
buildVector
(
line
,
item
);
buildVector
(
line
,
args
...);
}
//! Base case
function
to add one item to the log
//! Base case
method
to add one item to the log
, with specialisations by type
template
<
typename
T
>
void
buildVector
(
std
::
vector
<
std
::
string
>
&
line
,
const
T
&
item
)
{
line
.
push_back
(
std
::
to_string
(
item
));
...
...
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