1 | /* |
2 | * udf_cask.h |
3 | * |
4 | * Copyright (C) 2013-2014 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 <stddef.h> |
26 | #include <stdint.h> |
27 | |
28 | #include "dynbuf.h" |
29 | |
30 | #include "base/thr_info.h" |
31 | |
32 | |
33 | // UDF Types |
34 | #define AS_UDF_TYPE_LUA 0 |
35 | #define MAX_UDF_CONTENT_LENGTH (1024 * 1024) //(1MB) |
36 | |
37 | extern char *as_udf_type_name[]; |
38 | |
39 | //------------------------------------------------ |
40 | // Register function |
41 | void udf_cask_init(); |
42 | |
43 | //------------------------------------------------ |
44 | // these functions are "as_info_command" format |
45 | // and called directly from there. |
46 | // therefore they have the same calling convention |
47 | |
48 | int udf_cask_info_clear_cache(char * name, char * params, cf_dyn_buf * out); |
49 | |
50 | int udf_cask_info_get(char * name, char * params, cf_dyn_buf * out); |
51 | |
52 | int udf_cask_info_put(char * name, char * params, cf_dyn_buf * out); |
53 | |
54 | int udf_cask_info_remove(char * name, char * params, cf_dyn_buf * out); |
55 | |
56 | int udf_cask_info_reconfigure(char * name, char * params, cf_dyn_buf * buf); |
57 | |
58 | int udf_cask_info_list(char *name, cf_dyn_buf * out); |
59 | |
60 | //------------------------------------------------ |
61 | // these are called by the modules that need to run UDFs |
62 | |
63 | // called by a module to get the data associated with a udf (the file contents) |
64 | // this will be a reference count (rc_alloc) pointer and must be dereferenced by the caller |
65 | int udf_cask_get_udf(char *module, char *udf_type, uint8_t **buf , size_t *buf_len ); |
66 | |
67 | // called by a module to get the data associated with a udf (the fully qualified file name) |
68 | // caller passes in a max-size string buffer that gets filled out (null terminated) |
69 | int udf_cask_get_udf_filename(char *module, char *udf_type, char *filename ); |
70 | |
71 | |