1 /**
2  *
3  * Licensed under the Apache License, Version 2.0
4  * (the "License"); you may not use this file except in compliance with
5  * the License. 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
12  * implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  *
15  * @author: Sriram Rao (Kosmix Corp.)
16  *
17  * We need to provide the ability to the code in fs/kfs without really
18  * having a KFS deployment.  In particular, the glue code that wraps
19  * around calls to KfsAccess object.  This is accomplished by defining a
20  * filesystem implementation interface:
21  *   -- for testing purposes, a dummy implementation of this interface
22  * will suffice; as long as the dummy implementation is close enough
23  * to doing what KFS does, we are good.
24  *   -- for deployment purposes with KFS, this interface is
25  * implemented by the KfsImpl object.
26  */
27 
28 package org.apache.hadoop.fs.kfs;
29 
30 import java.io.*;
31 
32 import org.apache.hadoop.fs.FSDataInputStream;
33 import org.apache.hadoop.fs.FSDataOutputStream;
34 import org.apache.hadoop.fs.FileStatus;
35 import org.apache.hadoop.fs.Path;
36 
37 interface IFSImpl {
exists(String path)38     public boolean exists(String path) throws IOException;
isDirectory(String path)39     public boolean isDirectory(String path) throws IOException;
isFile(String path)40     public boolean isFile(String path) throws IOException;
readdir(String path)41     public String[] readdir(String path) throws IOException;
readdirplus(Path path)42     public FileStatus[] readdirplus(Path path) throws IOException;
43 
mkdirs(String path)44     public int mkdirs(String path) throws IOException;
rename(String source, String dest)45     public int rename(String source, String dest) throws IOException;
46 
rmdir(String path)47     public int rmdir(String path) throws IOException;
remove(String path)48     public int remove(String path) throws IOException;
filesize(String path)49     public long filesize(String path) throws IOException;
getReplication(String path)50     public short getReplication(String path) throws IOException;
setReplication(String path, short replication)51     public short setReplication(String path, short replication) throws IOException;
getDataLocation(String path, long start, long len)52     public String[][] getDataLocation(String path, long start, long len) throws IOException;
53 
getModificationTime(String path)54     public long getModificationTime(String path) throws IOException;
create(String path, short replication, int bufferSize)55     public FSDataOutputStream create(String path, short replication, int bufferSize) throws IOException;
open(String path, int bufferSize)56     public FSDataInputStream open(String path, int bufferSize) throws IOException;
57 
58 };
59