@@ -24,6 +24,8 @@ import (
2424 "github.com/arangodb/go-driver/v2/connection"
2525)
2626
27+ // Deprecated: Use CreateCollectionProprtiesV2 instead
28+ //
2729// CreateCollectionProperties contains options that customize the creating of a collection.
2830type CreateCollectionProperties struct {
2931 // CacheEnabled set cacheEnabled option in collection properties
@@ -108,6 +110,90 @@ type CreateCollectionProperties struct {
108110 ComputedValues []ComputedValue `json:"computedValues,omitempty"`
109111}
110112
113+ // CreateCollectionProperties contains options that customize the creating of a collection.
114+ type CreateCollectionPropertiesV2 struct {
115+ // CacheEnabled set cacheEnabled option in collection properties
116+ CacheEnabled * bool `json:"cacheEnabled,omitempty"`
117+ // This field is used for internal purposes only. DO NOT USE.
118+ DistributeShardsLike * string `json:"distributeShardsLike,omitempty"`
119+ // DoCompact checks if the collection will be compacted (default is true)
120+ DoCompact * bool `json:"doCompact,omitempty"`
121+ // The number of buckets into which indexes using a hash table are split. The default is 16 and this number has to be a power
122+ // of 2 and less than or equal to 1024. For very large collections one should increase this to avoid long pauses when the hash
123+ // table has to be initially built or resized, since buckets are resized individually and can be initially built in parallel.
124+ // For example, 64 might be a sensible value for a collection with 100 000 000 documents.
125+ // Currently, only the edge index respects this value, but other index types might follow in future ArangoDB versions.
126+ // Changes are applied when the collection is loaded the next time.
127+ IndexBuckets * int `json:"indexBuckets,omitempty"`
128+ // Available from 3.9 ArangoD version.
129+ InternalValidatorType * int `json:"internalValidatorType,omitempty"`
130+ // IsDisjoint set isDisjoint flag for Graph. Required ArangoDB 3.7+
131+ IsDisjoint * bool `json:"isDisjoint,omitempty"`
132+ // Set to create a smart edge or vertex collection.
133+ // This requires ArangoDB Enterprise Edition.
134+ IsSmart * bool `json:"isSmart,omitempty"`
135+ // If true, create a system collection. In this case collection-name should start with an underscore.
136+ // End users should normally create non-system collections only. API implementors may be required to create system
137+ // collections in very special occasions, but normally a regular collection will do. (The default is false)
138+ IsSystem * bool `json:"isSystem,omitempty"`
139+ // If true then the collection data is kept in-memory only and not made persistent.
140+ // Unloading the collection will cause the collection data to be discarded. Stopping or re-starting the server will also
141+ // cause full loss of data in the collection. Setting this option will make the resulting collection be slightly faster
142+ // than regular collections because ArangoDB does not enforce any synchronization to disk and does not calculate any
143+ // CRC checksums for datafiles (as there are no datafiles). This option should therefore be used for cache-type collections only,
144+ // and not for data that cannot be re-created otherwise. (The default is false)
145+ IsVolatile * bool `json:"isVolatile,omitempty"`
146+ // The maximal size of a journal or datafile in bytes. The value must be at least 1048576 (1 MiB). (The default is a configuration parameter)
147+ JournalSize * int64 `json:"journalSize,omitempty"`
148+ // Specifies how keys in the collection are created.
149+ KeyOptions * CollectionKeyOptions `json:"keyOptions,omitempty"`
150+ // Deprecated: use 'WriteConcern' instead
151+ MinReplicationFactor * int `json:"minReplicationFactor,omitempty"`
152+ // In a cluster, this value determines the number of shards to create for the collection. In a single server setup, this option is meaningless. (default is 1)
153+ NumberOfShards * int `json:"numberOfShards,omitempty"`
154+ // ReplicationFactor in a cluster (default is 1), this attribute determines how many copies of each shard are kept on different DBServers.
155+ // The value 1 means that only one copy (no synchronous replication) is kept.
156+ // A value of k means that k-1 replicas are kept. Any two copies reside on different DBServers.
157+ // Replication between them is synchronous, that is, every write operation to the "leader" copy will be replicated to all "follower" replicas,
158+ // before the write operation is reported successful. If a server fails, this is detected automatically
159+ // and one of the servers holding copies take over, usually without an error being reported.
160+ ReplicationFactor * ReplicationFactor `json:"replicationFactor,omitempty"`
161+ // Schema for collection validation
162+ Schema * CollectionSchemaOptions `json:"schema,omitempty"`
163+ // This attribute specifies the name of the sharding strategy to use for the collection.
164+ // Must be one of ShardingStrategy* values.
165+ ShardingStrategy * ShardingStrategy `json:"shardingStrategy,omitempty"`
166+ // In a cluster, this attribute determines which document attributes are used to
167+ // determine the target shard for documents. Documents are sent to shards based on the values of their shard key attributes.
168+ // The values of all shard key attributes in a document are hashed, and the hash value is used to determine the target shard.
169+ // Note: Values of shard key attributes cannot be changed once set. This option is meaningless in a single server setup.
170+ // The default is []string{"_key"}.
171+ ShardKeys * []string `json:"shardKeys,omitempty"`
172+ // This field must be set to the attribute that will be used for sharding or SmartGraphs.
173+ // All vertices are required to have this attribute set. Edges derive the attribute from their connected vertices.
174+ // This requires ArangoDB Enterprise Edition.
175+ SmartGraphAttribute * string `json:"smartGraphAttribute,omitempty"`
176+ // SmartJoinAttribute
177+ // In the specific case that the two collections have the same number of shards, the data of the two collections can
178+ // be co-located on the same server for the same shard key values. In this case the extra hop via the coordinator will not be necessary.
179+ // See documentation for SmartJoins.
180+ // This requires ArangoDB Enterprise Edition.
181+ SmartJoinAttribute * string `json:"smartJoinAttribute,omitempty"`
182+ // Available from 3.7 ArangoDB version
183+ SyncByRevision * bool `json:"syncByRevision,omitempty"`
184+ // The type of the collection to create. (default is CollectionTypeDocument)
185+ Type * CollectionType `json:"type,omitempty"`
186+ // If true then the data is synchronized to disk before returning from a document create, update, replace or removal operation. (default: false)
187+ WaitForSync * bool `json:"waitForSync,omitempty"`
188+ // WriteConcern contains how many copies must be available before a collection can be written.
189+ // It is required that 1 <= WriteConcern <= ReplicationFactor.
190+ // Default is 1. Not available for SatelliteCollections.
191+ // Available from 3.6 ArangoDB version.
192+ WriteConcern * int `json:"writeConcern,omitempty"`
193+ // ComputedValues let configure collections to generate document attributes when documents are created or modified, using an AQL expression
194+ ComputedValues * []ComputedValue `json:"computedValues,omitempty"`
195+ }
196+
111197// Init translate deprecated fields into current one for backward compatibility
112198func (c * CreateCollectionProperties ) Init () {
113199 if c == nil {
@@ -117,6 +203,15 @@ func (c *CreateCollectionProperties) Init() {
117203 c .KeyOptions .Init ()
118204}
119205
206+ // Init translate deprecated fields into current one for backward compatibility
207+ func (c * CreateCollectionPropertiesV2 ) Init () {
208+ if c == nil {
209+ return
210+ }
211+
212+ c .KeyOptions .Init ()
213+ }
214+
120215// CreateCollectionOptions specifies additional options to be provided while creating collection
121216type CreateCollectionOptions struct {
122217 // EnforceReplicationFactor the default is true, which means the server checks if there are enough replicas available
0 commit comments