gdp-if / tensorflow / gdpfs_tf.h @ master
History | View | Annotate | Download (1.8 KB)
1 | a531ea78 | Nitesh Mor | // essentially what tensorflow expects us to implement.
|
---|---|---|---|
2 | |||
3 | #ifndef TENSORFLOW_CONTRIB_GDP_GDP_FILE_SYSTEM_H_
|
||
4 | #define TENSORFLOW_CONTRIB_GDP_GDP_FILE_SYSTEM_H_
|
||
5 | |||
6 | #include "tensorflow/core/lib/io/path.h" |
||
7 | #include "tensorflow/core/platform/env.h" |
||
8 | |||
9 | 98b0e081 | Nitesh Mor | #include "gdpfs.h" |
10 | a531ea78 | Nitesh Mor | |
11 | namespace tensorflow { |
||
12 | |||
13 | class GDPFileSystem : public FileSystem { |
||
14 | |||
15 | public:
|
||
16 | |||
17 | GDPFileSystem(); |
||
18 | ~GDPFileSystem(); |
||
19 | Status NewRandomAccessFile( |
||
20 | const string& fname,
|
||
21 | std::unique_ptr<RandomAccessFile>* result) override; |
||
22 | Status NewWritableFile( |
||
23 | const string& fname,
|
||
24 | std::unique_ptr<WritableFile>* result) override; |
||
25 | Status NewAppendableFile( |
||
26 | const string& fname,
|
||
27 | std::unique_ptr<WritableFile>* result) override; |
||
28 | Status NewReadOnlyMemoryRegionFromFile( |
||
29 | const string& fname,
|
||
30 | std::unique_ptr<ReadOnlyMemoryRegion>* result) override; |
||
31 | Status FileExists(const string& fname) override;
|
||
32 | Status GetChildren( |
||
33 | const string& dir,
|
||
34 | std::vector<string>* result) override; |
||
35 | Status Stat(const string& fname, FileStatistics* stat) override;
|
||
36 | Status GetMatchingPaths( |
||
37 | const string& pattern,
|
||
38 | std::vector<string>* results) override; |
||
39 | Status DeleteFile(const string& fname) override;
|
||
40 | Status CreateDir(const string& name) override;
|
||
41 | Status DeleteDir(const string& name) override;
|
||
42 | Status GetFileSize(const string& fname, uint64* size) override;
|
||
43 | Status RenameFile(const string& src, const string& target) override; |
||
44 | |||
45 | private:
|
||
46 | // we a cache of open root directories; it is likely that
|
||
47 | // we will neeed them multiple time.
|
||
48 | std::map<string, GDPDir*> _open_root_dirs; |
||
49 | |||
50 | // Returns a pointer to an open root directory if one exists,
|
||
51 | // or opens a new directory, inserts it into _open_root_dirs,
|
||
52 | // and returns the pointer.
|
||
53 | GDPDir* get_root_dir(const string& dirname);
|
||
54 | }; |
||
55 | |||
56 | } // namespace tensorflow
|
||
57 | |||
58 | |||
59 | #endif // TENSORFLOW_CONTRIB_GDP_GDP_FILE_SYSTEM_H_ |