|
1 | | -package com.arangodb.entity; |
2 | | - |
3 | | -import java.util.List; |
4 | | - |
5 | | -/** |
6 | | - * |
7 | | - * Convenience object for collection creation. |
8 | | - * |
9 | | - * @see com.arangodb.entity.CollectionEntity |
10 | | - * |
11 | | - * @author Florian Bartels |
12 | | - * |
13 | | - */ |
14 | | -public class CollectionOptions { |
15 | | - |
16 | | - /** |
17 | | - * If true each write operation is synchronised to disk before the server |
18 | | - * sends a response |
19 | | - */ |
20 | | - private Boolean waitForSync; |
21 | | - |
22 | | - /** |
23 | | - * Whether or not the collection will be compacted. |
24 | | - */ |
25 | | - private Boolean doCompact; |
26 | | - |
27 | | - /** |
28 | | - * The maximal size setting for journals / datafiles. |
29 | | - */ |
30 | | - private Integer journalSize; |
31 | | - |
32 | | - /** |
33 | | - * If true the collection is a system collection |
34 | | - */ |
35 | | - private Boolean isSystem; |
36 | | - |
37 | | - /** |
38 | | - * If true then the collection data will be kept in memory only and ArangoDB |
39 | | - * will not write or sync the data to disk. |
40 | | - */ |
41 | | - private Boolean isVolatile; |
42 | | - |
43 | | - /** |
44 | | - * The collections type, either EDGE or DOCUMENT |
45 | | - */ |
46 | | - private CollectionType type; |
47 | | - |
48 | | - /** |
49 | | - * The collection key options |
50 | | - * |
51 | | - * @see com.arangodb.entity.CollectionKeyOption |
52 | | - */ |
53 | | - private CollectionKeyOption keyOptions; |
54 | | - |
55 | | - /** |
56 | | - * in a cluster, this value determines the number of shards to create for |
57 | | - * the collection. In a single server setup, this option is meaningless. |
58 | | - */ |
59 | | - private int numberOfShards; |
60 | | - |
61 | | - /** |
62 | | - * in a cluster, this attribute determines which document attributes are |
63 | | - * used to determine the target shard for documents. Documents are sent to |
64 | | - * shards based on the values of their shard key attributes. The values of |
65 | | - * all shard key attributes in a document are hashed, and the hash value is |
66 | | - * used to determine the target shard. |
67 | | - */ |
68 | | - private List<String> shardKeys; |
69 | | - |
70 | | - public CollectionOptions() { |
71 | | - // do nothing here |
72 | | - } |
73 | | - |
74 | | - public Boolean getWaitForSync() { |
75 | | - return waitForSync; |
76 | | - } |
77 | | - |
78 | | - public CollectionOptions setWaitForSync(Boolean waitForSync) { |
79 | | - this.waitForSync = waitForSync; |
80 | | - return this; |
81 | | - } |
82 | | - |
83 | | - public Boolean getDoCompact() { |
84 | | - return doCompact; |
85 | | - } |
86 | | - |
87 | | - public CollectionOptions setDoCompact(Boolean doCompact) { |
88 | | - this.doCompact = doCompact; |
89 | | - return this; |
90 | | - } |
91 | | - |
92 | | - public Integer getJournalSize() { |
93 | | - return journalSize; |
94 | | - } |
95 | | - |
96 | | - public CollectionOptions setJournalSize(Integer journalSize) { |
97 | | - this.journalSize = journalSize; |
98 | | - return this; |
99 | | - } |
100 | | - |
101 | | - public Boolean getIsSystem() { |
102 | | - return isSystem; |
103 | | - } |
104 | | - |
105 | | - public CollectionOptions setIsSystem(Boolean isSystem) { |
106 | | - this.isSystem = isSystem; |
107 | | - return this; |
108 | | - } |
109 | | - |
110 | | - public Boolean getIsVolatile() { |
111 | | - return isVolatile; |
112 | | - } |
113 | | - |
114 | | - public CollectionOptions setIsVolatile(Boolean isVolatile) { |
115 | | - this.isVolatile = isVolatile; |
116 | | - return this; |
117 | | - } |
118 | | - |
119 | | - public CollectionType getType() { |
120 | | - return type; |
121 | | - } |
122 | | - |
123 | | - public CollectionOptions setType(CollectionType type) { |
124 | | - this.type = type; |
125 | | - return this; |
126 | | - } |
127 | | - |
128 | | - public CollectionKeyOption getKeyOptions() { |
129 | | - return keyOptions; |
130 | | - } |
131 | | - |
132 | | - public CollectionOptions setKeyOptions(CollectionKeyOption keyOptions) { |
133 | | - this.keyOptions = keyOptions; |
134 | | - return this; |
135 | | - } |
136 | | - |
137 | | - public int getNumberOfShards() { |
138 | | - return numberOfShards; |
139 | | - } |
140 | | - |
141 | | - public CollectionOptions setNumberOfShards(int numberOfShards) { |
142 | | - this.numberOfShards = numberOfShards; |
143 | | - return this; |
144 | | - } |
145 | | - |
146 | | - public List<String> getShardKeys() { |
147 | | - return shardKeys; |
148 | | - } |
149 | | - |
150 | | - public CollectionOptions setShardKeys(List<String> shardKeys) { |
151 | | - this.shardKeys = shardKeys; |
152 | | - return this; |
153 | | - } |
154 | | - |
155 | | -} |
| 1 | +package com.arangodb.entity; |
| 2 | + |
| 3 | +import java.util.List; |
| 4 | + |
| 5 | +/** |
| 6 | + * |
| 7 | + * Convenience object for collection creation. |
| 8 | + * |
| 9 | + * @see com.arangodb.entity.CollectionEntity |
| 10 | + * |
| 11 | + * @author Florian Bartels |
| 12 | + * |
| 13 | + */ |
| 14 | +public class CollectionOptions { |
| 15 | + |
| 16 | + /** |
| 17 | + * If true each write operation is synchronised to disk before the server sends a response |
| 18 | + */ |
| 19 | + private Boolean waitForSync; |
| 20 | + |
| 21 | + /** |
| 22 | + * Whether or not the collection will be compacted. |
| 23 | + */ |
| 24 | + private Boolean doCompact; |
| 25 | + |
| 26 | + /** |
| 27 | + * The maximal size setting for journals / datafiles. |
| 28 | + */ |
| 29 | + private Integer journalSize; |
| 30 | + |
| 31 | + /** |
| 32 | + * If true the collection is a system collection |
| 33 | + */ |
| 34 | + private Boolean isSystem; |
| 35 | + |
| 36 | + /** |
| 37 | + * If true then the collection data will be kept in memory only and ArangoDB will not write or sync the data to |
| 38 | + * disk. |
| 39 | + */ |
| 40 | + private Boolean isVolatile; |
| 41 | + |
| 42 | + /** |
| 43 | + * The collections type, either EDGE or DOCUMENT |
| 44 | + */ |
| 45 | + private CollectionType type; |
| 46 | + |
| 47 | + /** |
| 48 | + * The collection key options |
| 49 | + * |
| 50 | + * @see com.arangodb.entity.CollectionKeyOption |
| 51 | + */ |
| 52 | + private CollectionKeyOption keyOptions; |
| 53 | + |
| 54 | + /** |
| 55 | + * in a cluster, this value determines the number of shards to create for the collection. In a single server setup, |
| 56 | + * this option is meaningless. |
| 57 | + */ |
| 58 | + private int numberOfShards; |
| 59 | + |
| 60 | + /** |
| 61 | + * in a cluster, this attribute determines which document attributes are used to determine the target shard for |
| 62 | + * documents. Documents are sent to shards based on the values of their shard key attributes. The values of all |
| 63 | + * shard key attributes in a document are hashed, and the hash value is used to determine the target shard. |
| 64 | + */ |
| 65 | + private List<String> shardKeys; |
| 66 | + |
| 67 | + /** |
| 68 | + * (The default is 1): in a cluster, this attribute determines how many copies of each shard are kept on different |
| 69 | + * DBServers. The value 1 means that only one copy (no synchronous replication) is kept. A value of k means that k-1 |
| 70 | + * replicas are kept. Any two copies reside on different DBServers. Replication between them is synchronous, that |
| 71 | + * is, every write operation to the "leader" copy will be replicated to all "follower" replicas, before the write |
| 72 | + * operation is reported successful. If a server fails, this is detected automatically and one of the servers |
| 73 | + * holding copies take over, usually without an error being reported. |
| 74 | + */ |
| 75 | + private Integer replicationFactor; |
| 76 | + |
| 77 | + public CollectionOptions() { |
| 78 | + // do nothing here |
| 79 | + } |
| 80 | + |
| 81 | + public Boolean getWaitForSync() { |
| 82 | + return waitForSync; |
| 83 | + } |
| 84 | + |
| 85 | + public CollectionOptions setWaitForSync(final Boolean waitForSync) { |
| 86 | + this.waitForSync = waitForSync; |
| 87 | + return this; |
| 88 | + } |
| 89 | + |
| 90 | + public Boolean getDoCompact() { |
| 91 | + return doCompact; |
| 92 | + } |
| 93 | + |
| 94 | + public CollectionOptions setDoCompact(final Boolean doCompact) { |
| 95 | + this.doCompact = doCompact; |
| 96 | + return this; |
| 97 | + } |
| 98 | + |
| 99 | + public Integer getJournalSize() { |
| 100 | + return journalSize; |
| 101 | + } |
| 102 | + |
| 103 | + public CollectionOptions setJournalSize(final Integer journalSize) { |
| 104 | + this.journalSize = journalSize; |
| 105 | + return this; |
| 106 | + } |
| 107 | + |
| 108 | + public Boolean getIsSystem() { |
| 109 | + return isSystem; |
| 110 | + } |
| 111 | + |
| 112 | + public CollectionOptions setIsSystem(final Boolean isSystem) { |
| 113 | + this.isSystem = isSystem; |
| 114 | + return this; |
| 115 | + } |
| 116 | + |
| 117 | + public Boolean getIsVolatile() { |
| 118 | + return isVolatile; |
| 119 | + } |
| 120 | + |
| 121 | + public CollectionOptions setIsVolatile(final Boolean isVolatile) { |
| 122 | + this.isVolatile = isVolatile; |
| 123 | + return this; |
| 124 | + } |
| 125 | + |
| 126 | + public CollectionType getType() { |
| 127 | + return type; |
| 128 | + } |
| 129 | + |
| 130 | + public CollectionOptions setType(final CollectionType type) { |
| 131 | + this.type = type; |
| 132 | + return this; |
| 133 | + } |
| 134 | + |
| 135 | + public CollectionKeyOption getKeyOptions() { |
| 136 | + return keyOptions; |
| 137 | + } |
| 138 | + |
| 139 | + public CollectionOptions setKeyOptions(final CollectionKeyOption keyOptions) { |
| 140 | + this.keyOptions = keyOptions; |
| 141 | + return this; |
| 142 | + } |
| 143 | + |
| 144 | + public int getNumberOfShards() { |
| 145 | + return numberOfShards; |
| 146 | + } |
| 147 | + |
| 148 | + public CollectionOptions setNumberOfShards(final int numberOfShards) { |
| 149 | + this.numberOfShards = numberOfShards; |
| 150 | + return this; |
| 151 | + } |
| 152 | + |
| 153 | + public List<String> getShardKeys() { |
| 154 | + return shardKeys; |
| 155 | + } |
| 156 | + |
| 157 | + public CollectionOptions setShardKeys(final List<String> shardKeys) { |
| 158 | + this.shardKeys = shardKeys; |
| 159 | + return this; |
| 160 | + } |
| 161 | + |
| 162 | + public Integer getReplicationFactor() { |
| 163 | + return replicationFactor; |
| 164 | + } |
| 165 | + |
| 166 | + public CollectionOptions setReplicationFactor(final Integer replicationFactor) { |
| 167 | + this.replicationFactor = replicationFactor; |
| 168 | + return this; |
| 169 | + } |
| 170 | + |
| 171 | +} |
0 commit comments