| 1 | /* |
| 2 | * partition_ce.c |
| 3 | * |
| 4 | * Copyright (C) 2017-2018 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 "fabric/partition.h" |
| 28 | |
| 29 | #include <stdbool.h> |
| 30 | |
| 31 | #include "node.h" |
| 32 | |
| 33 | #include "base/datamodel.h" |
| 34 | #include "base/proto.h" |
| 35 | #include "base/transaction.h" |
| 36 | |
| 37 | |
| 38 | //========================================================== |
| 39 | // Public API. |
| 40 | // |
| 41 | |
| 42 | void |
| 43 | as_partition_isolate_version(const as_namespace* ns, as_partition* p) |
| 44 | { |
| 45 | if (as_partition_version_has_data(&p->version)) { |
| 46 | p->version.master = 0; |
| 47 | p->version.subset = 1; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | int |
| 52 | as_partition_check_source(const as_namespace* ns, as_partition* p, cf_node src, |
| 53 | bool* from_replica) |
| 54 | { |
| 55 | return AS_OK; |
| 56 | } |
| 57 | |
| 58 | |
| 59 | //========================================================== |
| 60 | // Private API - for enterprise separation only. |
| 61 | // |
| 62 | |
| 63 | int |
| 64 | partition_reserve_unavailable(const as_namespace* ns, const as_partition* p, |
| 65 | as_transaction* tr, cf_node* node) |
| 66 | { |
| 67 | *node = (cf_node)0; |
| 68 | |
| 69 | return -2; |
| 70 | } |
| 71 | |
| 72 | bool |
| 73 | partition_reserve_promote(const as_namespace* ns, const as_partition* p, |
| 74 | as_transaction* tr) |
| 75 | { |
| 76 | return false; |
| 77 | } |
| 78 | |