From 16f48f851cae336ace65036ef33d4f48f6013959 Mon Sep 17 00:00:00 2001 From: Simran Spiller Date: Mon, 10 Mar 2025 19:00:24 +0100 Subject: [PATCH 1/2] Fix spelling of some Enterprise Edition features --- v2/arangodb/collection_documents_create.go | 8 ++++---- v2/arangodb/collection_documents_delete.go | 8 ++++---- v2/arangodb/collection_documents_read.go | 8 ++++---- v2/arangodb/collection_documents_replace.go | 8 ++++---- v2/arangodb/collection_documents_update.go | 8 ++++---- v2/arangodb/collection_opts.go | 10 +++++----- v2/arangodb/database_collection_opts.go | 6 +++--- v2/arangodb/database_query.go | 4 ++-- v2/arangodb/graph_vertex_collections.go | 2 +- v2/tests/admin_cluster_test.go | 8 ++++---- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/v2/arangodb/collection_documents_create.go b/v2/arangodb/collection_documents_create.go index 889a5185..dba28636 100644 --- a/v2/arangodb/collection_documents_create.go +++ b/v2/arangodb/collection_documents_create.go @@ -36,7 +36,7 @@ type CollectionDocumentCreate interface { // If the document data already contains a `_key` field, this will be used as key of the new document, // otherwise a unique key is created. // A ConflictError is returned when a `_key` field contains a duplicate key, other any other field violates an index constraint. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface CreateDocument(ctx context.Context, document interface{}) (CollectionDocumentCreateResponse, error) // CreateDocumentWithOptions creates a single document in the collection. @@ -44,7 +44,7 @@ type CollectionDocumentCreate interface { // If the document data already contains a `_key` field, this will be used as key of the new document, // otherwise a unique key is created. // A ConflictError is returned when a `_key` field contains a duplicate key, other any other field violates an index constraint. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface CreateDocumentWithOptions(ctx context.Context, document interface{}, options *CollectionDocumentCreateOptions) (CollectionDocumentCreateResponse, error) // CreateDocuments creates multiple documents in the collection. @@ -57,7 +57,7 @@ type CollectionDocumentCreate interface { // a slice with the same number of entries as the `documents` slice. // To wait until document has been synced to disk, prepare a context with `WithWaitForSync`. // If the create request itself fails or one of the arguments is invalid, an error is returned. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface CreateDocuments(ctx context.Context, documents interface{}) (CollectionDocumentCreateResponseReader, error) // CreateDocumentsWithOptions creates multiple documents in the collection. @@ -70,7 +70,7 @@ type CollectionDocumentCreate interface { // a slice with the same number of entries as the `documents` slice. // To wait until document has been synced to disk, prepare a context with `WithWaitForSync`. // If the create request itself fails or one of the arguments is invalid, an error is returned. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface CreateDocumentsWithOptions(ctx context.Context, documents interface{}, opts *CollectionDocumentCreateOptions) (CollectionDocumentCreateResponseReader, error) } diff --git a/v2/arangodb/collection_documents_delete.go b/v2/arangodb/collection_documents_delete.go index e13e166b..28641243 100644 --- a/v2/arangodb/collection_documents_delete.go +++ b/v2/arangodb/collection_documents_delete.go @@ -33,26 +33,26 @@ type CollectionDocumentDelete interface { // DeleteDocument removes a single document with given key from the collection. // The document metadata is returned. // If no document exists with given key, a NotFoundError is returned. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface DeleteDocument(ctx context.Context, key string) (CollectionDocumentDeleteResponse, error) // DeleteDocumentWithOptions removes a single document with given key from the collection. // The document metadata is returned. // If no document exists with given key, a NotFoundError is returned. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface DeleteDocumentWithOptions(ctx context.Context, key string, opts *CollectionDocumentDeleteOptions) (CollectionDocumentDeleteResponse, error) // DeleteDocuments removes multiple documents with given keys from the collection. // The document metadata are returned. // If no document exists with a given key, a NotFoundError is returned at its errors index. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface DeleteDocuments(ctx context.Context, keys []string) (CollectionDocumentDeleteResponseReader, error) // DeleteDocumentsWithOptions removes multiple documents with given keys from the collection. // The document metadata are returned. // If no document exists with a given key, a NotFoundError is returned at its errors index. // 'documents' must be a slice of structs with a `_key` field or a slice of keys. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface DeleteDocumentsWithOptions(ctx context.Context, documents interface{}, opts *CollectionDocumentDeleteOptions) (CollectionDocumentDeleteResponseReader, error) } diff --git a/v2/arangodb/collection_documents_read.go b/v2/arangodb/collection_documents_read.go index 2875f347..32c49d83 100644 --- a/v2/arangodb/collection_documents_read.go +++ b/v2/arangodb/collection_documents_read.go @@ -33,27 +33,27 @@ type CollectionDocumentRead interface { // ReadDocument reads a single document with given key from the collection. // The document data is stored into result, the document metadata is returned. // If no document exists with given key, a NotFoundError is returned. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface ReadDocument(ctx context.Context, key string, result interface{}) (DocumentMeta, error) // ReadDocumentWithOptions reads a single document with given key from the collection. // The document data is stored into result, the document metadata is returned. // If no document exists with given key, a NotFoundError is returned. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface ReadDocumentWithOptions(ctx context.Context, key string, result interface{}, opts *CollectionDocumentReadOptions) (DocumentMeta, error) // ReadDocuments reads multiple documents with given keys from the collection. // The documents data is stored into elements of the given results slice, // the documents metadata is returned. // If no document exists with a given key, a NotFoundError is returned at its errors index. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface ReadDocuments(ctx context.Context, keys []string) (CollectionDocumentReadResponseReader, error) // ReadDocumentsWithOptions reads multiple documents with given keys from the collection. // The documents data is stored into elements of the given results slice and the documents metadata is returned. // If no document exists with a given key, a NotFoundError is returned at its errors index. // 'documents' must be a slice of structs with a `_key` field or a slice of keys. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface ReadDocumentsWithOptions(ctx context.Context, documents interface{}, opts *CollectionDocumentReadOptions) (CollectionDocumentReadResponseReader, error) } diff --git a/v2/arangodb/collection_documents_replace.go b/v2/arangodb/collection_documents_replace.go index ff024fa5..1e62b789 100644 --- a/v2/arangodb/collection_documents_replace.go +++ b/v2/arangodb/collection_documents_replace.go @@ -34,13 +34,13 @@ type CollectionDocumentReplace interface { // ReplaceDocument replaces a single document with given key in the collection. // If no document exists with given key, a NotFoundError is returned. // If `_id` field is present in the document body, it is always ignored. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface ReplaceDocument(ctx context.Context, key string, document interface{}) (CollectionDocumentReplaceResponse, error) // ReplaceDocumentWithOptions replaces a single document with given key in the collection. // If no document exists with given key, a NotFoundError is returned. // If `_id` field is present in the document body, it is always ignored. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface ReplaceDocumentWithOptions(ctx context.Context, key string, document interface{}, options *CollectionDocumentReplaceOptions) (CollectionDocumentReplaceResponse, error) // ReplaceDocuments replaces multiple document with given keys in the collection. @@ -48,7 +48,7 @@ type CollectionDocumentReplace interface { // If no document exists with a given key, a NotFoundError is returned at its errors index. // Each element in the replaces slice must contain a `_key` field. // If `_id` field is present in the document body, it is always ignored. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface ReplaceDocuments(ctx context.Context, documents interface{}) (CollectionDocumentReplaceResponseReader, error) // ReplaceDocumentsWithOptions replaces multiple document with given keys in the collection. @@ -56,7 +56,7 @@ type CollectionDocumentReplace interface { // If no document exists with a given key, a NotFoundError is returned at its errors index. // Each element in the replaces slice must contain a `_key` field. // If `_id` field is present in the document body, it is always ignored. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface ReplaceDocumentsWithOptions(ctx context.Context, documents interface{}, opts *CollectionDocumentReplaceOptions) (CollectionDocumentReplaceResponseReader, error) } diff --git a/v2/arangodb/collection_documents_update.go b/v2/arangodb/collection_documents_update.go index 4a200c28..adffcf6b 100644 --- a/v2/arangodb/collection_documents_update.go +++ b/v2/arangodb/collection_documents_update.go @@ -34,14 +34,14 @@ type CollectionDocumentUpdate interface { // The document metadata is returned. // If no document exists with a given key, a NotFoundError is returned. // If `_id` field is present in the document body, it is always ignored. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface UpdateDocument(ctx context.Context, key string, document interface{}) (CollectionDocumentUpdateResponse, error) // UpdateDocumentWithOptions updates a single document with a given key in the collection. // The document metadata is returned. // If no document exists with a given key, a NotFoundError is returned. // If `_id` field is present in the document body, it is always ignored. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface UpdateDocumentWithOptions(ctx context.Context, key string, document interface{}, options *CollectionDocumentUpdateOptions) (CollectionDocumentUpdateResponse, error) // UpdateDocuments updates multiple documents @@ -49,7 +49,7 @@ type CollectionDocumentUpdate interface { // If no document exists with a given key, a NotFoundError is returned at its errors index. // Each element in the update slice must contain a `_key` field. // If `_id` field is present in the document body, it is always ignored. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface UpdateDocuments(ctx context.Context, documents interface{}) (CollectionDocumentUpdateResponseReader, error) // UpdateDocumentsWithOptions updates multiple documents @@ -57,7 +57,7 @@ type CollectionDocumentUpdate interface { // If no document exists with a given key, a NotFoundError is returned at its errors index. // Each element in the update slice must contain a `_key` field. // If `_id` field is present in the document body, it is always ignored. - // SmartGraphs and Enterprise Graphs cannot use existing collections and cannot use the document interface + // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface UpdateDocumentsWithOptions(ctx context.Context, documents interface{}, opts *CollectionDocumentUpdateOptions) (CollectionDocumentUpdateResponseReader, error) } diff --git a/v2/arangodb/collection_opts.go b/v2/arangodb/collection_opts.go index 71c34f09..bd9fd289 100644 --- a/v2/arangodb/collection_opts.go +++ b/v2/arangodb/collection_opts.go @@ -29,7 +29,7 @@ import ( type ReplicationFactor int const ( - // ReplicationFactorSatellite represents a satellite collection's replication factor + // ReplicationFactorSatellite represents a SatelliteCollection's replication factor ReplicationFactorSatellite ReplicationFactor = -1 replicationFactorSatelliteString string = "satellite" ) @@ -100,7 +100,7 @@ type CollectionExtendedInfo struct { // WriteConcern contains how many copies must be available before a collection can be written. // It is required that 1 <= WriteConcern <= ReplicationFactor. - // Default is 1. Not available for satellite collections. + // Default is 1. Not available for SatelliteCollections. // Available from 3.6 arangod version. WriteConcern int `json:"writeConcern,omitempty"` @@ -151,11 +151,11 @@ type CollectionProperties struct { IsVolatile bool `json:"isVolatile,omitempty"` // SmartJoinAttribute - // See documentation for smart joins. + // See documentation for SmartJoins. // This requires ArangoDB Enterprise Edition. SmartJoinAttribute string `json:"smartJoinAttribute,omitempty"` - // This field must be set to the attribute that will be used for sharding or smart graphs. + // This field must be set to the attribute that will be used for sharding or SmartGraphs. // All vertices are required to have this attribute set. Edges derive the attribute from their connected vertices. // This requires ArangoDB Enterprise Edition. SmartGraphAttribute string `json:"smartGraphAttribute,omitempty"` @@ -176,7 +176,7 @@ type CollectionProperties struct { Schema *CollectionSchemaOptions `json:"schema,omitempty"` } -// IsSatellite returns true if the collection is a satellite collection +// IsSatellite returns true if the collection is a SatelliteCollection func (p *CollectionProperties) IsSatellite() bool { return p.ReplicationFactor == ReplicationFactorSatellite } diff --git a/v2/arangodb/database_collection_opts.go b/v2/arangodb/database_collection_opts.go index e0856e5f..3aac1a29 100644 --- a/v2/arangodb/database_collection_opts.go +++ b/v2/arangodb/database_collection_opts.go @@ -83,14 +83,14 @@ type CreateCollectionProperties struct { // Note: Values of shard key attributes cannot be changed once set. This option is meaningless in a single server setup. // The default is []string{"_key"}. ShardKeys []string `json:"shardKeys,omitempty"` - // This field must be set to the attribute that will be used for sharding or smart graphs. + // This field must be set to the attribute that will be used for sharding or SmartGraphs. // All vertices are required to have this attribute set. Edges derive the attribute from their connected vertices. // This requires ArangoDB Enterprise Edition. SmartGraphAttribute string `json:"smartGraphAttribute,omitempty"` // SmartJoinAttribute // In the specific case that the two collections have the same number of shards, the data of the two collections can // 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. - // See documentation for smart joins. + // See documentation for SmartJoins. // This requires ArangoDB Enterprise Edition. SmartJoinAttribute string `json:"smartJoinAttribute,omitempty"` // Available from 3.7 ArangoDB version @@ -101,7 +101,7 @@ type CreateCollectionProperties struct { WaitForSync bool `json:"waitForSync,omitempty"` // WriteConcern contains how many copies must be available before a collection can be written. // It is required that 1 <= WriteConcern <= ReplicationFactor. - // Default is 1. Not available for satellite collections. + // Default is 1. Not available for SatelliteCollections. // Available from 3.6 ArangoDB version. WriteConcern int `json:"writeConcern,omitempty"` // ComputedValues let configure collections to generate document attributes when documents are created or modified, using an AQL expression diff --git a/v2/arangodb/database_query.go b/v2/arangodb/database_query.go index 976231e0..56c639af 100644 --- a/v2/arangodb/database_query.go +++ b/v2/arangodb/database_query.go @@ -130,7 +130,7 @@ type QuerySubOptions struct { // Additionally, the query plan is returned in the extra.plan sub-attribute. Profile uint `json:"profile,omitempty"` - // This Enterprise Edition parameter allows to configure how long a DBServer will have time to bring the satellite collections + // This Enterprise Edition parameter allows to configure how long a DBServer will have time to bring the SatelliteCollections // involved in the query into sync. The default value is 60.0 (seconds). When the max time has been reached the query will be stopped. SatelliteSyncWait float64 `json:"satelliteSyncWait,omitempty"` @@ -180,7 +180,7 @@ type QuerySubOptions struct { ShardIds []string `json:"shardIds,omitempty"` // [unofficial] This query option can be used in complex queries in case the query optimizer cannot - // automatically detect that the query can be limited to only a single server (e.g. in a disjoint smart graph case). + // automatically detect that the query can be limited to only a single server (e.g. in a Disjoint SmartGraph case). ForceOneShardAttributeValue *string `json:"forceOneShardAttributeValue,omitempty"` } diff --git a/v2/arangodb/graph_vertex_collections.go b/v2/arangodb/graph_vertex_collections.go index 639296c4..3c6f7a97 100644 --- a/v2/arangodb/graph_vertex_collections.go +++ b/v2/arangodb/graph_vertex_collections.go @@ -51,7 +51,7 @@ type GraphVertexCollections interface { type CreateVertexCollectionOptions struct { // Satellites contain an array of collection names that will be used to create SatelliteCollections for - // a Hybrid (Disjoint) SmartGraph (Enterprise Edition only) + // a (Disjoint) SmartGraph using SatelliteCollections (Enterprise Edition only) Satellites []string `json:"satellites,omitempty"` } diff --git a/v2/tests/admin_cluster_test.go b/v2/tests/admin_cluster_test.go index 44eaad96..f91cb6dd 100644 --- a/v2/tests/admin_cluster_test.go +++ b/v2/tests/admin_cluster_test.go @@ -100,7 +100,7 @@ func Test_ClusterDatabaseInventory(t *testing.T) { }) }) - t.Run("tests the DatabaseInventory with satellite collections", func(t *testing.T) { + t.Run("tests the DatabaseInventory with SatelliteCollections", func(t *testing.T) { skipNoEnterprise(client, context.Background(), t) WithDatabase(t, client, nil, func(db arangodb.Database) { @@ -131,13 +131,13 @@ func Test_ClusterDatabaseInventory(t *testing.T) { } } } - require.True(t, foundSatellite, "DatabaseInventory did not return any satellite collections") + require.True(t, foundSatellite, "DatabaseInventory did not return any SatelliteCollections") }) }) }) }) - t.Run("tests the DatabaseInventory with with smart joins", func(t *testing.T) { + t.Run("tests the DatabaseInventory with with SmartJoins", func(t *testing.T) { skipNoEnterprise(client, context.Background(), t) WithDatabase(t, client, nil, func(db arangodb.Database) { @@ -164,7 +164,7 @@ func Test_ClusterDatabaseInventory(t *testing.T) { foundSmartJoin = true } } - require.True(t, foundSmartJoin, "DatabaseInventory did not return any smart join collections") + require.True(t, foundSmartJoin, "DatabaseInventory did not return any SmartJoin collections") }) }) }) From f5eda32051ceb9d76ffeb57c256598ad7762abcd Mon Sep 17 00:00:00 2001 From: Simran Spiller Date: Mon, 10 Mar 2025 19:04:22 +0100 Subject: [PATCH 2/2] Remove leftover comments from v1 driver WithReturnNew, WithWaitForSync, etc. are not used in the v2 driver, you use the ...WithOptions variants of functions and set options there (or pass references to variables) --- v2/arangodb/collection_documents_create.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/v2/arangodb/collection_documents_create.go b/v2/arangodb/collection_documents_create.go index dba28636..846c99d9 100644 --- a/v2/arangodb/collection_documents_create.go +++ b/v2/arangodb/collection_documents_create.go @@ -53,9 +53,6 @@ type CollectionDocumentCreate interface { // otherwise a unique key is created. // If a documents element contains a `_key` field with a duplicate key, other any other field violates an index constraint, // a ConflictError is returned in its indeed in the errors slice. - // To return the NEW documents, prepare a context with `WithReturnNew`. The data argument passed to `WithReturnNew` must be - // a slice with the same number of entries as the `documents` slice. - // To wait until document has been synced to disk, prepare a context with `WithWaitForSync`. // If the create request itself fails or one of the arguments is invalid, an error is returned. // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface CreateDocuments(ctx context.Context, documents interface{}) (CollectionDocumentCreateResponseReader, error) @@ -66,9 +63,6 @@ type CollectionDocumentCreate interface { // otherwise a unique key is created. // If a documents element contains a `_key` field with a duplicate key, other any other field violates an index constraint, // a ConflictError is returned in its indeed in the errors slice. - // To return the NEW documents, prepare a context with `WithReturnNew`. The data argument passed to `WithReturnNew` must be - // a slice with the same number of entries as the `documents` slice. - // To wait until document has been synced to disk, prepare a context with `WithWaitForSync`. // If the create request itself fails or one of the arguments is invalid, an error is returned. // SmartGraphs and EnterpriseGraphs cannot use existing collections and cannot use the document interface CreateDocumentsWithOptions(ctx context.Context, documents interface{}, opts *CollectionDocumentCreateOptions) (CollectionDocumentCreateResponseReader, error)