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
9de8548e
Commit
9de8548e
authored
5 years ago
by
Michael Davis
Browse files
Options
Downloads
Patches
Plain Diff
[cta-admin] Displays new uid/gid and checksum formats
parent
72ee2e3a
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/CMakeLists.txt
+2
-7
2 additions, 7 deletions
cmdline/CMakeLists.txt
cmdline/CtaAdminTextFormatter.cpp
+43
-10
43 additions, 10 deletions
cmdline/CtaAdminTextFormatter.cpp
cmdline/EosCtaStub.cpp
+20
-9
20 additions, 9 deletions
cmdline/EosCtaStub.cpp
with
65 additions
and
26 deletions
cmdline/CMakeLists.txt
+
2
−
7
View file @
9de8548e
...
...
@@ -32,13 +32,8 @@ include_directories(${CMAKE_BINARY_DIR}/eos_cta ${PROTOBUF3_INCLUDE_DIRS})
#
# cta-admin <admin_command> is the SSI version of "cta <admin_command>"
#
add_executable
(
cta-admin
CtaAdminCmd.cpp
CtaAdminCmdParse.cpp
CtaAdminTextFormatter.cpp
../common/dataStructures/DriveStatus.cpp
../common/dataStructures/MountType.cpp
)
target_link_libraries
(
cta-admin XrdSsiPbEosCta XrdSsi-4 XrdSsiLib XrdUtils
)
add_executable
(
cta-admin CtaAdminCmd.cpp CtaAdminCmdParse.cpp CtaAdminTextFormatter.cpp
)
target_link_libraries
(
cta-admin XrdSsiPbEosCta XrdSsi-4 XrdSsiLib XrdUtils ctacommon
)
set_property
(
TARGET cta-admin APPEND PROPERTY INSTALL_RPATH
${
PROTOBUF3_RPATH
}
)
#
...
...
This diff is collapsed.
Click to expand it.
cmdline/CtaAdminTextFormatter.cpp
+
43
−
10
View file @
9de8548e
...
...
@@ -20,6 +20,7 @@
#include
<iostream>
#include
<iomanip>
#include
<cmdline/CtaAdminTextFormatter.hpp>
#include
<common/checksum/ChecksumBlobSerDeser.hpp>
#include
<common/dataStructures/DriveStatusSerDeser.hpp>
#include
<common/dataStructures/MountTypeSerDeser.hpp>
...
...
@@ -162,6 +163,22 @@ void TextFormatter::printArchiveFileLsHeader() {
}
void
TextFormatter
::
print
(
const
ArchiveFileLsItem
&
afls_item
)
{
using
namespace
cta
::
checksum
;
std
::
string
checksumType
(
"NONE"
);
std
::
string
checksumValue
;
ChecksumBlob
csb
;
ProtobufToChecksumBlob
(
afls_item
.
af
().
csb
(),
csb
);
// Files can have multiple checksums of different types. Display only the first checksum here. All
// checksums will be listed in JSON.
if
(
!
csb
.
empty
())
{
auto
cs_it
=
csb
.
getMap
().
begin
();
checksumType
=
ChecksumTypeName
.
at
(
cs_it
->
first
);
checksumValue
=
"0x"
+
ChecksumBlob
::
ByteArrayToHex
(
cs_it
->
second
);
}
push_back
(
afls_item
.
af
().
archive_id
(),
afls_item
.
copy_nb
(),
...
...
@@ -171,11 +188,11 @@ void TextFormatter::print(const ArchiveFileLsItem &afls_item) {
afls_item
.
af
().
disk_instance
(),
afls_item
.
af
().
disk_id
(),
dataSizeToStr
(
afls_item
.
af
().
size
()),
afls_item
.
af
().
cs
().
t
ype
()
,
afls_item
.
af
().
cs
().
v
alue
()
,
checksumT
ype
,
checksumV
alue
,
afls_item
.
af
().
storage_class
(),
afls_item
.
af
().
df
().
owner
(),
afls_item
.
af
().
df
().
group
(),
afls_item
.
af
().
df
().
owner
_id
().
uid
(),
afls_item
.
af
().
df
().
owner_id
().
gid
(),
timeToStr
(
afls_item
.
af
().
creation_time
()),
afls_item
.
tf
().
superseded_by_vid
(),
afls_item
.
tf
().
superseded_by_f_seq
(),
...
...
@@ -421,6 +438,22 @@ void TextFormatter::printListPendingArchivesHeader() {
}
void
TextFormatter
::
print
(
const
ListPendingArchivesItem
&
lpa_item
)
{
using
namespace
cta
::
checksum
;
std
::
string
checksumType
(
"NONE"
);
std
::
string
checksumValue
;
ChecksumBlob
csb
;
ProtobufToChecksumBlob
(
lpa_item
.
af
().
csb
(),
csb
);
// Files can have multiple checksums of different types. Display only the first checksum here. All
// checksums will be listed in JSON.
if
(
!
csb
.
empty
())
{
auto
cs_it
=
csb
.
getMap
().
begin
();
checksumType
=
ChecksumTypeName
.
at
(
cs_it
->
first
);
checksumValue
=
"0x"
+
ChecksumBlob
::
ByteArrayToHex
(
cs_it
->
second
);
}
push_back
(
lpa_item
.
tapepool
(),
lpa_item
.
af
().
archive_id
(),
...
...
@@ -428,11 +461,11 @@ void TextFormatter::print(const ListPendingArchivesItem &lpa_item) {
lpa_item
.
copy_nb
(),
lpa_item
.
af
().
disk_id
(),
lpa_item
.
af
().
disk_instance
(),
lpa_item
.
af
().
cs
().
t
ype
()
,
lpa_item
.
af
().
cs
().
v
alue
()
,
checksumT
ype
,
checksumV
alue
,
dataSizeToStr
(
lpa_item
.
af
().
size
()),
lpa_item
.
af
().
df
().
owner
(),
lpa_item
.
af
().
df
().
group
(),
lpa_item
.
af
().
df
().
owner
_id
().
uid
(),
lpa_item
.
af
().
df
().
owner_id
().
gid
(),
lpa_item
.
af
().
df
().
path
()
);
}
...
...
@@ -477,8 +510,8 @@ void TextFormatter::print(const ListPendingRetrievesItem &lpr_item) {
lpr_item
.
tf
().
f_seq
(),
lpr_item
.
tf
().
block_id
(),
dataSizeToStr
(
lpr_item
.
af
().
size
()),
lpr_item
.
af
().
df
().
owner
(),
lpr_item
.
af
().
df
().
group
(),
lpr_item
.
af
().
df
().
owner
_id
().
uid
(),
lpr_item
.
af
().
df
().
owner_id
().
gid
(),
lpr_item
.
af
().
df
().
path
()
);
}
...
...
This diff is collapsed.
Click to expand it.
cmdline/EosCtaStub.cpp
+
20
−
9
View file @
9de8548e
...
...
@@ -24,7 +24,8 @@
#include
<XrdSsiPbLog.hpp>
#include
"common/dataStructures/FrontendReturnCode.hpp"
#include
<common/dataStructures/FrontendReturnCode.hpp>
#include
<common/checksum/ChecksumBlobSerDeser.hpp>
#include
"CtaFrontendApi.hpp"
...
...
@@ -109,10 +110,15 @@ void base64Decode(cta::eos::Notification ¬ification, const std::string &argva
notification
.
mutable_file
()
->
mutable_mtime
()
->
set_nsec
(
stoi
(
val
.
substr
(
pt_pos
+
1
)));
}
else
if
(
key
==
"size"
)
notification
.
mutable_file
()
->
set_size
(
stoi
(
val
));
#ifdef CTA_CHECKSUMS_DONE
else
if
(
key
==
"xstype"
)
notification
.
mutable_file
()
->
mutable_cks
()
->
set_type
(
val
);
else
if
(
key
==
"xs"
)
notification
.
mutable_file
()
->
mutable_cks
()
->
set_value
(
val
);
#endif
else
if
(
key
==
"xs"
)
{
// In principle it's possible to set the full checksum blob with multiple checksums of different
// types, but this is not currently supported in eos_wfe_stub. It's only possible to set one
// checksum, which is assumed to be of type ADLER32.
auto
cs
=
notification
.
mutable_file
()
->
mutable_csb
()
->
add_cs
();
cs
->
set_type
(
cta
::
common
::
ChecksumBlob
::
Checksum
::
ADLER32
);
cs
->
set_value
(
cta
::
checksum
::
ChecksumBlob
::
HexToByteArray
(
val
));
}
else
if
(
key
==
"mode"
)
notification
.
mutable_file
()
->
set_mode
(
stoi
(
val
));
else
if
(
key
==
"file"
)
notification
.
mutable_file
()
->
set_lpath
(
val
);
else
{
...
...
@@ -222,10 +228,15 @@ void fillNotification(cta::eos::Notification ¬ification, int argc, const char
else
if
(
argstr
==
"--diskfileowner"
)
notification
.
mutable_file
()
->
mutable_owner
()
->
set_uid
(
std
::
stoi
(
argval
));
else
if
(
argstr
==
"--diskfilegroup"
)
notification
.
mutable_file
()
->
mutable_owner
()
->
set_gid
(
std
::
stoi
(
argval
));
else
if
(
argstr
==
"--size"
)
notification
.
mutable_file
()
->
set_size
(
std
::
stoi
(
argval
));
#ifdef CTA_CHECKSUMS_DONE
else
if
(
argstr
==
"--checksumtype"
)
notification
.
mutable_file
()
->
mutable_cks
()
->
set_type
(
argval
);
else
if
(
argstr
==
"--checksumvalue"
)
notification
.
mutable_file
()
->
mutable_cks
()
->
set_value
(
argval
);
#endif
else
if
(
argstr
==
"--checksumvalue"
)
{
// In principle it's possible to set the full checksum blob with multiple checksums of different
// types, but this is not currently supported in eos_wfe_stub. It's only possible to set one
// checksum, which is assumed to be of type ADLER32.
auto
cs
=
notification
.
mutable_file
()
->
mutable_csb
()
->
add_cs
();
cs
->
set_type
(
cta
::
common
::
ChecksumBlob
::
Checksum
::
ADLER32
);
cs
->
set_value
(
cta
::
checksum
::
ChecksumBlob
::
HexToByteArray
(
argval
));
}
else
if
(
argstr
==
"--diskfilepath"
)
notification
.
mutable_file
()
->
set_lpath
(
argval
);
else
if
(
argstr
==
"--storageclass"
)
{
google
::
protobuf
::
MapPair
<
std
::
string
,
std
::
string
>
sc
(
"CTA_StorageClass"
,
argval
);
...
...
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