Support HDFS Tiering (#7484)

This is the 1st step to supporting HDFS Tiering
Changes:

Add new mounted folder icon. Will have separate commit for file icon
Disable delete/mkdir/upload for mounted files and folders
Disable delete for root HDFS folder (this was added in error)
This commit is contained in:
Kevin Cunnane
2019-10-03 14:48:19 -07:00
committed by GitHub
parent 18c12dac9a
commit e85f93abec
8 changed files with 146 additions and 20 deletions

View File

@@ -0,0 +1,19 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Information about a HDFS mount to a remote directory
*/
export interface Mount {
mountPath: string;
mountStatus: string;
remotePath: string;
}
export enum MountStatus {
None = 0,
Mount = 1,
Mount_Child = 2
}

View File

@@ -12,6 +12,7 @@ import * as nls from 'vscode-nls';
import * as auth from '../util/auth';
import { IHdfsOptions, IRequestParams } from '../objectExplorerNodeProvider/fileSources';
import { IAclStatus, AclEntry, parseAcl, AclPermissionType, parseAclPermissionFromOctal, AclEntryScope } from './aclEntry';
import { Mount } from './mount';
import { everyoneName } from '../localizedConstants';
const localize = nls.loadMessageBundle();
@@ -472,6 +473,26 @@ export class WebHDFS {
});
}
/**
* Get all mounts for a HDFS connection
* @param callback Callback to handle the response
* @returns void
*/
public getMounts(callback: (error: HdfsError, mounts: Mount[]) => void): void {
let endpoint = this.getOperationEndpoint('listmounts', '');
this.sendRequest('GET', endpoint, undefined, (error, response) => {
if (!callback) { return; }
if (error) {
callback(error, undefined);
} else if (response.body.hasOwnProperty('Mounts')) {
const mounts = response.body.Mounts;
callback(undefined, mounts);
} else {
callback(new HdfsError(ErrorMessageInvalidDataStructure), undefined);
}
});
}
/**
* Check file existence
* Wraps stat method