All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
as_policy.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2016 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_consistency_level
38  * - as_policy_commit_level
39  *
40  * ## Operation Policies
41  *
42  * The following are the operation policies. Operation policies are groups of
43  * policy values for a type of operation.
44  *
45  * - as_policy_batch
46  * - as_policy_info
47  * - as_policy_operate
48  * - as_policy_read
49  * - as_policy_remove
50  * - as_policy_query
51  * - as_policy_scan
52  * - as_policy_write
53  */
54 
55 #include <stdbool.h>
56 #include <stdint.h>
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 /******************************************************************************
63  * MACROS
64  *****************************************************************************/
65 
66 /**
67  * Default timeout value
68  *
69  * @ingroup client_policies
70  */
71 #define AS_POLICY_TIMEOUT_DEFAULT 1000
72 
73 /**
74  * Default number of retries when a transaction fails due to a network error.
75  *
76  * @ingroup client_policies
77  */
78 #define AS_POLICY_RETRY_DEFAULT 1
79 
80 /**
81  * Default milliseconds to sleep before a command retry.
82  *
83  * @ingroup client_policies
84  */
85 #define AS_POLICY_RETRY_SLEEP_DEFAULT 0
86 
87 /**
88  * Default value for compression threshold
89  *
90  * @ingroup client_policies
91  */
92 #define AS_POLICY_COMPRESSION_THRESHOLD_DEFAULT 0
93 
94 /**
95  * Default as_policy_gen value
96  *
97  * @ingroup client_policies
98  */
99 #define AS_POLICY_GEN_DEFAULT AS_POLICY_GEN_IGNORE
100 
101 /**
102  * Default as_policy_key value
103  *
104  * @ingroup client_policies
105  */
106 #define AS_POLICY_KEY_DEFAULT AS_POLICY_KEY_DIGEST
107 
108 /**
109  * Default as_policy_exists value
110  *
111  * @ingroup client_policies
112  */
113 #define AS_POLICY_EXISTS_DEFAULT AS_POLICY_EXISTS_IGNORE
114 
115 /**
116  * Default as_policy_replica value
117  *
118  * @ingroup client_policies
119  */
120 #define AS_POLICY_REPLICA_DEFAULT AS_POLICY_REPLICA_MASTER
121 
122 /**
123  * Default as_policy_consistency_level value for read
124  *
125  * @ingroup client_policies
126  */
127 #define AS_POLICY_CONSISTENCY_LEVEL_DEFAULT AS_POLICY_CONSISTENCY_LEVEL_ONE
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 
140 /**
141  * Retry Policy
142  *
143  * Specifies the behavior of failed operations.
144  *
145  * @ingroup client_policies
146  */
147 typedef enum as_policy_retry_e {
148 
149  /**
150  * Only attempt an operation once.
151  */
153 
154  /**
155  * If an operation fails, attempt the operation
156  * one more time.
157  */
159 
161 
162 /**
163  * Generation Policy
164  *
165  * Specifies the behavior of record modifications with regard to the
166  * generation value.
167  *
168  * @ingroup client_policies
169  */
170 typedef enum as_policy_gen_e {
171 
172  /**
173  * Write a record, regardless of generation.
174  */
176 
177  /**
178  * Write a record, ONLY if generations are equal
179  */
181 
182  /**
183  * Write a record, ONLY if local generation is
184  * greater-than remote generation
185  */
187 
188 } as_policy_gen;
189 
190 /**
191  * Key Policy
192  *
193  * Specifies the behavior for whether keys or digests
194  * should be sent to the cluster.
195  *
196  * @ingroup client_policies
197  */
198 typedef enum as_policy_key_e {
199 
200  /**
201  * Send the digest value of the key.
202  *
203  * This is the recommended mode of operation. This calculates the digest
204  * and send the digest to the server. The digest is only calculated on
205  * the client, and not on the server.
206  */
208 
209  /**
210  * Send the key, in addition to the digest value.
211  *
212  * If you want keys to be returned when scanning or querying, the keys must
213  * be stored on the server. This policy causes a write operation to store
214  * the key. Once a key is stored, the server will keep it - there is no
215  * need to use this policy on subsequent updates of the record.
216  *
217  * If this policy is used on read or delete operations, or on subsequent
218  * updates of a record with a stored key, the key sent will be compared
219  * with the key stored on the server. A mismatch will cause
220  * AEROSPIKE_ERR_RECORD_KEY_MISMATCH to be returned.
221  */
223 
224 } as_policy_key;
225 
226 /**
227  * Existence Policy
228  *
229  * Specifies the behavior for writing the record
230  * depending whether or not it exists.
231  *
232  * @ingroup client_policies
233  */
234 typedef enum as_policy_exists_e {
235 
236  /**
237  * Write the record, regardless of existence. (i.e. create or update.)
238  */
240 
241  /**
242  * Create a record, ONLY if it doesn't exist.
243  */
245 
246  /**
247  * Update a record, ONLY if it exists.
248  */
250 
251  /**
252  * Completely replace a record, ONLY if it exists.
253  */
255 
256  /**
257  * Completely replace a record if it exists, otherwise create it.
258  */
260 
262 
263 /**
264  * Replica Policy
265  *
266  * Specifies which partition replica to read from.
267  *
268  * @ingroup client_policies
269  */
270 typedef enum as_policy_replica_e {
271 
272  /**
273  * Read from the partition master replica node.
274  */
276 
277  /**
278  * Distribute reads across nodes containing key's master and replicated partition
279  * in round-robin fashion. Currently restricted to master and one prole.
280  */
282 
283  /**
284  * Always try node containing master partition first. If connection fails and
285  * `retry_on_timeout` is true, try node containing prole partition.
286  * Currently restricted to master and one prole.
287  */
289 
291 
292 /**
293  * Consistency Level
294  *
295  * Specifies the number of replicas to be consulted
296  * in a read operation to provide the desired
297  * consistency guarantee.
298  *
299  * @ingroup client_policies
300  */
301 typedef enum as_policy_consistency_level_e {
302 
303  /**
304  * Involve a single replica in the operation.
305  */
307 
308  /**
309  * Involve all replicas in the operation.
310  */
312 
314 
315 /**
316  * Commit Level
317  *
318  * Specifies the number of replicas required to be successfully
319  * committed before returning success in a write operation
320  * to provide the desired consistency guarantee.
321  *
322  * @ingroup client_policies
323  */
324 typedef enum as_policy_commit_level_e {
325 
326  /**
327  * Return succcess only after successfully committing all replicas.
328  */
330 
331  /**
332  * Return succcess after successfully committing the master replica.
333  */
335 
337 
338 /**
339  * Write Policy
340  *
341  * @ingroup client_policies
342  */
343 typedef struct as_policy_write_s {
344 
345  /**
346  * Maximum time in milliseconds to wait for the operation to complete.
347  */
348  uint32_t timeout;
349 
350  /**
351  * Maximum number of retries when a transaction fails due to a network error.
352  * Used by synchronous commands only.
353  * Default: 1
354  */
355  uint32_t retry;
356 
357  /**
358  * Milliseconds to sleep between retries.
359  * Used by synchronous commands only.
360  * Default: 0 (do not sleep)
361  */
363 
364  /**
365  * Minimum record size beyond which it is compressed and sent to the server.
366  */
368 
369  /**
370  * Specifies the behavior for the key.
371  */
373 
374  /**
375  * Specifies the behavior for the generation
376  * value.
377  */
379 
380  /**
381  * Specifies the behavior for the existence
382  * of the record.
383  */
385 
386  /**
387  * Specifies the number of replicas required
388  * to be committed successfully when writing
389  * before returning transaction succeeded.
390  */
392 
393  /**
394  * Should the client retry a command if the timeout is reached.
395  * Used by synchronous commands only.
396  * <p>
397  * Values:
398  * <ul>
399  * <li>
400  * false: Return error when the timeout has been reached. Note that retries can still occur if
401  * a command fails on a network error before the timeout has been reached.
402  * </li>
403  * <li>
404  * true: Retry command with same timeout when the timeout has been reached. The maximum number
405  * of retries is defined by `retry`.
406  * </li>
407  * </ul>
408  * Default: false
409  */
411 
412  /**
413  * If the transaction results in a record deletion, leave a tombstone for the record.
414  * This prevents deleted records from reappearing after node failures.
415  * Valid for Aerospike Server Enterprise Edition only.
416  *
417  * Default: false (do not tombstone deleted records).
418  */
420 
422 
423 /**
424  * Read Policy
425  *
426  * @ingroup client_policies
427  */
428 typedef struct as_policy_read_s {
429 
430  /**
431  * Maximum time in milliseconds to wait for the operation to complete.
432  */
433  uint32_t timeout;
434 
435  /**
436  * Maximum number of retries when a transaction fails due to a network error.
437  * Used by synchronous commands only.
438  * Default: 1
439  */
440  uint32_t retry;
441 
442  /**
443  * Milliseconds to sleep between retries.
444  * Used by synchronous commands only.
445  * Default: 0 (do not sleep)
446  */
448 
449  /**
450  * Specifies the behavior for the key.
451  */
453 
454  /**
455  * Specifies the replica to be consulted for the read.
456  */
458 
459  /**
460  * Specifies the number of replicas consulted
461  * when reading for the desired consistency guarantee.
462  */
464 
465  /**
466  * Should the client retry a command if the timeout is reached.
467  * Used by synchronous commands only.
468  * <p>
469  * Values:
470  * <ul>
471  * <li>
472  * false: Return error when the timeout has been reached. Note that retries can still occur if
473  * a command fails on a network error before the timeout has been reached.
474  * </li>
475  * <li>
476  * true: Retry command with same timeout when the timeout has been reached. The maximum number
477  * of retries is defined by `retry`.
478  * </li>
479  * </ul>
480  * Default: false
481  */
483 
484  /**
485  * Should raw bytes representing a list or map be deserialized to as_list or as_map.
486  * Set to false for backup programs that just need access to raw bytes.
487  * Default: true
488  */
490 
492 
493 /**
494  * Key Apply Policy
495  *
496  * @ingroup client_policies
497  */
498 typedef struct as_policy_apply_s {
499 
500  /**
501  * Maximum time in milliseconds to wait for the operation to complete.
502  */
503  uint32_t timeout;
504 
505  /**
506  * Maximum number of retries when a transaction fails due to a network error.
507  * Used by synchronous commands only.
508  * Default: 1
509  */
510  uint32_t retry;
511 
512  /**
513  * Milliseconds to sleep between retries.
514  * Used by synchronous commands only.
515  * Default: 0 (do not sleep)
516  */
518 
519  /**
520  * Specifies the behavior for the key.
521  */
523 
524  /**
525  * Specifies the number of replicas required
526  * to be committed successfully when writing
527  * before returning transaction succeeded.
528  */
530 
531  /**
532  * The time-to-live (expiration) of the record in seconds.
533  * There are two special values that can be set in the record TTL:
534  * (*) ZERO (defined as AS_RECORD_DEFAULT_TTL), which means that the
535  * record will adopt the default TTL value from the namespace.
536  * (*) 0xFFFFFFFF (also, -1 in a signed 32 bit int)
537  * (defined as AS_RECORD_NO_EXPIRE_TTL), which means that the record
538  * will get an internal "void_time" of zero, and thus will never expire.
539  *
540  * Note that the TTL value will be employed ONLY on write/update calls.
541  */
542  uint32_t ttl;
543 
544  /**
545  * Should the client retry a command if the timeout is reached.
546  * Used by synchronous commands only.
547  * <p>
548  * Values:
549  * <ul>
550  * <li>
551  * false: Return error when the timeout has been reached. Note that retries can still occur if
552  * a command fails on a network error before the timeout has been reached.
553  * </li>
554  * <li>
555  * true: Retry command with same timeout when the timeout has been reached. The maximum number
556  * of retries is defined by `retry`.
557  * </li>
558  * </ul>
559  * Default: false
560  */
562 
563  /**
564  * If the transaction results in a record deletion, leave a tombstone for the record.
565  * This prevents deleted records from reappearing after node failures.
566  * Valid for Aerospike Server Enterprise Edition only.
567  *
568  * Default: false (do not tombstone deleted records).
569  */
571 
573 
574 /**
575  * Operate Policy
576  *
577  * @ingroup client_policies
578  */
579 typedef struct as_policy_operate_s {
580 
581  /**
582  * Maximum time in milliseconds to wait for the operation to complete.
583  */
584  uint32_t timeout;
585 
586  /**
587  * Maximum number of retries when a transaction fails due to a network error.
588  * Used by synchronous commands only.
589  * Default: 1
590  */
591  uint32_t retry;
592 
593  /**
594  * Milliseconds to sleep between retries.
595  * Used by synchronous commands only.
596  * Default: 0 (do not sleep)
597  */
599 
600  /**
601  * Specifies the behavior for the key.
602  */
604 
605  /**
606  * Specifies the behavior for the generation
607  * value.
608  */
610 
611  /**
612  * Specifies the replica to be consulted for the read.
613  */
615 
616  /**
617  * Specifies the number of replicas consulted
618  * when reading for the desired consistency guarantee.
619  */
621 
622  /**
623  * Specifies the number of replicas required
624  * to be committed successfully when writing
625  * before returning transaction succeeded.
626  */
628 
629  /**
630  * Should the client retry a command if the timeout is reached.
631  * Used by synchronous commands only.
632  * <p>
633  * Values:
634  * <ul>
635  * <li>
636  * false: Return error when the timeout has been reached. Note that retries can still occur if
637  * a command fails on a network error before the timeout has been reached.
638  * </li>
639  * <li>
640  * true: Retry command with same timeout when the timeout has been reached. The maximum number
641  * of retries is defined by `retry`.
642  * </li>
643  * </ul>
644  * Default: false
645  */
647 
648  /**
649  * Should raw bytes representing a list or map be deserialized to as_list or as_map.
650  * Set to false for backup programs that just need access to raw bytes.
651  * Default: true
652  */
654 
655  /**
656  * If the transaction results in a record deletion, leave a tombstone for the record.
657  * This prevents deleted records from reappearing after node failures.
658  * Valid for Aerospike Server Enterprise Edition only.
659  *
660  * Default: false (do not tombstone deleted records).
661  */
663 
665 
666 /**
667  * Remove Policy
668  *
669  * @ingroup client_policies
670  */
671 typedef struct as_policy_remove_s {
672 
673  /**
674  * Maximum time in milliseconds to wait for the operation to complete.
675  */
676  uint32_t timeout;
677 
678  /**
679  * Maximum number of retries when a transaction fails due to a network error.
680  * Used by synchronous commands only.
681  * Default: 1
682  */
683  uint32_t retry;
684 
685  /**
686  * Milliseconds to sleep between retries.
687  * Used by synchronous commands only.
688  * Default: 0 (do not sleep)
689  */
691 
692  /**
693  * Specifies the behavior for the key.
694  */
696 
697  /**
698  * Specifies the behavior for the generation
699  * value.
700  */
702 
703  /**
704  * Specifies the number of replicas required
705  * to be committed successfully when writing
706  * before returning transaction succeeded.
707  */
709 
710  /**
711  * The generation of the record.
712  */
713  uint16_t generation;
714 
715  /**
716  * Should the client retry a command if the timeout is reached.
717  * Used by synchronous commands only.
718  * <p>
719  * Values:
720  * <ul>
721  * <li>
722  * false: Return error when the timeout has been reached. Note that retries can still occur if
723  * a command fails on a network error before the timeout has been reached.
724  * </li>
725  * <li>
726  * true: Retry command with same timeout when the timeout has been reached. The maximum number
727  * of retries is defined by `retry`.
728  * </li>
729  * </ul>
730  * Default: false
731  */
733 
734  /**
735  * If the transaction results in a record deletion, leave a tombstone for the record.
736  * This prevents deleted records from reappearing after node failures.
737  * Valid for Aerospike Server Enterprise Edition only.
738  *
739  * Default: false (do not tombstone deleted records).
740  */
742 
744 
745 /**
746  * Query Policy
747  *
748  * @ingroup client_policies
749  */
750 typedef struct as_policy_query_s {
751 
752  /**
753  * Maximum time in milliseconds to wait for
754  * the operation to complete.
755  *
756  * The default (0) means do not timeout.
757  */
758  uint32_t timeout;
759 
760  /**
761  * Should raw bytes representing a list or map be deserialized to as_list or as_map.
762  * Set to false for backup programs that just need access to raw bytes.
763  * Default: true
764  */
766 
768 
769 /**
770  * Scan Policy
771  *
772  * @ingroup client_policies
773  */
774 typedef struct as_policy_scan_s {
775 
776  /**
777  * Maximum time in milliseconds to wait for the operation to complete.
778  *
779  * The default (0) means do not timeout.
780  */
781  uint32_t timeout;
782 
783  /**
784  * Abort the scan if the cluster is not in a
785  * stable state.
786  */
788 
789  /**
790  * If the scan runs a UDF which results in a record deletion, leave a tombstone for the record.
791  * This prevents deleted records from reappearing after node failures.
792  * Valid for Aerospike Server Enterprise Edition only.
793  *
794  * Default: false (do not tombstone deleted records).
795  */
797 
799 
800 /**
801  * Info Policy
802  *
803  * @ingroup client_policies
804  */
805 typedef struct as_policy_info_s {
806 
807  /**
808  * Maximum time in milliseconds to wait for
809  * the operation to complete.
810  */
811  uint32_t timeout;
812 
813  /**
814  * Send request without any further processing.
815  */
817 
818  /**
819  * Ensure the request is within allowable size limits.
820  */
822 
824 
825 /**
826  * Batch Policy
827  *
828  * @ingroup client_policies
829  */
830 typedef struct as_policy_batch_s {
831 
832  /**
833  * Maximum time in milliseconds to wait for the operation to complete.
834  */
835  uint32_t timeout;
836 
837  /**
838  * Maximum number of retries when a transaction fails due to a network error.
839  * Used by synchronous commands only.
840  * Default: 1
841  */
842  uint32_t retry;
843 
844  /**
845  * Milliseconds to sleep between retries.
846  * Used by synchronous commands only.
847  * Default: 0 (do not sleep)
848  */
850 
851  /**
852  * Should the client retry a command if the timeout is reached.
853  * Used by synchronous commands only.
854  * <p>
855  * Values:
856  * <ul>
857  * <li>
858  * false: Return error when the timeout has been reached. Note that retries can still occur if
859  * a command fails on a network error before the timeout has been reached.
860  * </li>
861  * <li>
862  * true: Retry command with same timeout when the timeout has been reached. The maximum number
863  * of retries is defined by `retry`.
864  * </li>
865  * </ul>
866  * Default: false
867  */
869 
870  /**
871  * Determine if batch commands to each server are run in parallel threads.
872  * <p>
873  * Values:
874  * <ul>
875  * <li>
876  * false: Issue batch commands sequentially. This mode has a performance advantage for small
877  * to medium sized batch sizes because commands can be issued in the main transaction thread.
878  * This is the default.
879  * </li>
880  * <li>
881  * true: Issue batch commands in parallel threads. This mode has a performance
882  * advantage for large batch sizes because each node can process the command immediately.
883  * The downside is extra threads will need to be created (or taken from
884  * a thread pool).
885  * </li>
886  * </ul>
887  */
889 
890  /**
891  * Use old batch direct protocol where batch reads are handled by direct low-level batch server
892  * database routines. The batch direct protocol can be faster when there is a single namespace,
893  * but there is one important drawback. The batch direct protocol will not proxy to a different
894  * server node when the mapped node has migrated a record to another node (resulting in not
895  * found record).
896  * <p>
897  * This can happen after a node has been added/removed from the cluster and there is a lag
898  * between records being migrated and client partition map update (once per second).
899  * <p>
900  * The new batch index protocol will perform this record proxy when necessary.
901  * Default: false (use new batch index protocol if server supports it)
902  */
904 
905  /**
906  * Allow batch to be processed immediately in the server's receiving thread when the server
907  * deems it to be appropriate. If false, the batch will always be processed in separate
908  * transaction threads. This field is only relevant for the new batch index protocol.
909  * <p>
910  * For batch exists or batch reads of smaller sized records (<= 1K per record), inline
911  * processing will be significantly faster on "in memory" namespaces. The server disables
912  * inline processing on disk based namespaces regardless of this policy field.
913  * <p>
914  * Inline processing can introduce the possibility of unfairness because the server
915  * can process the entire batch before moving onto the next command.
916  * Default: true
917  */
919 
920  /**
921  * Send set name field to server for every key in the batch for batch index protocol.
922  * This is only necessary when authentication is enabled and security roles are defined
923  * on a per set basis.
924  * Default: false
925  */
927 
928  /**
929  * Should raw bytes be deserialized to as_list or as_map. Set to false for backup programs that
930  * just need access to raw bytes.
931  * Default: true
932  */
934 
936 
937 /**
938  * Administration Policy
939  *
940  * @ingroup client_policies
941  */
942 typedef struct as_policy_admin_s {
943 
944  /**
945  * Maximum time in milliseconds to wait for
946  * the operation to complete.
947  */
948  uint32_t timeout;
949 
951 
952 /**
953  * Struct of all policy values and operation policies.
954  *
955  * This is utilizes by as_config, to define global and default values
956  * for policies.
957  *
958  * @ingroup as_config_t
959  */
960 typedef struct as_policies_s {
961 
962  /***************************************************************************
963  * DEFAULT VALUES, IF SPECIFIC POLICY IS UNDEFINED
964  **************************************************************************/
965 
966  /**
967  * Default timeout in milliseconds.
968  *
969  * Default: `AS_POLICY_TIMEOUT_DEFAULT`
970  */
971  uint32_t timeout;
972 
973  /**
974  * Default maximum number of retries when a transaction fails due to a network error.
975  *
976  * Default: `AS_POLICY_RETRY_DEFAULT`
977  */
978  uint32_t retry;
979 
980  /**
981  * Default milliseconds to sleep between retries.
982  *
983  * Default: `AS_POLICY_RETRY_SLEEP_DEFAULT`
984  */
986 
987  /**
988  * Specifies the behavior for the key.
989  *
990  * Default: `AS_POLICY_KEY_DEFAULT`
991  */
993 
994  /**
995  * Specifies the behavior for the generation
996  * value.
997  *
998  * Default: `AS_POLICY_GEN_DEFAULT`
999  */
1001 
1002  /**
1003  * Specifies the behavior for the existence
1004  * of the record.
1005  *
1006  * Default: `AS_POLICY_EXISTS_DEFAULT`
1007  */
1009 
1010  /**
1011  * Specifies which replica to read.
1012  *
1013  * Default: `AS_POLICY_REPLICA_MASTER`
1014  */
1016 
1017  /**
1018  * Specifies the consistency level for reading.
1019  *
1020  * Default: `AS_POLICY_CONSISTENCY_LEVEL_ONE`
1021  */
1023 
1024  /**
1025  * Specifies the commit level for writing.
1026  *
1027  * Default: `AS_POLICY_COMMIT_LEVEL_ALL`
1028  */
1030 
1031  /***************************************************************************
1032  * SPECIFIC POLICIES
1033  **************************************************************************/
1034 
1035  /**
1036  * The default read policy.
1037  */
1039 
1040  /**
1041  * The default write policy.
1042  */
1044 
1045  /**
1046  * The default operate policy.
1047  */
1049 
1050  /**
1051  * The default remove policy.
1052  */
1054 
1055  /**
1056  * The default apply policy.
1057  */
1059 
1060  /**
1061  * The default query policy.
1062  */
1064 
1065  /**
1066  * The default scan policy.
1067  */
1069 
1070  /**
1071  * The default info policy.
1072  */
1074 
1075  /**
1076  * The default batch policy.
1077  */
1079 
1080  /**
1081  * The default administration policy.
1082  */
1084 
1085 } as_policies;
1086 
1087 /******************************************************************************
1088  * FUNCTIONS
1089  *****************************************************************************/
1090 
1091 /**
1092  * Initialize as_policy_read to default values.
1093  *
1094  * @param p The policy to initialize.
1095  * @return The initialized policy.
1096  *
1097  * @relates as_policy_read
1098  */
1099 static inline as_policy_read*
1101 {
1108  p->retry_on_timeout = false;
1109  p->deserialize = true;
1110  return p;
1111 }
1112 
1113 /**
1114  * Copy as_policy_read values.
1115  *
1116  * @param src The source policy.
1117  * @param trg The target policy.
1118  *
1119  * @relates as_policy_read
1120  */
1121 static inline void
1123 {
1124  *trg = *src;
1125 }
1126 
1127 /**
1128  * Initialize as_policy_write to default values.
1129  *
1130  * @param p The policy to initialize.
1131  * @return The initialized policy.
1132  *
1133  * @relates as_policy_write
1134  */
1135 static inline as_policy_write*
1137 {
1146  p->retry_on_timeout = false;
1147  p->durable_delete = false;
1148  return p;
1149 }
1150 
1151 /**
1152  * Copy as_policy_write values.
1153  *
1154  * @param src The source policy.
1155  * @param trg The target policy.
1156  *
1157  * @relates as_policy_write
1158  */
1159 static inline void
1161 {
1162  *trg = *src;
1163 }
1164 
1165 /**
1166  * Initialize as_policy_operate to default values.
1167  *
1168  * @param p The policy to initialize.
1169  * @return The initialized policy.
1170  *
1171  * @relates as_policy_operate
1172  */
1173 static inline as_policy_operate*
1175 {
1184  p->retry_on_timeout = false;
1185  p->deserialize = true;
1186  p->durable_delete = false;
1187  return p;
1188 }
1189 
1190 /**
1191  * Copy as_policy_operate values.
1192  *
1193  * @param src The source policy.
1194  * @param trg The target policy.
1195  *
1196  * @relates as_policy_operate
1197  */
1198 static inline void
1200 {
1201  *trg = *src;
1202 }
1203 
1204 /**
1205  * Initialize as_policy_remove to default values.
1206  *
1207  * @param p The policy to initialize.
1208  * @return The initialized policy.
1209  *
1210  * @relates as_policy_remove
1211  */
1212 static inline as_policy_remove*
1214 {
1221  p->generation = 0;
1222  p->retry_on_timeout = false;
1223  p->durable_delete = false;
1224  return p;
1225 }
1226 
1227 /**
1228  * Copy as_policy_remove values.
1229  *
1230  * @param src The source policy.
1231  * @param trg The target policy.
1232  *
1233  * @relates as_policy_remove
1234  */
1235 static inline void
1237 {
1238  *trg = *src;
1239 }
1240 
1241 /**
1242  * Initialize as_policy_apply to default values.
1243  *
1244  * @param p The policy to initialize.
1245  * @return The initialized policy.
1246  *
1247  * @relates as_policy_apply
1248  */
1249 static inline as_policy_apply*
1251 {
1257  p->ttl = 0; // AS_RECORD_DEFAULT_TTL
1258  p->retry_on_timeout = false;
1259  p->durable_delete = false;
1260  return p;
1261 }
1262 
1263 /**
1264  * Copy as_policy_apply values.
1265  *
1266  * @param src The source policy.
1267  * @param trg The target policy.
1268  *
1269  * @relates as_policy_apply
1270  */
1271 static inline void
1273 {
1274  *trg = *src;
1275 }
1276 
1277 /**
1278  * Initialize as_policy_info to default values.
1279  *
1280  * @param p The policy to initialize.
1281  * @return The initialized policy.
1282  *
1283  * @relates as_policy_info
1284  */
1285 static inline as_policy_info*
1287 {
1289  p->send_as_is = true;
1290  p->check_bounds = true;
1291  return p;
1292 }
1293 
1294 /**
1295  * Copy as_policy_info values.
1296  *
1297  * @param src The source policy.
1298  * @param trg The target policy.
1299  *
1300  * @relates as_policy_info
1301  */
1302 static inline void
1304 {
1305  *trg = *src;
1306 }
1307 
1308 /**
1309  * Initialize as_policy_batch to default values.
1310  *
1311  * @param p The policy to initialize.
1312  * @return The initialized policy.
1313  *
1314  * @relates as_policy_batch
1315  */
1316 static inline as_policy_batch*
1318 {
1322  p->retry_on_timeout = false;
1323  p->concurrent = false;
1324  p->use_batch_direct = false;
1325  p->allow_inline = true;
1326  p->send_set_name = false;
1327  p->deserialize = true;
1328  return p;
1329 }
1330 
1331 /**
1332  * Copy as_policy_batch values.
1333  *
1334  * @param src The source policy.
1335  * @param trg The target policy.
1336  *
1337  * @relates as_policy_batch
1338  */
1339 static inline void
1341 {
1342  *trg = *src;
1343 }
1344 
1345 /**
1346  * Initialize as_policy_admin to default values.
1347  *
1348  * @param p The policy to initialize.
1349  * @return The initialized policy.
1350  *
1351  * @relates as_policy_admin
1352  */
1353 static inline as_policy_admin*
1355 {
1357  return p;
1358 }
1359 
1360 /**
1361  * Copy as_policy_admin values.
1362  *
1363  * @param src The source policy.
1364  * @param trg The target policy.
1365  *
1366  * @relates as_policy_admin
1367  */
1368 static inline void
1370 {
1371  *trg = *src;
1372 }
1373 
1374 /**
1375  * Initialize as_policy_scan to default values.
1376  *
1377  * @param p The policy to initialize.
1378  * @return The initialized policy.
1379  *
1380  * @relates as_policy_scan
1381  */
1382 static inline as_policy_scan*
1384 {
1385  p->timeout = 0;
1386  p->fail_on_cluster_change = false;
1387  p->durable_delete = false;
1388  return p;
1389 }
1390 
1391 /**
1392  * Copy as_policy_scan values.
1393  *
1394  * @param src The source policy.
1395  * @param trg The target policy.
1396  *
1397  * @relates as_policy_scan
1398  */
1399 static inline void
1401 {
1402  *trg = *src;
1403 }
1404 
1405 /**
1406  * Initialize as_policy_query to default values.
1407  *
1408  * @param p The policy to initialize.
1409  * @return The initialized policy.
1410  *
1411  * @relates as_policy_query
1412  */
1413 static inline as_policy_query*
1415 {
1416  p->timeout = 0;
1417  p->deserialize = true;
1418  return p;
1419 }
1420 
1421 /**
1422  * Copy as_policy_query values.
1423  *
1424  * @param src The source policy.
1425  * @param trg The target policy.
1426  *
1427  * @relates as_policy_query
1428  */
1429 static inline void
1431 {
1432  *trg = *src;
1433 }
1434 
1435 /**
1436  * Initialize as_policies to undefined values.
1437  * as_policies_resolve() will later be called resolve undefined values to global defaults.
1438  *
1439  * @param p The policies to undefine
1440  * @return The undefined policies.
1441  *
1442  * @relates as_policies
1443  */
1444 as_policies*
1446 
1447 /**
1448  * Resolve global policies (like timeout) with operational policies (like as_policy_read).
1449  *
1450  * @param p The policies to resolve
1451  *
1452  * @relates as_policies
1453  */
1454 void
1456 
1457 #ifdef __cplusplus
1458 } // end extern "C"
1459 #endif
static as_policy_batch * as_policy_batch_init(as_policy_batch *p)
Definition: as_policy.h:1317
static as_policy_operate * as_policy_operate_init(as_policy_operate *p)
Definition: as_policy.h:1174
bool fail_on_cluster_change
Definition: as_policy.h:787
uint32_t retry
Definition: as_policy.h:355
as_policy_key
Definition: as_policy.h:198
static as_policy_apply * as_policy_apply_init(as_policy_apply *p)
Definition: as_policy.h:1250
uint32_t timeout
Definition: as_policy.h:503
static as_policy_query * as_policy_query_init(as_policy_query *p)
Definition: as_policy.h:1414
as_policy_replica
Definition: as_policy.h:270
as_policy_scan scan
Definition: as_policy.h:1068
as_policy_replica replica
Definition: as_policy.h:457
as_policy_consistency_level
Definition: as_policy.h:301
static as_policy_info * as_policy_info_init(as_policy_info *p)
Definition: as_policy.h:1286
as_policy_commit_level commit_level
Definition: as_policy.h:708
bool deserialize
Definition: as_policy.h:489
uint32_t sleep_between_retries
Definition: as_policy.h:598
as_policy_consistency_level consistency_level
Definition: as_policy.h:463
as_policy_admin admin
Definition: as_policy.h:1083
as_policy_commit_level
Definition: as_policy.h:324
as_policy_key key
Definition: as_policy.h:452
as_policy_gen gen
Definition: as_policy.h:701
uint32_t sleep_between_retries
Definition: as_policy.h:985
as_policy_gen
Definition: as_policy.h:170
as_policy_retry
Definition: as_policy.h:147
as_policy_key key
Definition: as_policy.h:695
as_policy_commit_level commit_level
Definition: as_policy.h:627
#define AS_POLICY_COMPRESSION_THRESHOLD_DEFAULT
Definition: as_policy.h:92
static void as_policy_write_copy(as_policy_write *src, as_policy_write *trg)
Definition: as_policy.h:1160
uint32_t timeout
Definition: as_policy.h:948
uint32_t retry
Definition: as_policy.h:510
bool check_bounds
Definition: as_policy.h:821
static void as_policy_query_copy(as_policy_query *src, as_policy_query *trg)
Definition: as_policy.h:1430
static as_policy_read * as_policy_read_init(as_policy_read *p)
Definition: as_policy.h:1100
as_policy_key key
Definition: as_policy.h:603
uint32_t sleep_between_retries
Definition: as_policy.h:517
uint32_t timeout
Definition: as_policy.h:835
#define AS_POLICY_RETRY_SLEEP_DEFAULT
Definition: as_policy.h:85
bool retry_on_timeout
Definition: as_policy.h:561
as_policy_exists
Definition: as_policy.h:234
uint32_t timeout
Definition: as_policy.h:758
as_policy_info info
Definition: as_policy.h:1073
bool retry_on_timeout
Definition: as_policy.h:732
uint32_t compression_threshold
Definition: as_policy.h:367
as_policy_write write
Definition: as_policy.h:1043
bool retry_on_timeout
Definition: as_policy.h:868
static void as_policy_apply_copy(as_policy_apply *src, as_policy_apply *trg)
Definition: as_policy.h:1272
static void as_policy_operate_copy(as_policy_operate *src, as_policy_operate *trg)
Definition: as_policy.h:1199
as_policy_apply apply
Definition: as_policy.h:1058
uint32_t timeout
Definition: as_policy.h:811
uint32_t timeout
Definition: as_policy.h:348
#define AS_POLICY_REPLICA_DEFAULT
Definition: as_policy.h:120
static as_policy_remove * as_policy_remove_init(as_policy_remove *p)
Definition: as_policy.h:1213
#define AS_POLICY_CONSISTENCY_LEVEL_DEFAULT
Definition: as_policy.h:127
uint32_t ttl
Definition: as_policy.h:542
uint32_t timeout
Definition: as_policy.h:433
as_policy_query query
Definition: as_policy.h:1063
uint32_t retry
Definition: as_policy.h:683
#define AS_POLICY_RETRY_DEFAULT
Definition: as_policy.h:78
as_policy_operate operate
Definition: as_policy.h:1048
uint32_t retry
Definition: as_policy.h:978
static void as_policy_read_copy(as_policy_read *src, as_policy_read *trg)
Definition: as_policy.h:1122
bool durable_delete
Definition: as_policy.h:419
static as_policy_admin * as_policy_admin_init(as_policy_admin *p)
Definition: as_policy.h:1354
uint32_t sleep_between_retries
Definition: as_policy.h:447
void as_policies_resolve(as_policies *p)
#define AS_POLICY_KEY_DEFAULT
Definition: as_policy.h:106
uint32_t retry
Definition: as_policy.h:591
as_policies * as_policies_init(as_policies *p)
bool durable_delete
Definition: as_policy.h:570
bool retry_on_timeout
Definition: as_policy.h:410
as_policy_replica replica
Definition: as_policy.h:1015
as_policy_key key
Definition: as_policy.h:992
as_policy_key key
Definition: as_policy.h:522
uint32_t timeout
Definition: as_policy.h:971
bool durable_delete
Definition: as_policy.h:796
as_policy_gen gen
Definition: as_policy.h:1000
#define AS_POLICY_GEN_DEFAULT
Definition: as_policy.h:99
as_policy_gen gen
Definition: as_policy.h:609
as_policy_commit_level commit_level
Definition: as_policy.h:1029
bool send_set_name
Definition: as_policy.h:926
static void as_policy_admin_copy(as_policy_admin *src, as_policy_admin *trg)
Definition: as_policy.h:1369
uint32_t timeout
Definition: as_policy.h:676
as_policy_read read
Definition: as_policy.h:1038
as_policy_exists exists
Definition: as_policy.h:1008
uint32_t retry
Definition: as_policy.h:842
static void as_policy_info_copy(as_policy_info *src, as_policy_info *trg)
Definition: as_policy.h:1303
as_policy_batch batch
Definition: as_policy.h:1078
uint32_t timeout
Definition: as_policy.h:781
uint32_t retry
Definition: as_policy.h:440
#define AS_POLICY_TIMEOUT_DEFAULT
Definition: as_policy.h:71
as_policy_consistency_level consistency_level
Definition: as_policy.h:1022
#define AS_POLICY_EXISTS_DEFAULT
Definition: as_policy.h:113
as_policy_exists exists
Definition: as_policy.h:384
static void as_policy_scan_copy(as_policy_scan *src, as_policy_scan *trg)
Definition: as_policy.h:1400
uint32_t timeout
Definition: as_policy.h:584
uint32_t sleep_between_retries
Definition: as_policy.h:849
#define AS_POLICY_COMMIT_LEVEL_DEFAULT
Definition: as_policy.h:134
static void as_policy_batch_copy(as_policy_batch *src, as_policy_batch *trg)
Definition: as_policy.h:1340
as_policy_key key
Definition: as_policy.h:372
as_policy_commit_level commit_level
Definition: as_policy.h:391
static as_policy_scan * as_policy_scan_init(as_policy_scan *p)
Definition: as_policy.h:1383
static void as_policy_remove_copy(as_policy_remove *src, as_policy_remove *trg)
Definition: as_policy.h:1236
bool retry_on_timeout
Definition: as_policy.h:482
static as_policy_write * as_policy_write_init(as_policy_write *p)
Definition: as_policy.h:1136
as_policy_consistency_level consistency_level
Definition: as_policy.h:620
uint32_t sleep_between_retries
Definition: as_policy.h:690
uint32_t sleep_between_retries
Definition: as_policy.h:362
as_policy_gen gen
Definition: as_policy.h:378
bool use_batch_direct
Definition: as_policy.h:903
as_policy_commit_level commit_level
Definition: as_policy.h:529
as_policy_replica replica
Definition: as_policy.h:614
uint16_t generation
Definition: as_policy.h:713