• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 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 implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #ifndef TENSORFLOW_CORE_PLATFORM_NULL_FILE_SYSTEM_H_
17 #define TENSORFLOW_CORE_PLATFORM_NULL_FILE_SYSTEM_H_
18 
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 #include "tensorflow/core/platform/env.h"
24 #include "tensorflow/core/platform/file_system.h"
25 #include "tensorflow/core/platform/file_system_helper.h"
26 
27 namespace tensorflow {
28 
29 // START_SKIP_DOXYGEN
30 
31 #ifndef SWIG
32 // Degenerate file system that provides no implementations.
33 class NullFileSystem : public FileSystem {
34  public:
NullFileSystem()35   NullFileSystem() {}
36 
37   ~NullFileSystem() override = default;
38 
39   TF_USE_FILESYSTEM_METHODS_WITH_NO_TRANSACTION_SUPPORT;
40 
NewRandomAccessFile(const string & fname,TransactionToken * token,std::unique_ptr<RandomAccessFile> * result)41   Status NewRandomAccessFile(
42       const string& fname, TransactionToken* token,
43       std::unique_ptr<RandomAccessFile>* result) override {
44     return errors::Unimplemented("NewRandomAccessFile unimplemented");
45   }
46 
NewWritableFile(const string & fname,TransactionToken * token,std::unique_ptr<WritableFile> * result)47   Status NewWritableFile(const string& fname, TransactionToken* token,
48                          std::unique_ptr<WritableFile>* result) override {
49     return errors::Unimplemented("NewWritableFile unimplemented");
50   }
51 
NewAppendableFile(const string & fname,TransactionToken * token,std::unique_ptr<WritableFile> * result)52   Status NewAppendableFile(const string& fname, TransactionToken* token,
53                            std::unique_ptr<WritableFile>* result) override {
54     return errors::Unimplemented("NewAppendableFile unimplemented");
55   }
56 
NewReadOnlyMemoryRegionFromFile(const string & fname,TransactionToken * token,std::unique_ptr<ReadOnlyMemoryRegion> * result)57   Status NewReadOnlyMemoryRegionFromFile(
58       const string& fname, TransactionToken* token,
59       std::unique_ptr<ReadOnlyMemoryRegion>* result) override {
60     return errors::Unimplemented(
61         "NewReadOnlyMemoryRegionFromFile unimplemented");
62   }
63 
FileExists(const string & fname,TransactionToken * token)64   Status FileExists(const string& fname, TransactionToken* token) override {
65     return errors::Unimplemented("FileExists unimplemented");
66   }
67 
GetChildren(const string & dir,TransactionToken * token,std::vector<string> * result)68   Status GetChildren(const string& dir, TransactionToken* token,
69                      std::vector<string>* result) override {
70     return errors::Unimplemented("GetChildren unimplemented");
71   }
72 
GetMatchingPaths(const string & pattern,TransactionToken * token,std::vector<string> * results)73   Status GetMatchingPaths(const string& pattern, TransactionToken* token,
74                           std::vector<string>* results) override {
75     return internal::GetMatchingPaths(this, Env::Default(), pattern, results);
76   }
77 
DeleteFile(const string & fname,TransactionToken * token)78   Status DeleteFile(const string& fname, TransactionToken* token) override {
79     return errors::Unimplemented("DeleteFile unimplemented");
80   }
81 
CreateDir(const string & dirname,TransactionToken * token)82   Status CreateDir(const string& dirname, TransactionToken* token) override {
83     return errors::Unimplemented("CreateDir unimplemented");
84   }
85 
DeleteDir(const string & dirname,TransactionToken * token)86   Status DeleteDir(const string& dirname, TransactionToken* token) override {
87     return errors::Unimplemented("DeleteDir unimplemented");
88   }
89 
GetFileSize(const string & fname,TransactionToken * token,uint64 * file_size)90   Status GetFileSize(const string& fname, TransactionToken* token,
91                      uint64* file_size) override {
92     return errors::Unimplemented("GetFileSize unimplemented");
93   }
94 
RenameFile(const string & src,const string & target,TransactionToken * token)95   Status RenameFile(const string& src, const string& target,
96                     TransactionToken* token) override {
97     return errors::Unimplemented("RenameFile unimplemented");
98   }
99 
Stat(const string & fname,TransactionToken * token,FileStatistics * stat)100   Status Stat(const string& fname, TransactionToken* token,
101               FileStatistics* stat) override {
102     return errors::Unimplemented("Stat unimplemented");
103   }
104 };
105 #endif
106 
107 // END_SKIP_DOXYGEN
108 
109 }  // namespace tensorflow
110 
111 #endif  // TENSORFLOW_CORE_PLATFORM_NULL_FILE_SYSTEM_H_
112