| 1 | /******************************************************************** |
| 2 | * Copyright (c) 2013 - 2014, Pivotal Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Author: Zhanwei Wang |
| 6 | ********************************************************************/ |
| 7 | /******************************************************************** |
| 8 | * 2014 - |
| 9 | * open source under Apache License Version 2.0 |
| 10 | ********************************************************************/ |
| 11 | /** |
| 12 | * Licensed to the Apache Software Foundation (ASF) under one |
| 13 | * or more contributor license agreements. See the NOTICE file |
| 14 | * distributed with this work for additional information |
| 15 | * regarding copyright ownership. The ASF licenses this file |
| 16 | * to you under the Apache License, Version 2.0 (the |
| 17 | * "License"); you may not use this file except in compliance |
| 18 | * with the License. You may obtain a copy of the License at |
| 19 | * |
| 20 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 21 | * |
| 22 | * Unless required by applicable law or agreed to in writing, software |
| 23 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 25 | * See the License for the specific language governing permissions and |
| 26 | * limitations under the License. |
| 27 | */ |
| 28 | #ifndef _HDFS_LIBHDFS3_CLIENT_FSSTATS_H_ |
| 29 | #define _HDFS_LIBHDFS3_CLIENT_FSSTATS_H_ |
| 30 | |
| 31 | #include <stdint.h> |
| 32 | |
| 33 | namespace Hdfs { |
| 34 | |
| 35 | /** |
| 36 | * file system statistics |
| 37 | */ |
| 38 | class FileSystemStats { |
| 39 | public: |
| 40 | /** |
| 41 | * To construct a FileSystemStats. |
| 42 | */ |
| 43 | FileSystemStats() : |
| 44 | capacity(-1), used(-1), remaining(-1) { |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * To construct a FileSystemStats with given values. |
| 49 | * @param capacity the capacity of file system. |
| 50 | * @param used the space which has been used. |
| 51 | * @param remaining available space on file system. |
| 52 | */ |
| 53 | FileSystemStats(int64_t capacity, int64_t used, int64_t remaining) : |
| 54 | capacity(capacity), used(used), remaining(remaining) { |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Return the capacity in bytes of the file system |
| 59 | * @return capacity of file system. |
| 60 | */ |
| 61 | int64_t getCapacity() { |
| 62 | return capacity; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Return the number of bytes used on the file system |
| 67 | * @return return used space. |
| 68 | */ |
| 69 | int64_t getUsed() { |
| 70 | return used; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Return the number of remaining bytes on the file system |
| 75 | * @return return available space. |
| 76 | */ |
| 77 | int64_t getRemaining() { |
| 78 | return remaining; |
| 79 | } |
| 80 | |
| 81 | private: |
| 82 | int64_t capacity; |
| 83 | int64_t used; |
| 84 | int64_t remaining; |
| 85 | |
| 86 | }; |
| 87 | |
| 88 | } |
| 89 | #endif /* _HDFS_LIBHDFS3_CLIENT_FSSTATS_H_ */ |
| 90 | |