| 1 | /* |
| 2 | * proxy.h |
| 3 | * |
| 4 | * Copyright (C) 2016 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 | #pragma once |
| 24 | |
| 25 | //========================================================== |
| 26 | // Includes. |
| 27 | // |
| 28 | |
| 29 | #include <stdint.h> |
| 30 | |
| 31 | #include "dynbuf.h" |
| 32 | #include "node.h" |
| 33 | |
| 34 | |
| 35 | //========================================================== |
| 36 | // Forward declarations. |
| 37 | // |
| 38 | |
| 39 | struct as_bin_s; |
| 40 | struct as_msg_op_s; |
| 41 | struct as_namespace_s; |
| 42 | struct as_transaction_s; |
| 43 | |
| 44 | |
| 45 | //========================================================== |
| 46 | // Public API. |
| 47 | // |
| 48 | |
| 49 | void as_proxy_init(); |
| 50 | |
| 51 | uint32_t as_proxy_hash_count(); |
| 52 | |
| 53 | void as_proxy_divert(cf_node dst, struct as_transaction_s* tr, struct as_namespace_s* ns); |
| 54 | void as_proxy_return_to_sender(const struct as_transaction_s* tr, struct as_namespace_s* ns); |
| 55 | |
| 56 | void as_proxy_send_response(cf_node dst, uint32_t proxy_tid, |
| 57 | uint32_t result_code, uint32_t generation, uint32_t void_time, |
| 58 | struct as_msg_op_s** ops, struct as_bin_s** bins, uint16_t bin_count, |
| 59 | struct as_namespace_s* ns, uint64_t trid); |
| 60 | void as_proxy_send_ops_response(cf_node dst, uint32_t proxy_tid, cf_dyn_buf* db); |
| 61 | |