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 enum CJErrorCode { 26 CJ_ERROR_PERMISSION_DENIED = 202, 27 28 CJ_ERROR_INVALID_ARGUMENT = 401, 29 30 CJ_ERROR_OVER_MAX_LIMITS = 15100001, 31 32 CJ_ERROR_STORE_META_CHANGED = 15100002, 33 34 CJ_ERROR_CRYPT_ERROR = 15100003, 35 36 CJ_ERROR_NOT_FOUND = 15100004, 37 38 CJ_ERROR_ALREADY_CLOSED = 15100005, 39 }; 40 41 enum TypeSymbol { 42 /* Blob's first byte is the blob's data ValueType */ 43 STRING = 0, 44 INTEGER = 1, 45 FLOAT = 2, 46 BYTE_ARRAY = 3, 47 BOOLEAN = 4, 48 DOUBLE = 5, 49 INVALID = 255 50 }; 51 } 52 } 53 #endif