11//
22// DISCLAIMER
33//
4- // Copyright 2017 ArangoDB GmbH, Cologne, Germany
4+ // Copyright 2017-2021 ArangoDB GmbH, Cologne, Germany
55//
66// Licensed under the Apache License, Version 2.0 (the "License");
77// you may not use this file except in compliance with the License.
1818// Copyright holder is ArangoDB GmbH, Cologne, Germany
1919//
2020// Author Ewout Prangsma
21+ // Author Tomasz Mielech
2122//
2223
2324package arangodb
@@ -26,7 +27,7 @@ import (
2627 "time"
2728)
2829
29- // CollectionInfo contains information about a collection
30+ // CollectionInfo contains basic information about a collection.
3031type CollectionInfo struct {
3132 // The identifier of the collection.
3233 ID string `json:"id,omitempty"`
@@ -42,17 +43,10 @@ type CollectionInfo struct {
4243 GloballyUniqueId string `json:"globallyUniqueId,omitempty"`
4344}
4445
45- // CollectionProperties contains extended information about a collection.
46- type CollectionProperties struct {
46+ // CollectionExtendedInfo contains extended information about a collection.
47+ type CollectionExtendedInfo struct {
4748 CollectionInfo
48-
49- // WaitForSync; If true then creating, changing or removing documents will wait until the data has been synchronized to disk.
50- WaitForSync bool `json:"waitForSync,omitempty"`
51- // DoCompact specifies whether or not the collection will be compacted.
52- DoCompact bool `json:"doCompact,omitempty"`
53- // JournalSize is the maximal size setting for journals / datafiles in bytes.
54- JournalSize int64 `json:"journalSize,omitempty"`
55- // CacheEnabled set cacheEnabled option in collection properties
49+ // CacheEnabled set cacheEnabled option in collection properties.
5650 CacheEnabled bool `json:"cacheEnabled,omitempty"`
5751 KeyOptions struct {
5852 // Type specifies the type of the key generator. The currently available generators are traditional and autoincrement.
@@ -62,29 +56,41 @@ type CollectionProperties struct {
6256 // the _key attribute of documents is considered an error.
6357 AllowUserKeys bool `json:"allowUserKeys,omitempty"`
6458 } `json:"keyOptions,omitempty"`
59+ // Deprecated: use 'WriteConcern' instead.
60+ MinReplicationFactor int `json:"minReplicationFactor,omitempty"`
6561 // NumberOfShards is the number of shards of the collection.
6662 // Only available in cluster setup.
6763 NumberOfShards int `json:"numberOfShards,omitempty"`
64+ // This attribute specifies the name of the sharding strategy to use for the collection.
65+ // Can not be changed after creation.
66+ ShardingStrategy ShardingStrategy `json:"shardingStrategy,omitempty"`
6867 // ShardKeys contains the names of document attributes that are used to determine the target shard for documents.
6968 // Only available in cluster setup.
7069 ShardKeys []string `json:"shardKeys,omitempty"`
7170 // ReplicationFactor contains how many copies of each shard are kept on different DBServers.
7271 // Only available in cluster setup.
7372 ReplicationFactor int `json:"replicationFactor,omitempty"`
74- // Deprecated: use 'WriteConcern' instead
75- MinReplicationFactor int `json:"minReplicationFactor,omitempty"`
73+ // WaitForSync; If true then creating, changing or removing documents will wait
74+ // until the data has been synchronized to disk.
75+ WaitForSync bool `json:"waitForSync,omitempty"`
7676 // WriteConcern contains how many copies must be available before a collection can be written.
7777 // It is required that 1 <= WriteConcern <= ReplicationFactor.
7878 // Default is 1. Not available for satellite collections.
7979 // Available from 3.6 arangod version.
8080 WriteConcern int `json:"writeConcern,omitempty"`
81+ }
82+
83+ // CollectionProperties contains extended information about a collection.
84+ type CollectionProperties struct {
85+ CollectionExtendedInfo
86+ // DoCompact specifies whether or not the collection will be compacted.
87+ DoCompact bool `json:"doCompact,omitempty"`
88+ // JournalSize is the maximal size setting for journals / datafiles in bytes.
89+ JournalSize int64 `json:"journalSize,omitempty"`
8190 // SmartJoinAttribute
8291 // See documentation for smart joins.
8392 // This requires ArangoDB Enterprise Edition.
8493 SmartJoinAttribute string `json:"smartJoinAttribute,omitempty"`
85- // This attribute specifies the name of the sharding strategy to use for the collection.
86- // Can not be changed after creation.
87- ShardingStrategy ShardingStrategy `json:"shardingStrategy,omitempty"`
8894 // This attribute specifies that the sharding of a collection follows that of another
8995 // one.
9096 DistributeShardsLike string `json:"distributeShardsLike,omitempty"`
@@ -213,3 +219,18 @@ type CollectionStatistics struct {
213219 } `json:"revisions"`
214220 } `json:"figures"`
215221}
222+
223+ // CollectionShards contains shards information about a collection.
224+ type CollectionShards struct {
225+ CollectionExtendedInfo
226+ // Set to create a smart edge or vertex collection.
227+ // This requires ArangoDB Enterprise Edition.
228+ IsSmart bool `json:"isSmart,omitempty"`
229+
230+ // Shards is a list of shards that belong to the collection.
231+ // Each shard contains a list of DB servers where the first one is the leader and the rest are followers.
232+ Shards map [ShardID ][]ServerID `json:"shards,omitempty"`
233+
234+ // StatusString represents status as a string.
235+ StatusString string `json:"statusString,omitempty"`
236+ }
0 commit comments