rc.h 3.2 KB
Newer Older
羽飞's avatar
羽飞 已提交
1
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
羽飞's avatar
羽飞 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
         http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details. */

//
// Created by Longda on 2021/5/2.
//

羽飞's avatar
羽飞 已提交
15
#pragma once
羽飞's avatar
羽飞 已提交
16

羽飞's avatar
羽飞 已提交
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
/**
 * @brief 这个文件定义函数返回码/错误码(Return Code)
 */

#define DEFINE_RCS                          \
  DEFINE_RC(SUCCESS)                        \
  DEFINE_RC(INVALID_ARGUMENT)               \
  DEFINE_RC(UNIMPLENMENT)                   \
  DEFINE_RC(SQL_SYNTAX)                     \
  DEFINE_RC(INTERNAL)                       \
  DEFINE_RC(NOMEM)                          \
  DEFINE_RC(NOTFOUND)                       \
  DEFINE_RC(EMPTY)                          \
  DEFINE_RC(BUFFERPOOL_OPEN)                \
  DEFINE_RC(BUFFERPOOL_NOBUF)               \
  DEFINE_RC(BUFFERPOOL_INVALID_PAGE_NUM)    \
  DEFINE_RC(RECORD_OPENNED)                 \
  DEFINE_RC(RECORD_INVALID_RID)             \
  DEFINE_RC(RECORD_INVALID_KEY)             \
  DEFINE_RC(RECORD_DUPLICATE_KEY)           \
  DEFINE_RC(RECORD_NOMEM)                   \
  DEFINE_RC(RECORD_EOF)                     \
  DEFINE_RC(RECORD_NOT_EXIST)               \
  DEFINE_RC(RECORD_INVISIBLE)               \
  DEFINE_RC(SCHEMA_DB_EXIST)                \
  DEFINE_RC(SCHEMA_DB_NOT_EXIST)            \
  DEFINE_RC(SCHEMA_DB_NOT_OPENED)           \
  DEFINE_RC(SCHEMA_TABLE_NOT_EXIST)         \
  DEFINE_RC(SCHEMA_TABLE_EXIST)             \
  DEFINE_RC(SCHEMA_FIELD_NOT_EXIST)         \
  DEFINE_RC(SCHEMA_FIELD_MISSING)           \
  DEFINE_RC(SCHEMA_FIELD_TYPE_MISMATCH)     \
  DEFINE_RC(SCHEMA_INDEX_NAME_REPEAT)       \
  DEFINE_RC(IOERR_READ)                     \
  DEFINE_RC(IOERR_WRITE)                    \
  DEFINE_RC(IOERR_ACCESS)                   \
  DEFINE_RC(IOERR_OPEN)                     \
  DEFINE_RC(IOERR_CLOSE)                    \
  DEFINE_RC(IOERR_SEEK)                     \
  DEFINE_RC(IOERR_TOO_LONG)                 \
57
  DEFINE_RC(IOERR_SYNC)                     \
羽飞's avatar
羽飞 已提交
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
  DEFINE_RC(LOCKED_UNLOCK)                  \
  DEFINE_RC(LOCKED_NEED_WAIT)               \
  DEFINE_RC(LOCKED_CONCURRENCY_CONFLICT)    \
  DEFINE_RC(FILE_EXIST)                     \
  DEFINE_RC(FILE_NOT_EXIST)                 \
  DEFINE_RC(FILE_NAME)                      \
  DEFINE_RC(FILE_BOUND)                     \
  DEFINE_RC(FILE_CREATE)                    \
  DEFINE_RC(FILE_OPEN)                      \
  DEFINE_RC(FILE_NOT_OPENED)                \
  DEFINE_RC(FILE_CLOSE)                     \
  DEFINE_RC(FILE_REMOVE)                    \
  DEFINE_RC(FILE_SEEK)                      \
  DEFINE_RC(FILE_READ)                      \
  DEFINE_RC(FILE_WRITE)                     \
  DEFINE_RC(LOGBUF_FULL)

羽飞's avatar
羽飞 已提交
75
enum class RC
羽飞's avatar
羽飞 已提交
76 77 78 79
{
#define DEFINE_RC(name) name,
  DEFINE_RCS
#undef DEFINE_RC
羽飞's avatar
羽飞 已提交
80 81 82 83
};

extern const char *strrc(RC rc);

羽飞's avatar
羽飞 已提交
84 85
extern bool OB_SUCC(RC rc);
extern bool OB_FAIL(RC rc);