1/*
2 * aggr.h
3 *
4 * Copyright (C) 2014-2015 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#include <stdbool.h>
26
27#include "aerospike/as_rec.h"
28#include "aerospike/as_result.h"
29#include "aerospike/as_stream.h"
30#include "aerospike/as_val.h"
31#include "citrusleaf/cf_ll.h"
32
33#include "ai_btree.h"
34
35#include "transaction/udf.h"
36
37struct as_namespace_s;
38struct as_partition_reservation_s;
39struct udf_record_s;
40
41typedef struct {
42 as_stream_status (* ostream_write) (void *, as_val *);
43 void (* set_error) (void *, int);
44 struct as_partition_reservation_s * (* ptn_reserve) (void *, struct as_namespace_s *, uint32_t, struct as_partition_reservation_s *);
45 void (* ptn_release) (void *, struct as_partition_reservation_s *);
46 bool (* pre_check) (void *, struct udf_record_s *, void *);
47} as_aggr_hooks;
48
49typedef struct {
50 udf_def def;
51 const as_aggr_hooks * aggr_hooks;
52} as_aggr_call;
53
54int as_aggr_process(struct as_namespace_s *ns, as_aggr_call *ag_call, cf_ll *ap_recl, void *udata, as_result *ap_res);
55