1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef DISTRIBUTED_KV_STORE_UTILS_H 16 #define DISTRIBUTED_KV_STORE_UTILS_H 17 18 #include <cstdint> 19 #include <memory> 20 #include <string> 21 22 namespace OHOS { 23 namespace DistributedKVStore { 24 char* MallocCString(const std::string& origin); 25 void FreeCString(char* str); 26 enum CJErrorCode { 27 CJ_ERROR_PERMISSION_DENIED = 202, 28 29 CJ_ERROR_INVALID_ARGUMENT = 401, 30 31 CJ_ERROR_OVER_MAX_LIMITS = 15100001, 32 33 CJ_ERROR_STORE_META_CHANGED = 15100002, 34 35 CJ_ERROR_CRYPT_ERROR = 15100003, 36 37 CJ_ERROR_NOT_FOUND = 15100004, 38 39 CJ_ERROR_ALREADY_CLOSED = 15100005, 40 }; 41 42 enum TypeSymbol { 43 /* Blob's first byte is the blob's data ValueType */ 44 STRING = 0, 45 INTEGER = 1, 46 FLOAT = 2, 47 BYTE_ARRAY = 3, 48 BOOLEAN = 4, 49 DOUBLE = 5, 50 INVALID = 255 51 }; 52 } 53 } 54 #endif