OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef LIBRARIES_NACL_IO_GOOGLEDRIVEFS_NODE_H_ |
| 6 #define LIBRARIES_NACL_IO_GOOGLEDRIVEFS_NODE_H_ |
| 7 |
| 8 #include <time.h> |
| 9 #include <vector> |
| 10 |
| 11 #include "nacl_io/error.h" |
| 12 |
| 13 #include "nacl_io/filesystem.h" |
| 14 #include "nacl_io/kernel_handle.h" |
| 15 #include "nacl_io/path.h" |
| 16 |
| 17 namespace nacl_io { |
| 18 |
| 19 class GoogleDriveFsNode : public Node { |
| 20 public: |
| 21 GoogleDriveFsNode(Filesystem* filesystem, Path path); |
| 22 |
| 23 Error GetDents(size_t offs, struct dirent* pdir, size_t size, int* out_bytes); |
| 24 Error Write(const HandleAttr& attr, |
| 25 const void* buf, |
| 26 size_t count, |
| 27 int* out_bytes); |
| 28 Error FTruncate(off_t length); |
| 29 Error Read(const HandleAttr& attr, void* buf, size_t count, int* out_bytes); |
| 30 Error GetSize(off_t* out_size); |
| 31 Error GetStat(struct stat* pstat); |
| 32 Error Init(int open_flags); |
| 33 void Destroy(); |
| 34 |
| 35 private: |
| 36 Error ReadHelper(off_t start, |
| 37 off_t end, |
| 38 std::string* out_string_buffer, |
| 39 int* out_bytes); |
| 40 Error WriteHelper(const char* body_data, uint32_t body_size); |
| 41 Error GetModifiedTime(time_t* out_mtime); |
| 42 Error CreateEmptyFile(); |
| 43 Error RequestDirentHelper(const std::string& url, |
| 44 std::vector<std::string>* out_dirent_names); |
| 45 Error RequestDirentWithNextPageToken( |
| 46 const std::string& next_page_token, |
| 47 std::vector<std::string>* out_dirent_names); |
| 48 Error RequestDirent(std::vector<std::string>* out_dirent_names); |
| 49 |
| 50 std::string parent_dir_id_; |
| 51 std::string item_id_; |
| 52 Path path_; |
| 53 |
| 54 friend class GoogleDriveFs; |
| 55 }; |
| 56 |
| 57 } // namespace nacl_io |
| 58 |
| 59 #endif // LIBRARIES_NACL_IO_GOOGLEDRIVEFS_NODE_H_ |
OLD | NEW |