1/* 2* Copyright (C) 2022 Huawei Device Co., Ltd. 3* Licensed under the Apache License, Version 2.0 (the "License"); 4* you may not use this file except in compliance with the License. 5* You may obtain a copy of the License at 6* 7* http://www.apache.org/licenses/LICENSE-2.0 8* 9* Unless required by applicable law or agreed to in writing, software 10* distributed under the License is distributed on an "AS IS" BASIS, 11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12* See the License for the specific language governing permissions and 13* limitations under the License. 14*/ 15 16import {AsyncCallback, Callback} from "./basic"; 17 18/** 19 * Provides volumemanager statistics APIs 20 * 21 * @since 9 22 * @syscap SystemCapability.FileManagement.StorageService.Volume 23 * @systemapi 24 */ 25declare namespace volumeManager { 26 27/** 28 * Get All Volumes 29 * 30 * @since 9 31 * @systemapi 32 */ 33 export interface Volume { 34 id: string; 35 uuid: string; 36 diskId: string; 37 description: string; 38 removable: boolean; 39 state: number; 40 path: string; 41} 42/** 43 * Get All Volumes 44 * 45 * @since 9 46 * @syscap SystemCapability.FileManagement.StorageService.Volume 47 * @permission ohos.permission.STORAGE_MANAGER 48 * @systemapi 49 */ 50function getAllVolumes(callback: AsyncCallback<Array<Volume>>): void; 51function getAllVolumes(): Promise<Array<Volume>>; 52 53 54 /** 55 * Mount 56 * 57 * @since 9 58 * @syscap SystemCapability.FileManagement.StorageService.Volume 59 * @permission ohos.permission.MOUNT_UNMOUNT_MANAGER 60 * @systemapi 61 */ 62function mount(volumeId: string, callback: AsyncCallback<void>): void; 63function mount(volumeId: string): Promise<void>; 64 65/** 66 * UnMount 67 * 68 * @since 9 69 * @syscap SystemCapability.FileManagement.StorageService.Volume 70 * @permission ohos.permission.MOUNT_UNMOUNT_MANAGER 71 * @systemapi 72 */ 73function unmount(volumeId: string, callback: AsyncCallback<void>): void; 74function unmount(volumeId: string): Promise<void>; 75 76 77/** 78 * Get the volume by uuid. 79 * 80 * @since 9 81 * @syscap SystemCapability.FileManagement.StorageService.Volume 82 * @permission ohos.permission.STORAGE_MANAGER 83 * @systemapi 84 */ 85 function getVolumeByUuid(uuid: string, callback: AsyncCallback<Volume>): void; 86 function getVolumeByUuid(uuid: string): Promise<Volume>; 87 88/** 89 * Get the volume by id. 90 * 91 * @since 9 92 * @syscap SystemCapability.FileManagement.StorageService.Volume 93 * @permission ohos.permission.STORAGE_MANAGER 94 * @systemapi 95 */ 96function getVolumeById(volumeId: string, callback: AsyncCallback<Volume>): void; 97function getVolumeById(volumeId: string): Promise<Volume>; 98 99/** 100 * Set the description of volume. 101 * 102 * @since 9 103 * @syscap SystemCapability.FileManagement.StorageService.Volume 104 * @permission ohos.permission.MOUNT_UNMOUNT_MANAGER 105 * @systemapi 106 */ 107function setVolumeDescription(uuid: string, description: string, callback: AsyncCallback<boolean>): void; 108function setVolumeDescription(uuid: string, description: string): Promise<boolean>; 109 110/** 111 * Format. 112 * 113 * @since 9 114 * @syscap SystemCapability.FileManagement.StorageService.Volume 115 * @permission ohos.permission.MOUNT_FORMAT_MANAGER 116 * @systemapi 117 */ 118function format(volumeId: string, fsType: string, callback: AsyncCallback<boolean>): void; 119function format(volumeId: string, fsType: string): Promise<boolean>; 120 121 122/** 123 * Partition. 124 * 125 * @since 9 126 * @syscap SystemCapability.FileManagement.StorageService.Volume 127 * @permission ohos.permission.MOUNT_FORMAT_MANAGER 128 * @systemapi 129 */ 130function partition(diskId: string, type: number, callback: AsyncCallback<boolean>): void; 131function partition(diskId: string, type: number): Promise<boolean>; 132} 133 134export default volumeManager; 135