| 1 | /* |
| 2 | * delete_ce.c |
| 3 | * |
| 4 | * Copyright (C) 2016-2019 Aerospike, Inc. |
| 5 | * |
| 6 | * Portions may be licensed to Aerospike, Inc. under one or more contributor |
| 7 | * license agreements. |
| 8 | * |
| 9 | * This program is free software: you can redistribute it and/or modify it under |
| 10 | * the terms of the GNU Affero General Public License as published by the Free |
| 11 | * Software Foundation, either version 3 of the License, or (at your option) any |
| 12 | * later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 16 | * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
| 17 | * details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Affero General Public License |
| 20 | * along with this program. If not, see http://www.gnu.org/licenses/ |
| 21 | */ |
| 22 | |
| 23 | //========================================================== |
| 24 | // Includes. |
| 25 | // |
| 26 | |
| 27 | #include "transaction/delete.h" |
| 28 | |
| 29 | #include <stdbool.h> |
| 30 | |
| 31 | #include "fault.h" |
| 32 | |
| 33 | #include "base/datamodel.h" |
| 34 | #include "base/index.h" |
| 35 | #include "base/proto.h" |
| 36 | #include "base/transaction.h" |
| 37 | #include "transaction/rw_request.h" |
| 38 | #include "transaction/rw_utils.h" |
| 39 | |
| 40 | |
| 41 | //========================================================== |
| 42 | // Private API - for enterprise separation only. |
| 43 | // |
| 44 | |
| 45 | bool |
| 46 | delete_storage_overloaded(as_transaction* tr) |
| 47 | { |
| 48 | return false; |
| 49 | } |
| 50 | |
| 51 | transaction_status |
| 52 | delete_master(as_transaction* tr, rw_request* rw) |
| 53 | { |
| 54 | if (as_transaction_is_durable_delete(tr)) { |
| 55 | cf_warning(AS_RW, "durable delete is an enterprise feature" ); |
| 56 | tr->result_code = AS_ERR_ENTERPRISE_ONLY; |
| 57 | return TRANS_DONE_ERROR; |
| 58 | } |
| 59 | |
| 60 | as_index_ref r_ref; |
| 61 | |
| 62 | if (as_record_get(tr->rsv.tree, &tr->keyd, &r_ref) != 0) { |
| 63 | tr->result_code = AS_ERR_NOT_FOUND; |
| 64 | return TRANS_DONE_ERROR; |
| 65 | } |
| 66 | |
| 67 | // Make sure the message set name (if it's there) is correct. |
| 68 | if (! set_name_check(tr, r_ref.r)) { |
| 69 | as_record_done(&r_ref, tr->rsv.ns); |
| 70 | tr->result_code = AS_ERR_PARAMETER; |
| 71 | return TRANS_DONE_ERROR; |
| 72 | } |
| 73 | |
| 74 | return drop_master(tr, &r_ref, rw); |
| 75 | } |
| 76 | |