Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
OpenSpace
Commits
9715d22a
Commit
9715d22a
authored
3 years ago
by
Alexander Bock
Browse files
Options
Download
Email Patches
Plain Diff
Include the version number in the uid of the HttpSynchronization (closes #2081)
parent
2816ad4d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
include/openspace/util/resourcesynchronization.h
+2
-11
include/openspace/util/resourcesynchronization.h
modules/sync/syncs/httpsynchronization.cpp
+4
-0
modules/sync/syncs/httpsynchronization.cpp
modules/sync/syncs/httpsynchronization.h
+2
-0
modules/sync/syncs/httpsynchronization.h
modules/sync/syncs/urlsynchronization.cpp
+4
-0
modules/sync/syncs/urlsynchronization.cpp
modules/sync/syncs/urlsynchronization.h
+2
-0
modules/sync/syncs/urlsynchronization.h
src/scene/assetmanager.cpp
+4
-5
src/scene/assetmanager.cpp
src/util/resourcesynchronization.cpp
+0
-5
src/util/resourcesynchronization.cpp
with
18 additions
and
21 deletions
+18
-21
include/openspace/util/resourcesynchronization.h
+
2
-
11
View file @
9715d22a
...
...
@@ -70,18 +70,9 @@ public:
const
ghoul
::
Dictionary
&
dictionary
);
/**
* Generates a unique identifying string for the dictionary that is based on the
* \c Type and the \c Identifier values of the passed \p dictionary. All other
* parameters are ignored, but as long as the \c Type and/or the \c Identifier values
* differ, the resulting string will be different.
*
* \param dictionary The dictionary containing the \c Type and the \c Identifier used
* to create a unique identifier
*
* \throw SpecificationError If the \p dictionary does not contain a \c Type, an
* \c Identifier, and a \c Name
* Generates a unique identifying string for ResourceSynchronizaiton.
*/
static
std
::
string
generateUid
(
const
ghoul
::
Dictionary
&
dictionary
)
;
virtual
std
::
string
generateUid
(
)
=
0
;
/// Defaulted virtual constructor
virtual
~
ResourceSynchronization
()
=
default
;
...
...
This diff is collapsed.
Click to expand it.
modules/sync/syncs/httpsynchronization.cpp
+
4
-
0
View file @
9715d22a
...
...
@@ -117,6 +117,10 @@ void HttpSynchronization::cancel() {
_state
=
State
::
Unsynced
;
}
std
::
string
HttpSynchronization
::
generateUid
()
{
return
fmt
::
format
(
"{}/{}"
,
_identifier
,
_version
);
}
bool
HttpSynchronization
::
trySyncFromUrl
(
std
::
string
listUrl
)
{
HttpMemoryDownload
fileListDownload
(
std
::
move
(
listUrl
));
fileListDownload
.
onProgress
([
&
c
=
_shouldCancel
](
int64_t
,
std
::
optional
<
int64_t
>
)
{
...
...
This diff is collapsed.
Click to expand it.
modules/sync/syncs/httpsynchronization.h
+
2
-
0
View file @
9715d22a
...
...
@@ -87,6 +87,8 @@ public:
/// Cancels any ongoing synchronization of this ResourceSynchronization
void
cancel
()
override
;
std
::
string
generateUid
()
override
;
static
documentation
::
Documentation
Documentation
();
private:
...
...
This diff is collapsed.
Click to expand it.
modules/sync/syncs/urlsynchronization.cpp
+
4
-
0
View file @
9715d22a
...
...
@@ -245,4 +245,8 @@ void UrlSynchronization::cancel() {
_state
=
State
::
Unsynced
;
}
std
::
string
UrlSynchronization
::
generateUid
()
{
return
_identifier
;
}
}
// namespace openspace
This diff is collapsed.
Click to expand it.
modules/sync/syncs/urlsynchronization.h
+
2
-
0
View file @
9715d22a
...
...
@@ -73,6 +73,8 @@ public:
/// Cancels any ongoing synchronization of this ResourceSynchronization
void
cancel
()
override
;
std
::
string
generateUid
()
override
;
static
documentation
::
Documentation
Documentation
();
private:
...
...
This diff is collapsed.
Click to expand it.
src/scene/assetmanager.cpp
+
4
-
5
View file @
9715d22a
...
...
@@ -495,14 +495,13 @@ void AssetManager::setUpAssetLuaTable(Asset* asset) {
Asset
*
thisAsset
=
ghoul
::
lua
::
userData
<
Asset
>
(
L
,
2
);
ghoul
::
lua
::
checkArgumentsAndThrow
(
L
,
1
,
"lua::syncedResourceLua"
);
ghoul
::
Dictionary
d
=
ghoul
::
lua
::
value
<
ghoul
::
Dictionary
>
(
L
);
std
::
string
uid
=
ResourceSynchronization
::
generateUid
(
d
);
std
::
unique_ptr
<
ResourceSynchronization
>
s
=
ResourceSynchronization
::
createFromDictionary
(
d
);
std
::
string
uid
=
d
.
value
<
std
::
string
>
(
"Type"
)
+
"/"
+
s
->
generateUid
();
SyncItem
*
syncItem
=
nullptr
;
auto
it
=
manager
->
_synchronizations
.
find
(
uid
);
if
(
it
==
manager
->
_synchronizations
.
end
())
{
std
::
unique_ptr
<
ResourceSynchronization
>
s
=
ResourceSynchronization
::
createFromDictionary
(
d
);
auto
si
=
std
::
make_unique
<
SyncItem
>
();
si
->
synchronization
=
std
::
move
(
s
);
si
->
assets
.
push_back
(
thisAsset
);
...
...
This diff is collapsed.
Click to expand it.
src/util/resourcesynchronization.cpp
+
0
-
5
View file @
9715d22a
...
...
@@ -68,11 +68,6 @@ std::unique_ptr<ResourceSynchronization> ResourceSynchronization::createFromDict
return
std
::
unique_ptr
<
ResourceSynchronization
>
(
sync
);
}
std
::
string
ResourceSynchronization
::
generateUid
(
const
ghoul
::
Dictionary
&
dictionary
)
{
const
Parameters
p
=
codegen
::
bake
<
Parameters
>
(
dictionary
);
return
fmt
::
format
(
"{}/{}"
,
p
.
type
,
p
.
identifier
);
}
ResourceSynchronization
::
ResourceSynchronization
(
std
::
filesystem
::
path
synchronizationRoot
)
:
_synchronizationRoot
(
std
::
move
(
synchronizationRoot
))
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment