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-2015 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 
371 
372 /**
373  * Read Policy
374  *
375  * @ingroup client_policies
376  */
377 typedef struct as_policy_read_s {
378 
379  /**
380  * Maximum time in milliseconds to wait for
381  * the operation to complete.
382  */
383  uint32_t timeout;
384 
385  /**
386  * Maximum number of retries when a transaction fails due to a network error.
387  */
388  uint32_t retry;
389 
390  /**
391  * Specifies the behavior for the key.
392  */
394 
395  /**
396  * Specifies the replica to be consulted for the read.
397  */
399 
400  /**
401  * Specifies the number of replicas consulted
402  * when reading for the desired consistency guarantee.
403  */
405 
406  /**
407  * Should raw bytes representing a list or map be deserialized to as_list or as_map.
408  * Set to false for backup programs that just need access to raw bytes.
409  * Default: true
410  */
412 
414 
415 /**
416  * Key Apply Policy
417  *
418  * @ingroup client_policies
419  */
420 typedef struct as_policy_apply_s {
421 
422  /**
423  * Maximum time in milliseconds to wait for
424  * the operation to complete.
425  */
426  uint32_t timeout;
427 
428  /**
429  * Specifies the behavior for the key.
430  */
432 
433  /**
434  * Specifies the number of replicas required
435  * to be committed successfully when writing
436  * before returning transaction succeeded.
437  */
439 
440  /**
441  * The time-to-live (expiration) of the record in seconds.
442  * There are two special values that can be set in the record TTL:
443  * (*) ZERO (defined as AS_RECORD_DEFAULT_TTL), which means that the
444  * record will adopt the default TTL value from the namespace.
445  * (*) 0xFFFFFFFF (also, -1 in a signed 32 bit int)
446  * (defined as AS_RECORD_NO_EXPIRE_TTL), which means that the record
447  * will get an internal "void_time" of zero, and thus will never expire.
448  *
449  * Note that the TTL value will be employed ONLY on write/update calls.
450  */
451  uint32_t ttl;
452 
454 
455 /**
456  * Operate Policy
457  *
458  * @ingroup client_policies
459  */
460 typedef struct as_policy_operate_s {
461 
462  /**
463  * Maximum time in milliseconds to wait for
464  * the operation to complete.
465  */
466  uint32_t timeout;
467 
468  /**
469  * Maximum number of retries when a transaction fails due to a network error.
470  */
471  uint32_t retry;
472 
473  /**
474  * Specifies the behavior for the key.
475  */
477 
478  /**
479  * Specifies the behavior for the generation
480  * value.
481  */
483 
484  /**
485  * Specifies the replica to be consulted for the read.
486  */
488 
489  /**
490  * Specifies the number of replicas consulted
491  * when reading for the desired consistency guarantee.
492  */
494 
495  /**
496  * Specifies the number of replicas required
497  * to be committed successfully when writing
498  * before returning transaction succeeded.
499  */
501 
502  /**
503  * Should raw bytes representing a list or map be deserialized to as_list or as_map.
504  * Set to false for backup programs that just need access to raw bytes.
505  * Default: true
506  */
508 
510 
511 /**
512  * Remove Policy
513  *
514  * @ingroup client_policies
515  */
516 typedef struct as_policy_remove_s {
517 
518  /**
519  * Maximum time in milliseconds to wait for
520  * the operation to complete.
521  */
522  uint32_t timeout;
523 
524  /**
525  * The generation of the record.
526  */
527  uint16_t generation;
528 
529  /**
530  * Maximum number of retries when a transaction fails due to a network error.
531  */
532  uint32_t retry;
533 
534  /**
535  * Specifies the behavior for the key.
536  */
538 
539  /**
540  * Specifies the behavior for the generation
541  * value.
542  */
544 
545  /**
546  * Specifies the number of replicas required
547  * to be committed successfully when writing
548  * before returning transaction succeeded.
549  */
551 
553 
554 /**
555  * Query Policy
556  *
557  * @ingroup client_policies
558  */
559 typedef struct as_policy_query_s {
560 
561  /**
562  * Maximum time in milliseconds to wait for
563  * the operation to complete.
564  *
565  * The default (0) means do not timeout.
566  */
567  uint32_t timeout;
568 
569  /**
570  * Should raw bytes representing a list or map be deserialized to as_list or as_map.
571  * Set to false for backup programs that just need access to raw bytes.
572  * Default: true
573  */
575 
577 
578 /**
579  * Scan Policy
580  *
581  * @ingroup client_policies
582  */
583 typedef struct as_policy_scan_s {
584 
585  /**
586  * Maximum time in milliseconds to wait for the operation to complete.
587  *
588  * The default (0) means do not timeout.
589  */
590  uint32_t timeout;
591 
592  /**
593  * Abort the scan if the cluster is not in a
594  * stable state.
595  */
597 
599 
600 /**
601  * Info Policy
602  *
603  * @ingroup client_policies
604  */
605 typedef struct as_policy_info_s {
606 
607  /**
608  * Maximum time in milliseconds to wait for
609  * the operation to complete.
610  */
611  uint32_t timeout;
612 
613  /**
614  * Send request without any further processing.
615  */
617 
618  /**
619  * Ensure the request is within allowable size limits.
620  */
622 
624 
625 /**
626  * Batch Policy
627  *
628  * @ingroup client_policies
629  */
630 typedef struct as_policy_batch_s {
631 
632  /**
633  * Maximum time in milliseconds to wait for
634  * the operation to complete.
635  */
636  uint32_t timeout;
637 
638  /**
639  * Determine if batch commands to each server are run in parallel threads.
640  * <p>
641  * Values:
642  * <ul>
643  * <li>
644  * false: Issue batch commands sequentially. This mode has a performance advantage for small
645  * to medium sized batch sizes because commands can be issued in the main transaction thread.
646  * This is the default.
647  * </li>
648  * <li>
649  * true: Issue batch commands in parallel threads. This mode has a performance
650  * advantage for large batch sizes because each node can process the command immediately.
651  * The downside is extra threads will need to be created (or taken from
652  * a thread pool).
653  * </li>
654  * </ul>
655  */
657 
658  /**
659  * Use old batch direct protocol where batch reads are handled by direct low-level batch server
660  * database routines. The batch direct protocol can be faster when there is a single namespace,
661  * but there is one important drawback. The batch direct protocol will not proxy to a different
662  * server node when the mapped node has migrated a record to another node (resulting in not
663  * found record).
664  * <p>
665  * This can happen after a node has been added/removed from the cluster and there is a lag
666  * between records being migrated and client partition map update (once per second).
667  * <p>
668  * The new batch index protocol will perform this record proxy when necessary.
669  * Default: false (use new batch index protocol if server supports it)
670  */
672 
673  /**
674  * Allow batch to be processed immediately in the server's receiving thread when the server
675  * deems it to be appropriate. If false, the batch will always be processed in separate
676  * transaction threads. This field is only relevant for the new batch index protocol.
677  * <p>
678  * For batch exists or batch reads of smaller sized records (<= 1K per record), inline
679  * processing will be significantly faster on "in memory" namespaces. The server disables
680  * inline processing on disk based namespaces regardless of this policy field.
681  * <p>
682  * Inline processing can introduce the possibility of unfairness because the server
683  * can process the entire batch before moving onto the next command.
684  * Default: true
685  */
687 
688  /**
689  * Should raw bytes be deserialized to as_list or as_map. Set to false for backup programs that
690  * just need access to raw bytes.
691  * Default: true
692  */
694 
696 
697 /**
698  * Administration Policy
699  *
700  * @ingroup client_policies
701  */
702 typedef struct as_policy_admin_s {
703 
704  /**
705  * Maximum time in milliseconds to wait for
706  * the operation to complete.
707  */
708  uint32_t timeout;
709 
711 
712 /**
713  * Struct of all policy values and operation policies.
714  *
715  * This is utilizes by as_config, to define global and default values
716  * for policies.
717  *
718  * @ingroup as_config_t
719  */
720 typedef struct as_policies_s {
721 
722  /***************************************************************************
723  * DEFAULT VALUES, IF SPECIFIC POLICY IS UNDEFINED
724  **************************************************************************/
725 
726  /**
727  * Default timeout in milliseconds.
728  *
729  * Will be used if specific policies have a timeout of 0 (zero).
730  *
731  * The default value is `AS_POLICY_TIMEOUT_DEFAULT`.
732  */
733  uint32_t timeout;
734 
735  /**
736  * Maximum number of retries when a transaction fails due to a network error.
737  *
738  * The default value is `AS_POLICY_RETRY_DEFAULT`.
739  */
740  uint32_t retry;
741 
742  /**
743  * Specifies the behavior for the key.
744  *
745  * The default value is `AS_POLICY_KEY_DEFAULT`.
746  */
748 
749  /**
750  * Specifies the behavior for the generation
751  * value.
752  *
753  * The default value is `AS_POLICY_GEN_DEFAULT`.
754  */
756 
757  /**
758  * Specifies the behavior for the existence
759  * of the record.
760  *
761  * The default value is `AS_POLICY_EXISTS_DEFAULT`.
762  */
764 
765  /**
766  * Specifies which replica to read.
767  *
768  * The default value is `AS_POLICY_REPLICA_MASTER`.
769  */
771 
772  /**
773  * Specifies the consistency level for reading.
774  *
775  * The default value is `AS_POLICY_CONSISTENCY_LEVEL_ONE`.
776  */
778 
779  /**
780  * Specifies the commit level for writing.
781  *
782  * The default value is `AS_POLICY_COMMIT_LEVEL_ALL`.
783  */
785 
786  /***************************************************************************
787  * SPECIFIC POLICIES
788  **************************************************************************/
789 
790  /**
791  * The default read policy.
792  */
794 
795  /**
796  * The default write policy.
797  */
799 
800  /**
801  * The default operate policy.
802  */
804 
805  /**
806  * The default remove policy.
807  */
809 
810  /**
811  * The default apply policy.
812  */
814 
815  /**
816  * The default query policy.
817  */
819 
820  /**
821  * The default scan policy.
822  */
824 
825  /**
826  * The default info policy.
827  */
829 
830  /**
831  * The default batch policy.
832  */
834 
835  /**
836  * The default administration policy.
837  */
839 
840 } as_policies;
841 
842 /******************************************************************************
843  * FUNCTIONS
844  *****************************************************************************/
845 
846 /**
847  * Initialize as_policy_read to default values.
848  *
849  * @param p The policy to initialize.
850  * @return The initialized policy.
851  *
852  * @relates as_policy_read
853  */
854 static inline as_policy_read*
856 {
862  p->deserialize = true;
863  return p;
864 }
865 
866 /**
867  * Copy as_policy_read values.
868  *
869  * @param src The source policy.
870  * @param trg The target policy.
871  *
872  * @relates as_policy_read
873  */
874 static inline void
876 {
877  trg->timeout = src->timeout;
878  trg->retry = src->retry;
879  trg->key = src->key;
880  trg->replica = src->replica;
882  trg->deserialize = src->deserialize;
883 }
884 
885 /**
886  * Initialize as_policy_write to default values.
887  *
888  * @param p The policy to initialize.
889  * @return The initialized policy.
890  *
891  * @relates as_policy_write
892  */
893 static inline as_policy_write*
895 {
903  return p;
904 }
905 
906 /**
907  * Copy as_policy_write values.
908  *
909  * @param src The source policy.
910  * @param trg The target policy.
911  *
912  * @relates as_policy_write
913  */
914 static inline void
916 {
917  trg->timeout = src->timeout;
918  trg->retry = src->retry;
920  trg->key = src->key;
921  trg->gen = src->gen;
922  trg->exists = src->exists;
923  trg->commit_level = src->commit_level;
924 }
925 
926 /**
927  * Initialize as_policy_operate to default values.
928  *
929  * @param p The policy to initialize.
930  * @return The initialized policy.
931  *
932  * @relates as_policy_operate
933  */
934 static inline as_policy_operate*
936 {
944  p->deserialize = true;
945  return p;
946 }
947 
948 /**
949  * Copy as_policy_operate values.
950  *
951  * @param src The source policy.
952  * @param trg The target policy.
953  *
954  * @relates as_policy_operate
955  */
956 static inline void
958 {
959  trg->timeout = src->timeout;
960  trg->retry = src->retry;
961  trg->key = src->key;
962  trg->gen = src->gen;
963  trg->replica = src->replica;
965  trg->commit_level = src->commit_level;
966  trg->deserialize = src->deserialize;
967 }
968 
969 /**
970  * Initialize as_policy_remove to default values.
971  *
972  * @param p The policy to initialize.
973  * @return The initialized policy.
974  *
975  * @relates as_policy_remove
976  */
977 static inline as_policy_remove*
979 {
984  p->generation = 0;
986  return p;
987 }
988 
989 /**
990  * Copy as_policy_remove values.
991  *
992  * @param src The source policy.
993  * @param trg The target policy.
994  *
995  * @relates as_policy_remove
996  */
997 static inline void
999 {
1000  trg->timeout = src->timeout;
1001  trg->retry = src->retry;
1002  trg->key = src->key;
1003  trg->gen = src->gen;
1004  trg->generation = src->generation;
1005  trg->commit_level = src->commit_level;
1006 }
1007 
1008 /**
1009  * Initialize as_policy_apply to default values.
1010  *
1011  * @param p The policy to initialize.
1012  * @return The initialized policy.
1013  *
1014  * @relates as_policy_apply
1015  */
1016 static inline as_policy_apply*
1018 {
1022  p->ttl = 0; // AS_RECORD_DEFAULT_TTL
1023  return p;
1024 }
1025 
1026 /**
1027  * Copy as_policy_apply values.
1028  *
1029  * @param src The source policy.
1030  * @param trg The target policy.
1031  *
1032  * @relates as_policy_apply
1033  */
1034 static inline void
1036 {
1037  trg->timeout = src->timeout;
1038  trg->key = src->key;
1039  trg->commit_level = src->commit_level;
1040  trg->ttl = src->ttl;
1041 }
1042 
1043 /**
1044  * Initialize as_policy_info to default values.
1045  *
1046  * @param p The policy to initialize.
1047  * @return The initialized policy.
1048  *
1049  * @relates as_policy_info
1050  */
1051 static inline as_policy_info*
1053 {
1055  p->send_as_is = true;
1056  p->check_bounds = true;
1057  return p;
1058 }
1059 
1060 /**
1061  * Copy as_policy_info values.
1062  *
1063  * @param src The source policy.
1064  * @param trg The target policy.
1065  *
1066  * @relates as_policy_info
1067  */
1068 static inline void
1070 {
1071  trg->timeout = src->timeout;
1072  trg->send_as_is = src->send_as_is;
1073  trg->check_bounds = src->check_bounds;
1074 }
1075 
1076 /**
1077  * Initialize as_policy_batch to default values.
1078  *
1079  * @param p The policy to initialize.
1080  * @return The initialized policy.
1081  *
1082  * @relates as_policy_batch
1083  */
1084 static inline as_policy_batch*
1086 {
1088  p->concurrent = false;
1089  p->use_batch_direct = false;
1090  p->allow_inline = true;
1091  p->deserialize = true;
1092  return p;
1093 }
1094 
1095 /**
1096  * Copy as_policy_batch values.
1097  *
1098  * @param src The source policy.
1099  * @param trg The target policy.
1100  *
1101  * @relates as_policy_batch
1102  */
1103 static inline void
1105 {
1106  trg->timeout = src->timeout;
1107  trg->concurrent = src->concurrent;
1108  trg->use_batch_direct = src->use_batch_direct;
1109  trg->allow_inline = src->allow_inline;
1110  trg->deserialize = src->deserialize;
1111 }
1112 
1113 /**
1114  * Initialize as_policy_admin to default values.
1115  *
1116  * @param p The policy to initialize.
1117  * @return The initialized policy.
1118  *
1119  * @relates as_policy_admin
1120  */
1121 static inline as_policy_admin*
1123 {
1125  return p;
1126 }
1127 
1128 /**
1129  * Copy as_policy_admin values.
1130  *
1131  * @param src The source policy.
1132  * @param trg The target policy.
1133  *
1134  * @relates as_policy_admin
1135  */
1136 static inline void
1138 {
1139  trg->timeout = src->timeout;
1140 }
1141 
1142 /**
1143  * Initialize as_policy_scan to default values.
1144  *
1145  * @param p The policy to initialize.
1146  * @return The initialized policy.
1147  *
1148  * @relates as_policy_scan
1149  */
1150 static inline as_policy_scan*
1152 {
1153  p->timeout = 0;
1154  p->fail_on_cluster_change = false;
1155  return p;
1156 }
1157 
1158 /**
1159  * Copy as_policy_scan values.
1160  *
1161  * @param src The source policy.
1162  * @param trg The target policy.
1163  *
1164  * @relates as_policy_scan
1165  */
1166 static inline void
1168 {
1169  trg->timeout = src->timeout;
1171 }
1172 
1173 /**
1174  * Initialize as_policy_query to default values.
1175  *
1176  * @param p The policy to initialize.
1177  * @return The initialized policy.
1178  *
1179  * @relates as_policy_query
1180  */
1181 static inline as_policy_query*
1183 {
1184  p->timeout = 0;
1185  p->deserialize = true;
1186  return p;
1187 }
1188 
1189 /**
1190  * Copy as_policy_query values.
1191  *
1192  * @param src The source policy.
1193  * @param trg The target policy.
1194  *
1195  * @relates as_policy_query
1196  */
1197 static inline void
1199 {
1200  trg->timeout = src->timeout;
1201  trg->deserialize = src->deserialize;
1202 }
1203 
1204 /**
1205  * Initialize as_policies to undefined values.
1206  * as_policies_resolve() will later be called resolve undefined values to global defaults.
1207  *
1208  * @param p The policies to undefine
1209  * @return The undefined policies.
1210  *
1211  * @relates as_policies
1212  */
1213 as_policies*
1215 
1216 /**
1217  * Resolve global policies (like timeout) with operational policies (like as_policy_read).
1218  *
1219  * @param p The policies to resolve
1220  *
1221  * @relates as_policies
1222  */
1223 void
1225 
1226 #ifdef __cplusplus
1227 } // end extern "C"
1228 #endif