Loading...
Searching...
No Matches
as_policy.h
Go to the documentation of this file.
1/*
2 * Copyright 2008-2024 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 client_policies Client Policies
21 *
22 * Policies define the behavior of database operations.
23 *
24 * Policies fall into two groups: policy values and operation policies.
25 * A policy value is a single value which defines how the client behaves. An
26 * operation policy is a group of policy values which affect an operation.
27 *
28 * ## Policy Values
29 *
30 * The following are the policy values. For details, please see the documentation
31 * for each policy value
32 *
33 * - as_policy_key
34 * - as_policy_gen
35 * - as_policy_exists
36 * - as_policy_replica
37 * - as_policy_read_mode_ap
38 * - as_policy_read_mode_sc
39 * - as_policy_commit_level
40 *
41 * ## Operation Policies
42 *
43 * The following are the operation policies. Operation policies are groups of
44 * policy values for a type of operation.
45 *
46 * - as_policy_batch
47 * - as_policy_info
48 * - as_policy_operate
49 * - as_policy_read
50 * - as_policy_remove
51 * - as_policy_query
52 * - as_policy_scan
53 * - as_policy_write
54 */
55
56#include <aerospike/as_std.h>
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62//---------------------------------
63// Macros
64//---------------------------------
65
66/**
67 * Default socket idle timeout value
68 *
69 * @ingroup client_policies
70 */
71#define AS_POLICY_SOCKET_TIMEOUT_DEFAULT 30000
72
73/**
74 * Default total timeout value
75 *
76 * @ingroup client_policies
77 */
78#define AS_POLICY_TOTAL_TIMEOUT_DEFAULT 1000
79
80/**
81 * Default value for compression threshold
82 *
83 * @ingroup client_policies
84 */
85#define AS_POLICY_COMPRESSION_THRESHOLD_DEFAULT 0
86
87/**
88 * Default as_policy_gen value
89 *
90 * @ingroup client_policies
91 */
92#define AS_POLICY_GEN_DEFAULT AS_POLICY_GEN_IGNORE
93
94/**
95 * Default as_policy_key value
96 *
97 * @ingroup client_policies
98 */
99#define AS_POLICY_KEY_DEFAULT AS_POLICY_KEY_DIGEST
100
101/**
102 * Default as_policy_exists value
103 *
104 * @ingroup client_policies
105 */
106#define AS_POLICY_EXISTS_DEFAULT AS_POLICY_EXISTS_IGNORE
107
108/**
109 * Default as_policy_replica value
110 *
111 * @ingroup client_policies
112 */
113#define AS_POLICY_REPLICA_DEFAULT AS_POLICY_REPLICA_SEQUENCE
114
115/**
116 * Default as_policy_read_mode_ap value
117 *
118 * @ingroup client_policies
119 */
120#define AS_POLICY_READ_MODE_AP_DEFAULT AS_POLICY_READ_MODE_AP_ONE
121
122/**
123 * Default as_policy_read_mode_sc value
124 *
125 * @ingroup client_policies
126 */
127#define AS_POLICY_READ_MODE_SC_DEFAULT AS_POLICY_READ_MODE_SC_SESSION
128
129/**
130 * Default as_policy_commit_level value for write
131 *
132 * @ingroup client_policies
133 */
134#define AS_POLICY_COMMIT_LEVEL_DEFAULT AS_POLICY_COMMIT_LEVEL_ALL
135
136//---------------------------------
137// Types
138//---------------------------------
139
140struct as_exp;
141
142/**
143 * Retry Policy
144 *
145 * Specifies the behavior of failed operations.
146 *
147 * @ingroup client_policies
148 */
149typedef enum as_policy_retry_e {
150
151 /**
152 * Only attempt an operation once.
153 */
155
156 /**
157 * If an operation fails, attempt the operation
158 * one more time.
159 */
161
163
164/**
165 * Generation Policy
166 *
167 * Specifies the behavior of record modifications with regard to the
168 * generation value.
169 *
170 * @ingroup client_policies
171 */
172typedef enum as_policy_gen_e {
173
174 /**
175 * Do not use record generation to restrict writes.
176 */
178
179 /**
180 * Update/delete record if expected generation is equal to server generation. Otherwise, fail.
181 */
183
184 /**
185 * Update/delete record if expected generation greater than the server generation.
186 * Otherwise, fail. This is useful for restore after backup.
187 */
189
191
192/**
193 * Key Policy
194 *
195 * Specifies the behavior for whether keys or digests
196 * should be sent to the cluster.
197 *
198 * @ingroup client_policies
199 */
200typedef enum as_policy_key_e {
201
202 /**
203 * Send the digest value of the key.
204 *
205 * This is the recommended mode of operation. This calculates the digest
206 * and send the digest to the server. The digest is only calculated on
207 * the client, and not on the server.
208 */
210
211 /**
212 * Send the key, in addition to the digest value.
213 *
214 * If you want keys to be returned when scanning or querying, the keys must
215 * be stored on the server. This policy causes a write operation to store
216 * the key. Once a key is stored, the server will keep it - there is no
217 * need to use this policy on subsequent updates of the record.
218 *
219 * If this policy is used on read or delete operations, or on subsequent
220 * updates of a record with a stored key, the key sent will be compared
221 * with the key stored on the server. A mismatch will cause
222 * AEROSPIKE_ERR_RECORD_KEY_MISMATCH to be returned.
223 */
225
227
228/**
229 * Existence Policy
230 *
231 * Specifies the behavior for writing the record
232 * depending whether or not it exists.
233 *
234 * @ingroup client_policies
235 */
236typedef enum as_policy_exists_e {
237
238 /**
239 * Write the record, regardless of existence. (i.e. create or update.)
240 */
242
243 /**
244 * Create a record, ONLY if it doesn't exist.
245 */
247
248 /**
249 * Update a record, ONLY if it exists.
250 */
252
253 /**
254 * Completely replace a record, ONLY if it exists.
255 */
257
258 /**
259 * Completely replace a record if it exists, otherwise create it.
260 */
262
264
265/**
266 * Replica Policy
267 *
268 * Defines algorithm used to determine the target node for a command.
269 *
270 * @ingroup client_policies
271 */
272typedef enum as_policy_replica_e {
273
274 /**
275 * Use node containing key's master partition.
276 */
278
279 /**
280 * Distribute reads across nodes containing key's master and replicated partition
281 * in round-robin fashion.
282 */
284
285 /**
286 * Try node containing master partition first.
287 * If connection fails, all commands try nodes containing replicated partitions.
288 * If socketTimeout is reached, reads also try nodes containing replicated partitions,
289 * but writes remain on master node.
290 */
292
293 /**
294 * For reads, try node on preferred racks first. If there are no nodes on preferred racks,
295 * use SEQUENCE instead. Also use SEQUENCE for writes.
296 *
297 * as_config.rack_aware, as_config.rack_id or as_config.rack_ids, and server rack
298 * configuration must also be set to enable this functionality.
299 */
301
303
304/**
305 * Read policy for AP (availability) namespaces.
306 *
307 * How duplicates should be consulted in a read operation.
308 * Only makes a difference during migrations and only applicable in AP mode.
309 *
310 * @ingroup client_policies
311 */
312typedef enum as_policy_read_mode_ap_e {
313
314 /**
315 * Involve single node in the read operation.
316 */
318
319 /**
320 * Involve all duplicates in the read operation.
321 */
323
325
326/**
327 * Read policy for SC (strong consistency) namespaces.
328 *
329 * Determines SC read consistency options.
330 *
331 * @ingroup client_policies
332 */
333typedef enum as_policy_read_mode_sc_e {
334
335 /**
336 * Ensures this client will only see an increasing sequence of record versions.
337 * Client only reads from master. This is the default.
338 */
340
341 /**
342 * Ensures all clients will only see an increasing sequence of record versions.
343 * Client only reads from master.
344 */
346
347 /**
348 * Client may read from master or any full (non-migrating) replica.
349 * Increasing sequence of record versions is not guaranteed.
350 */
352
353 /**
354 * Client may read from master or any full (non-migrating) replica or from unavailable
355 * partitions. Increasing sequence of record versions is not guaranteed.
356 */
358
360
361/**
362 * Commit Level
363 *
364 * Specifies the number of replicas required to be successfully
365 * committed before returning success in a write operation
366 * to provide the desired consistency guarantee.
367 *
368 * @ingroup client_policies
369 */
370typedef enum as_policy_commit_level_e {
371
372 /**
373 * Return succcess only after successfully committing all replicas.
374 */
376
377 /**
378 * Return succcess after successfully committing the master replica.
379 */
381
383
384/**
385 * Expected query duration. The server treats the query in different ways depending on the expected duration.
386 * This enum is ignored for aggregation queries, background queries and server versions &lt; 6.0.
387 *
388 * @ingroup client_policies
389 */
390typedef enum as_query_duration_e {
391
392 /**
393 * The query is expected to return more than 100 records per node. The server optimizes for a
394 * large record set in the following ways:
395 * <ul>
396 * <li>Allow query to be run in multiple threads using the server's query threading configuration.</li>
397 * <li>Do not relax read consistency for AP namespaces.</li>
398 * <li>Add the query to the server's query monitor.</li>
399 * <li>Do not add the overall latency to the server's latency histogram.</li>
400 * <li>Do not allow server timeouts.</li>
401 * </ul>
402 */
404
405 /**
406 * The query is expected to return less than 100 records per node. The server optimizes for a
407 * small record set in the following ways:
408 * <ul>
409 * <li>Always run the query in one thread and ignore the server's query threading configuration.</li>
410 * <li>Allow query to be inlined directly on the server's service thread.</li>
411 * <li>Relax read consistency for AP namespaces.</li>
412 * <li>Do not add the query to the server's query monitor.</li>
413 * <li>Add the overall latency to the server's latency histogram.</li>
414 * <li>Allow server timeouts. The default server timeout for a short query is 1 second.</li>
415 * </ul>
416 */
418
419 /**
420 * Treat query as a LONG query, but relax read consistency for AP namespaces.
421 * This value is treated exactly like LONG for server versions &lt; 7.1.
422 */
424
426
427/**
428 * Generic policy fields shared among all policies.
429 *
430 * @ingroup client_policies
431 */
432typedef struct as_policy_base_s {
433
434 /**
435 * Socket idle timeout in milliseconds when processing a database command.
436 *
437 * If socket_timeout is zero and total_timeout is non-zero, then socket_timeout will be set
438 * to total_timeout. If both socket_timeout and total_timeout are non-zero and
439 * socket_timeout > total_timeout, then socket_timeout will be set to total_timeout. If both
440 * socket_timeout and total_timeout are zero, then there will be no socket idle limit.
441 *
442 * If socket_timeout is non-zero and the socket has been idle for at least socket_timeout,
443 * both max_retries and total_timeout are checked. If max_retries and total_timeout are not
444 * exceeded, the transaction is retried.
445 *
446 * Default: 30000ms
447 */
449
450 /**
451 * Total transaction timeout in milliseconds.
452 *
453 * The total_timeout is tracked on the client and sent to the server along with
454 * the transaction in the wire protocol. The client will most likely timeout
455 * first, but the server also has the capability to timeout the transaction.
456 *
457 * If total_timeout is not zero and total_timeout is reached before the transaction
458 * completes, the transaction will return error AEROSPIKE_ERR_TIMEOUT.
459 * If totalTimeout is zero, there will be no total time limit.
460 *
461 * Default: 1000
462 */
464
465 /**
466 * Maximum number of retries before aborting the current transaction.
467 * The initial attempt is not counted as a retry.
468 *
469 * If max_retries is exceeded, the transaction will return error AEROSPIKE_ERR_TIMEOUT.
470 *
471 * WARNING: Database writes that are not idempotent (such as "add")
472 * should not be retried because the write operation may be performed
473 * multiple times if the client timed out previous transaction attempts.
474 * It's important to use a distinct write policy for non-idempotent
475 * writes which sets max_retries = 0;
476 *
477 * Default for read: 2 (initial attempt + 2 retries = 3 attempts)
478 *
479 * Default for write: 0 (no retries)
480 *
481 * Default for partition scan or query with null filter: 5
482 *
483 * No default for legacy scan/query. No retries are allowed for these commands.
484 */
485 uint32_t max_retries;
486
487 /**
488 * Milliseconds to sleep between retries. Enter zero to skip sleep.
489 * This field is ignored when max_retries is zero.
490 * This field is also ignored in async mode.
491 *
492 * Reads do not have to sleep when a node goes down because the cluster
493 * does not shut out reads during cluster reformation. The default for
494 * reads is zero.
495 *
496 * The default for writes is also zero because writes are not retried by default.
497 * Writes need to wait for the cluster to reform when a node goes down.
498 * Immediate write retries on node failure have been shown to consistently
499 * result in errors. If max_retries is greater than zero on a write, then
500 * sleep_between_retries should be set high enough to allow the cluster to
501 * reform (>= 3000ms).
502 *
503 * Default: 0 (do not sleep between retries).
504 */
506
507 /**
508 * Optional expression filter. If filter_exp exists and evaluates to false, the
509 * transaction is ignored. This can be used to eliminate a client/server roundtrip
510 * in some cases.
511 *
512 * aerospike_destroy() automatically calls as_exp_destroy() on all global default
513 * policy filter expression instances. The user is responsible for calling as_exp_destroy()
514 * on filter expressions when setting temporary transaction policies.
515 *
516 * ~~~~~~~~~~{.c}
517 * as_exp_build(filter,
518 * as_exp_cmp_eq(as_exp_bin_int("a"), as_exp_int(10)));
519 *
520 * as_policy_read p;
521 * as_policy_read_init(&p);
522 * p.filter_exp = filter;
523 * ...
524 * as_exp_destroy(filter);
525 * ~~~~~~~~~~
526 *
527 * Default: NULL
528 */
530
531 /**
532 * Use zlib compression on write or batch read commands when the command buffer size is greater
533 * than 128 bytes. In addition, tell the server to compress it's response on read commands.
534 * The server response compression threshold is also 128 bytes.
535 *
536 * This option will increase cpu and memory usage (for extra compressed buffers), but
537 * decrease the size of data sent over the network.
538 *
539 * Default: false
540 */
542
544
545/**
546 * Read Policy
547 *
548 * @ingroup client_policies
549 */
550typedef struct as_policy_read_s {
551
552 /**
553 * Generic policy fields.
554 */
556
557 /**
558 * Specifies the behavior for the key.
559 */
561
562 /**
563 * Algorithm used to determine target node.
564 */
566
567 /**
568 * Read policy for AP (availability) namespaces.
569 * Default: AS_POLICY_READ_MODE_AP_ONE
570 */
572
573 /**
574 * Read policy for SC (strong consistency) namespaces.
575 * Default: AS_POLICY_READ_MODE_SC_SESSION
576 */
578
579 /**
580 * Determine how record TTL (time to live) is affected on reads. When enabled, the server can
581 * efficiently operate as a read-based LRU cache where the least recently used records are expired.
582 * The value is expressed as a percentage of the TTL sent on the most recent write such that a read
583 * within this interval of the record’s end of life will generate a touch.
584 *
585 * For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
586 * 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
587 * recent write) will result in a touch, resetting the TTL to another 10 hours.
588 *
589 * Values:
590 * <ul>
591 * <li> 0 : Use server config default-read-touch-ttl-pct for the record's namespace/set.</li>
592 * <li>-1 : Do not reset record TTL on reads.</li>
593 * <li>1 - 100 : Reset record TTL on reads when within this percentage of the most recent write TTL.</li>
594 * </ul>
595 *
596 * Default: 0
597 */
599
600 /**
601 * Should raw bytes representing a list or map be deserialized to as_list or as_map.
602 * Set to false for backup programs that just need access to raw bytes.
603 *
604 * Default: true
605 */
607
608 /**
609 * Should as_record instance be allocated on the heap before user listener is called in
610 * async commands. If true, the user is responsible for calling as_record_destroy() when done
611 * with the record. If false, as_record_destroy() is automatically called by the client after
612 * the user listener function completes. This field is ignored for sync commands.
613 *
614 * Default: false
615 */
617
619
620/**
621 * Write Policy
622 *
623 * @ingroup client_policies
624 */
625typedef struct as_policy_write_s {
626
627 /**
628 * Generic policy fields.
629 */
631
632 /**
633 * Specifies the behavior for the key.
634 */
636
637 /**
638 * Algorithm used to determine target node.
639 */
641
642 /**
643 * Specifies the number of replicas required to be committed successfully when writing
644 * before returning transaction succeeded.
645 */
647
648 /**
649 * Specifies the behavior for the generation value.
650 */
652
653 /**
654 * Specifies the behavior for the existence of the record.
655 */
657
658 /**
659 * The default time-to-live (expiration) of the record in seconds. This field will
660 * only be used if "as_record.ttl" is set to AS_RECORD_CLIENT_DEFAULT_TTL. The
661 * as_record instance is passed in to write functions along with as_policy_write.
662 *
663 * There are also special values that can be set in the record ttl:
664 * <ul>
665 * <li>AS_RECORD_DEFAULT_TTL: Use the server default ttl from the namespace.</li>
666 * <li>AS_RECORD_NO_EXPIRE_TTL: Do not expire the record.</li>
667 * <li>AS_RECORD_NO_CHANGE_TTL: Keep the existing record ttl when the record is updated.</li>
668 * </ul>
669 */
670 uint32_t ttl;
671
672 /**
673 * Minimum record size beyond which it is compressed and sent to the server.
674 */
676
677 /**
678 * If the transaction results in a record deletion, leave a tombstone for the record.
679 * This prevents deleted records from reappearing after node failures.
680 * Valid for Aerospike Server Enterprise Edition only.
681 *
682 * Default: false (do not tombstone deleted records).
683 */
685
687
688/**
689 * Key Apply Policy
690 *
691 * @ingroup client_policies
692 */
693typedef struct as_policy_apply_s {
694
695 /**
696 * Generic policy fields.
697 */
699
700 /**
701 * Specifies the behavior for the key.
702 */
704
705 /**
706 * Algorithm used to determine target node.
707 */
709
710 /**
711 * Specifies the number of replicas required to be committed successfully when writing
712 * before returning transaction succeeded.
713 */
715
716 /**
717 * The time-to-live (expiration) of the record in seconds. Note that ttl
718 * is only used on write/update calls.
719 *
720 * There are also special values that can be set in the record ttl:
721 * <ul>
722 * <li>AS_RECORD_DEFAULT_TTL: Use the server default ttl from the namespace.</li>
723 * <li>AS_RECORD_NO_EXPIRE_TTL: Do not expire the record.</li>
724 * <li>AS_RECORD_NO_CHANGE_TTL: Keep the existing record ttl when the record is updated.</li>
725 * </ul>
726 */
727 uint32_t ttl;
728
729 /**
730 * If the transaction results in a record deletion, leave a tombstone for the record.
731 * This prevents deleted records from reappearing after node failures.
732 * Valid for Aerospike Server Enterprise Edition only.
733 *
734 * Default: false (do not tombstone deleted records).
735 */
737
739
740/**
741 * Operate Policy
742 *
743 * @ingroup client_policies
744 */
745typedef struct as_policy_operate_s {
746
747 /**
748 * Generic policy fields.
749 */
751
752 /**
753 * Specifies the behavior for the key.
754 */
756
757 /**
758 * Algorithm used to determine target node.
759 */
761
762 /**
763 * Read policy for AP (availability) namespaces.
764 * Default: AS_POLICY_READ_MODE_AP_ONE
765 */
767
768 /**
769 * Read policy for SC (strong consistency) namespaces.
770 * Default: AS_POLICY_READ_MODE_SC_SESSION
771 */
773
774 /**
775 * Specifies the number of replicas required to be committed successfully when writing
776 * before returning transaction succeeded.
777 */
779
780 /**
781 * Specifies the behavior for the generation value.
782 */
784
785 /**
786 * Specifies the behavior for the existence of the record.
787 */
789
790 /**
791 * The default time-to-live (expiration) of the record in seconds. This field will
792 * only be used if one or more of the operations is a write operation and if "as_operations.ttl"
793 * is set to AS_RECORD_CLIENT_DEFAULT_TTL. The as_operations instance is passed in to
794 * operate functions along with as_policy_operate.
795 *
796 * There are also special values that can be set in the record ttl:
797 * <ul>
798 * <li>AS_RECORD_DEFAULT_TTL: Use the server default ttl from the namespace.</li>
799 * <li>AS_RECORD_NO_EXPIRE_TTL: Do not expire the record.</li>
800 * <li>AS_RECORD_NO_CHANGE_TTL: Keep the existing record ttl when the record is updated.</li>
801 * </ul>
802 */
803 uint32_t ttl;
804
805 /**
806 * Determine how record TTL (time to live) is affected on reads. When enabled, the server can
807 * efficiently operate as a read-based LRU cache where the least recently used records are expired.
808 * The value is expressed as a percentage of the TTL sent on the most recent write such that a read
809 * within this interval of the record’s end of life will generate a touch.
810 *
811 * For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
812 * 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
813 * recent write) will result in a touch, resetting the TTL to another 10 hours.
814 *
815 * Values:
816 * <ul>
817 * <li> 0 : Use server config default-read-touch-ttl-pct for the record's namespace/set.</li>
818 * <li>-1 : Do not reset record TTL on reads.</li>
819 * <li>1 - 100 : Reset record TTL on reads when within this percentage of the most recent write TTL.</li>
820 * </ul>
821 *
822 * Default: 0
823 */
825
826 /**
827 * Should raw bytes representing a list or map be deserialized to as_list or as_map.
828 * Set to false for backup programs that just need access to raw bytes.
829 *
830 * Default: true
831 */
833
834 /**
835 * If the transaction results in a record deletion, leave a tombstone for the record.
836 * This prevents deleted records from reappearing after node failures.
837 * Valid for Aerospike Server Enterprise Edition only.
838 *
839 * Default: false (do not tombstone deleted records).
840 */
842
843 /**
844 * Should as_record instance be allocated on the heap before user listener is called in
845 * async commands. If true, the user is responsible for calling as_record_destroy() when done
846 * with the record. If false, as_record_destroy() is automatically called by the client after
847 * the user listener function completes. This field is ignored for sync commands.
848 *
849 * Default: false
850 */
852
854
855/**
856 * Remove Policy
857 *
858 * @ingroup client_policies
859 */
860typedef struct as_policy_remove_s {
861
862 /**
863 * Generic policy fields.
864 */
866
867 /**
868 * Specifies the behavior for the key.
869 */
871
872 /**
873 * Algorithm used to determine target node.
874 */
876
877 /**
878 * Specifies the number of replicas required to be committed successfully when writing
879 * before returning transaction succeeded.
880 */
882
883 /**
884 * Specifies the behavior for the generation value.
885 */
887
888 /**
889 * The generation of the record.
890 */
891 uint16_t generation;
892
893 /**
894 * If the transaction results in a record deletion, leave a tombstone for the record.
895 * This prevents deleted records from reappearing after node failures.
896 * Valid for Aerospike Server Enterprise Edition only.
897 *
898 * Default: false (do not tombstone deleted records).
899 */
901
903
904/**
905 * Batch parent policy.
906 *
907 * @ingroup client_policies
908 */
909typedef struct as_policy_batch_s {
910
911 /**
912 * Generic policy fields.
913 */
915
916 /**
917 * Algorithm used to determine target node.
918 */
920
921 /**
922 * Read policy for AP (availability) namespaces.
923 * Default: AS_POLICY_READ_MODE_AP_ONE
924 */
926
927 /**
928 * Read policy for SC (strong consistency) namespaces.
929 * Default: AS_POLICY_READ_MODE_SC_SESSION
930 */
932
933 /**
934 * Determine how record TTL (time to live) is affected on reads. When enabled, the server can
935 * efficiently operate as a read-based LRU cache where the least recently used records are expired.
936 * The value is expressed as a percentage of the TTL sent on the most recent write such that a read
937 * within this interval of the record’s end of life will generate a touch.
938 *
939 * For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
940 * 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
941 * recent write) will result in a touch, resetting the TTL to another 10 hours.
942 *
943 * Values:
944 * <ul>
945 * <li> 0 : Use server config default-read-touch-ttl-pct for the record's namespace/set.</li>
946 * <li>-1 : Do not reset record TTL on reads.</li>
947 * <li>1 - 100 : Reset record TTL on reads when within this percentage of the most recent write TTL.</li>
948 * </ul>
949 *
950 * Default: 0
951 */
953
954 /**
955 * Determine if batch commands to each server are run in parallel threads.
956 *
957 * Values:
958 * <ul>
959 * <li>
960 * false: Issue batch commands sequentially. This mode has a performance advantage for small
961 * to medium sized batch sizes because commands can be issued in the main transaction thread.
962 * This is the default.
963 * </li>
964 * <li>
965 * true: Issue batch commands in parallel threads. This mode has a performance
966 * advantage for large batch sizes because each node can process the command immediately.
967 * The downside is extra threads will need to be created (or taken from
968 * a thread pool).
969 * </li>
970 * </ul>
971 */
973
974 /**
975 * Allow batch to be processed immediately in the server's receiving thread for in-memory
976 * namespaces. If false, the batch will always be processed in separate service threads.
977 *
978 * For batch transactions with smaller sized records (&lt;= 1K per record), inline
979 * processing will be significantly faster on in-memory namespaces.
980 *
981 * Inline processing can introduce the possibility of unfairness because the server
982 * can process the entire batch before moving onto the next command.
983 *
984 * Default: true
985 */
987
988 /**
989 * Allow batch to be processed immediately in the server's receiving thread for SSD
990 * namespaces. If false, the batch will always be processed in separate service threads.
991 * Server versions &lt; 6.0 ignore this field.
992 *
993 * Inline processing can introduce the possibility of unfairness because the server
994 * can process the entire batch before moving onto the next command.
995 *
996 * Default: false
997 */
999
1000 /**
1001 * Should all batch keys be attempted regardless of errors. This field is used on both
1002 * the client and server. The client handles node specific errors and the server handles
1003 * key specific errors.
1004 *
1005 * If true, every batch key is attempted regardless of previous key specific errors.
1006 * Node specific errors such as timeouts stop keys to that node, but keys directed at
1007 * other nodes will continue to be processed.
1008 *
1009 * If false, the server will stop the batch to its node on most key specific errors.
1010 * The exceptions are AEROSPIKE_ERR_RECORD_NOT_FOUND and AEROSPIKE_FILTERED_OUT
1011 * which never stop the batch. The client will stop the entire batch on node specific
1012 * errors for sync commands that are run in sequence (concurrent == false). The client
1013 * will not stop the entire batch for async commands or sync commands run in parallel.
1014 *
1015 * Server versions &lt; 6.0 do not support this field and treat this value as false
1016 * for key specific errors.
1017 *
1018 * Default: true
1019 */
1021
1022 /**
1023 * This method is deprecated and will eventually be removed.
1024 * The set name is now always sent for every distinct namespace/set in the batch.
1025 *
1026 * Send set name field to server for every key in the batch for batch index protocol.
1027 * This is necessary for batch writes and batch reads when authentication is enabled and
1028 * security roles are defined on a per set basis.
1029 *
1030 * @deprecated Set name always sent.
1031 */
1033
1034 /**
1035 * Should raw bytes be deserialized to as_list or as_map. Set to false for backup programs that
1036 * just need access to raw bytes.
1037 *
1038 * Default: true
1039 */
1041
1043
1044/**
1045 * Policy attributes used in batch read commands.
1046 * @ingroup client_policies
1047 */
1048typedef struct as_policy_batch_read_s {
1049 /**
1050 * Optional expression filter. If filter_exp exists and evaluates to false, the
1051 * transaction is ignored. This can be used to eliminate a client/server roundtrip
1052 * in some cases.
1053 *
1054 * aerospike_destroy() automatically calls as_exp_destroy() on all global default
1055 * policy filter expression instances. The user is responsible for calling as_exp_destroy()
1056 * on filter expressions when setting temporary transaction policies.
1057 *
1058 * Default: NULL
1059 */
1061
1062 /**
1063 * Read policy for AP (availability) namespaces.
1064 * Default: AS_POLICY_READ_MODE_AP_ONE
1065 */
1067
1068 /**
1069 * Read policy for SC (strong consistency) namespaces.
1070 * Default: AS_POLICY_READ_MODE_SC_SESSION
1071 */
1073
1074 /**
1075 * Determine how record TTL (time to live) is affected on reads. When enabled, the server can
1076 * efficiently operate as a read-based LRU cache where the least recently used records are expired.
1077 * The value is expressed as a percentage of the TTL sent on the most recent write such that a read
1078 * within this interval of the record’s end of life will generate a touch.
1079 *
1080 * For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
1081 * 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
1082 * recent write) will result in a touch, resetting the TTL to another 10 hours.
1083 *
1084 * Values:
1085 * <ul>
1086 * <li> 0 : Use server config default-read-touch-ttl-pct for the record's namespace/set.</li>
1087 * <li>-1 : Do not reset record TTL on reads.</li>
1088 * <li>1 - 100 : Reset record TTL on reads when within this percentage of the most recent write TTL.</li>
1089 * </ul>
1090 *
1091 * Default: 0
1092 */
1094
1096
1097/**
1098 * Policy attributes used in batch write commands.
1099 * @ingroup client_policies
1100 */
1101typedef struct as_policy_batch_write_s {
1102 /**
1103 * Optional expression filter. If filter_exp exists and evaluates to false, the
1104 * transaction is ignored. This can be used to eliminate a client/server roundtrip
1105 * in some cases.
1106 *
1107 * aerospike_destroy() automatically calls as_exp_destroy() on all global default
1108 * policy filter expression instances. The user is responsible for calling as_exp_destroy()
1109 * on filter expressions when setting temporary transaction policies.
1110 *
1111 * Default: NULL
1112 */
1114
1115 /**
1116 * Specifies the behavior for the key.
1117 */
1119
1120 /**
1121 * Specifies the number of replicas required to be committed successfully when writing
1122 * before returning transaction succeeded.
1123 */
1125
1126 /**
1127 * Specifies the behavior for the generation value.
1128 */
1130
1131 /**
1132 * Specifies the behavior for the existence of the record.
1133 */
1135
1136 /**
1137 * The default time-to-live (expiration) of the record in seconds. This field will only be
1138 * used if "as_operations.ttl" is set to AS_RECORD_CLIENT_DEFAULT_TTL. The as_operations
1139 * instance is passed in to batch write functions along with as_policy_batch_write.
1140 *
1141 * There are also special values that can be set in the record ttl:
1142 * <ul>
1143 * <li>AS_RECORD_DEFAULT_TTL: Use the server default ttl from the namespace.</li>
1144 * <li>AS_RECORD_NO_EXPIRE_TTL: Do not expire the record.</li>
1145 * <li>AS_RECORD_NO_CHANGE_TTL: Keep the existing record ttl when the record is updated.</li>
1146 * </ul>
1147 */
1148 uint32_t ttl;
1149
1150 /**
1151 * If the transaction results in a record deletion, leave a tombstone for the record.
1152 * This prevents deleted records from reappearing after node failures.
1153 * Valid for Aerospike Server Enterprise Edition only.
1154 *
1155 * Default: false (do not tombstone deleted records).
1156 */
1158
1160
1161/**
1162 * Policy attributes used in batch UDF apply commands.
1163 * @ingroup client_policies
1164 */
1165typedef struct as_policy_batch_apply_s {
1166 /**
1167 * Optional expression filter. If filter_exp exists and evaluates to false, the
1168 * transaction is ignored. This can be used to eliminate a client/server roundtrip
1169 * in some cases.
1170 *
1171 * aerospike_destroy() automatically calls as_exp_destroy() on all global default
1172 * policy filter expression instances. The user is responsible for calling as_exp_destroy()
1173 * on filter expressions when setting temporary transaction policies.
1174 *
1175 * Default: NULL
1176 */
1178
1179 /**
1180 * Specifies the behavior for the key.
1181 */
1183
1184 /**
1185 * Specifies the number of replicas required to be committed successfully when writing
1186 * before returning transaction succeeded.
1187 */
1189
1190 /**
1191 * The time-to-live (expiration) of the record in seconds. Note that ttl
1192 * is only used on write/update calls.
1193 *
1194 * There are also special values that can be set in the record ttl:
1195 * <ul>
1196 * <li>AS_RECORD_DEFAULT_TTL: Use the server default ttl from the namespace.</li>
1197 * <li>AS_RECORD_NO_EXPIRE_TTL: Do not expire the record.</li>
1198 * <li>AS_RECORD_NO_CHANGE_TTL: Keep the existing record ttl when the record is updated.</li>
1199 * </ul>
1200 */
1201 uint32_t ttl;
1202
1203 /**
1204 * If the transaction results in a record deletion, leave a tombstone for the record.
1205 * This prevents deleted records from reappearing after node failures.
1206 * Valid for Aerospike Server Enterprise Edition only.
1207 *
1208 * Default: false (do not tombstone deleted records).
1209 */
1211
1213
1214/**
1215 * Policy attributes used in batch remove commands.
1216 * @ingroup client_policies
1217 */
1218typedef struct as_policy_batch_remove_s {
1219 /**
1220 * Optional expression filter. If filter_exp exists and evaluates to false, the
1221 * transaction is ignored. This can be used to eliminate a client/server roundtrip
1222 * in some cases.
1223 *
1224 * aerospike_destroy() automatically calls as_exp_destroy() on all global default
1225 * policy filter expression instances. The user is responsible for calling as_exp_destroy()
1226 * on filter expressions when setting temporary transaction policies.
1227 *
1228 * Default: NULL
1229 */
1231
1232 /**
1233 * Specifies the behavior for the key.
1234 */
1236
1237 /**
1238 * Specifies the number of replicas required to be committed successfully when writing
1239 * before returning transaction succeeded.
1240 */
1242
1243 /**
1244 * Specifies the behavior for the generation value.
1245 */
1247
1248 /**
1249 * The generation of the record.
1250 */
1251 uint16_t generation;
1252
1253 /**
1254 * If the transaction results in a record deletion, leave a tombstone for the record.
1255 * This prevents deleted records from reappearing after node failures.
1256 * Valid for Aerospike Server Enterprise Edition only.
1257 *
1258 * Default: false (do not tombstone deleted records).
1259 */
1261
1263
1264/**
1265 * Query Policy
1266 *
1267 * @ingroup client_policies
1268 */
1269typedef struct as_policy_query_s {
1270
1271 /**
1272 * Generic policy fields.
1273 */
1275
1276 /**
1277 * Timeout used when info command is used that checks for cluster changes before and
1278 * after the query. This timeout is only used when fail_on_cluster_change is enabled.
1279 *
1280 * Default: 10000 ms
1281 */
1283
1284 /**
1285 * Algorithm used to determine target node.
1286 */
1288
1289 /**
1290 * Expected query duration. The server treats the query in different ways depending on the expected duration.
1291 * This field is ignored for aggregation queries, background queries and server versions &lt; 6.0.
1292 *
1293 * Default: AS_QUERY_DURATION_LONG
1294 */
1296
1297 /**
1298 * Terminate query if cluster is in migration state. If the server supports partition
1299 * queries or the query filter is null (scan), this field is ignored.
1300 *
1301 * Default: false
1302 */
1304
1305 /**
1306 * Should raw bytes representing a list or map be deserialized to as_list or as_map.
1307 * Set to false for backup programs that just need access to raw bytes.
1308 *
1309 * Default: true
1310 */
1312
1313 /**
1314 * This field is deprecated and will eventually be removed. Use expected_duration instead.
1315 *
1316 * For backwards compatibility: If short_query is true, the query is treated as a short query and
1317 * expected_duration is ignored. If short_query is false, expected_duration is used
1318 * and defaults to AS_QUERY_DURATION_LONG.
1319 *
1320 * Is query expected to return less than 100 records per node.
1321 * If true, the server will optimize the query for a small record set.
1322 * This field is ignored for aggregation queries, background queries
1323 * and server versions &lt; 6.0.
1324 *
1325 * Default: false
1326 *
1327 * @deprecated Use expected_duration instead.
1328 */
1330
1332
1333/**
1334 * Scan Policy
1335 *
1336 * @ingroup client_policies
1337 */
1338typedef struct as_policy_scan_s {
1339
1340 /**
1341 * Generic policy fields.
1342 */
1344
1345 /**
1346 * Approximate number of records to return to client. This number is divided by the
1347 * number of nodes involved in the scan. The actual number of records returned
1348 * may be less than max_records if node record counts are small and unbalanced across
1349 * nodes.
1350 *
1351 * Default: 0 (do not limit record count)
1352 */
1353 uint64_t max_records;
1354
1355 /**
1356 * Limit returned records per second (rps) rate for each server.
1357 * Do not apply rps limit if records_per_second is zero.
1358 *
1359 * Default: 0
1360 */
1362
1363 /**
1364 * Algorithm used to determine target node.
1365 */
1367
1368 /**
1369 * The default time-to-live (expiration) of the record in seconds. This field will only be
1370 * used on background scan writes if "as_scan.ttl" is set to AS_RECORD_CLIENT_DEFAULT_TTL.
1371 *
1372 * There are also special values that can be set in the record ttl:
1373 * <ul>
1374 * <li>AS_RECORD_DEFAULT_TTL: Use the server default ttl from the namespace.</li>
1375 * <li>AS_RECORD_NO_EXPIRE_TTL: Do not expire the record.</li>
1376 * <li>AS_RECORD_NO_CHANGE_TTL: Keep the existing record ttl when the record is updated.</li>
1377 * </ul>
1378 */
1379 uint32_t ttl;
1380
1381 /**
1382 * If the transaction results in a record deletion, leave a tombstone for the record.
1383 * This prevents deleted records from reappearing after node failures.
1384 * Valid for Aerospike Server Enterprise Edition only.
1385 *
1386 * Default: false (do not tombstone deleted records).
1387 */
1389
1391
1392/**
1393 * Info Policy
1394 *
1395 * @ingroup client_policies
1396 */
1397typedef struct as_policy_info_s {
1398
1399 /**
1400 * Maximum time in milliseconds to wait for the operation to complete.
1401 */
1402 uint32_t timeout;
1403
1404 /**
1405 * Send request without any further processing.
1406 */
1408
1409 /**
1410 * Ensure the request is within allowable size limits.
1411 */
1413
1415
1416/**
1417 * Administration Policy
1418 *
1419 * @ingroup client_policies
1420 */
1421typedef struct as_policy_admin_s {
1422
1423 /**
1424 * Maximum time in milliseconds to wait for the operation to complete.
1425 */
1426 uint32_t timeout;
1427
1429
1430/**
1431 * Struct of all policy values and operation policies.
1432 *
1433 * This is utilized by as_config to define default values for policies.
1434 *
1435 * @ingroup client_policies
1436 */
1437typedef struct as_policies_s {
1438
1439 /**
1440 * The default read policy.
1441 */
1443
1444 /**
1445 * The default write policy.
1446 */
1448
1449 /**
1450 * The default operate policy.
1451 */
1453
1454 /**
1455 * The default remove policy.
1456 */
1458
1459 /**
1460 * The default apply policy.
1461 */
1463
1464 /**
1465 * Default parent policy used in batch read commands.
1466 */
1468
1469 /**
1470 * Default parent policy used in batch write commands.
1471 */
1473
1474 /**
1475 * Default write policy used in batch operate commands.
1476 */
1478
1479 /**
1480 * Default user defined function policy used in batch UDF apply commands.
1481 */
1483
1484 /**
1485 * Default delete policy used in batch remove commands.
1486 */
1488
1489 /**
1490 * The default scan policy.
1491 */
1493
1494 /**
1495 * The default query policy.
1496 */
1498
1499 /**
1500 * The default info policy.
1501 */
1503
1504 /**
1505 * The default administration policy.
1506 */
1508
1509} as_policies;
1510
1511//---------------------------------
1512// Functions
1513//---------------------------------
1514
1515/**
1516 * Initialize base defaults for reads.
1517 */
1518static inline void
1528
1529/**
1530 * Initialize base defaults for writes.
1531 */
1532static inline void
1542
1543/**
1544 * Initialize base defaults for scan/query.
1545 *
1546 * Set max_retries for scans and non-aggregation queries with a null filter.
1547 * All other queries are not retried.
1548 *
1549 * The latest servers support retries on individual data partitions.
1550 * This feature is useful when a cluster is migrating and partition(s)
1551 * are missed or incomplete on the first query (with null filter) attempt.
1552 *
1553 * If the first query attempt misses 2 of 4096 partitions, then only
1554 * those 2 partitions are retried in the next query attempt from the
1555 * last key digest received for each respective partition. A higher
1556 * default max_retries is used because it's wasteful to invalidate
1557 * all query results because a single partition was missed.
1558 */
1559static inline void
1561{
1563 p->total_timeout = 0;
1564 p->max_retries = 5;
1565 p->sleep_between_retries = 0;
1566 p->filter_exp = NULL;
1567 p->compress = false;
1568}
1569
1570/**
1571 * Initialize as_policy_read to default values.
1572 *
1573 * @param p The policy to initialize.
1574 * @return The initialized policy.
1575 *
1576 * @relates as_policy_read
1577 */
1578static inline as_policy_read*
1591
1592/**
1593 * Shallow copy as_policy_read values.
1594 *
1595 * @param src The source policy.
1596 * @param trg The target policy.
1597 *
1598 * @relates as_policy_read
1599 */
1600static inline void
1602{
1603 *trg = *src;
1604}
1605
1606/**
1607 * Initialize as_policy_write to default values.
1608 *
1609 * @param p The policy to initialize.
1610 * @return The initialized policy.
1611 *
1612 * @relates as_policy_write
1613 */
1614static inline as_policy_write*
1628
1629/**
1630 * Shallow copy as_policy_write values.
1631 *
1632 * @param src The source policy.
1633 * @param trg The target policy.
1634 *
1635 * @relates as_policy_write
1636 */
1637static inline void
1639{
1640 *trg = *src;
1641}
1642
1643/**
1644 * Initialize as_policy_operate to default values.
1645 *
1646 * @param p The policy to initialize.
1647 * @return The initialized policy.
1648 *
1649 * @relates as_policy_operate
1650 */
1651static inline as_policy_operate*
1669
1670/**
1671 * Shallow copy as_policy_operate values.
1672 *
1673 * @param src The source policy.
1674 * @param trg The target policy.
1675 *
1676 * @relates as_policy_operate
1677 */
1678static inline void
1680{
1681 *trg = *src;
1682}
1683
1684/**
1685 * Initialize as_policy_remove to default values.
1686 *
1687 * @param p The policy to initialize.
1688 * @return The initialized policy.
1689 *
1690 * @relates as_policy_remove
1691 */
1692static inline as_policy_remove*
1704
1705/**
1706 * Shallow copy as_policy_remove values.
1707 *
1708 * @param src The source policy.
1709 * @param trg The target policy.
1710 *
1711 * @relates as_policy_remove
1712 */
1713static inline void
1715{
1716 *trg = *src;
1717}
1718
1719/**
1720 * Initialize as_policy_apply to default values.
1721 *
1722 * @param p The policy to initialize.
1723 * @return The initialized policy.
1724 *
1725 * @relates as_policy_apply
1726 */
1727static inline as_policy_apply*
1729{
1734 p->ttl = 0; // AS_RECORD_DEFAULT_TTL
1735 p->durable_delete = false;
1736 return p;
1737}
1738
1739/**
1740 * Shallow copy as_policy_apply values.
1741 *
1742 * @param src The source policy.
1743 * @param trg The target policy.
1744 *
1745 * @relates as_policy_apply
1746 */
1747static inline void
1749{
1750 *trg = *src;
1751}
1752
1753/**
1754 * Initialize as_policy_batch to default values.
1755 *
1756 * @param p The policy to initialize.
1757 * @return The initialized policy.
1758 *
1759 * @relates as_policy_batch
1760 */
1761static inline as_policy_batch*
1763{
1769 p->concurrent = false;
1770 p->allow_inline = true;
1771 p->allow_inline_ssd = false;
1772 p->respond_all_keys = true;
1773 p->send_set_name = true;
1774 p->deserialize = true;
1775 return p;
1776}
1777
1778/**
1779 * Initialize as_policy_batch to default values when writes may occur.
1780 *
1781 * @param p The policy to initialize.
1782 * @return The initialized policy.
1783 *
1784 * @relates as_policy_batch
1785 */
1786static inline as_policy_batch*
1788{
1789 as_policy_batch_init(p);
1790 p->base.max_retries = 0;
1791 return p;
1792}
1793
1794/**
1795 * Shallow copy as_policy_batch values.
1796 *
1797 * @param src The source policy.
1798 * @param trg The target policy.
1799 *
1800 * @relates as_policy_batch
1801 */
1802static inline void
1804{
1805 *trg = *src;
1806}
1807
1808/**
1809 * Initialize as_policy_batch_read to default values.
1810 * @relates as_policy_batch_read
1811 */
1812static inline as_policy_batch_read*
1821
1822/**
1823 * Initialize as_policy_batch_write to default values.
1824 * @relates as_policy_batch_write
1825 */
1826static inline as_policy_batch_write*
1828{
1829 p->filter_exp = NULL;
1834 p->ttl = 0; // AS_RECORD_DEFAULT_TTL
1835 p->durable_delete = false;
1836 return p;
1837}
1838
1839/**
1840 * Initialize as_policy_batch_apply to default values.
1841 * @relates as_policy_batch_apply
1842 */
1843static inline as_policy_batch_apply*
1845{
1846 p->filter_exp = NULL;
1849 p->ttl = 0; // AS_RECORD_DEFAULT_TTL
1850 p->durable_delete = false;
1851 return p;
1852}
1853
1854/**
1855 * Initialize as_policy_batch_remove to default values.
1856 * @relates as_policy_batch_remove
1857 */
1858static inline as_policy_batch_remove*
1860{
1861 p->filter_exp = NULL;
1865 p->generation = 0;
1866 p->durable_delete = false;
1867 return p;
1868}
1869
1870/**
1871 * Initialize as_policy_scan to default values.
1872 *
1873 * @param p The policy to initialize.
1874 * @return The initialized policy.
1875 *
1876 * @relates as_policy_scan
1877 */
1878static inline as_policy_scan*
1880{
1882 p->max_records = 0;
1883 p->records_per_second = 0;
1885 p->ttl = 0; // AS_RECORD_DEFAULT_TTL
1886 p->durable_delete = false;
1887 return p;
1888}
1889
1890/**
1891 * Shallow copy as_policy_scan values.
1892 *
1893 * @param src The source policy.
1894 * @param trg The target policy.
1895 *
1896 * @relates as_policy_scan
1897 */
1898static inline void
1900{
1901 *trg = *src;
1902}
1903
1904/**
1905 * Initialize as_policy_query to default values.
1906 *
1907 * @param p The policy to initialize.
1908 * @return The initialized policy.
1909 *
1910 * @relates as_policy_query
1911 */
1912static inline as_policy_query*
1914{
1916 p->info_timeout = 10000;
1919 p->fail_on_cluster_change = false;
1920 p->deserialize = true;
1921 p->short_query = false;
1922 return p;
1923}
1924
1925/**
1926 * Shallow copy as_policy_query values.
1927 *
1928 * @param src The source policy.
1929 * @param trg The target policy.
1930 *
1931 * @relates as_policy_query
1932 */
1933static inline void
1935{
1936 *trg = *src;
1937}
1938
1939/**
1940 * Initialize as_policy_info to default values.
1941 *
1942 * @param p The policy to initialize.
1943 * @return The initialized policy.
1944 *
1945 * @relates as_policy_info
1946 */
1947static inline as_policy_info*
1949{
1951 p->send_as_is = true;
1952 p->check_bounds = true;
1953 return p;
1954}
1955
1956/**
1957 * Copy as_policy_info values.
1958 *
1959 * @param src The source policy.
1960 * @param trg The target policy.
1961 *
1962 * @relates as_policy_info
1963 */
1964static inline void
1966{
1967 *trg = *src;
1968}
1969
1970/**
1971 * Initialize as_policy_admin to default values.
1972 *
1973 * @param p The policy to initialize.
1974 * @return The initialized policy.
1975 *
1976 * @relates as_policy_admin
1977 */
1978static inline as_policy_admin*
1984
1985/**
1986 * Copy as_policy_admin values.
1987 *
1988 * @param src The source policy.
1989 * @param trg The target policy.
1990 *
1991 * @relates as_policy_admin
1992 */
1993static inline void
1995{
1996 *trg = *src;
1997}
1998
1999/**
2000 * @private
2001 * Initialize as_policies.
2002 *
2003 * @relates as_policies
2004 */
2007
2008/**
2009 * @private
2010 * Destroy as_policies.
2011 *
2012 * @relates as_policies
2013 */
2014void
2016
2017#ifdef __cplusplus
2018} // end extern "C"
2019#endif
static void as_policy_base_query_init(as_policy_base *p)
Definition as_policy.h:1560
static void as_policy_base_read_init(as_policy_base *p)
Definition as_policy.h:1519
static void as_policy_base_write_init(as_policy_base *p)
Definition as_policy.h:1533
as_policy_commit_level
Definition as_policy.h:370
#define AS_POLICY_READ_MODE_AP_DEFAULT
Definition as_policy.h:120
as_policy_gen
Definition as_policy.h:172
#define AS_POLICY_COMPRESSION_THRESHOLD_DEFAULT
Definition as_policy.h:85
as_policy_read_mode_sc
Definition as_policy.h:333
as_policy_exists
Definition as_policy.h:236
#define AS_POLICY_EXISTS_DEFAULT
Definition as_policy.h:106
as_query_duration
Definition as_policy.h:390
#define AS_POLICY_READ_MODE_SC_DEFAULT
Definition as_policy.h:127
as_policy_retry
Definition as_policy.h:149
as_policy_key
Definition as_policy.h:200
#define AS_POLICY_TOTAL_TIMEOUT_DEFAULT
Definition as_policy.h:78
#define AS_POLICY_REPLICA_DEFAULT
Definition as_policy.h:113
as_policy_replica
Definition as_policy.h:272
#define AS_POLICY_COMMIT_LEVEL_DEFAULT
Definition as_policy.h:134
as_policy_read_mode_ap
Definition as_policy.h:312
#define AS_POLICY_GEN_DEFAULT
Definition as_policy.h:92
#define AS_POLICY_SOCKET_TIMEOUT_DEFAULT
Definition as_policy.h:71
#define AS_POLICY_KEY_DEFAULT
Definition as_policy.h:99
@ AS_POLICY_COMMIT_LEVEL_MASTER
Definition as_policy.h:380
@ AS_POLICY_COMMIT_LEVEL_ALL
Definition as_policy.h:375
@ AS_POLICY_GEN_EQ
Definition as_policy.h:182
@ AS_POLICY_GEN_IGNORE
Definition as_policy.h:177
@ AS_POLICY_GEN_GT
Definition as_policy.h:188
@ AS_POLICY_READ_MODE_SC_ALLOW_REPLICA
Definition as_policy.h:351
@ AS_POLICY_READ_MODE_SC_SESSION
Definition as_policy.h:339
@ AS_POLICY_READ_MODE_SC_ALLOW_UNAVAILABLE
Definition as_policy.h:357
@ AS_POLICY_READ_MODE_SC_LINEARIZE
Definition as_policy.h:345
@ AS_POLICY_EXISTS_UPDATE
Definition as_policy.h:251
@ AS_POLICY_EXISTS_IGNORE
Definition as_policy.h:241
@ AS_POLICY_EXISTS_REPLACE
Definition as_policy.h:256
@ AS_POLICY_EXISTS_CREATE
Definition as_policy.h:246
@ AS_POLICY_EXISTS_CREATE_OR_REPLACE
Definition as_policy.h:261
@ AS_QUERY_DURATION_LONG
Definition as_policy.h:403
@ AS_QUERY_DURATION_LONG_RELAX_AP
Definition as_policy.h:423
@ AS_QUERY_DURATION_SHORT
Definition as_policy.h:417
@ AS_POLICY_RETRY_ONCE
Definition as_policy.h:160
@ AS_POLICY_RETRY_NONE
Definition as_policy.h:154
@ AS_POLICY_KEY_SEND
Definition as_policy.h:224
@ AS_POLICY_KEY_DIGEST
Definition as_policy.h:209
@ AS_POLICY_REPLICA_PREFER_RACK
Definition as_policy.h:300
@ AS_POLICY_REPLICA_ANY
Definition as_policy.h:283
@ AS_POLICY_REPLICA_MASTER
Definition as_policy.h:277
@ AS_POLICY_REPLICA_SEQUENCE
Definition as_policy.h:291
@ AS_POLICY_READ_MODE_AP_ONE
Definition as_policy.h:317
@ AS_POLICY_READ_MODE_AP_ALL
Definition as_policy.h:322
as_policy_scan scan
Definition as_policy.h:1492
as_policy_admin admin
Definition as_policy.h:1507
as_policies * as_policies_init(as_policies *p)
void as_policies_destroy(as_policies *p)
as_policy_batch batch
Definition as_policy.h:1467
as_policy_write write
Definition as_policy.h:1447
as_policy_batch batch_parent_write
Definition as_policy.h:1472
as_policy_remove remove
Definition as_policy.h:1457
as_policy_apply apply
Definition as_policy.h:1462
as_policy_query query
Definition as_policy.h:1497
as_policy_batch_apply batch_apply
Definition as_policy.h:1482
as_policy_operate operate
Definition as_policy.h:1452
as_policy_info info
Definition as_policy.h:1502
as_policy_batch_remove batch_remove
Definition as_policy.h:1487
as_policy_read read
Definition as_policy.h:1442
as_policy_batch_write batch_write
Definition as_policy.h:1477
static void as_policy_admin_copy(const as_policy_admin *src, as_policy_admin *trg)
Definition as_policy.h:1994
static as_policy_admin * as_policy_admin_init(as_policy_admin *p)
Definition as_policy.h:1979
uint32_t timeout
Definition as_policy.h:1426
as_policy_base base
Definition as_policy.h:698
static as_policy_apply * as_policy_apply_init(as_policy_apply *p)
Definition as_policy.h:1728
as_policy_key key
Definition as_policy.h:703
static void as_policy_apply_copy(const as_policy_apply *src, as_policy_apply *trg)
Definition as_policy.h:1748
as_policy_commit_level commit_level
Definition as_policy.h:714
as_policy_replica replica
Definition as_policy.h:708
uint32_t socket_timeout
Definition as_policy.h:448
struct as_exp * filter_exp
Definition as_policy.h:529
uint32_t total_timeout
Definition as_policy.h:463
uint32_t sleep_between_retries
Definition as_policy.h:505
uint32_t max_retries
Definition as_policy.h:485
struct as_exp * filter_exp
Definition as_policy.h:1177
static as_policy_batch_apply * as_policy_batch_apply_init(as_policy_batch_apply *p)
Definition as_policy.h:1844
as_policy_commit_level commit_level
Definition as_policy.h:1188
as_policy_key key
Definition as_policy.h:1182
as_policy_read_mode_ap read_mode_ap
Definition as_policy.h:1066
struct as_exp * filter_exp
Definition as_policy.h:1060
as_policy_read_mode_sc read_mode_sc
Definition as_policy.h:1072
static as_policy_batch_read * as_policy_batch_read_init(as_policy_batch_read *p)
Definition as_policy.h:1813
struct as_exp * filter_exp
Definition as_policy.h:1230
as_policy_commit_level commit_level
Definition as_policy.h:1241
static as_policy_batch_remove * as_policy_batch_remove_init(as_policy_batch_remove *p)
Definition as_policy.h:1859
static as_policy_batch_write * as_policy_batch_write_init(as_policy_batch_write *p)
Definition as_policy.h:1827
as_policy_exists exists
Definition as_policy.h:1134
as_policy_commit_level commit_level
Definition as_policy.h:1124
as_policy_key key
Definition as_policy.h:1118
as_policy_gen gen
Definition as_policy.h:1129
struct as_exp * filter_exp
Definition as_policy.h:1113
static as_policy_batch * as_policy_batch_parent_write_init(as_policy_batch *p)
Definition as_policy.h:1787
as_policy_read_mode_ap read_mode_ap
Definition as_policy.h:925
as_policy_replica replica
Definition as_policy.h:919
as_policy_base base
Definition as_policy.h:914
as_policy_read_mode_sc read_mode_sc
Definition as_policy.h:931
int read_touch_ttl_percent
Definition as_policy.h:952
static void as_policy_batch_copy(const as_policy_batch *src, as_policy_batch *trg)
Definition as_policy.h:1803
bool allow_inline_ssd
Definition as_policy.h:998
static as_policy_batch * as_policy_batch_init(as_policy_batch *p)
Definition as_policy.h:1762
static as_policy_info * as_policy_info_init(as_policy_info *p)
Definition as_policy.h:1948
uint32_t timeout
Definition as_policy.h:1402
static void as_policy_info_copy(const as_policy_info *src, as_policy_info *trg)
Definition as_policy.h:1965
as_policy_gen gen
Definition as_policy.h:783
as_policy_replica replica
Definition as_policy.h:760
static void as_policy_operate_copy(const as_policy_operate *src, as_policy_operate *trg)
Definition as_policy.h:1679
as_policy_read_mode_ap read_mode_ap
Definition as_policy.h:766
as_policy_base base
Definition as_policy.h:750
as_policy_read_mode_sc read_mode_sc
Definition as_policy.h:772
as_policy_commit_level commit_level
Definition as_policy.h:778
as_policy_key key
Definition as_policy.h:755
as_policy_exists exists
Definition as_policy.h:788
static as_policy_operate * as_policy_operate_init(as_policy_operate *p)
Definition as_policy.h:1652
as_query_duration expected_duration
Definition as_policy.h:1295
uint32_t info_timeout
Definition as_policy.h:1282
static void as_policy_query_copy(const as_policy_query *src, as_policy_query *trg)
Definition as_policy.h:1934
static as_policy_query * as_policy_query_init(as_policy_query *p)
Definition as_policy.h:1913
as_policy_replica replica
Definition as_policy.h:1287
as_policy_base base
Definition as_policy.h:1274
bool fail_on_cluster_change
Definition as_policy.h:1303
as_policy_key key
Definition as_policy.h:560
static as_policy_read * as_policy_read_init(as_policy_read *p)
Definition as_policy.h:1579
bool async_heap_rec
Definition as_policy.h:616
as_policy_read_mode_sc read_mode_sc
Definition as_policy.h:577
static void as_policy_read_copy(const as_policy_read *src, as_policy_read *trg)
Definition as_policy.h:1601
int read_touch_ttl_percent
Definition as_policy.h:598
as_policy_read_mode_ap read_mode_ap
Definition as_policy.h:571
as_policy_replica replica
Definition as_policy.h:565
as_policy_base base
Definition as_policy.h:555
static void as_policy_remove_copy(const as_policy_remove *src, as_policy_remove *trg)
Definition as_policy.h:1714
uint16_t generation
Definition as_policy.h:891
as_policy_base base
Definition as_policy.h:865
as_policy_commit_level commit_level
Definition as_policy.h:881
static as_policy_remove * as_policy_remove_init(as_policy_remove *p)
Definition as_policy.h:1693
as_policy_gen gen
Definition as_policy.h:886
as_policy_replica replica
Definition as_policy.h:875
as_policy_key key
Definition as_policy.h:870
as_policy_base base
Definition as_policy.h:1343
static as_policy_scan * as_policy_scan_init(as_policy_scan *p)
Definition as_policy.h:1879
uint64_t max_records
Definition as_policy.h:1353
uint32_t records_per_second
Definition as_policy.h:1361
as_policy_replica replica
Definition as_policy.h:1366
static void as_policy_scan_copy(const as_policy_scan *src, as_policy_scan *trg)
Definition as_policy.h:1899
as_policy_gen gen
Definition as_policy.h:651
as_policy_exists exists
Definition as_policy.h:656
uint32_t compression_threshold
Definition as_policy.h:675
static as_policy_write * as_policy_write_init(as_policy_write *p)
Definition as_policy.h:1615
as_policy_key key
Definition as_policy.h:635
as_policy_base base
Definition as_policy.h:630
static void as_policy_write_copy(const as_policy_write *src, as_policy_write *trg)
Definition as_policy.h:1638
as_policy_replica replica
Definition as_policy.h:640
as_policy_commit_level commit_level
Definition as_policy.h:646