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 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_MASTER
114 
115 /**
116  * Default as_policy_consistency_level value for read
117  *
118  * @ingroup client_policies
119  */
120 #define AS_POLICY_CONSISTENCY_LEVEL_DEFAULT AS_POLICY_CONSISTENCY_LEVEL_ONE
121 
122 /**
123  * Default as_policy_commit_level value for write
124  *
125  * @ingroup client_policies
126  */
127 #define AS_POLICY_COMMIT_LEVEL_DEFAULT AS_POLICY_COMMIT_LEVEL_ALL
128 
129 /******************************************************************************
130  * TYPES
131  *****************************************************************************/
132 
133 /**
134  * Retry Policy
135  *
136  * Specifies the behavior of failed operations.
137  *
138  * @ingroup client_policies
139  */
140 typedef enum as_policy_retry_e {
141 
142  /**
143  * Only attempt an operation once.
144  */
146 
147  /**
148  * If an operation fails, attempt the operation
149  * one more time.
150  */
152 
154 
155 /**
156  * Generation Policy
157  *
158  * Specifies the behavior of record modifications with regard to the
159  * generation value.
160  *
161  * @ingroup client_policies
162  */
163 typedef enum as_policy_gen_e {
164 
165  /**
166  * Write a record, regardless of generation.
167  */
169 
170  /**
171  * Write a record, ONLY if generations are equal
172  */
174 
175  /**
176  * Write a record, ONLY if local generation is
177  * greater-than remote generation
178  */
180 
181 } as_policy_gen;
182 
183 /**
184  * Key Policy
185  *
186  * Specifies the behavior for whether keys or digests
187  * should be sent to the cluster.
188  *
189  * @ingroup client_policies
190  */
191 typedef enum as_policy_key_e {
192 
193  /**
194  * Send the digest value of the key.
195  *
196  * This is the recommended mode of operation. This calculates the digest
197  * and send the digest to the server. The digest is only calculated on
198  * the client, and not on the server.
199  */
201 
202  /**
203  * Send the key, in addition to the digest value.
204  *
205  * If you want keys to be returned when scanning or querying, the keys must
206  * be stored on the server. This policy causes a write operation to store
207  * the key. Once a key is stored, the server will keep it - there is no
208  * need to use this policy on subsequent updates of the record.
209  *
210  * If this policy is used on read or delete operations, or on subsequent
211  * updates of a record with a stored key, the key sent will be compared
212  * with the key stored on the server. A mismatch will cause
213  * AEROSPIKE_ERR_RECORD_KEY_MISMATCH to be returned.
214  */
216 
217 } as_policy_key;
218 
219 /**
220  * Existence Policy
221  *
222  * Specifies the behavior for writing the record
223  * depending whether or not it exists.
224  *
225  * @ingroup client_policies
226  */
227 typedef enum as_policy_exists_e {
228 
229  /**
230  * Write the record, regardless of existence. (i.e. create or update.)
231  */
233 
234  /**
235  * Create a record, ONLY if it doesn't exist.
236  */
238 
239  /**
240  * Update a record, ONLY if it exists.
241  */
243 
244  /**
245  * Completely replace a record, ONLY if it exists.
246  */
248 
249  /**
250  * Completely replace a record if it exists, otherwise create it.
251  */
253 
255 
256 /**
257  * Replica Policy
258  *
259  * Specifies which partition replica to read from.
260  *
261  * @ingroup client_policies
262  */
263 typedef enum as_policy_replica_e {
264 
265  /**
266  * Read from the partition master replica node.
267  */
269 
270  /**
271  * Read from an unspecified replica node.
272  */
274 
276 
277 /**
278  * Consistency Level
279  *
280  * Specifies the number of replicas to be consulted
281  * in a read operation to provide the desired
282  * consistency guarantee.
283  *
284  * @ingroup client_policies
285  */
286 typedef enum as_policy_consistency_level_e {
287 
288  /**
289  * Involve a single replica in the operation.
290  */
292 
293  /**
294  * Involve all replicas in the operation.
295  */
297 
299 
300 /**
301  * Commit Level
302  *
303  * Specifies the number of replicas required to be successfully
304  * committed before returning success in a write operation
305  * to provide the desired consistency guarantee.
306  *
307  * @ingroup client_policies
308  */
309 typedef enum as_policy_commit_level_e {
310 
311  /**
312  * Return succcess only after successfully committing all replicas.
313  */
315 
316  /**
317  * Return succcess after successfully committing the master replica.
318  */
320 
322 
323 /**
324  * Write Policy
325  *
326  * @ingroup client_policies
327  */
328 typedef struct as_policy_write_s {
329 
330  /**
331  * Maximum time in milliseconds to wait for
332  * the operation to complete.
333  */
334  uint32_t timeout;
335 
336  /**
337  * Maximum number of retries when a transaction fails due to a network error.
338  */
339  uint32_t retry;
340 
341  /**
342  * Minimum record size beyond which it is compressed and sent to the server.
343  */
345 
346  /**
347  * Specifies the behavior for the key.
348  */
350 
351  /**
352  * Specifies the behavior for the generation
353  * value.
354  */
356 
357  /**
358  * Specifies the behavior for the existence
359  * of the record.
360  */
362 
363  /**
364  * Specifies the number of replicas required
365  * to be committed successfully when writing
366  * before returning transaction succeeded.
367  */
369 
370  /**
371  * If the transaction results in a record deletion, leave a tombstone for the record.
372  * This prevents deleted records from reappearing after node failures.
373  * Valid for Aerospike Server Enterprise Edition only.
374  *
375  * Default: false (do not tombstone deleted records).
376  */
378 
380 
381 /**
382  * Read Policy
383  *
384  * @ingroup client_policies
385  */
386 typedef struct as_policy_read_s {
387 
388  /**
389  * Maximum time in milliseconds to wait for
390  * the operation to complete.
391  */
392  uint32_t timeout;
393 
394  /**
395  * Maximum number of retries when a transaction fails due to a network error.
396  */
397  uint32_t retry;
398 
399  /**
400  * Specifies the behavior for the key.
401  */
403 
404  /**
405  * Specifies the replica to be consulted for the read.
406  */
408 
409  /**
410  * Specifies the number of replicas consulted
411  * when reading for the desired consistency guarantee.
412  */
414 
415  /**
416  * Should raw bytes representing a list or map be deserialized to as_list or as_map.
417  * Set to false for backup programs that just need access to raw bytes.
418  * Default: true
419  */
421 
423 
424 /**
425  * Key Apply Policy
426  *
427  * @ingroup client_policies
428  */
429 typedef struct as_policy_apply_s {
430 
431  /**
432  * Maximum time in milliseconds to wait for
433  * the operation to complete.
434  */
435  uint32_t timeout;
436 
437  /**
438  * Specifies the behavior for the key.
439  */
441 
442  /**
443  * Specifies the number of replicas required
444  * to be committed successfully when writing
445  * before returning transaction succeeded.
446  */
448 
449  /**
450  * The time-to-live (expiration) of the record in seconds.
451  * There are two special values that can be set in the record TTL:
452  * (*) ZERO (defined as AS_RECORD_DEFAULT_TTL), which means that the
453  * record will adopt the default TTL value from the namespace.
454  * (*) 0xFFFFFFFF (also, -1 in a signed 32 bit int)
455  * (defined as AS_RECORD_NO_EXPIRE_TTL), which means that the record
456  * will get an internal "void_time" of zero, and thus will never expire.
457  *
458  * Note that the TTL value will be employed ONLY on write/update calls.
459  */
460  uint32_t ttl;
461 
462  /**
463  * If the transaction results in a record deletion, leave a tombstone for the record.
464  * This prevents deleted records from reappearing after node failures.
465  * Valid for Aerospike Server Enterprise Edition only.
466  *
467  * Default: false (do not tombstone deleted records).
468  */
470 
472 
473 /**
474  * Operate Policy
475  *
476  * @ingroup client_policies
477  */
478 typedef struct as_policy_operate_s {
479 
480  /**
481  * Maximum time in milliseconds to wait for
482  * the operation to complete.
483  */
484  uint32_t timeout;
485 
486  /**
487  * Maximum number of retries when a transaction fails due to a network error.
488  */
489  uint32_t retry;
490 
491  /**
492  * Specifies the behavior for the key.
493  */
495 
496  /**
497  * Specifies the behavior for the generation
498  * value.
499  */
501 
502  /**
503  * Specifies the replica to be consulted for the read.
504  */
506 
507  /**
508  * Specifies the number of replicas consulted
509  * when reading for the desired consistency guarantee.
510  */
512 
513  /**
514  * Specifies the number of replicas required
515  * to be committed successfully when writing
516  * before returning transaction succeeded.
517  */
519 
520  /**
521  * Should raw bytes representing a list or map be deserialized to as_list or as_map.
522  * Set to false for backup programs that just need access to raw bytes.
523  * Default: true
524  */
526 
527  /**
528  * If the transaction results in a record deletion, leave a tombstone for the record.
529  * This prevents deleted records from reappearing after node failures.
530  * Valid for Aerospike Server Enterprise Edition only.
531  *
532  * Default: false (do not tombstone deleted records).
533  */
535 
537 
538 /**
539  * Remove Policy
540  *
541  * @ingroup client_policies
542  */
543 typedef struct as_policy_remove_s {
544 
545  /**
546  * Maximum time in milliseconds to wait for
547  * the operation to complete.
548  */
549  uint32_t timeout;
550 
551  /**
552  * The generation of the record.
553  */
554  uint16_t generation;
555 
556  /**
557  * Maximum number of retries when a transaction fails due to a network error.
558  */
559  uint32_t retry;
560 
561  /**
562  * Specifies the behavior for the key.
563  */
565 
566  /**
567  * Specifies the behavior for the generation
568  * value.
569  */
571 
572  /**
573  * Specifies the number of replicas required
574  * to be committed successfully when writing
575  * before returning transaction succeeded.
576  */
578 
579  /**
580  * If the transaction results in a record deletion, leave a tombstone for the record.
581  * This prevents deleted records from reappearing after node failures.
582  * Valid for Aerospike Server Enterprise Edition only.
583  *
584  * Default: false (do not tombstone deleted records).
585  */
587 
589 
590 /**
591  * Query Policy
592  *
593  * @ingroup client_policies
594  */
595 typedef struct as_policy_query_s {
596 
597  /**
598  * Maximum time in milliseconds to wait for
599  * the operation to complete.
600  *
601  * The default (0) means do not timeout.
602  */
603  uint32_t timeout;
604 
605  /**
606  * Should raw bytes representing a list or map be deserialized to as_list or as_map.
607  * Set to false for backup programs that just need access to raw bytes.
608  * Default: true
609  */
611 
613 
614 /**
615  * Scan Policy
616  *
617  * @ingroup client_policies
618  */
619 typedef struct as_policy_scan_s {
620 
621  /**
622  * Maximum time in milliseconds to wait for the operation to complete.
623  *
624  * The default (0) means do not timeout.
625  */
626  uint32_t timeout;
627 
628  /**
629  * Abort the scan if the cluster is not in a
630  * stable state.
631  */
633 
634  /**
635  * If the scan runs a UDF which results in a record deletion, leave a tombstone for the record.
636  * This prevents deleted records from reappearing after node failures.
637  * Valid for Aerospike Server Enterprise Edition only.
638  *
639  * Default: false (do not tombstone deleted records).
640  */
642 
644 
645 /**
646  * Info Policy
647  *
648  * @ingroup client_policies
649  */
650 typedef struct as_policy_info_s {
651 
652  /**
653  * Maximum time in milliseconds to wait for
654  * the operation to complete.
655  */
656  uint32_t timeout;
657 
658  /**
659  * Send request without any further processing.
660  */
662 
663  /**
664  * Ensure the request is within allowable size limits.
665  */
667 
669 
670 /**
671  * Batch Policy
672  *
673  * @ingroup client_policies
674  */
675 typedef struct as_policy_batch_s {
676 
677  /**
678  * Maximum time in milliseconds to wait for
679  * the operation to complete.
680  */
681  uint32_t timeout;
682 
683  /**
684  * Determine if batch commands to each server are run in parallel threads.
685  * <p>
686  * Values:
687  * <ul>
688  * <li>
689  * false: Issue batch commands sequentially. This mode has a performance advantage for small
690  * to medium sized batch sizes because commands can be issued in the main transaction thread.
691  * This is the default.
692  * </li>
693  * <li>
694  * true: Issue batch commands in parallel threads. This mode has a performance
695  * advantage for large batch sizes because each node can process the command immediately.
696  * The downside is extra threads will need to be created (or taken from
697  * a thread pool).
698  * </li>
699  * </ul>
700  */
702 
703  /**
704  * Use old batch direct protocol where batch reads are handled by direct low-level batch server
705  * database routines. The batch direct protocol can be faster when there is a single namespace,
706  * but there is one important drawback. The batch direct protocol will not proxy to a different
707  * server node when the mapped node has migrated a record to another node (resulting in not
708  * found record).
709  * <p>
710  * This can happen after a node has been added/removed from the cluster and there is a lag
711  * between records being migrated and client partition map update (once per second).
712  * <p>
713  * The new batch index protocol will perform this record proxy when necessary.
714  * Default: false (use new batch index protocol if server supports it)
715  */
717 
718  /**
719  * Allow batch to be processed immediately in the server's receiving thread when the server
720  * deems it to be appropriate. If false, the batch will always be processed in separate
721  * transaction threads. This field is only relevant for the new batch index protocol.
722  * <p>
723  * For batch exists or batch reads of smaller sized records (<= 1K per record), inline
724  * processing will be significantly faster on "in memory" namespaces. The server disables
725  * inline processing on disk based namespaces regardless of this policy field.
726  * <p>
727  * Inline processing can introduce the possibility of unfairness because the server
728  * can process the entire batch before moving onto the next command.
729  * Default: true
730  */
732 
733  /**
734  * Send set name field to server for every key in the batch for batch index protocol.
735  * This is only necessary when authentication is enabled and security roles are defined
736  * on a per set basis.
737  * Default: false
738  */
740 
741  /**
742  * Should raw bytes be deserialized to as_list or as_map. Set to false for backup programs that
743  * just need access to raw bytes.
744  * Default: true
745  */
747 
749 
750 /**
751  * Administration Policy
752  *
753  * @ingroup client_policies
754  */
755 typedef struct as_policy_admin_s {
756 
757  /**
758  * Maximum time in milliseconds to wait for
759  * the operation to complete.
760  */
761  uint32_t timeout;
762 
764 
765 /**
766  * Struct of all policy values and operation policies.
767  *
768  * This is utilizes by as_config, to define global and default values
769  * for policies.
770  *
771  * @ingroup as_config_t
772  */
773 typedef struct as_policies_s {
774 
775  /***************************************************************************
776  * DEFAULT VALUES, IF SPECIFIC POLICY IS UNDEFINED
777  **************************************************************************/
778 
779  /**
780  * Default timeout in milliseconds.
781  *
782  * Will be used if specific policies have a timeout of 0 (zero).
783  *
784  * Default: `AS_POLICY_TIMEOUT_DEFAULT`
785  */
786  uint32_t timeout;
787 
788  /**
789  * Maximum number of retries when a transaction fails due to a network error.
790  *
791  * Default: `AS_POLICY_RETRY_DEFAULT`
792  */
793  uint32_t retry;
794 
795  /**
796  * Specifies the behavior for the key.
797  *
798  * Default: `AS_POLICY_KEY_DEFAULT`
799  */
801 
802  /**
803  * Specifies the behavior for the generation
804  * value.
805  *
806  * Default: `AS_POLICY_GEN_DEFAULT`
807  */
809 
810  /**
811  * Specifies the behavior for the existence
812  * of the record.
813  *
814  * Default: `AS_POLICY_EXISTS_DEFAULT`
815  */
817 
818  /**
819  * Specifies which replica to read.
820  *
821  * Default: `AS_POLICY_REPLICA_MASTER`
822  */
824 
825  /**
826  * Specifies the consistency level for reading.
827  *
828  * Default: `AS_POLICY_CONSISTENCY_LEVEL_ONE`
829  */
831 
832  /**
833  * Specifies the commit level for writing.
834  *
835  * Default: `AS_POLICY_COMMIT_LEVEL_ALL`
836  */
838 
839  /***************************************************************************
840  * SPECIFIC POLICIES
841  **************************************************************************/
842 
843  /**
844  * The default read policy.
845  */
847 
848  /**
849  * The default write policy.
850  */
852 
853  /**
854  * The default operate policy.
855  */
857 
858  /**
859  * The default remove policy.
860  */
862 
863  /**
864  * The default apply policy.
865  */
867 
868  /**
869  * The default query policy.
870  */
872 
873  /**
874  * The default scan policy.
875  */
877 
878  /**
879  * The default info policy.
880  */
882 
883  /**
884  * The default batch policy.
885  */
887 
888  /**
889  * The default administration policy.
890  */
892 
893 } as_policies;
894 
895 /******************************************************************************
896  * FUNCTIONS
897  *****************************************************************************/
898 
899 /**
900  * Initialize as_policy_read to default values.
901  *
902  * @param p The policy to initialize.
903  * @return The initialized policy.
904  *
905  * @relates as_policy_read
906  */
907 static inline as_policy_read*
909 {
915  p->deserialize = true;
916  return p;
917 }
918 
919 /**
920  * Copy as_policy_read values.
921  *
922  * @param src The source policy.
923  * @param trg The target policy.
924  *
925  * @relates as_policy_read
926  */
927 static inline void
929 {
930  trg->timeout = src->timeout;
931  trg->retry = src->retry;
932  trg->key = src->key;
933  trg->replica = src->replica;
935  trg->deserialize = src->deserialize;
936 }
937 
938 /**
939  * Initialize as_policy_write to default values.
940  *
941  * @param p The policy to initialize.
942  * @return The initialized policy.
943  *
944  * @relates as_policy_write
945  */
946 static inline as_policy_write*
948 {
956  p->durable_delete = false;
957  return p;
958 }
959 
960 /**
961  * Copy as_policy_write values.
962  *
963  * @param src The source policy.
964  * @param trg The target policy.
965  *
966  * @relates as_policy_write
967  */
968 static inline void
970 {
971  trg->timeout = src->timeout;
972  trg->retry = src->retry;
974  trg->key = src->key;
975  trg->gen = src->gen;
976  trg->exists = src->exists;
977  trg->commit_level = src->commit_level;
978  trg->durable_delete = src->durable_delete;
979 }
980 
981 /**
982  * Initialize as_policy_operate to default values.
983  *
984  * @param p The policy to initialize.
985  * @return The initialized policy.
986  *
987  * @relates as_policy_operate
988  */
989 static inline as_policy_operate*
991 {
999  p->deserialize = true;
1000  p->durable_delete = false;
1001  return p;
1002 }
1003 
1004 /**
1005  * Copy as_policy_operate values.
1006  *
1007  * @param src The source policy.
1008  * @param trg The target policy.
1009  *
1010  * @relates as_policy_operate
1011  */
1012 static inline void
1014 {
1015  trg->timeout = src->timeout;
1016  trg->retry = src->retry;
1017  trg->key = src->key;
1018  trg->gen = src->gen;
1019  trg->replica = src->replica;
1021  trg->commit_level = src->commit_level;
1022  trg->deserialize = src->deserialize;
1023  trg->durable_delete = src->durable_delete;
1024 }
1025 
1026 /**
1027  * Initialize as_policy_remove to default values.
1028  *
1029  * @param p The policy to initialize.
1030  * @return The initialized policy.
1031  *
1032  * @relates as_policy_remove
1033  */
1034 static inline as_policy_remove*
1036 {
1041  p->generation = 0;
1043  p->durable_delete = false;
1044  return p;
1045 }
1046 
1047 /**
1048  * Copy as_policy_remove values.
1049  *
1050  * @param src The source policy.
1051  * @param trg The target policy.
1052  *
1053  * @relates as_policy_remove
1054  */
1055 static inline void
1057 {
1058  trg->timeout = src->timeout;
1059  trg->retry = src->retry;
1060  trg->key = src->key;
1061  trg->gen = src->gen;
1062  trg->generation = src->generation;
1063  trg->commit_level = src->commit_level;
1064  trg->durable_delete = src->durable_delete;
1065 }
1066 
1067 /**
1068  * Initialize as_policy_apply to default values.
1069  *
1070  * @param p The policy to initialize.
1071  * @return The initialized policy.
1072  *
1073  * @relates as_policy_apply
1074  */
1075 static inline as_policy_apply*
1077 {
1081  p->ttl = 0; // AS_RECORD_DEFAULT_TTL
1082  p->durable_delete = false;
1083  return p;
1084 }
1085 
1086 /**
1087  * Copy as_policy_apply values.
1088  *
1089  * @param src The source policy.
1090  * @param trg The target policy.
1091  *
1092  * @relates as_policy_apply
1093  */
1094 static inline void
1096 {
1097  trg->timeout = src->timeout;
1098  trg->key = src->key;
1099  trg->commit_level = src->commit_level;
1100  trg->ttl = src->ttl;
1101  trg->durable_delete = src->durable_delete;
1102 }
1103 
1104 /**
1105  * Initialize as_policy_info to default values.
1106  *
1107  * @param p The policy to initialize.
1108  * @return The initialized policy.
1109  *
1110  * @relates as_policy_info
1111  */
1112 static inline as_policy_info*
1114 {
1116  p->send_as_is = true;
1117  p->check_bounds = true;
1118  return p;
1119 }
1120 
1121 /**
1122  * Copy as_policy_info values.
1123  *
1124  * @param src The source policy.
1125  * @param trg The target policy.
1126  *
1127  * @relates as_policy_info
1128  */
1129 static inline void
1131 {
1132  trg->timeout = src->timeout;
1133  trg->send_as_is = src->send_as_is;
1134  trg->check_bounds = src->check_bounds;
1135 }
1136 
1137 /**
1138  * Initialize as_policy_batch to default values.
1139  *
1140  * @param p The policy to initialize.
1141  * @return The initialized policy.
1142  *
1143  * @relates as_policy_batch
1144  */
1145 static inline as_policy_batch*
1147 {
1149  p->concurrent = false;
1150  p->use_batch_direct = false;
1151  p->allow_inline = true;
1152  p->send_set_name = false;
1153  p->deserialize = true;
1154  return p;
1155 }
1156 
1157 /**
1158  * Copy as_policy_batch values.
1159  *
1160  * @param src The source policy.
1161  * @param trg The target policy.
1162  *
1163  * @relates as_policy_batch
1164  */
1165 static inline void
1167 {
1168  trg->timeout = src->timeout;
1169  trg->concurrent = src->concurrent;
1170  trg->use_batch_direct = src->use_batch_direct;
1171  trg->allow_inline = src->allow_inline;
1172  trg->send_set_name = src->send_set_name;
1173  trg->deserialize = src->deserialize;
1174 }
1175 
1176 /**
1177  * Initialize as_policy_admin to default values.
1178  *
1179  * @param p The policy to initialize.
1180  * @return The initialized policy.
1181  *
1182  * @relates as_policy_admin
1183  */
1184 static inline as_policy_admin*
1186 {
1188  return p;
1189 }
1190 
1191 /**
1192  * Copy as_policy_admin values.
1193  *
1194  * @param src The source policy.
1195  * @param trg The target policy.
1196  *
1197  * @relates as_policy_admin
1198  */
1199 static inline void
1201 {
1202  trg->timeout = src->timeout;
1203 }
1204 
1205 /**
1206  * Initialize as_policy_scan to default values.
1207  *
1208  * @param p The policy to initialize.
1209  * @return The initialized policy.
1210  *
1211  * @relates as_policy_scan
1212  */
1213 static inline as_policy_scan*
1215 {
1216  p->timeout = 0;
1217  p->fail_on_cluster_change = false;
1218  p->durable_delete = false;
1219  return p;
1220 }
1221 
1222 /**
1223  * Copy as_policy_scan values.
1224  *
1225  * @param src The source policy.
1226  * @param trg The target policy.
1227  *
1228  * @relates as_policy_scan
1229  */
1230 static inline void
1232 {
1233  trg->timeout = src->timeout;
1235  trg->durable_delete = src->durable_delete;
1236 }
1237 
1238 /**
1239  * Initialize as_policy_query to default values.
1240  *
1241  * @param p The policy to initialize.
1242  * @return The initialized policy.
1243  *
1244  * @relates as_policy_query
1245  */
1246 static inline as_policy_query*
1248 {
1249  p->timeout = 0;
1250  p->deserialize = true;
1251  return p;
1252 }
1253 
1254 /**
1255  * Copy as_policy_query values.
1256  *
1257  * @param src The source policy.
1258  * @param trg The target policy.
1259  *
1260  * @relates as_policy_query
1261  */
1262 static inline void
1264 {
1265  trg->timeout = src->timeout;
1266  trg->deserialize = src->deserialize;
1267 }
1268 
1269 /**
1270  * Initialize as_policies to undefined values.
1271  * as_policies_resolve() will later be called resolve undefined values to global defaults.
1272  *
1273  * @param p The policies to undefine
1274  * @return The undefined policies.
1275  *
1276  * @relates as_policies
1277  */
1278 as_policies*
1280 
1281 /**
1282  * Resolve global policies (like timeout) with operational policies (like as_policy_read).
1283  *
1284  * @param p The policies to resolve
1285  *
1286  * @relates as_policies
1287  */
1288 void
1290 
1291 #ifdef __cplusplus
1292 } // end extern "C"
1293 #endif