1/*
2 * xdr_serverside.h
3 *
4 * Copyright (C) 2012-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 <stdbool.h>
30#include <stdint.h>
31
32#include "citrusleaf/cf_digest.h"
33
34#include "dynbuf.h"
35#include "node.h"
36#include "socket.h"
37
38#include "base/datamodel.h"
39#include "base/transaction.h"
40
41//==========================================================
42// Forward declarations.
43//
44
45//==========================================================
46// Constants & typedefs.
47//
48
49typedef enum {
50 XDR_OP_TYPE_WRITE,
51 XDR_OP_TYPE_DROP,
52 XDR_OP_TYPE_DURABLE_DELETE
53} xdr_op_type;
54
55typedef uint64_t xdr_dirty_bins[2];
56
57//==========================================================
58// Public API.
59//
60
61int as_xdr_init();
62void xdr_config_post_process();
63void as_xdr_start();
64void as_xdr_shutdown();
65
66void xdr_clear_dirty_bins(xdr_dirty_bins *dirty);
67void xdr_fill_dirty_bins(xdr_dirty_bins *dirty);
68void xdr_copy_dirty_bins(xdr_dirty_bins *from, xdr_dirty_bins *to);
69void xdr_add_dirty_bin(as_namespace *ns, xdr_dirty_bins *dirty, const char *name, size_t name_len);
70void xdr_write(as_namespace *ns, cf_digest *keyd, uint16_t generation, cf_node masternode, xdr_op_type op_type, uint16_t set_id, xdr_dirty_bins *dirty);
71void as_xdr_read_txn(as_transaction *txn);
72
73void as_xdr_info_init(void);
74void as_xdr_info_port(cf_serv_cfg *serv_cfg);
75int as_info_command_xdr(char *name, char *params, cf_dyn_buf *db);
76void as_xdr_get_stats(cf_dyn_buf *db);
77void as_xdr_get_config(cf_dyn_buf *db);
78bool as_xdr_set_config(char *params);
79bool as_xdr_set_config_ns(char *ns_name, char *params);
80
81bool is_xdr_delete_shipping_enabled();
82bool is_xdr_digestlog_low(as_namespace *ns);
83bool is_xdr_forwarding_enabled();
84bool is_xdr_nsup_deletes_enabled();
85
86void xdr_cfg_add_int_ext_mapping(xdr_dest_aero_config *aero_conf, char* orig, char* alt);
87