xref: /5.5.2/couchstore/src/os.h (revision ea89a543)
1/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 *     Copyright 2016 Couchbase, Inc
4 *
5 *   Licensed under the Apache License, Version 2.0 (the "License");
6 *   you may not use this file except in compliance with the License.
7 *   You may obtain a copy of the License at
8 *
9 *       http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *   Unless required by applicable law or agreed to in writing, software
12 *   distributed under the License is distributed on an "AS IS" BASIS,
13 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *   See the License for the specific language governing permissions and
15 *   limitations under the License.
16 */
17
18#pragma once
19
20#include <libcouchstore/couch_db.h>
21
22class FileOps : public FileOpsInterface {
23public:
24    FileOps() {}
25
26    couch_file_handle constructor(couchstore_error_info_t* errinfo) override ;
27    couchstore_error_t open(couchstore_error_info_t* errinfo,
28                            couch_file_handle* handle, const char* path,
29                            int oflag) override;
30    couchstore_error_t close(couchstore_error_info_t* errinfo,
31                             couch_file_handle handle) override;
32    couchstore_error_t set_periodic_sync(couch_file_handle handle,
33                                         uint64_t period_bytes) override;
34    ssize_t pread(couchstore_error_info_t* errinfo,
35                  couch_file_handle handle, void* buf, size_t nbytes,
36                  cs_off_t offset) override;
37    ssize_t pwrite(couchstore_error_info_t* errinfo,
38                   couch_file_handle handle, const void* buf,
39                   size_t nbytes, cs_off_t offset) override;
40    cs_off_t goto_eof(couchstore_error_info_t* errinfo,
41                      couch_file_handle handle) override;
42    couchstore_error_t sync(couchstore_error_info_t* errinfo,
43                            couch_file_handle handle) override;
44    couchstore_error_t advise(couchstore_error_info_t* errinfo,
45                              couch_file_handle handle, cs_off_t offset,
46                              cs_off_t len,
47                              couchstore_file_advice_t advice) override;
48    void destructor(couch_file_handle handle) override;
49};
50