Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
medialibrary
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Pierre Lamot
medialibrary
Commits
062d4ba0
Commit
062d4ba0
authored
1 year ago
by
Duncan McNamara
Committed by
Alaric Senat
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
FsDiscoverer: Rename "entry point" to "root"
Co-Authored-by:
Alaric Senat
<
dev.asenat@posteo.net
>
parent
abe5007f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/discoverer/FsDiscoverer.cpp
+15
-15
15 additions, 15 deletions
src/discoverer/FsDiscoverer.cpp
src/discoverer/FsDiscoverer.h
+2
-2
2 additions, 2 deletions
src/discoverer/FsDiscoverer.h
with
17 additions
and
17 deletions
src/discoverer/FsDiscoverer.cpp
+
15
−
15
View file @
062d4ba0
...
...
@@ -79,7 +79,7 @@ bool FsDiscoverer::reloadFolder( std::shared_ptr<Folder> f,
auto
device
=
fsFactory
.
createDeviceFromMrl
(
mrl
);
if
(
device
==
nullptr
||
device
->
isRemovable
()
==
false
)
{
LOG_DEBUG
(
"Failed to find folder matching
entrypoin
t "
,
mrl
,
". "
LOG_DEBUG
(
"Failed to find folder matching
roo
t "
,
mrl
,
". "
"Removing that folder"
);
Folder
::
remove
(
m_ml
,
std
::
move
(
f
),
Folder
::
RemovalBehavior
::
RemovedFromDisk
);
return
false
;
...
...
@@ -145,7 +145,7 @@ void FsDiscoverer::checkRemovedDevices( fs::IDirectory& fsFolder,
// - ignore it when we're discovering a new folder.
// - delete it when it was discovered in the past. This is likely to be due to a permission change
// as we would not check the folder if it wasn't present during the parent folder browsing
// but it might also be that we're checking a
n entry point
.
// but it might also be that we're checking a
root folder
.
// The error won't arise earlier, as we only perform IO when reading the folder from this function.
// If we ever came across this folder, its content is now unaccessible: let's remove it.
Folder
::
remove
(
m_ml
,
std
::
move
(
folder
),
...
...
@@ -200,7 +200,7 @@ bool FsDiscoverer::reload()
catch
(
const
fs
::
errors
::
DeviceRemoved
&
ex
)
{
// If the device was removed, let's wait until it comes back, but
// don't abort all
entry point
s reloading
// don't abort all
root folder
s reloading
LOG_INFO
(
"Can't reload folder on a removed device"
);
continue
;
}
...
...
@@ -226,22 +226,22 @@ bool FsDiscoverer::reload()
return
true
;
}
bool
FsDiscoverer
::
reload
(
const
std
::
string
&
entryPoin
t
)
bool
FsDiscoverer
::
reload
(
const
std
::
string
&
roo
t
)
{
resetInterrupt
();
auto
fsFactory
=
m_ml
->
fsFactoryForMrl
(
entryPoin
t
);
auto
fsFactory
=
m_ml
->
fsFactoryForMrl
(
roo
t
);
if
(
fsFactory
==
nullptr
)
return
false
;
auto
folder
=
Folder
::
fromMrl
(
m_ml
,
entryPoin
t
);
auto
folder
=
Folder
::
fromMrl
(
m_ml
,
roo
t
);
if
(
folder
==
nullptr
)
{
LOG_ERROR
(
"Can't reload "
,
entryPoin
t
,
": folder wasn't found in database"
);
LOG_ERROR
(
"Can't reload "
,
roo
t
,
": folder wasn't found in database"
);
return
false
;
}
if
(
folder
->
isPresent
()
==
false
)
{
LOG_INFO
(
"Folder "
,
entryPoin
t
,
" isn't present, and therefore won't "
LOG_INFO
(
"Folder "
,
roo
t
,
" isn't present, and therefore won't "
"be reloaded"
);
return
false
;
}
...
...
@@ -249,29 +249,29 @@ bool FsDiscoverer::reload( const std::string& entryPoint )
return
true
;
}
bool
FsDiscoverer
::
add
EntryPoin
t
(
const
std
::
string
&
entryPoin
t
)
bool
FsDiscoverer
::
add
Roo
t
(
const
std
::
string
&
roo
t
)
{
auto
fsFactory
=
m_ml
->
fsFactoryForMrl
(
entryPoin
t
);
auto
fsFactory
=
m_ml
->
fsFactoryForMrl
(
roo
t
);
if
(
fsFactory
==
nullptr
)
return
false
;
std
::
shared_ptr
<
fs
::
IDirectory
>
fsDir
;
try
{
fsDir
=
fsFactory
->
createDirectory
(
entryPoin
t
);
fsDir
=
fsFactory
->
createDirectory
(
roo
t
);
}
catch
(
const
fs
::
errors
::
System
&
ex
)
{
LOG_ERROR
(
"Can't create IDirectory to represent "
,
entryPoin
t
,
LOG_ERROR
(
"Can't create IDirectory to represent "
,
roo
t
,
": "
,
ex
.
what
()
);
return
false
;
}
/*
* We are about to add a
n entry point
, and will need a device representation.
* We are about to add a
root folder
, and will need a device representation.
* Since this is a function that's (indirectly) called explicitly by the users
* from a background thread, we can afford to wait a bit.
*/
if
(
fsFactory
->
waitForDevice
(
entryPoin
t
,
5000
)
==
false
)
if
(
fsFactory
->
waitForDevice
(
roo
t
,
5000
)
==
false
)
return
false
;
// Use the canonical path computed by IDirectory
try
...
...
@@ -280,7 +280,7 @@ bool FsDiscoverer::addEntryPoint( const std::string& entryPoint )
}
catch
(
const
sqlite
::
errors
::
ConstraintViolation
&
ex
)
{
LOG_WARN
(
"Can't add
entrypoint "
,
entryPoin
t
,
": "
,
ex
.
what
()
);
LOG_WARN
(
"Can't add
root "
,
roo
t
,
": "
,
ex
.
what
()
);
return
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/discoverer/FsDiscoverer.h
+
2
−
2
View file @
062d4ba0
...
...
@@ -42,8 +42,8 @@ class FsDiscoverer
public:
FsDiscoverer
(
MediaLibrary
*
ml
,
FsHolder
&
fsHolder
,
IMediaLibraryCb
*
cb
);
bool
reload
();
bool
reload
(
const
std
::
string
&
entryPoin
t
);
bool
add
EntryPoin
t
(
const
std
::
string
&
entryPoin
t
);
bool
reload
(
const
std
::
string
&
roo
t
);
bool
add
Roo
t
(
const
std
::
string
&
roo
t
);
/**
* @brief interrupt Interrupts the current operation and return ASAP
*/
...
...
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