Main Page
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
aerospike
as_exp_operations.h
Go to the documentation of this file.
1
/*
2
* Copyright 2008-2022 Aerospike, Inc.
3
*
4
* Portions may be licensed to Aerospike, Inc. under one or more contributor
5
* license agreements.
6
*
7
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
8
* use this file except in compliance with the License. You may obtain a copy of
9
* the License at http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
* License for the specific language governing permissions and limitations under
15
* the License.
16
*/
17
#pragma once
18
19
/**
20
* @defgroup exp_operations Expression Operations
21
* @ingroup client_operations
22
*
23
* Expression operations.
24
*/
25
26
#include <
aerospike/as_operations.h
>
27
#include <
aerospike/as_exp.h
>
28
29
#ifdef __cplusplus
30
extern
"C"
{
31
#endif
32
33
/******************************************************************************
34
* TYPES
35
*****************************************************************************/
36
37
/**
38
* Expression write flags.
39
*
40
* @ingroup exp_operations
41
*/
42
typedef
enum
as_exp_write_flags_e {
43
/**
44
* Default. Allow create or update.
45
*/
46
AS_EXP_WRITE_DEFAULT
= 0,
47
48
/**
49
* If bin does not exist, a new bin will be created.
50
* If bin exists, the operation will be denied.
51
* If bin exists, fail with AEROSPIKE_ERR_BIN_EXISTS
52
* when AS_EXP_WRITE_POLICY_NO_FAIL is not set.
53
*/
54
AS_EXP_WRITE_CREATE_ONLY
= 1,
55
56
/**
57
* If bin exists, the bin will be overwritten.
58
* If bin does not exist, the operation will be denied.
59
* If bin does not exist, fail with AEROSPIKE_ERR_BIN_NOT_FOUND
60
* when AS_EXP_WRITE_POLICY_NO_FAIL is not set.
61
*/
62
AS_EXP_WRITE_UPDATE_ONLY
= 2,
63
64
/**
65
* If expression results in nil value, then delete the bin. Otherwise, return
66
* AEROSPIKE_ERR_OP_NOT_APPLICABLE when AS_EXP_WRITE_POLICY_NO_FAIL is not set.
67
*/
68
AS_EXP_WRITE_ALLOW_DELETE
= 4,
69
70
/**
71
* Do not raise error if operation is denied.
72
*/
73
AS_EXP_WRITE_POLICY_NO_FAIL
= 8,
74
75
/**
76
* Ignore failures caused by the expression resolving to unknown or a non-bin type.
77
*/
78
AS_EXP_WRITE_EVAL_NO_FAIL
= 16
79
}
as_exp_write_flags
;
80
81
/**
82
* Expression read flags.
83
*
84
* @ingroup exp_operations
85
*/
86
typedef
enum
as_exp_read_flags_e {
87
/**
88
* Default.
89
*/
90
AS_EXP_READ_DEFAULT
= 0,
91
92
/**
93
* Ignore failures caused by the expression resolving to unknown or a non-bin type.
94
*/
95
AS_EXP_READ_EVAL_NO_FAIL
= 16
96
}
as_exp_read_flags
;
97
98
/******************************************************************************
99
* PUBLIC FUNCTIONS
100
*****************************************************************************/
101
102
/**
103
* Create operation that performs an expression that writes to a record bin.
104
* Requires server version 5.6.0+.
105
*
106
* @param ops Operations array.
107
* @param name Name of bin.
108
* @param exp Expression to evaluate.
109
* @param flags Expression write flags. Multiple flags can be specified via "|" operator.
110
* @ingroup exp_operations
111
*/
112
AS_EXTERN
bool
113
as_operations_exp_write
(
114
as_operations
* ops,
const
char
* name,
const
as_exp
* exp,
as_exp_write_flags
flags
115
);
116
117
/**
118
* Create operation that performs a read expression.
119
* Requires server version 5.6.0+.
120
*
121
* @param ops Operations array.
122
* @param name Variable name of read expression result. This name can be used as the
123
* bin name when retrieving bin results from the record.
124
* @param exp Expression to evaluate.
125
* @param flags Expression read flags.
126
* @ingroup exp_operations
127
*/
128
AS_EXTERN
bool
129
as_operations_exp_read
(
130
as_operations
* ops,
const
char
* name,
const
as_exp
* exp,
as_exp_read_flags
flags
131
);
132
133
#ifdef __cplusplus
134
}
// end extern "C"
135
#endif
AS_EXP_WRITE_EVAL_NO_FAIL
Definition:
as_exp_operations.h:78
as_operations
Definition:
as_operations.h:254
as_operations_exp_write
AS_EXTERN bool as_operations_exp_write(as_operations *ops, const char *name, const as_exp *exp, as_exp_write_flags flags)
AS_EXP_WRITE_CREATE_ONLY
Definition:
as_exp_operations.h:54
as_operations_exp_read
AS_EXTERN bool as_operations_exp_read(as_operations *ops, const char *name, const as_exp *exp, as_exp_read_flags flags)
AS_EXP_WRITE_POLICY_NO_FAIL
Definition:
as_exp_operations.h:73
AS_EXP_WRITE_UPDATE_ONLY
Definition:
as_exp_operations.h:62
AS_EXP_READ_EVAL_NO_FAIL
Definition:
as_exp_operations.h:95
AS_EXTERN
#define AS_EXTERN
Definition:
as_std.h:25
AS_EXP_READ_DEFAULT
Definition:
as_exp_operations.h:90
as_exp_write_flags
as_exp_write_flags
Definition:
as_exp_operations.h:42
as_exp
Definition:
as_exp.h:182
as_exp.h
as_exp_read_flags
as_exp_read_flags
Definition:
as_exp_operations.h:86
AS_EXP_WRITE_DEFAULT
Definition:
as_exp_operations.h:46
as_operations.h
AS_EXP_WRITE_ALLOW_DELETE
Definition:
as_exp_operations.h:68