storage: add getStatus hook
This commit is contained in:
@@ -10,6 +10,7 @@ exports = module.exports = {
|
||||
injectPrivateFields,
|
||||
|
||||
getAvailableSize,
|
||||
getStatus,
|
||||
|
||||
upload,
|
||||
download,
|
||||
@@ -63,6 +64,21 @@ async function getAvailableSize(config) {
|
||||
return dfResult.available;
|
||||
}
|
||||
|
||||
async function getStatus(config) {
|
||||
assert.strictEqual(typeof config, 'object');
|
||||
|
||||
let hostPath;
|
||||
if (mounts.isManagedProvider(config._provider)) {
|
||||
hostPath = config._managedMountPath;
|
||||
} else if (config._provider === 'mountpoint') {
|
||||
hostPath = config.mountPoint;
|
||||
} else if (config._provider === 'filesystem') {
|
||||
hostPath = config.backupDir;
|
||||
}
|
||||
|
||||
return await mounts.getStatus(config._provider, hostPath); // { state, message }
|
||||
}
|
||||
|
||||
function hasChownSupportSync(config) {
|
||||
switch (config._provider) {
|
||||
case mounts.MOUNT_TYPE_NFS:
|
||||
|
||||
Reference in New Issue
Block a user