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-2017 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 socket idle timeout value
68  *
69  * @ingroup client_policies
70  */
71 #define AS_POLICY_SOCKET_TIMEOUT_DEFAULT 0
72 
73 /**
74  * Default total timeout value
75  *
76  * @ingroup client_policies
77  */
78 #define AS_POLICY_TOTAL_TIMEOUT_DEFAULT 1000
79 
80 /**
81  * Default number of retries when a transaction fails due to a network error.
82  *
83  * @ingroup client_policies
84  */
85 #define AS_POLICY_MAX_RETRIES_DEFAULT 2
86 
87 /**
88  * Default milliseconds to sleep before a command retry.
89  *
90  * @ingroup client_policies
91  */
92 #define AS_POLICY_SLEEP_BETWEEN_RETRIES_DEFAULT 0
93 
94 /**
95  * Default value for compression threshold
96  *
97  * @ingroup client_policies
98  */
99 #define AS_POLICY_COMPRESSION_THRESHOLD_DEFAULT 0
100 
101 /**
102  * Default as_policy_gen value
103  *
104  * @ingroup client_policies
105  */
106 #define AS_POLICY_GEN_DEFAULT AS_POLICY_GEN_IGNORE
107 
108 /**
109  * Default as_policy_key value
110  *
111  * @ingroup client_policies
112  */
113 #define AS_POLICY_KEY_DEFAULT AS_POLICY_KEY_DIGEST
114 
115 /**
116  * Default as_policy_exists value
117  *
118  * @ingroup client_policies
119  */
120 #define AS_POLICY_EXISTS_DEFAULT AS_POLICY_EXISTS_IGNORE
121 
122 /**
123  * Default as_policy_replica value
124  *
125  * @ingroup client_policies
126  */
127 #define AS_POLICY_REPLICA_DEFAULT AS_POLICY_REPLICA_SEQUENCE
128 
129 /**
130  * Default as_policy_consistency_level value for read
131  *
132  * @ingroup client_policies
133  */
134 #define AS_POLICY_CONSISTENCY_LEVEL_DEFAULT AS_POLICY_CONSISTENCY_LEVEL_ONE
135 
136 /**
137  * Default as_policy_commit_level value for write
138  *
139  * @ingroup client_policies
140  */
141 #define AS_POLICY_COMMIT_LEVEL_DEFAULT AS_POLICY_COMMIT_LEVEL_ALL
142 
143 /******************************************************************************
144  * TYPES
145  *****************************************************************************/
146 
147 /**
148  * Retry Policy
149  *
150  * Specifies the behavior of failed operations.
151  *
152  * @ingroup client_policies
153  */
154 typedef enum as_policy_retry_e {
155 
156  /**
157  * Only attempt an operation once.
158  */
160 
161  /**
162  * If an operation fails, attempt the operation
163  * one more time.
164  */
166 
168 
169 /**
170  * Generation Policy
171  *
172  * Specifies the behavior of record modifications with regard to the
173  * generation value.
174  *
175  * @ingroup client_policies
176  */
177 typedef enum as_policy_gen_e {
178 
179  /**
180  * Write a record, regardless of generation.
181  */
183 
184  /**
185  * Write a record, ONLY if generations are equal
186  */
188 
189  /**
190  * Write a record, ONLY if local generation is
191  * greater-than remote generation
192  */
194 
195 } as_policy_gen;
196 
197 /**
198  * Key Policy
199  *
200  * Specifies the behavior for whether keys or digests
201  * should be sent to the cluster.
202  *
203  * @ingroup client_policies
204  */
205 typedef enum as_policy_key_e {
206 
207  /**
208  * Send the digest value of the key.
209  *
210  * This is the recommended mode of operation. This calculates the digest
211  * and send the digest to the server. The digest is only calculated on
212  * the client, and not on the server.
213  */
215 
216  /**
217  * Send the key, in addition to the digest value.
218  *
219  * If you want keys to be returned when scanning or querying, the keys must
220  * be stored on the server. This policy causes a write operation to store
221  * the key. Once a key is stored, the server will keep it - there is no
222  * need to use this policy on subsequent updates of the record.
223  *
224  * If this policy is used on read or delete operations, or on subsequent
225  * updates of a record with a stored key, the key sent will be compared
226  * with the key stored on the server. A mismatch will cause
227  * AEROSPIKE_ERR_RECORD_KEY_MISMATCH to be returned.
228  */
230 
231 } as_policy_key;
232 
233 /**
234  * Existence Policy
235  *
236  * Specifies the behavior for writing the record
237  * depending whether or not it exists.
238  *
239  * @ingroup client_policies
240  */
241 typedef enum as_policy_exists_e {
242 
243  /**
244  * Write the record, regardless of existence. (i.e. create or update.)
245  */
247 
248  /**
249  * Create a record, ONLY if it doesn't exist.
250  */
252 
253  /**
254  * Update a record, ONLY if it exists.
255  */
257 
258  /**
259  * Completely replace a record, ONLY if it exists.
260  */
262 
263  /**
264  * Completely replace a record if it exists, otherwise create it.
265  */
267 
269 
270 /**
271  * Replica Policy
272  *
273  * Specifies which partition replica to read from.
274  *
275  * @ingroup client_policies
276  */
277 typedef enum as_policy_replica_e {
278 
279  /**
280  * Read from the partition master replica node.
281  */
283 
284  /**
285  * Distribute reads across nodes containing key's master and replicated partition
286  * in round-robin fashion. Currently restricted to master and one prole.
287  */
289 
290  /**
291  * Always try node containing master partition first. If connection fails and
292  * `retry_on_timeout` is true, try node containing prole partition.
293  * Currently restricted to master and one prole.
294  */
296 
298 
299 /**
300  * Consistency Level
301  *
302  * Specifies the number of replicas to be consulted
303  * in a read operation to provide the desired
304  * consistency guarantee.
305  *
306  * @ingroup client_policies
307  */
308 typedef enum as_policy_consistency_level_e {
309 
310  /**
311  * Involve a single replica in the operation.
312  */
314 
315  /**
316  * Involve all replicas in the operation.
317  */
319 
321 
322 /**
323  * Commit Level
324  *
325  * Specifies the number of replicas required to be successfully
326  * committed before returning success in a write operation
327  * to provide the desired consistency guarantee.
328  *
329  * @ingroup client_policies
330  */
331 typedef enum as_policy_commit_level_e {
332 
333  /**
334  * Return succcess only after successfully committing all replicas.
335  */
337 
338  /**
339  * Return succcess after successfully committing the master replica.
340  */
342 
344 
345 /**
346  * Generic policy fields shared among all policies.
347  *
348  * @ingroup client_policies
349  */
350 typedef struct as_policy_base_s {
351 
352  /**
353  * Socket idle timeout in milliseconds when processing a database command.
354  *
355  * If socket_timeout is not zero and the socket has been idle for at least socket_timeout,
356  * both max_retries and total_timeout are checked. If max_retries and total_timeout are not
357  * exceeded, the transaction is retried.
358  *
359  * If both socket_timeout and total_timeout are non-zero and socket_timeout > total_timeout,
360  * then socket_timeout will be set to total_timeout. If socket_timeout is zero, there will be
361  * no socket idle limit.
362  *
363  * Default: 0 (no socket idle time limit).
364  */
365  uint32_t socket_timeout;
366 
367  /**
368  * Total transaction timeout in milliseconds.
369  *
370  * The total_timeout is tracked on the client and sent to the server along with
371  * the transaction in the wire protocol. The client will most likely timeout
372  * first, but the server also has the capability to timeout the transaction.
373  *
374  * If total_timeout is not zero and total_timeout is reached before the transaction
375  * completes, the transaction will return error AEROSPIKE_ERR_TIMEOUT.
376  * If totalTimeout is zero, there will be no total time limit.
377  *
378  * Default: 1000
379  */
380  uint32_t total_timeout;
381 
382  /**
383  * Maximum number of retries before aborting the current transaction.
384  * The initial attempt is not counted as a retry.
385  *
386  * If max_retries is exceeded, the transaction will return error AEROSPIKE_ERR_TIMEOUT.
387  *
388  * WARNING: Database writes that are not idempotent (such as "add")
389  * should not be retried because the write operation may be performed
390  * multiple times if the client timed out previous transaction attempts.
391  * It's important to use a distinct write policy for non-idempotent
392  * writes which sets max_retries = 0;
393  *
394  * Default: 2 (initial attempt + 2 retries = 3 attempts)
395  */
396  uint32_t max_retries;
397 
398  /**
399  * Milliseconds to sleep between retries. Enter zero to skip sleep.
400  * This field is ignored in async mode.
401  *
402  * Reads do not have to sleep when a node goes down because the cluster
403  * does not shut out reads during cluster reformation. The default for
404  * reads is zero.
405  *
406  * Writes need to wait for the cluster to reform when a node goes down.
407  * Immediate write retries on node failure have been shown to consistently
408  * result in errors. The default for writes is 500ms.
409  */
411 
413 
414 /**
415  * Read Policy
416  *
417  * @ingroup client_policies
418  */
419 typedef struct as_policy_read_s {
420 
421  /**
422  * Generic policy fields.
423  */
425 
426  /**
427  * Specifies the behavior for the key.
428  */
430 
431  /**
432  * Specifies the replica to be consulted for the read.
433  */
435 
436  /**
437  * Specifies the number of replicas consulted when reading for the desired consistency guarantee.
438  */
440 
441  /**
442  * Should raw bytes representing a list or map be deserialized to as_list or as_map.
443  * Set to false for backup programs that just need access to raw bytes.
444  * Default: true
445  */
447 
448  /**
449  * Force reads to be linearized for server namespaces that support CP mode.
450  * Default: false
451  */
453 
455 
456 /**
457  * Write Policy
458  *
459  * @ingroup client_policies
460  */
461 typedef struct as_policy_write_s {
462 
463  /**
464  * Generic policy fields.
465  */
467 
468  /**
469  * Specifies the behavior for the key.
470  */
472 
473  /**
474  * Specifies the replica to be consulted for the read.
475  */
477 
478  /**
479  * Specifies the number of replicas required to be committed successfully when writing
480  * before returning transaction succeeded.
481  */
483 
484  /**
485  * Specifies the behavior for the generation value.
486  */
488 
489  /**
490  * Specifies the behavior for the existence of the record.
491  */
493 
494  /**
495  * Minimum record size beyond which it is compressed and sent to the server.
496  */
498 
499  /**
500  * If the transaction results in a record deletion, leave a tombstone for the record.
501  * This prevents deleted records from reappearing after node failures.
502  * Valid for Aerospike Server Enterprise Edition only.
503  *
504  * Default: false (do not tombstone deleted records).
505  */
507 
509 
510 /**
511  * Key Apply Policy
512  *
513  * @ingroup client_policies
514  */
515 typedef struct as_policy_apply_s {
516 
517  /**
518  * Generic policy fields.
519  */
521 
522  /**
523  * Specifies the behavior for the key.
524  */
526 
527  /**
528  * Specifies the replica to be consulted for the read.
529  */
531 
532  /**
533  * Specifies the number of replicas required to be committed successfully when writing
534  * before returning transaction succeeded.
535  */
537 
538  /**
539  * The time-to-live (expiration) of the record in seconds.
540  * There are also special values that can be set in the record TTL:
541  * (*) ZERO (defined as AS_RECORD_DEFAULT_TTL), which means that the
542  * record will adopt the default TTL value from the namespace.
543  * (*) 0xFFFFFFFF (also, -1 in a signed 32 bit int)
544  * (defined as AS_RECORD_NO_EXPIRE_TTL), which means that the record
545  * will get an internal "void_time" of zero, and thus will never expire.
546  * (*) 0xFFFFFFFE (also, -2 in a signed 32 bit int)
547  * (defined as AS_RECORD_NO_CHANGE_TTL), which means that the record
548  * ttl will not change when the record is updated.
549  *
550  * Note that the TTL value will be employed ONLY on write/update calls.
551  */
552  uint32_t ttl;
553 
554  /**
555  * Specifies the behavior for the generation value.
556  */
558 
559  /**
560  * The expected generation of the record.
561  */
562  uint16_t gen_value;
563 
564  /**
565  * If the transaction results in a record deletion, leave a tombstone for the record.
566  * This prevents deleted records from reappearing after node failures.
567  * Valid for Aerospike Server Enterprise Edition only.
568  *
569  * Default: false (do not tombstone deleted records).
570  */
572 
573  /**
574  * Force reads to be linearized for server namespaces that support CP mode.
575  * Default: false
576  */
578 
580 
581 /**
582  * Operate Policy
583  *
584  * @ingroup client_policies
585  */
586 typedef struct as_policy_operate_s {
587 
588  /**
589  * Generic policy fields.
590  */
592 
593  /**
594  * Specifies the behavior for the key.
595  */
597 
598  /**
599  * Specifies the replica to be consulted for the read.
600  */
602 
603  /**
604  * Specifies the number of replicas consulted when reading for the desired consistency guarantee.
605  */
607 
608  /**
609  * Specifies the number of replicas required to be committed successfully when writing
610  * before returning transaction succeeded.
611  */
613 
614  /**
615  * Specifies the behavior for the generation value.
616  */
618 
619  /**
620  * Should raw bytes representing a list or map be deserialized to as_list or as_map.
621  * Set to false for backup programs that just need access to raw bytes.
622  * Default: true
623  */
625 
626  /**
627  * If the transaction results in a record deletion, leave a tombstone for the record.
628  * This prevents deleted records from reappearing after node failures.
629  * Valid for Aerospike Server Enterprise Edition only.
630  *
631  * Default: false (do not tombstone deleted records).
632  */
634 
635  /**
636  * Force reads to be linearized for server namespaces that support CP mode.
637  * Default: false
638  */
640 
642 
643 /**
644  * Remove Policy
645  *
646  * @ingroup client_policies
647  */
648 typedef struct as_policy_remove_s {
649 
650  /**
651  * Generic policy fields.
652  */
654 
655  /**
656  * Specifies the behavior for the key.
657  */
659 
660  /**
661  * Specifies the replica to be consulted for the read.
662  */
664 
665  /**
666  * Specifies the number of replicas required to be committed successfully when writing
667  * before returning transaction succeeded.
668  */
670 
671  /**
672  * Specifies the behavior for the generation value.
673  */
675 
676  /**
677  * The generation of the record.
678  */
679  uint16_t generation;
680 
681  /**
682  * If the transaction results in a record deletion, leave a tombstone for the record.
683  * This prevents deleted records from reappearing after node failures.
684  * Valid for Aerospike Server Enterprise Edition only.
685  *
686  * Default: false (do not tombstone deleted records).
687  */
689 
691 
692 /**
693  * Batch Policy
694  *
695  * @ingroup client_policies
696  */
697 typedef struct as_policy_batch_s {
698 
699  /**
700  * Generic policy fields.
701  */
703 
704  /**
705  * Specifies the number of replicas consulted when reading for the desired consistency guarantee.
706  */
708 
709  /**
710  * Determine if batch commands to each server are run in parallel threads.
711  *
712  * Values:
713  * <ul>
714  * <li>
715  * false: Issue batch commands sequentially. This mode has a performance advantage for small
716  * to medium sized batch sizes because commands can be issued in the main transaction thread.
717  * This is the default.
718  * </li>
719  * <li>
720  * true: Issue batch commands in parallel threads. This mode has a performance
721  * advantage for large batch sizes because each node can process the command immediately.
722  * The downside is extra threads will need to be created (or taken from
723  * a thread pool).
724  * </li>
725  * </ul>
726  */
728 
729  /**
730  * Use old batch direct protocol where batch reads are handled by direct low-level batch server
731  * database routines. The batch direct protocol can be faster when there is a single namespace,
732  * but there is one important drawback. The batch direct protocol will not proxy to a different
733  * server node when the mapped node has migrated a record to another node (resulting in not
734  * found record).
735  *
736  * This can happen after a node has been added/removed from the cluster and there is a lag
737  * between records being migrated and client partition map update (once per second).
738  *
739  * The new batch index protocol will perform this record proxy when necessary.
740  * Default: false (use new batch index protocol if server supports it)
741  */
743 
744  /**
745  * Allow batch to be processed immediately in the server's receiving thread when the server
746  * deems it to be appropriate. If false, the batch will always be processed in separate
747  * transaction threads. This field is only relevant for the new batch index protocol.
748  *
749  * For batch exists or batch reads of smaller sized records (<= 1K per record), inline
750  * processing will be significantly faster on "in memory" namespaces. The server disables
751  * inline processing on disk based namespaces regardless of this policy field.
752  *
753  * Inline processing can introduce the possibility of unfairness because the server
754  * can process the entire batch before moving onto the next command.
755  * Default: true
756  */
758 
759  /**
760  * Send set name field to server for every key in the batch for batch index protocol.
761  * This is only necessary when authentication is enabled and security roles are defined
762  * on a per set basis.
763  * Default: false
764  */
766 
767  /**
768  * Should raw bytes be deserialized to as_list or as_map. Set to false for backup programs that
769  * just need access to raw bytes.
770  * Default: true
771  */
773 
774  /**
775  * Force reads to be linearized for server namespaces that support CP mode.
776  * Default: false
777  */
779 
781 
782 /**
783  * Query Policy
784  *
785  * @ingroup client_policies
786  */
787 typedef struct as_policy_query_s {
788 
789  /**
790  * Generic policy fields.
791  */
793 
794  /**
795  * Should raw bytes representing a list or map be deserialized to as_list or as_map.
796  * Set to false for backup programs that just need access to raw bytes.
797  * Default: true
798  */
800 
802 
803 /**
804  * Scan Policy
805  *
806  * @ingroup client_policies
807  */
808 typedef struct as_policy_scan_s {
809 
810  /**
811  * Generic policy fields.
812  */
814 
815  /**
816  * Abort the scan if the cluster is not in a stable state.
817  */
819 
820  /**
821  * If the transaction results in a record deletion, leave a tombstone for the record.
822  * This prevents deleted records from reappearing after node failures.
823  * Valid for Aerospike Server Enterprise Edition only.
824  *
825  * Default: false (do not tombstone deleted records).
826  */
828 
830 
831 /**
832  * Info Policy
833  *
834  * @ingroup client_policies
835  */
836 typedef struct as_policy_info_s {
837 
838  /**
839  * Maximum time in milliseconds to wait for the operation to complete.
840  */
841  uint32_t timeout;
842 
843  /**
844  * Send request without any further processing.
845  */
847 
848  /**
849  * Ensure the request is within allowable size limits.
850  */
852 
854 
855 /**
856  * Administration Policy
857  *
858  * @ingroup client_policies
859  */
860 typedef struct as_policy_admin_s {
861 
862  /**
863  * Maximum time in milliseconds to wait for the operation to complete.
864  */
865  uint32_t timeout;
866 
868 
869 /**
870  * Struct of all policy values and operation policies.
871  *
872  * This is utilized by as_config to define default values for policies.
873  *
874  * @ingroup as_config_t
875  */
876 typedef struct as_policies_s {
877 
878  /**
879  * The default read policy.
880  */
882 
883  /**
884  * The default write policy.
885  */
887 
888  /**
889  * The default operate policy.
890  */
892 
893  /**
894  * The default remove policy.
895  */
897 
898  /**
899  * The default apply policy.
900  */
902 
903  /**
904  * The default batch policy.
905  */
907 
908  /**
909  * The default scan policy.
910  */
912 
913  /**
914  * The default query policy.
915  */
917 
918  /**
919  * The default info policy.
920  */
922 
923  /**
924  * The default administration policy.
925  */
927 
928 } as_policies;
929 
930 /******************************************************************************
931  * FUNCTIONS
932  *****************************************************************************/
933 
934 /**
935  * Initialize as_policy_read to default values.
936  *
937  * @param p The policy to initialize.
938  * @return The initialized policy.
939  *
940  * @relates as_policy_read
941  */
942 static inline as_policy_read*
944 {
952  p->deserialize = true;
953  p->linearize_read = false;
954  return p;
955 }
956 
957 /**
958  * Copy as_policy_read values.
959  *
960  * @param src The source policy.
961  * @param trg The target policy.
962  *
963  * @relates as_policy_read
964  */
965 static inline void
967 {
968  *trg = *src;
969 }
970 
971 /**
972  * Initialize as_policy_write to default values.
973  *
974  * @param p The policy to initialize.
975  * @return The initialized policy.
976  *
977  * @relates as_policy_write
978  */
979 static inline as_policy_write*
981 {
985  p->base.sleep_between_retries = 500;
992  p->durable_delete = false;
993  return p;
994 }
995 
996 /**
997  * Copy as_policy_write values.
998  *
999  * @param src The source policy.
1000  * @param trg The target policy.
1001  *
1002  * @relates as_policy_write
1003  */
1004 static inline void
1006 {
1007  *trg = *src;
1008 }
1009 
1010 /**
1011  * Initialize as_policy_operate to default values.
1012  *
1013  * @param p The policy to initialize.
1014  * @return The initialized policy.
1015  *
1016  * @relates as_policy_operate
1017  */
1018 static inline as_policy_operate*
1020 {
1024  p->base.sleep_between_retries = 500;
1030  p->deserialize = true;
1031  p->durable_delete = false;
1032  p->linearize_read = false;
1033  return p;
1034 }
1035 
1036 /**
1037  * Copy as_policy_operate values.
1038  *
1039  * @param src The source policy.
1040  * @param trg The target policy.
1041  *
1042  * @relates as_policy_operate
1043  */
1044 static inline void
1046 {
1047  *trg = *src;
1048 }
1049 
1050 /**
1051  * Initialize as_policy_remove to default values.
1052  *
1053  * @param p The policy to initialize.
1054  * @return The initialized policy.
1055  *
1056  * @relates as_policy_remove
1057  */
1058 static inline as_policy_remove*
1060 {
1064  p->base.sleep_between_retries = 500;
1069  p->generation = 0;
1070  p->durable_delete = false;
1071  return p;
1072 }
1073 
1074 /**
1075  * Copy as_policy_remove values.
1076  *
1077  * @param src The source policy.
1078  * @param trg The target policy.
1079  *
1080  * @relates as_policy_remove
1081  */
1082 static inline void
1084 {
1085  *trg = *src;
1086 }
1087 
1088 /**
1089  * Initialize as_policy_apply to default values.
1090  *
1091  * @param p The policy to initialize.
1092  * @return The initialized policy.
1093  *
1094  * @relates as_policy_apply
1095  */
1096 static inline as_policy_apply*
1098 {
1102  p->base.sleep_between_retries = 500;
1106  p->ttl = 0; // AS_RECORD_DEFAULT_TTL
1108  p->gen_value = 0;
1109  p->durable_delete = false;
1110  p->linearize_read = false;
1111  return p;
1112 }
1113 
1114 /**
1115  * Copy as_policy_apply values.
1116  *
1117  * @param src The source policy.
1118  * @param trg The target policy.
1119  *
1120  * @relates as_policy_apply
1121  */
1122 static inline void
1124 {
1125  *trg = *src;
1126 }
1127 
1128 /**
1129  * Initialize as_policy_batch to default values.
1130  *
1131  * @param p The policy to initialize.
1132  * @return The initialized policy.
1133  *
1134  * @relates as_policy_batch
1135  */
1136 static inline as_policy_batch*
1138 {
1144  p->concurrent = false;
1145  p->use_batch_direct = false;
1146  p->allow_inline = true;
1147  p->send_set_name = false;
1148  p->deserialize = true;
1149  p->linearize_read = false;
1150  return p;
1151 }
1152 
1153 /**
1154  * Copy as_policy_batch values.
1155  *
1156  * @param src The source policy.
1157  * @param trg The target policy.
1158  *
1159  * @relates as_policy_batch
1160  */
1161 static inline void
1163 {
1164  *trg = *src;
1165 }
1166 
1167 /**
1168  * Initialize as_policy_scan to default values.
1169  *
1170  * @param p The policy to initialize.
1171  * @return The initialized policy.
1172  *
1173  * @relates as_policy_scan
1174  */
1175 static inline as_policy_scan*
1177 {
1178  p->base.socket_timeout = 10000;
1179  p->base.total_timeout = 0;
1180  p->base.max_retries = 0;
1181  p->base.sleep_between_retries = 0;
1182  p->fail_on_cluster_change = false;
1183  p->durable_delete = false;
1184  return p;
1185 }
1186 
1187 /**
1188  * Copy as_policy_scan values.
1189  *
1190  * @param src The source policy.
1191  * @param trg The target policy.
1192  *
1193  * @relates as_policy_scan
1194  */
1195 static inline void
1197 {
1198  *trg = *src;
1199 }
1200 
1201 /**
1202  * Initialize as_policy_query to default values.
1203  *
1204  * @param p The policy to initialize.
1205  * @return The initialized policy.
1206  *
1207  * @relates as_policy_query
1208  */
1209 static inline as_policy_query*
1211 {
1212  p->base.socket_timeout = 10000;
1213  p->base.total_timeout = 0;
1214  p->base.max_retries = 0;
1215  p->base.sleep_between_retries = 0;
1216  p->deserialize = true;
1217  return p;
1218 }
1219 
1220 /**
1221  * Copy as_policy_query values.
1222  *
1223  * @param src The source policy.
1224  * @param trg The target policy.
1225  *
1226  * @relates as_policy_query
1227  */
1228 static inline void
1230 {
1231  *trg = *src;
1232 }
1233 
1234 /**
1235  * Initialize as_policy_info to default values.
1236  *
1237  * @param p The policy to initialize.
1238  * @return The initialized policy.
1239  *
1240  * @relates as_policy_info
1241  */
1242 static inline as_policy_info*
1244 {
1246  p->send_as_is = true;
1247  p->check_bounds = true;
1248  return p;
1249 }
1250 
1251 /**
1252  * Copy as_policy_info values.
1253  *
1254  * @param src The source policy.
1255  * @param trg The target policy.
1256  *
1257  * @relates as_policy_info
1258  */
1259 static inline void
1261 {
1262  *trg = *src;
1263 }
1264 
1265 /**
1266  * Initialize as_policy_admin to default values.
1267  *
1268  * @param p The policy to initialize.
1269  * @return The initialized policy.
1270  *
1271  * @relates as_policy_admin
1272  */
1273 static inline as_policy_admin*
1275 {
1277  return p;
1278 }
1279 
1280 /**
1281  * Copy as_policy_admin values.
1282  *
1283  * @param src The source policy.
1284  * @param trg The target policy.
1285  *
1286  * @relates as_policy_admin
1287  */
1288 static inline void
1290 {
1291  *trg = *src;
1292 }
1293 
1294 /**
1295  * Initialize as_policies.
1296  *
1297  * @relates as_policies
1298  */
1299 as_policies*
1301 
1302 #ifdef __cplusplus
1303 } // end extern "C"
1304 #endif