-
Notifications
You must be signed in to change notification settings - Fork 0
/
vfs_handler.h
38 lines (30 loc) · 1 KB
/
vfs_handler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* @file vfs_handler.hpp
* @author Jichan (development@jc-lab.net / http://ablog.jc-lab.net/ )
* @date 2019/10/21
* @copyright Copyright (C) 2019 jichan.\n
* This software may be modified and distributed under the terms
* of the Apache License 2.0. See the LICENSE file for details.
*/
#ifndef __NODE_APP_VFS_HANDLER_HPP__
#define __NODE_APP_VFS_HANDLER_HPP__
#include <stdint.h>
#include <string>
namespace node_app {
class StringOnceWriter {
public:
virtual void write(const char *data, int64_t size = -1) = 0;
};
class ArrayBufferWriter {
public:
virtual void *allocate(size_t size) = 0;
virtual void *allocate(void *data, size_t size) = 0;
};
class VfsHandler {
public:
virtual int vfsStat(const std::string &rel_path) = 0;
virtual int vfsRealpathSync(std::string &retval, const std::string &arg_path, const std::string &rel_path) = 0;
virtual int vfsReadFileSync(StringOnceWriter &writer, const std::string &rel_path) = 0;
};
}
#endif //__NODE_APP_VFS_HANDLER_HPP__