forked from opencurve/curve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcbd_client.h
80 lines (62 loc) · 2.35 KB
/
cbd_client.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* Copyright (c) 2020 NetEase Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Project: curve
* Date: Fri May 15 15:46:59 CST 2020
* Author: wuhanqing
*/
#ifndef CURVEFS_PYTHON_CBD_CLIENT_H_
#define CURVEFS_PYTHON_CBD_CLIENT_H_
#include <memory>
#include <string>
#include "curvefs_python/curve_type.h"
namespace curve {
namespace client {
class FileClient;
} // namespace client
} // namespace curve
class CBDClient {
public:
CBDClient();
~CBDClient();
int Init(const char* configPath);
void UnInit();
int Open(const char* filename, UserInfo_t* userInfo);
int Close(int fd);
int Create(const char* filename, UserInfo_t* userInfo, size_t size);
int Unlink(const char* filename, UserInfo_t* info);
int DeleteForce(const char* filename, UserInfo_t* info);
int Rename(UserInfo_t* info, const char* oldpath, const char* newpath);
int Extend(const char* filename, UserInfo_t* info, uint64_t size);
// 同步读写
int Read(int fd, char* buf, unsigned long offset, unsigned long length); // NOLINT
int Write(int fd, const char* buf, unsigned long offset, unsigned long length); // NOLINT
// 异步读写
int AioRead(int fd, AioContext* aioctx);
int AioWrite(int fd, AioContext* aioctx);
// 获取文件的基本信息
int StatFile(const char* filename, UserInfo_t* info, FileInfo_t* finfo);
int ChangeOwner(const char* filename, const char* owner, UserInfo_t* info);
DirInfos_t* OpenDir(const char* dirpath, UserInfo_t* userinfo);
int Listdir(DirInfos_t* dirinfo);
void CloseDir(DirInfos_t* dirinfo);
int Mkdir(const char* dirpath, UserInfo_t* info);
int Rmdir(const char* dirpath, UserInfo_t* info);
std::string GetClusterId();
private:
std::unique_ptr<curve::client::FileClient> client_;
};
#endif // CURVEFS_PYTHON_CBD_CLIENT_H_