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
Harbor 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
38a1af33
Commit
38a1af33
authored
6 years ago
by
Michael Davis
Browse files
Options
Downloads
Patches
Plain Diff
[cta-admin] Generalises client to handle multiple types of streaming response
parent
6c9f8947
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cmdline/CtaAdminCmd.cpp
+49
-17
49 additions, 17 deletions
cmdline/CtaAdminCmd.cpp
cmdline/CtaAdminCmd.hpp
+5
-0
5 additions, 0 deletions
cmdline/CtaAdminCmd.hpp
xroot_plugins/XrdCtaArchiveFileLs.hpp
+3
-0
3 additions, 0 deletions
xroot_plugins/XrdCtaArchiveFileLs.hpp
with
57 additions
and
17 deletions
cmdline/CtaAdminCmd.cpp
+
49
−
17
View file @
38a1af33
...
...
@@ -53,25 +53,36 @@ void RequestCallback<cta::xrd::Alert>::operator()(const cta::xrd::Alert &alert)
template
<
>
void
IStreamBuffer
<
cta
::
xrd
::
Data
>::
DataCallback
(
cta
::
xrd
::
Data
record
)
const
{
const
cta
::
admin
::
ArchiveFileItem
&
af_item
=
record
.
af_item
();
using
namespace
cta
::
xrd
;
using
namespace
cta
::
admin
;
Log
::
DumpProtobuf
(
Log
::
PROTOBUF
,
&
af_item
);
Log
::
DumpProtobuf
(
Log
::
PROTOBUF
,
&
record
);
std
::
cout
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
7
)
<<
std
::
right
<<
af_item
.
af
().
archive_id
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
7
)
<<
std
::
right
<<
af_item
.
copy_nb
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
7
)
<<
std
::
right
<<
af_item
.
tf
().
vid
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
7
)
<<
std
::
right
<<
af_item
.
tf
().
f_seq
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
8
)
<<
std
::
right
<<
af_item
.
tf
().
block_id
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
8
)
<<
std
::
right
<<
af_item
.
af
().
disk_instance
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
7
)
<<
std
::
right
<<
af_item
.
af
().
disk_id
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
12
)
<<
std
::
right
<<
af_item
.
af
().
size
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
13
)
<<
std
::
right
<<
af_item
.
af
().
cs
().
type
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
14
)
<<
std
::
right
<<
af_item
.
af
().
cs
().
value
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
13
)
<<
std
::
right
<<
af_item
.
af
().
storage_class
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
8
)
<<
std
::
right
<<
af_item
.
af
().
df
().
owner
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
8
)
<<
std
::
right
<<
af_item
.
af
().
df
().
group
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
13
)
<<
std
::
right
<<
af_item
.
af
().
creation_time
()
<<
' '
<<
af_item
.
af
().
df
().
path
()
<<
std
::
endl
;
switch
(
record
.
data_case
())
{
case
Data
::
kAfItemFieldNumber
:
switch
(
record
.
af_item
().
type
())
{
case
ArchiveFileItem
::
ARCHIVEFILE_LS
:
CtaAdminCmd
::
printAfLsItem
(
record
.
af_item
());
break
;
case
ArchiveFileItem
::
LISTPENDINGARCHIVES
:
case
ArchiveFileItem
::
LISTPENDINGRETRIEVES
:
default:
throw
std
::
runtime_error
(
"Not implemented/received invalid stream data from CTA Frontend."
);
}
case
Data
::
kAfSummaryItemFieldNumber
:
switch
(
record
.
af_summary_item
().
type
())
{
case
ArchiveFileItem
::
ARCHIVEFILE_LS
:
case
ArchiveFileItem
::
LISTPENDINGARCHIVES
:
case
ArchiveFileItem
::
LISTPENDINGRETRIEVES
:
default:
throw
std
::
runtime_error
(
"Not implemented/received invalid stream data from CTA Frontend."
);
}
default
:
throw
std
::
runtime_error
(
"Received invalid stream data from CTA Frontend."
);
}
}
}
// namespace XrdSsiPb
...
...
@@ -337,6 +348,27 @@ void CtaAdminCmd::throwUsage(const std::string &error_txt) const
throw
std
::
runtime_error
(
help
.
str
());
}
void
CtaAdminCmd
::
printAfLsItem
(
const
cta
::
admin
::
ArchiveFileItem
&
af_item
)
{
std
::
cout
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
7
)
<<
std
::
right
<<
af_item
.
af
().
archive_id
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
7
)
<<
std
::
right
<<
af_item
.
copy_nb
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
7
)
<<
std
::
right
<<
af_item
.
tf
().
vid
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
7
)
<<
std
::
right
<<
af_item
.
tf
().
f_seq
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
8
)
<<
std
::
right
<<
af_item
.
tf
().
block_id
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
8
)
<<
std
::
right
<<
af_item
.
af
().
disk_instance
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
7
)
<<
std
::
right
<<
af_item
.
af
().
disk_id
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
12
)
<<
std
::
right
<<
af_item
.
af
().
size
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
13
)
<<
std
::
right
<<
af_item
.
af
().
cs
().
type
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
14
)
<<
std
::
right
<<
af_item
.
af
().
cs
().
value
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
13
)
<<
std
::
right
<<
af_item
.
af
().
storage_class
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
8
)
<<
std
::
right
<<
af_item
.
af
().
df
().
owner
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
8
)
<<
std
::
right
<<
af_item
.
af
().
df
().
group
()
<<
' '
<<
std
::
setfill
(
' '
)
<<
std
::
setw
(
13
)
<<
std
::
right
<<
af_item
.
af
().
creation_time
()
<<
' '
<<
af_item
.
af
().
df
().
path
()
<<
std
::
endl
;
}
}}
// namespace cta::admin
...
...
This diff is collapsed.
Click to expand it.
cmdline/CtaAdminCmd.hpp
+
5
−
0
View file @
38a1af33
...
...
@@ -34,6 +34,11 @@ public:
*/
void
send
()
const
;
/*!
* Handle stream responses for "af ls" command
*/
static
void
printAfLsItem
(
const
cta
::
admin
::
ArchiveFileItem
&
af_item
);
private:
/*!
* Parse the options for a specific command/subcommand
...
...
This diff is collapsed.
Click to expand it.
xroot_plugins/XrdCtaArchiveFileLs.hpp
+
3
−
0
View file @
38a1af33
...
...
@@ -82,6 +82,9 @@ public:
for
(
auto
jt
=
archiveFile
.
tapeFiles
.
cbegin
();
jt
!=
archiveFile
.
tapeFiles
.
cend
();
jt
++
)
{
cta
::
xrd
::
Data
record
;
// Response type
record
.
mutable_af_item
()
->
set_type
(
cta
::
admin
::
ArchiveFileItem
::
ARCHIVEFILE_LS
);
// Copy number
record
.
mutable_af_item
()
->
set_copy_nb
(
jt
->
first
);
...
...
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