Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
crest-cmd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Insights
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
crest-db
crest-cmd
Commits
ef301215
Commit
ef301215
authored
8 months ago
by
Mikhail Mineev
Browse files
Options
Downloads
Patches
Plain Diff
crestCopy utility rewritten
parent
a92636dd
Branches
Branches containing commit
No related tags found
1 merge request
!13
Upd16
Pipeline
#10363863
passed
8 months ago
Stage: build_docker_image
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/crestCopy.cxx
+24
-70
24 additions, 70 deletions
src/crestCopy.cxx
with
24 additions
and
70 deletions
src/crestCopy.cxx
+
24
−
70
View file @
ef301215
...
...
@@ -276,7 +276,7 @@ int main(int argc, char *argv[])
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
std
::
endl
<<
"Cannot
write tag
:"
<<
std
::
endl
;
<<
"Cannot
create a new tag
\"
"
<<
NEW_TAG
<<
"
:"
<<
std
::
endl
;
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
}
}
...
...
@@ -293,7 +293,7 @@ int main(int argc, char *argv[])
try
{
TagMetaDto
tagMetaInfo
=
crestSource
->
findTagMeta
(
TAG_NAME
);
// NEW
TagMetaDto
tagMetaInfo
=
crestSource
->
findTagMeta
(
TAG_NAME
);
TagMetaDto
newTagMetaInfo
=
tagMetaInfo
;
newTagMetaInfo
.
setTagName
(
NEW_TAG
);
...
...
@@ -316,27 +316,29 @@ int main(int argc, char *argv[])
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
}
// This code fragment works when one or more time interval limits are set (i.e. since-until).
// It uses selectIovs(TAG_NAME, SINCE, UNTIL) method.
if
(
FLAG
==
1
)
{
std
::
cout
<<
"ALGORITHM 2 (selectIovs):"
<<
std
::
endl
;
int
page_number
=
0
;
int
current_page
=
0
;
int
step
=
0
;
do
{
IovSetDto
dto
;
try
{
dto
=
crestSource
->
selectIovs
(
TAG_NAME
,
SINCE
,
UNTIL
,
SNAPSHOT
,
10000
,
0
,
"id.since:ASC"
);
dto
=
crestSource
->
selectIovs
(
TAG_NAME
,
SINCE
,
UNTIL
,
SNAPSHOT
,
PAGE_SIZE
,
step
,
"id.since:ASC"
);
IovSetDto
destDto
=
copyIovSetDto
(
dto
,
NEW_TAG
);
std
::
cout
<<
std
::
endl
<<
" IOV list to be copied into TAG "
<<
NEW_TAG
<<
std
::
endl
<<
destDto
.
toJson
().
dump
(
4
)
<<
std
::
endl
;
IovSetDto
storedDto
=
crestSource
->
storeIovs
(
destDto
);
/*
// IOV list printing:
std::cout << std::endl
<< " IOV list copied into TAG " << NEW_TAG << std::endl
<< storedDto.toJson().dump(4) << std::endl;
*/
}
catch
(
const
std
::
exception
&
e
)
{
...
...
@@ -345,75 +347,27 @@ int main(int argc, char *argv[])
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
exit
(
0
);
}
}
else
// without since/until
{
// This code fragment works when the time interval is not set (i.e. since-until).
// It uses findAllIovs method.
// IOVs
nlohmann
::
json
iovList
;
auto
rpage
=
dto
.
getRespPage
();
if
(
rpage
)
{
// IOV number:
page_number
=
rpage
->
getTotalPages
();
current_page
=
rpage
->
getNumber
();
step
=
current_page
+
1
;
int
iovSize
=
0
;
try
{
iovSize
=
crestSource
->
getSize
(
TAG_NAME
);
std
::
cout
<<
std
::
endl
<<
" IOV Number for TAG
\"
"
<<
TAG_NAME
<<
"
\"
= "
<<
iovSize
<<
std
::
endl
;
std
::
cout
<<
"total page number = "
<<
page_number
<<
std
::
endl
;
std
::
cout
<<
"current page number = "
<<
current_page
<<
std
::
endl
;
std
::
cout
<<
"step = "
<<
current_page
<<
std
::
endl
;
}
catch
(
const
std
::
exception
&
e
)
else
{
std
::
cerr
<<
std
::
endl
<<
"Cannot get IOV number for tag with name
\"
"
<<
TAG_NAME
<<
"
\"
"
<<
std
::
endl
;
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
<<
"Cannot get page information from IOV list for tag
\"
"
<<
TAG_NAME
<<
"
\"
"
<<
std
::
endl
;
exit
(
0
);
}
int
stepNumber
=
iovSize
/
PAGE_SIZE
;
int
stepsA
=
iovSize
%
PAGE_SIZE
;
if
(
stepsA
!=
0
)
stepNumber
=
stepNumber
+
1
;
// the data recieved by pages:
for
(
int
i
=
0
;
i
<
stepNumber
;
i
++
)
{
nlohmann
::
json
iovList
=
nlohmann
::
json
::
array
();
// DATA_SOURCE == "server"
try
{
std
::
cout
<<
"ALGORITHM for copying page by page....:"
<<
std
::
endl
;
IovSetDto
dto
=
crestSource
->
selectIovs
(
TAG_NAME
,
0
,
-
1
,
SNAPSHOT
,
PAGE_SIZE
,
i
,
"id.since:ASC"
);
IovSetDto
destDto
=
copyIovSetDto
(
dto
,
NEW_TAG
);
std
::
cout
<<
std
::
endl
<<
" IOV list to be copied into TAG "
<<
NEW_TAG
<<
std
::
endl
<<
destDto
.
toJson
().
dump
(
4
)
<<
std
::
endl
;
IovSetDto
storedDto
=
crestSource
->
storeIovs
(
destDto
);
// IOV list printing:
std
::
cout
<<
std
::
endl
<<
" IOV list copied into TAG "
<<
NEW_TAG
<<
std
::
endl
<<
storedDto
.
toJson
().
dump
(
4
)
<<
std
::
endl
;
nlohmann
::
json
iov_data
=
dto
.
toJson
();
iovList
=
getResources
(
iov_data
);
}
// findAllIovsFs
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
"ERROR: Cannot get an IOV list for the tag
\"
"
<<
TAG_NAME
<<
"
\"
"
<<
std
::
endl
;
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
exit
(
0
);
}
// findAllIovs
}
// i
}
while
(
step
<
page_number
);
std
::
cout
<<
"The tag "
<<
TAG_NAME
<<
" copied in to tag "
<<
NEW_TAG
<<
std
::
endl
;
}
// else (end)
return
retv
;
}
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
sign in
to comment