Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 49 additions & 29 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,42 +188,62 @@ func (i InventoryCollection) IndexByFieldsAndType(fields []string, indexType str

// InventoryCollectionParameters contains all configuration parameters of a collection in a database inventory.
type InventoryCollectionParameters struct {
Deleted bool `json:"deleted,omitempty"`
DoCompact bool `json:"doCompact,omitempty"`
ID string `json:"id,omitempty"`
IndexBuckets int `json:"indexBuckets,omitempty"`
Indexes []InventoryIndex `json:"indexes,omitempty"`
IsSmart bool `json:"isSmart,omitempty"`
SmartGraphAttribute string `json:"smartGraphAttribute,omitempty"`
IsSystem bool `json:"isSystem,omitempty"`
IsVolatile bool `json:"isVolatile,omitempty"`
JournalSize int64 `json:"journalSize,omitempty"`
KeyOptions struct {
Type string `json:"type,omitempty"`
// Available from 3.7 ArangoD version.
CacheEnabled bool `json:"cacheEnabled,omitempty"`
Deleted bool `json:"deleted,omitempty"`
DistributeShardsLike string `json:"distributeShardsLike,omitempty"`
// Deprecated: since 3.7 version. It is related only to MMFiles.
DoCompact bool `json:"doCompact,omitempty"`
// Available from 3.7 ArangoD version.
GloballyUniqueId string `json:"globallyUniqueId,omitempty"`
ID string `json:"id,omitempty"`
// Deprecated: since 3.7 version. It is related only to MMFiles.
IndexBuckets int `json:"indexBuckets,omitempty"`
Indexes []InventoryIndex `json:"indexes,omitempty"`
// Available from 3.9 ArangoD version.
InternalValidatorType int `json:"internalValidatorType,omitempty"`
// Available from 3.7 ArangoD version.
IsDisjoint bool `json:"isDisjoint,omitempty"`
IsSmart bool `json:"isSmart,omitempty"`
// Available from 3.7 ArangoD version.
IsSmartChild bool `json:"isSmartChild,omitempty"`
IsSystem bool `json:"isSystem,omitempty"`
// Deprecated: since 3.7 version. It is related only to MMFiles.
IsVolatile bool `json:"isVolatile,omitempty"`
// Deprecated: since 3.7 version. It is related only to MMFiles.
JournalSize int64 `json:"journalSize,omitempty"`
KeyOptions struct {
AllowUserKeys bool `json:"allowUserKeys,omitempty"`
LastValue int64 `json:"lastValue,omitempty"`
Type string `json:"type,omitempty"`
} `json:"keyOptions"`
Name string `json:"name,omitempty"`
NumberOfShards int `json:"numberOfShards,omitempty"`
// Deprecated: use 'WriteConcern' instead.
MinReplicationFactor int `json:"minReplicationFactor,omitempty"`
Name string `json:"name,omitempty"`
NumberOfShards int `json:"numberOfShards,omitempty"`
// Deprecated: since 3.7 ArangoD version.
Path string `json:"path,omitempty"`
PlanID string `json:"planId,omitempty"`
ReplicationFactor int `json:"replicationFactor,omitempty"`
// Deprecated: use 'WriteConcern' instead
MinReplicationFactor int `json:"minReplicationFactor,omitempty"`
// Available from 3.6 arangod version.
WriteConcern int `json:"writeConcern,omitempty"`
ShardKeys []string `json:"shardKeys,omitempty"`
Shards map[ShardID][]ServerID `json:"shards,omitempty"`
Status CollectionStatus `json:"status,omitempty"`
Type CollectionType `json:"type,omitempty"`
WaitForSync bool `json:"waitForSync,omitempty"`
DistributeShardsLike string `json:"distributeShardsLike,omitempty"`
SmartJoinAttribute string `json:"smartJoinAttribute,omitempty"`
ShardingStrategy ShardingStrategy `json:"shardingStrategy,omitempty"`
// Available from 3.7 arangod version
// Schema for collection validation.
Schema *CollectionSchemaOptions `json:"schema,omitempty"`
ShadowCollections []int `json:"shadowCollections,omitempty"`
ShardingStrategy ShardingStrategy `json:"shardingStrategy,omitempty"`
ShardKeys []string `json:"shardKeys,omitempty"`
Shards map[ShardID][]ServerID `json:"shards,omitempty"`
// Optional only for some collections.
SmartGraphAttribute string `json:"smartGraphAttribute,omitempty"`
// Optional only for some collections.
SmartJoinAttribute string `json:"smartJoinAttribute,omitempty"`
Status CollectionStatus `json:"status,omitempty"`
// Available from 3.7 ArangoD version.
SyncByRevision bool `json:"syncByRevision,omitempty"`
Type CollectionType `json:"type,omitempty"`
// Available from 3.7 ArangoD version.
UsesRevisionsAsDocumentIds bool `json:"usesRevisionsAsDocumentIds,omitempty"`
// Available from 3.7 arangod version
SyncByRevision bool `json:"syncByRevision,omitempty"`
WaitForSync bool `json:"waitForSync,omitempty"`
// Available from 3.6 ArangoD version.
WriteConcern int `json:"writeConcern,omitempty"`
}

// IsSatellite returns true if the collection is a satellite collection
Expand Down
125 changes: 78 additions & 47 deletions cluster_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,74 +266,98 @@ func (c *cluster) RemoveServer(ctx context.Context, serverID ServerID) error {
type replicationFactor int

type inventoryCollectionParametersInternal struct {
Deleted bool `json:"deleted,omitempty"`
DoCompact bool `json:"doCompact,omitempty"`
ID string `json:"id,omitempty"`
IndexBuckets int `json:"indexBuckets,omitempty"`
Indexes []InventoryIndex `json:"indexes,omitempty"`
IsSmart bool `json:"isSmart,omitempty"`
SmartGraphAttribute string `json:"smartGraphAttribute,omitempty"`
IsSystem bool `json:"isSystem,omitempty"`
IsVolatile bool `json:"isVolatile,omitempty"`
JournalSize int64 `json:"journalSize,omitempty"`
KeyOptions struct {
Type string `json:"type,omitempty"`
// Available from 3.7 ArangoD version.
CacheEnabled bool `json:"cacheEnabled,omitempty"`
Deleted bool `json:"deleted,omitempty"`
DistributeShardsLike string `json:"distributeShardsLike,omitempty"`
DoCompact bool `json:"doCompact,omitempty"`
// Available from 3.7 ArangoD version.
GloballyUniqueId string `json:"globallyUniqueId,omitempty"`
ID string `json:"id,omitempty"`
IndexBuckets int `json:"indexBuckets,omitempty"`
Indexes []InventoryIndex `json:"indexes,omitempty"`
// Available from 3.9 ArangoD version.
InternalValidatorType int `json:"internalValidatorType,omitempty"`
// Available from 3.7 ArangoD version.
IsDisjoint bool `json:"isDisjoint,omitempty"`
IsSmart bool `json:"isSmart,omitempty"`
// Available from 3.7 ArangoD version.
IsSmartChild bool `json:"isSmartChild,omitempty"`
IsSystem bool `json:"isSystem,omitempty"`
// Deprecated: since 3.7 version. It is related only to MMFiles.
IsVolatile bool `json:"isVolatile,omitempty"`
// Deprecated: since 3.7 version. It is related only to MMFiles.
JournalSize int64 `json:"journalSize,omitempty"`
KeyOptions struct {
AllowUserKeys bool `json:"allowUserKeys,omitempty"`
LastValue int64 `json:"lastValue,omitempty"`
Type string `json:"type,omitempty"`
} `json:"keyOptions"`
Name string `json:"name,omitempty"`
NumberOfShards int `json:"numberOfShards,omitempty"`
Path string `json:"path,omitempty"`
PlanID string `json:"planId,omitempty"`
ReplicationFactor replicationFactor `json:"replicationFactor,omitempty"`
// Deprecated: use 'WriteConcern' instead
MinReplicationFactor int `json:"minReplicationFactor,omitempty"`
// Available from 3.6 arangod version.
WriteConcern int `json:"writeConcern,omitempty"`
ShardKeys []string `json:"shardKeys,omitempty"`
Shards map[ShardID][]ServerID `json:"shards,omitempty"`
Status CollectionStatus `json:"status,omitempty"`
Type CollectionType `json:"type,omitempty"`
WaitForSync bool `json:"waitForSync,omitempty"`
DistributeShardsLike string `json:"distributeShardsLike,omitempty"`
SmartJoinAttribute string `json:"smartJoinAttribute,omitempty"`
ShardingStrategy ShardingStrategy `json:"shardingStrategy,omitempty"`
// Available from 3.7 arangod version
MinReplicationFactor int `json:"minReplicationFactor,omitempty"`
Name string `json:"name,omitempty"`
NumberOfShards int `json:"numberOfShards,omitempty"`
Path string `json:"path,omitempty"`
PlanID string `json:"planId,omitempty"`
ReplicationFactor replicationFactor `json:"replicationFactor,omitempty"`
// Schema for collection validation
Schema *CollectionSchemaOptions `json:"schema,omitempty"`
ShadowCollections []int `json:"shadowCollections,omitempty"`
ShardingStrategy ShardingStrategy `json:"shardingStrategy,omitempty"`
ShardKeys []string `json:"shardKeys,omitempty"`
Shards map[ShardID][]ServerID `json:"shards,omitempty"`
// Optional only for some collections.
SmartGraphAttribute string `json:"smartGraphAttribute,omitempty"`
// Optional only for some collections.
SmartJoinAttribute string `json:"smartJoinAttribute,omitempty"`
Status CollectionStatus `json:"status,omitempty"`
// Available from 3.7 ArangoD version
SyncByRevision bool `json:"syncByRevision,omitempty"`
Type CollectionType `json:"type,omitempty"`
// Available from 3.7 ArangoD version
UsesRevisionsAsDocumentIds bool `json:"usesRevisionsAsDocumentIds,omitempty"`
// Available from 3.7 arangod version
SyncByRevision bool `json:"syncByRevision,omitempty"`
WaitForSync bool `json:"waitForSync,omitempty"`
// Available from 3.6 ArangoD version.
WriteConcern int `json:"writeConcern,omitempty"`
}

func (p *InventoryCollectionParameters) asInternal() inventoryCollectionParametersInternal {
return inventoryCollectionParametersInternal{
CacheEnabled: p.CacheEnabled,
Deleted: p.Deleted,
DistributeShardsLike: p.DistributeShardsLike,
DoCompact: p.DoCompact,
GloballyUniqueId: p.GloballyUniqueId,
ID: p.ID,
IndexBuckets: p.IndexBuckets,
Indexes: p.Indexes,
InternalValidatorType: p.InternalValidatorType,
IsDisjoint: p.IsDisjoint,
IsSmart: p.IsSmart,
SmartGraphAttribute: p.SmartGraphAttribute,
IsSmartChild: p.IsSmartChild,
IsSystem: p.IsSystem,
IsVolatile: p.IsVolatile,
JournalSize: p.JournalSize,
KeyOptions: p.KeyOptions,
MinReplicationFactor: p.MinReplicationFactor,
Name: p.Name,
NumberOfShards: p.NumberOfShards,
Path: p.Path,
PlanID: p.PlanID,
ReplicationFactor: replicationFactor(p.ReplicationFactor),
MinReplicationFactor: p.MinReplicationFactor,
WriteConcern: p.WriteConcern,
Schema: p.Schema,
ShadowCollections: p.ShadowCollections,
ShardingStrategy: p.ShardingStrategy,
ShardKeys: p.ShardKeys,
Shards: p.Shards,
SmartGraphAttribute: p.SmartGraphAttribute,
SmartJoinAttribute: p.SmartJoinAttribute,
Status: p.Status,
SyncByRevision: p.SyncByRevision,
Type: p.Type,
WaitForSync: p.WaitForSync,
DistributeShardsLike: p.DistributeShardsLike,
SmartJoinAttribute: p.SmartJoinAttribute,
ShardingStrategy: p.ShardingStrategy,
UsesRevisionsAsDocumentIds: p.UsesRevisionsAsDocumentIds,
SyncByRevision: p.SyncByRevision,
WaitForSync: p.WaitForSync,
WriteConcern: p.WriteConcern,
}
}

Expand All @@ -343,34 +367,41 @@ func (p *InventoryCollectionParameters) fromInternal(i inventoryCollectionParame

func (p *inventoryCollectionParametersInternal) asExternal() InventoryCollectionParameters {
return InventoryCollectionParameters{
CacheEnabled: p.CacheEnabled,
Deleted: p.Deleted,
DistributeShardsLike: p.DistributeShardsLike,
DoCompact: p.DoCompact,
GloballyUniqueId: p.GloballyUniqueId,
ID: p.ID,
IndexBuckets: p.IndexBuckets,
Indexes: p.Indexes,
InternalValidatorType: p.InternalValidatorType,
IsDisjoint: p.IsDisjoint,
IsSmart: p.IsSmart,
SmartGraphAttribute: p.SmartGraphAttribute,
IsSmartChild: p.IsSmartChild,
IsSystem: p.IsSystem,
IsVolatile: p.IsVolatile,
JournalSize: p.JournalSize,
KeyOptions: p.KeyOptions,
MinReplicationFactor: p.MinReplicationFactor,
Name: p.Name,
NumberOfShards: p.NumberOfShards,
Path: p.Path,
PlanID: p.PlanID,
ReplicationFactor: int(p.ReplicationFactor),
MinReplicationFactor: p.MinReplicationFactor,
WriteConcern: p.WriteConcern,
Schema: p.Schema,
ShadowCollections: p.ShadowCollections,
ShardingStrategy: p.ShardingStrategy,
ShardKeys: p.ShardKeys,
Shards: p.Shards,
SmartGraphAttribute: p.SmartGraphAttribute,
SmartJoinAttribute: p.SmartJoinAttribute,
Status: p.Status,
SyncByRevision: p.SyncByRevision,
Type: p.Type,
WaitForSync: p.WaitForSync,
DistributeShardsLike: p.DistributeShardsLike,
SmartJoinAttribute: p.SmartJoinAttribute,
ShardingStrategy: p.ShardingStrategy,
UsesRevisionsAsDocumentIds: p.UsesRevisionsAsDocumentIds,
SyncByRevision: p.SyncByRevision,
WaitForSync: p.WaitForSync,
WriteConcern: p.WriteConcern,
}
}

Expand Down
Loading