1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 package org.apache.hadoop.fs.s3native;
20 
21 import java.io.File;
22 import java.io.IOException;
23 import java.io.InputStream;
24 import java.net.URI;
25 
26 import org.apache.hadoop.classification.InterfaceAudience;
27 import org.apache.hadoop.classification.InterfaceStability;
28 import org.apache.hadoop.conf.Configuration;
29 
30 /**
31  * <p>
32  * An abstraction for a key-based {@link File} store.
33  * </p>
34  */
35 @InterfaceAudience.Private
36 @InterfaceStability.Unstable
37 interface NativeFileSystemStore {
38 
initialize(URI uri, Configuration conf)39   void initialize(URI uri, Configuration conf) throws IOException;
40 
storeFile(String key, File file, byte[] md5Hash)41   void storeFile(String key, File file, byte[] md5Hash) throws IOException;
storeEmptyFile(String key)42   void storeEmptyFile(String key) throws IOException;
43 
retrieveMetadata(String key)44   FileMetadata retrieveMetadata(String key) throws IOException;
retrieve(String key)45   InputStream retrieve(String key) throws IOException;
retrieve(String key, long byteRangeStart)46   InputStream retrieve(String key, long byteRangeStart) throws IOException;
47 
list(String prefix, int maxListingLength)48   PartialListing list(String prefix, int maxListingLength) throws IOException;
list(String prefix, int maxListingLength, String priorLastKey, boolean recursive)49   PartialListing list(String prefix, int maxListingLength, String priorLastKey, boolean recursive)
50     throws IOException;
51 
delete(String key)52   void delete(String key) throws IOException;
53 
copy(String srcKey, String dstKey)54   void copy(String srcKey, String dstKey) throws IOException;
55 
56   /**
57    * Delete all keys with the given prefix. Used for testing.
58    * @throws IOException
59    */
purge(String prefix)60   void purge(String prefix) throws IOException;
61 
62   /**
63    * Diagnostic method to dump state to the console.
64    * @throws IOException
65    */
dump()66   void dump() throws IOException;
67 }
68