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_BLOCKLOCATION_H_
29#define _HDFS_LIBHDFS3_CLIENT_BLOCKLOCATION_H_
30
31#include <string>
32#include <vector>
33
34namespace Hdfs {
35
36class BlockLocation {
37public:
38 bool isCorrupt() const {
39 return corrupt;
40 }
41
42 void setCorrupt(bool corrupt) {
43 this->corrupt = corrupt;
44 }
45
46 const std::vector<std::string> & getHosts() const {
47 return hosts;
48 }
49
50 void setHosts(const std::vector<std::string> & hosts) {
51 this->hosts = hosts;
52 }
53
54 int64_t getLength() const {
55 return length;
56 }
57
58 void setLength(int64_t length) {
59 this->length = length;
60 }
61
62 const std::vector<std::string> & getNames() const {
63 return names;
64 }
65
66 void setNames(const std::vector<std::string> & names) {
67 this->names = names;
68 }
69
70 int64_t getOffset() const {
71 return offset;
72 }
73
74 void setOffset(int64_t offset) {
75 this->offset = offset;
76 }
77
78 const std::vector<std::string> & getTopologyPaths() const {
79 return topologyPaths;
80 }
81
82 void setTopologyPaths(const std::vector<std::string> & topologyPaths) {
83 this->topologyPaths = topologyPaths;
84 }
85
86private:
87 bool corrupt;
88 int64_t length;
89 int64_t offset; // Offset of the block in the file
90 std::vector<std::string> hosts; // Datanode hostnames
91 std::vector<std::string> names; // Datanode IP:xferPort for accessing the block
92 std::vector<std::string> topologyPaths; // Full path name in network topology
93};
94
95}
96
97#endif /* _HDFS_LIBHDFS3_CLIENT_BLOCKLOCATION_H_ */
98