tfile.h 1.4 KB
Newer Older
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

16 17
#ifndef _TD_UTIL_FILE_H
#define _TD_UTIL_FILE_H
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
18 19 20 21 22

#ifdef __cplusplus
extern "C" {
#endif

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
23
// init taos file module
S
TD-1895  
Shengliang Guan 已提交
24
int32_t tfInit();
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
25 26

// clean up taos file module
S
TD-1895  
Shengliang Guan 已提交
27
void tfCleanup();
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
28

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
29 30
// the same syntax as UNIX standard open/close/read/write
// but FD is int64_t and will never be reused
L
Liu Jicong 已提交
31
int64_t tfOpenRead(const char *pathname);
32 33 34 35
int64_t tfOpenReadWrite(const char *pathname);
int64_t tfOpenCreateWrite(const char *pathname);
int64_t tfOpenCreateWriteAppend(const char *pathname);

S
TD-1895  
Shengliang Guan 已提交
36 37 38 39 40
int64_t tfClose(int64_t tfd);
int64_t tfWrite(int64_t tfd, void *buf, int64_t count);
int64_t tfRead(int64_t tfd, void *buf, int64_t count);
int32_t tfFsync(int64_t tfd);
bool    tfValid(int64_t tfd);
S
Shengliang Guan 已提交
41
int64_t tfLseek(int64_t tfd, int64_t offset, int32_t whence);
S
TD-1895  
Shengliang Guan 已提交
42
int32_t tfFtruncate(int64_t tfd, int64_t length);
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
43 44 45 46 47

#ifdef __cplusplus
}
#endif

48
#endif  /*_TD_UTIL_FILE_H*/