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_LIBHFDS3_CLIENT_DIRECTORY_ITERATOR_H_
29#define _HDFS_LIBHFDS3_CLIENT_DIRECTORY_ITERATOR_H_
30
31#include "FileStatus.h"
32#include <vector>
33
34namespace Hdfs {
35namespace Internal {
36class FileSystemImpl;
37}
38
39class DirectoryIterator {
40public:
41 DirectoryIterator();
42 DirectoryIterator(Hdfs::Internal::FileSystemImpl * const fs,
43 std::string path, bool needLocations);
44 DirectoryIterator(const DirectoryIterator & it);
45 DirectoryIterator & operator = (const DirectoryIterator & it);
46 bool hasNext();
47 FileStatus getNext();
48
49private:
50 bool getListing();
51
52private:
53 bool needLocations;
54 Hdfs::Internal::FileSystemImpl * filesystem;
55 size_t next;
56 std::string path;
57 std::string startAfter;
58 std::vector<FileStatus> lists;
59};
60
61}
62
63#endif /* _HDFS_LIBHFDS3_CLIENT_DIRECTORY_ITERATOR_H_ */
64