diff --git a/v2/arangodb/client_database.go b/v2/arangodb/client_database.go index ac69962a..c08dae83 100644 --- a/v2/arangodb/client_database.go +++ b/v2/arangodb/client_database.go @@ -25,12 +25,6 @@ import ( ) type ClientDatabase interface { - // Deprecated: use GetDatabase instead - // - // Database opens a connection to an existing database. - // If no database with given name exists, an NotFoundError is returned. - Database(ctx context.Context, name string) (Database, error) - // GetDatabase opens a connection to an existing database. // If no database with given name exists, an NotFoundError is returned. GetDatabase(ctx context.Context, name string, options *GetDatabaseOptions) (Database, error) diff --git a/v2/arangodb/collection.go b/v2/arangodb/collection.go index 5e5a3067..5aa44e8d 100644 --- a/v2/arangodb/collection.go +++ b/v2/arangodb/collection.go @@ -45,11 +45,6 @@ type Collection interface { // Properties fetches extended information about the collection. Properties(ctx context.Context) (CollectionProperties, error) - // Deprecated: use 'SetPropertiesV2' instead - // - // SetProperties allows modifying collection parameters - SetProperties(ctx context.Context, options SetCollectionPropertiesOptions) error - // SetProperties allows modifying collection parameters SetPropertiesV2(ctx context.Context, options SetCollectionPropertiesOptionsV2) error diff --git a/v2/arangodb/collection_impl.go b/v2/arangodb/collection_impl.go index f2a84f5c..d4ae5286 100644 --- a/v2/arangodb/collection_impl.go +++ b/v2/arangodb/collection_impl.go @@ -139,26 +139,6 @@ func (c collection) Properties(ctx context.Context) (CollectionProperties, error } } -func (c collection) SetProperties(ctx context.Context, options SetCollectionPropertiesOptions) error { - urlEndpoint := c.url("collection", "properties") - - var response struct { - shared.ResponseStruct `json:",inline"` - } - - resp, err := connection.CallPut(ctx, c.connection(), urlEndpoint, &response, options, c.withModifiers()...) - if err != nil { - return errors.WithStack(err) - } - - switch code := resp.Code(); code { - case http.StatusOK: - return nil - default: - return response.AsArangoErrorWithCode(code) - } -} - func (c collection) SetPropertiesV2(ctx context.Context, options SetCollectionPropertiesOptionsV2) error { urlEndpoint := c.url("collection", "properties") diff --git a/v2/arangodb/collection_indexes.go b/v2/arangodb/collection_indexes.go index 72f25255..067a6609 100644 --- a/v2/arangodb/collection_indexes.go +++ b/v2/arangodb/collection_indexes.go @@ -59,14 +59,6 @@ type CollectionIndexes interface { // fields The index is returned, together with a boolean indicating if the index was newly created (true) or pre-existing (false). EnsureTTLIndex(ctx context.Context, fields []string, expireAfter int, options *CreateTTLIndexOptions) (IndexResponse, bool, error) - // EnsureZKDIndex - // The previously experimental `zkd` index is now stable and has been renamed to `mdi`. - // Existing indexes keep the `zkd` type. The HTTP API still allows the old name to create new indexes that behave - // exactly like `mdi` indexes but this is discouraged. The `zkd` alias may get removed in a future version. - // - // Deprecated: since 3.12 version use EnsureMKDIndex instead. - EnsureZKDIndex(ctx context.Context, fields []string, options *CreateZKDIndexOptions) (IndexResponse, bool, error) - // EnsureMDIIndex creates a multidimensional index for the collection, if it does not already exist. // The index is returned, together with a boolean indicating if the index was newly created (true) or pre-existing (false). // Available in ArangoDB 3.12 and later. @@ -114,12 +106,6 @@ const ( // Documents which are expired are eventually removed by a background thread. TTLIndexType = IndexType("ttl") - // ZKDIndexType == multi-dimensional index. The zkd index type is an experimental index for indexing two- or higher dimensional data such as time ranges, - // for efficient intersection of multiple range queries. - // - // Deprecated: since 3.12 version use MDIIndexType instead. - ZKDIndexType = IndexType("zkd") - // MDIIndexType is multidimensional index for indexing two- or higher dimensional data such as time ranges, // for efficient intersection of multiple range queries. // Available in ArangoDB 3.12 and later. @@ -132,26 +118,6 @@ const ( // InvertedIndexType can be used to speed up a broad range of AQL queries, from simple to complex, including full-text search InvertedIndexType = IndexType("inverted") - - // FullTextIndex - // - // Deprecated: since 3.10 version. Use ArangoSearch view instead. - // It is ued just for the read compatibility with older versions. - FullTextIndex = IndexType("fulltext") - - // HashIndex are an aliases for the persistent index type and should no longer be used to create new indexes. - // The aliases will be removed in a future version. - // It is ued just for the read compatibility with older versions. - // - // Deprecated: use PersistentIndexType instead - HashIndex = IndexType("hash") - - // SkipListIndex are an aliases for the persistent index type and should no longer be used to create new indexes. - // The aliases will be removed in a future version. - // It is ued just for the read compatibility with older versions. - // - // Deprecated: use PersistentIndexType instead - SkipListIndex = IndexType("skiplist") ) // IndexResponse is the response from the Index list method @@ -302,29 +268,10 @@ type CreateTTLIndexOptions struct { InBackground *bool `json:"inBackground,omitempty"` } -// ZKDFieldType -// -// Deprecated: use MDIFieldType instead -type ZKDFieldType string - -// ZKDDoubleFieldType -// -// Deprecated: use MDIDoubleFieldType instead -const ZKDDoubleFieldType ZKDFieldType = "double" - type MDIFieldType string const MDIDoubleFieldType MDIFieldType = "double" -// CreateZKDIndexOptions provides specific options for creating a ZKD index -type CreateZKDIndexOptions struct { - // Name optional user defined name used for hints in AQL queries - Name string `json:"name,omitempty"` - - // FieldValueTypes is required and the only allowed value is "double". Future extensions of the index will allow other types. - FieldValueTypes ZKDFieldType `json:"fieldValueTypes,required"` -} - // CreateMDIIndexOptions provides specific options for creating a MKD index type CreateMDIIndexOptions struct { // Name optional user defined name used for hints in AQL queries diff --git a/v2/arangodb/collection_indexes_impl.go b/v2/arangodb/collection_indexes_impl.go index 8d0e5a67..e75a547c 100644 --- a/v2/arangodb/collection_indexes_impl.go +++ b/v2/arangodb/collection_indexes_impl.go @@ -159,22 +159,6 @@ func (c *collectionIndexes) EnsureTTLIndex(ctx context.Context, fields []string, return newIndexResponse(&result), created, err } -func (c *collectionIndexes) EnsureZKDIndex(ctx context.Context, fields []string, options *CreateZKDIndexOptions) (IndexResponse, bool, error) { - reqData := struct { - Type IndexType `json:"type"` - Fields []string `json:"fields"` - *CreateZKDIndexOptions - }{ - Type: ZKDIndexType, - Fields: fields, - CreateZKDIndexOptions: options, - } - - result := responseIndex{} - created, err := c.ensureIndex(ctx, &reqData, &result) - return newIndexResponse(&result), created, err -} - func (c *collectionIndexes) EnsureMDIIndex(ctx context.Context, fields []string, options *CreateMDIIndexOptions) (IndexResponse, bool, error) { reqData := struct { Type IndexType `json:"type"` diff --git a/v2/arangodb/collection_opts.go b/v2/arangodb/collection_opts.go index 0ff4de79..e5e9f083 100644 --- a/v2/arangodb/collection_opts.go +++ b/v2/arangodb/collection_opts.go @@ -75,9 +75,6 @@ type CollectionExtendedInfo struct { AllowUserKeys bool `json:"allowUserKeys,omitempty"` } `json:"keyOptions,omitempty"` - // Deprecated: use 'WriteConcern' instead. - MinReplicationFactor int `json:"minReplicationFactor,omitempty"` - // NumberOfShards is the number of shards of the collection. // Only available in cluster setup. NumberOfShards int `json:"numberOfShards,omitempty"` @@ -125,34 +122,9 @@ type CollectionExtendedInfo struct { type CollectionProperties struct { CollectionExtendedInfo - // 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 - // of 2 and less than or equal to 1024. For very large collections one should increase this to avoid long pauses when the hash - // table has to be initially built or resized, since buckets are resized individually and can be initially built in parallel. - // For example, 64 might be a sensible value for a collection with 100 000 000 documents. - // Currently, only the edge index respects this value, but other index types might follow in future ArangoDB versions. - // Changes are applied when the collection is loaded the next time. - // - // Deprecated: since 3.7 version. It is related only to MMFiles. - IndexBuckets int `json:"indexBuckets,omitempty"` - - // DoCompact specifies whether or not the collection will be compacted. - // - // Deprecated: since 3.7 version. It is related only to MMFiles. - DoCompact bool `json:"doCompact,omitempty"` - // JournalSize is the maximal size setting for journals / datafiles in bytes. JournalSize int64 `json:"journalSize,omitempty"` - // If true then the collection data is kept in-memory only and not made persistent. - // Unloading the collection will cause the collection data to be discarded. Stopping or re-starting the server will also - // cause full loss of data in the collection. Setting this option will make the resulting collection be slightly faster - // than regular collections because ArangoDB does not enforce any synchronization to disk and does not calculate any - // CRC checksums for datafiles (as there are no datafiles). This option should therefore be used for cache-type collections only, - // and not for data that cannot be re-created otherwise. (The default is false) - // - // Deprecated: since 3.7 version. It is related only to MMFiles. - IsVolatile bool `json:"isVolatile,omitempty"` - // SmartJoinAttribute // See documentation for SmartJoins. // This requires ArangoDB Enterprise Edition. @@ -184,37 +156,7 @@ func (p *CollectionProperties) IsSatellite() bool { return p.ReplicationFactor == ReplicationFactorSatellite } -// Deprecated: use 'SetCollectionPropertiesOptionsV2' instead -// // SetCollectionPropertiesOptions contains data for Collection.SetProperties. -type SetCollectionPropertiesOptions struct { - // If true then creating or changing a document will wait until the data has been synchronized to disk. - WaitForSync *bool `json:"waitForSync,omitempty"` - - // The maximal size of a journal or datafile in bytes. The value must be at least 1048576 (1 MB). Note that when changing the journalSize value, it will only have an effect for additional journals or datafiles that are created. Already existing journals or datafiles will not be affected. - JournalSize int64 `json:"journalSize,omitempty"` - - // ReplicationFactor contains how many copies of each shard are kept on different DBServers. - // Only available in cluster setup. - ReplicationFactor ReplicationFactor `json:"replicationFactor,omitempty"` - - // Deprecated: use 'WriteConcern' instead - MinReplicationFactor int `json:"minReplicationFactor,omitempty"` - - // WriteConcern contains how many copies must be available before a collection can be written. - // Available from 3.6 arangod version. - WriteConcern int `json:"writeConcern,omitempty"` - - // CacheEnabled set cacheEnabled option in collection properties - CacheEnabled *bool `json:"cacheEnabled,omitempty"` - - // Schema for collection validation - Schema *CollectionSchemaOptions `json:"schema,omitempty"` - - // ComputedValues let configure collections to generate document attributes when documents are created or modified, using an AQL expression - ComputedValues []ComputedValue `json:"computedValues,omitempty"` -} - type SetCollectionPropertiesOptionsV2 struct { // If true then creating or changing a document will wait until the data has been synchronized to disk. WaitForSync *bool `json:"waitForSync,omitempty"` @@ -226,9 +168,6 @@ type SetCollectionPropertiesOptionsV2 struct { // Only available in cluster setup. ReplicationFactor *ReplicationFactor `json:"replicationFactor,omitempty"` - // Deprecated: use 'WriteConcern' instead - MinReplicationFactor *int `json:"minReplicationFactor,omitempty"` - // WriteConcern contains how many copies must be available before a collection can be written. // Available from 3.6 arangod version. WriteConcern *int `json:"writeConcern,omitempty"` diff --git a/v2/arangodb/database_analyzer.go b/v2/arangodb/database_analyzer.go index e4fee9c4..c784ec65 100644 --- a/v2/arangodb/database_analyzer.go +++ b/v2/arangodb/database_analyzer.go @@ -25,12 +25,6 @@ import ( ) type DatabaseAnalyzer interface { - // Deprecated: Use EnsureCreatedAnalyzer instead - // - // EnsureAnalyzer ensures that the given analyzer exists. If it does not exist, it is created. - // The function returns whether the analyzer already existed or not. - EnsureAnalyzer(ctx context.Context, analyzer *AnalyzerDefinition) (bool, Analyzer, error) - // EnsureCreatedAnalyzer creates an Analyzer for the database, if it does not already exist. // It returns the Analyser object together with a boolean indicating if the Analyzer was newly created (true) or pre-existing (false). EnsureCreatedAnalyzer(ctx context.Context, analyzer *AnalyzerDefinition) (Analyzer, bool, error) diff --git a/v2/arangodb/database_analyzer_impl.go b/v2/arangodb/database_analyzer_impl.go index b755aabd..5c1595b9 100644 --- a/v2/arangodb/database_analyzer_impl.go +++ b/v2/arangodb/database_analyzer_impl.go @@ -44,27 +44,6 @@ type databaseAnalyzer struct { db *database } -// Deprecated: Use EnsureCreatedAnalyzer instead -func (d databaseAnalyzer) EnsureAnalyzer(ctx context.Context, analyzer *AnalyzerDefinition) (bool, Analyzer, error) { - urlEndpoint := d.db.url("_api", "analyzer") - - var response struct { - shared.ResponseStruct `json:",inline"` - AnalyzerDefinition - } - resp, err := connection.CallPost(ctx, d.db.connection(), urlEndpoint, &response, analyzer) - if err != nil { - return false, nil, errors.WithStack(err) - } - - switch code := resp.Code(); code { - case http.StatusCreated, http.StatusOK: - return code == http.StatusOK, newAnalyzer(d.db, response.AnalyzerDefinition), nil - default: - return false, nil, response.AsArangoErrorWithCode(code) - } -} - // EnsureCreatedAnalyzer creates an Analyzer for the database, if it does not already exist. // It returns the Analyser object together with a boolean indicating if the Analyzer was newly created (true) or pre-existing (false). func (d databaseAnalyzer) EnsureCreatedAnalyzer(ctx context.Context, analyzer *AnalyzerDefinition) (Analyzer, bool, error) { diff --git a/v2/arangodb/database_collection.go b/v2/arangodb/database_collection.go index 730f4335..c2ab7c92 100644 --- a/v2/arangodb/database_collection.go +++ b/v2/arangodb/database_collection.go @@ -25,12 +25,6 @@ import ( ) type DatabaseCollection interface { - // Deprecated: use GetCollection instead - // - // Collection opens a connection to an existing collection within the database. - // If no collection with given name exists, an NotFoundError is returned. - Collection(ctx context.Context, name string) (Collection, error) - // GetCollection opens a connection to an existing collection within the database. // If no collection with given name exists, an NotFoundError is returned. GetCollection(ctx context.Context, name string, options *GetCollectionOptions) (Collection, error) @@ -41,22 +35,10 @@ type DatabaseCollection interface { // Collections returns a list of all collections in the database. Collections(ctx context.Context) ([]Collection, error) - // Deprecated: use CreateCollectionV2 instead - // - // CreateCollection creates a new collection with given name and options, and opens a connection to it. - // If a collection with given name already exists within the database, a DuplicateError is returned. - CreateCollection(ctx context.Context, name string, props *CreateCollectionProperties) (Collection, error) - // CreateCollection creates a new collection with given name and options, and opens a connection to it. // If a collection with given name already exists within the database, a DuplicateError is returned. CreateCollectionV2(ctx context.Context, name string, props *CreateCollectionPropertiesV2) (Collection, error) - // Deprecated: use CreateCollectionWithOptionsV2 instead - // - // CreateCollectionWithOptions creates a new collection with given name and options, and opens a connection to it. - // If a collection with given name already exists within the database, a DuplicateError is returned. - CreateCollectionWithOptions(ctx context.Context, name string, props *CreateCollectionProperties, options *CreateCollectionOptions) (Collection, error) - // CreateCollectionWithOptions creates a new collection with given name and options, and opens a connection to it. // If a collection with given name already exists within the database, a DuplicateError is returned. CreateCollectionWithOptionsV2(ctx context.Context, name string, props *CreateCollectionPropertiesV2, options *CreateCollectionOptions) (Collection, error) diff --git a/v2/arangodb/database_collection_impl.go b/v2/arangodb/database_collection_impl.go index 327eae6b..2e293ea1 100644 --- a/v2/arangodb/database_collection_impl.go +++ b/v2/arangodb/database_collection_impl.go @@ -43,10 +43,6 @@ type databaseCollection struct { db *database } -func (d databaseCollection) Collection(ctx context.Context, name string) (Collection, error) { - return d.GetCollection(ctx, name, nil) -} - func (d databaseCollection) GetCollection(ctx context.Context, name string, options *GetCollectionOptions) (Collection, error) { col := newCollection(d.db, name) @@ -113,47 +109,10 @@ func (d databaseCollection) Collections(ctx context.Context) ([]Collection, erro } } -// Deprecated: use CreateCollectionV2 instead -// -// CreateCollectionWithOptions -func (d databaseCollection) CreateCollection(ctx context.Context, name string, props *CreateCollectionProperties) (Collection, error) { - return d.CreateCollectionWithOptions(ctx, name, props, nil) -} - func (d databaseCollection) CreateCollectionV2(ctx context.Context, name string, props *CreateCollectionPropertiesV2) (Collection, error) { return d.CreateCollectionWithOptionsV2(ctx, name, props, nil) } -// Deprecated: use CreateCollectionWithOptionsV2 instead -// -// CreateCollectionWithOptions -func (d databaseCollection) CreateCollectionWithOptions(ctx context.Context, name string, props *CreateCollectionProperties, options *CreateCollectionOptions) (Collection, error) { - props.Init() - - urlEndpoint := d.db.url("_api", "collection") - reqData := struct { - Name string `json:"name"` - *CreateCollectionProperties - }{ - Name: name, - CreateCollectionProperties: props, - } - - var respData shared.ResponseStruct - - resp, err := connection.CallPost(ctx, d.db.connection(), urlEndpoint, &respData, &reqData, append(d.db.modifiers, options.modifyRequest)...) - if err != nil { - return nil, errors.WithStack(err) - } - - switch code := resp.Code(); code { - case http.StatusOK: - return newCollection(d.db, name), nil - default: - return nil, respData.AsArangoErrorWithCode(code) - } -} - func (d databaseCollection) CreateCollectionWithOptionsV2(ctx context.Context, name string, props *CreateCollectionPropertiesV2, options *CreateCollectionOptions) (Collection, error) { props.Init() diff --git a/v2/arangodb/database_collection_opts.go b/v2/arangodb/database_collection_opts.go index 31a96017..fda3d5a9 100644 --- a/v2/arangodb/database_collection_opts.go +++ b/v2/arangodb/database_collection_opts.go @@ -24,92 +24,6 @@ import ( "github.com/arangodb/go-driver/v2/connection" ) -// Deprecated: Use CreateCollectionProprtiesV2 instead -// -// CreateCollectionProperties contains options that customize the creating of a collection. -type CreateCollectionProperties struct { - // CacheEnabled set cacheEnabled option in collection properties - CacheEnabled *bool `json:"cacheEnabled,omitempty"` - // This field is used for internal purposes only. DO NOT USE. - DistributeShardsLike string `json:"distributeShardsLike,omitempty"` - // DoCompact checks if the collection will be compacted (default is true) - DoCompact *bool `json:"doCompact,omitempty"` - // 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 - // of 2 and less than or equal to 1024. For very large collections one should increase this to avoid long pauses when the hash - // table has to be initially built or resized, since buckets are resized individually and can be initially built in parallel. - // For example, 64 might be a sensible value for a collection with 100 000 000 documents. - // Currently, only the edge index respects this value, but other index types might follow in future ArangoDB versions. - // Changes are applied when the collection is loaded the next time. - IndexBuckets int `json:"indexBuckets,omitempty"` - // Available from 3.9 ArangoD version. - InternalValidatorType int `json:"internalValidatorType,omitempty"` - // IsDisjoint set isDisjoint flag for Graph. Required ArangoDB 3.7+ - IsDisjoint bool `json:"isDisjoint,omitempty"` - // Set to create a smart edge or vertex collection. - // This requires ArangoDB Enterprise Edition. - IsSmart bool `json:"isSmart,omitempty"` - // If true, create a system collection. In this case collection-name should start with an underscore. - // End users should normally create non-system collections only. API implementors may be required to create system - // collections in very special occasions, but normally a regular collection will do. (The default is false) - IsSystem bool `json:"isSystem,omitempty"` - // If true then the collection data is kept in-memory only and not made persistent. - // Unloading the collection will cause the collection data to be discarded. Stopping or re-starting the server will also - // cause full loss of data in the collection. Setting this option will make the resulting collection be slightly faster - // than regular collections because ArangoDB does not enforce any synchronization to disk and does not calculate any - // CRC checksums for datafiles (as there are no datafiles). This option should therefore be used for cache-type collections only, - // and not for data that cannot be re-created otherwise. (The default is false) - IsVolatile bool `json:"isVolatile,omitempty"` - // 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) - JournalSize int64 `json:"journalSize,omitempty"` - // Specifies how keys in the collection are created. - KeyOptions *CollectionKeyOptions `json:"keyOptions,omitempty"` - // Deprecated: use 'WriteConcern' instead - MinReplicationFactor int `json:"minReplicationFactor,omitempty"` - // 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) - NumberOfShards int `json:"numberOfShards,omitempty"` - // ReplicationFactor in a cluster (default is 1), this attribute determines how many copies of each shard are kept on different DBServers. - // The value 1 means that only one copy (no synchronous replication) is kept. - // A value of k means that k-1 replicas are kept. Any two copies reside on different DBServers. - // Replication between them is synchronous, that is, every write operation to the "leader" copy will be replicated to all "follower" replicas, - // before the write operation is reported successful. If a server fails, this is detected automatically - // and one of the servers holding copies take over, usually without an error being reported. - ReplicationFactor ReplicationFactor `json:"replicationFactor,omitempty"` - // Schema for collection validation - Schema *CollectionSchemaOptions `json:"schema,omitempty"` - // This attribute specifies the name of the sharding strategy to use for the collection. - // Must be one of ShardingStrategy* values. - ShardingStrategy ShardingStrategy `json:"shardingStrategy,omitempty"` - // In a cluster, this attribute determines which document attributes are used to - // determine the target shard for documents. Documents are sent to shards based on the values of their shard key attributes. - // The values of all shard key attributes in a document are hashed, and the hash value is used to determine the target shard. - // 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 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 SmartJoins. - // This requires ArangoDB Enterprise Edition. - SmartJoinAttribute string `json:"smartJoinAttribute,omitempty"` - // Available from 3.7 ArangoDB version - SyncByRevision bool `json:"syncByRevision,omitempty"` - // The type of the collection to create. (default is CollectionTypeDocument) - Type CollectionType `json:"type,omitempty"` - // If true then the data is synchronized to disk before returning from a document create, update, replace or removal operation. (default: false) - 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 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 - ComputedValues []ComputedValue `json:"computedValues,omitempty"` -} - // CreateCollectionProperties contains options that customize the creating of a collection. type CreateCollectionPropertiesV2 struct { // CacheEnabled set cacheEnabled option in collection properties @@ -147,8 +61,6 @@ type CreateCollectionPropertiesV2 struct { JournalSize *int64 `json:"journalSize,omitempty"` // Specifies how keys in the collection are created. KeyOptions *CollectionKeyOptions `json:"keyOptions,omitempty"` - // Deprecated: use 'WriteConcern' instead - MinReplicationFactor *int `json:"minReplicationFactor,omitempty"` // 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) NumberOfShards *int `json:"numberOfShards,omitempty"` // ReplicationFactor in a cluster (default is 1), this attribute determines how many copies of each shard are kept on different DBServers. @@ -194,22 +106,11 @@ type CreateCollectionPropertiesV2 struct { ComputedValues *[]ComputedValue `json:"computedValues,omitempty"` } -// Init translate deprecated fields into current one for backward compatibility -func (c *CreateCollectionProperties) Init() { - if c == nil { - return - } - - c.KeyOptions.Init() -} - // Init translate deprecated fields into current one for backward compatibility func (c *CreateCollectionPropertiesV2) Init() { if c == nil { return } - - c.KeyOptions.Init() } // CreateCollectionOptions specifies additional options to be provided while creating collection @@ -244,9 +145,6 @@ type CollectionKeyOptions struct { // If set to true, then it is allowed to supply own key values in the _key attribute of a document. // If set to false, then the key generator will solely be responsible for generating keys and supplying own // key values in the _key attribute of documents is considered an error. - // - // Deprecated: Use AllowUserKeysPtr instead - AllowUserKeys bool `json:"-"` // If set to true, then it is allowed to supply own key values in the _key attribute of a document. // If set to false, then the key generator will solely be responsible for generating keys and supplying own // key values in the _key attribute of documents is considered an error. @@ -259,19 +157,6 @@ type CollectionKeyOptions struct { Offset int `json:"offset,omitempty"` } -// Init translate deprecated fields into current one for backward compatibility -func (c *CollectionKeyOptions) Init() { - if c == nil { - return - } - - if c.AllowUserKeysPtr == nil { - if c.AllowUserKeys { - c.AllowUserKeysPtr = &c.AllowUserKeys - } - } -} - // KeyGeneratorType is a type of key generated, used in `CollectionKeyOptions`. type KeyGeneratorType string diff --git a/v2/connection/connection_http_content-type.go b/v2/connection/connection_http_content-type.go index 4253ecd1..eb1484f2 100644 --- a/v2/connection/connection_http_content-type.go +++ b/v2/connection/connection_http_content-type.go @@ -30,5 +30,5 @@ const ( // ApplicationVPack is the content type for VelocyPack // // Deprecated: Use JSON instead - ApplicationVPack = "application/x-velocypack" + // ApplicationVPack = "application/x-velocypack" ) diff --git a/v2/connection/connection_http_internal.go b/v2/connection/connection_http_internal.go index c08340fc..b92d3047 100644 --- a/v2/connection/connection_http_internal.go +++ b/v2/connection/connection_http_internal.go @@ -293,8 +293,6 @@ func (j *httpConnection) stream(ctx context.Context, req *httpRequest) (*httpRes // If contentType is unknown, then nil is returned. func getDecoderByContentType(contentType string) Decoder { switch contentType { - case ApplicationVPack: - return getVPackDecoder() case ApplicationJSON: return getJsonDecoder() case PlainText, ApplicationOctetStream, ApplicationZip: diff --git a/v2/connection/connection_http_internal_test.go b/v2/connection/connection_http_internal_test.go index 34281f44..4022763c 100644 --- a/v2/connection/connection_http_internal_test.go +++ b/v2/connection/connection_http_internal_test.go @@ -39,10 +39,6 @@ func Test_httpConnection_Decoder(t *testing.T) { contentType: ApplicationJSON, wantDecoder: getJsonDecoder(), }, - "VPack response decoder": { - contentType: ApplicationVPack, - wantDecoder: getVPackDecoder(), - }, "Bytes response decoder": { contentType: PlainText, wantDecoder: getBytesDecoder(), @@ -53,12 +49,6 @@ func Test_httpConnection_Decoder(t *testing.T) { }, wantDecoder: getJsonDecoder(), }, - "VPack HTTP connection decoder": { - conn: httpConnection{ - contentType: ApplicationVPack, - }, - wantDecoder: getVPackDecoder(), - }, "Bytes HTTP connection decoder": { conn: httpConnection{ contentType: PlainText, diff --git a/v2/connection/endpoints_round_robin.go b/v2/connection/endpoints_round_robin.go index 0ad81829..f3ff52d0 100644 --- a/v2/connection/endpoints_round_robin.go +++ b/v2/connection/endpoints_round_robin.go @@ -25,13 +25,6 @@ import ( "sync" ) -// Deprecated: use NewRoundRobinEndpoints -// -// NewEndpoints returns Endpoint manager which runs round-robin -func NewEndpoints(e ...string) Endpoint { - return NewRoundRobinEndpoints(e) -} - // NewRoundRobinEndpoints returns Endpoint manager which runs round-robin func NewRoundRobinEndpoints(e []string) Endpoint { return &roundRobinEndpoints{ diff --git a/v2/tests/database_collection_indexes_test.go b/v2/tests/database_collection_indexes_test.go index 47edb035..b9763974 100644 --- a/v2/tests/database_collection_indexes_test.go +++ b/v2/tests/database_collection_indexes_test.go @@ -404,16 +404,6 @@ func Test_NamedIndexes(t *testing.T) { return idx, err }, }, - { - Name: "ZKD", - CreateCallback: func(col arangodb.Collection, name string) (arangodb.IndexResponse, error) { - idx, _, err := col.EnsureZKDIndex(ctx, []string{"zkd"}, &arangodb.CreateZKDIndexOptions{ - Name: name, - FieldValueTypes: arangodb.ZKDDoubleFieldType, - }) - return idx, err - }, - }, { Name: "MKD", CreateCallback: func(col arangodb.Collection, name string) (arangodb.IndexResponse, error) { diff --git a/v2/tests/graph_edge_definitions_test.go b/v2/tests/graph_edge_definitions_test.go index ed65f3a2..f0c0df03 100644 --- a/v2/tests/graph_edge_definitions_test.go +++ b/v2/tests/graph_edge_definitions_test.go @@ -103,7 +103,7 @@ func Test_GraphEdgeDefinitions(t *testing.T) { require.NoError(t, err) require.True(t, exist) - col, err := db.Collection(ctx, colName) + col, err := db.GetCollection(ctx, colName, nil) require.NoError(t, err) prop, err := col.Properties(ctx) @@ -167,14 +167,14 @@ func TestGraphEdgeDefinitionsWithSatellites(t *testing.T) { require.NoError(t, err) require.Len(t, createResp.GraphDefinition.EdgeDefinitions, 1) - col, err := db.Collection(ctx, colName) + col, err := db.GetCollection(ctx, colName, nil) require.NoError(t, err) prop, err := col.Properties(ctx) require.NoError(t, err) require.True(t, prop.IsSatellite()) - colFrom, err := db.Collection(ctx, colFromName) + colFrom, err := db.GetCollection(ctx, colFromName, nil) require.NoError(t, err) propFrom, err := colFrom.Properties(ctx) @@ -191,7 +191,7 @@ func TestGraphEdgeDefinitionsWithSatellites(t *testing.T) { require.Contains(t, delResp.GraphDefinition.EdgeDefinitions[0].From, newColName) require.Contains(t, delResp.GraphDefinition.OrphanCollections, colFromName) - colNew, err := db.Collection(ctx, newColName) + colNew, err := db.GetCollection(ctx, newColName, nil) require.NoError(t, err) propNew, err := colNew.Properties(ctx) diff --git a/v2/tests/graph_test.go b/v2/tests/graph_test.go index 7b59597a..0177128c 100644 --- a/v2/tests/graph_test.go +++ b/v2/tests/graph_test.go @@ -68,7 +68,7 @@ func Test_GraphSimple(t *testing.T) { t.Run("Test created collections", func(t *testing.T) { for _, c := range append(g.EdgeDefinitions()[0].To, g.EdgeDefinitions()[0].From...) { - col, err := db.Collection(ctx, c) + col, err := db.GetCollection(ctx, c, nil) require.NoError(t, err) require.NotNil(t, col) @@ -162,7 +162,7 @@ func Test_GraphCreation(t *testing.T) { require.True(t, g.IsSmart()) for _, c := range []string{colHybrid, colSat, colNonSat} { - col, err := db.Collection(ctx, c) + col, err := db.GetCollection(ctx, c, nil) require.NoError(t, err) require.NotNil(t, col) diff --git a/v2/tests/graph_vertex_collections_test.go b/v2/tests/graph_vertex_collections_test.go index cc4b7580..73546980 100644 --- a/v2/tests/graph_vertex_collections_test.go +++ b/v2/tests/graph_vertex_collections_test.go @@ -66,7 +66,7 @@ func Test_GraphVertexCollections(t *testing.T) { require.NoError(t, err) require.NotContains(t, delResp.GraphDefinition.OrphanCollections, colName) - col, err := db.Collection(ctx, colName) + col, err := db.GetCollection(ctx, colName, nil) require.NoError(t, err) prop, err := col.Properties(ctx) @@ -105,7 +105,7 @@ func TestCreateSatelliteVertexCollection(t *testing.T) { require.NoError(t, err) require.True(t, exist, "vertex collection should exist") - col, err := db.Collection(ctx, colName) + col, err := db.GetCollection(ctx, colName, nil) require.NoError(t, err) prop, err := col.Properties(ctx) diff --git a/v2/tests/helper_test.go b/v2/tests/helper_test.go index 0b4a834b..7d1f0525 100644 --- a/v2/tests/helper_test.go +++ b/v2/tests/helper_test.go @@ -77,35 +77,6 @@ func WithDatabase(t testing.TB, client arangodb.Client, opts *arangodb.CreateDat }) } -// Deprecated: use WithCollectionV2 instead -// -// WithCollection -func WithCollection(t testing.TB, db arangodb.Database, props *arangodb.CreateCollectionProperties, f func(col arangodb.Collection)) { - name := GenerateUUID("test-COL") - - t.Logf("Creating COL %s, time: %s", name, time.Now()) - - withContextT(t, defaultTestTimeout, func(ctx context.Context, _ testing.TB) { - col, err := db.CreateCollection(ctx, name, props) - require.NoError(t, err, fmt.Sprintf("Failed to create COL %s", name)) - - NewTimeout(func() error { - _, err := db.GetCollection(ctx, name, nil) - if err == nil { - return Interrupt{} - } - - if shared.IsNotFound(err) { - return nil - } - - return err - }).TimeoutT(t, 15*time.Second, 125*time.Millisecond) - - f(col) - }) -} - func WithCollectionV2(t testing.TB, db arangodb.Database, props *arangodb.CreateCollectionPropertiesV2, f func(col arangodb.Collection)) { name := GenerateUUID("test-COL") diff --git a/v2/tests/run_wrap_test.go b/v2/tests/run_wrap_test.go index d2296fa7..6e9e41fd 100644 --- a/v2/tests/run_wrap_test.go +++ b/v2/tests/run_wrap_test.go @@ -99,23 +99,6 @@ func WrapConnectionFactory(t *testing.T, w WrapperConnectionFactory, wo ...WrapO }) }) - t.Run("HTTP VPACK", func(t *testing.T) { - if parallel { - t.Parallel() - } - - w(t, func(t *testing.T) connection.Connection { - conn := connectionVPACKHttp(t) - if async { - conn = connection.NewConnectionAsyncWrapper(conn) - } - - waitForConnection(t, arangodb.NewClient(conn)) - applyCompression(conn) - return conn - }) - }) - t.Run("HTTP2 JSON", func(t *testing.T) { if version.Version.CompareTo("3.7.1") < 1 { t.Skipf("Not supported") @@ -135,26 +118,6 @@ func WrapConnectionFactory(t *testing.T, w WrapperConnectionFactory, wo ...WrapO return conn }) }) - - t.Run("HTTP2 VPACK", func(t *testing.T) { - if version.Version.CompareTo("3.7.1") < 1 { - t.Skipf("Not supported") - } - if parallel { - t.Parallel() - } - - w(t, func(t *testing.T) connection.Connection { - conn := connectionVPACKHttp2(t) - if async { - conn = connection.NewConnectionAsyncWrapper(conn) - } - - waitForConnection(t, arangodb.NewClient(conn)) - applyCompression(conn) - return conn - }) - }) } func applyCompression(conn connection.Connection) { @@ -194,17 +157,6 @@ func WrapB(t *testing.B, w WrapperB) { w(t, newClient(t, connectionJsonHttp(t))) }) - t.Run("HTTP VPACK", func(t *testing.B) { - w(t, newClient(t, connectionVPACKHttp(t))) - }) - - t.Run("HTTP2 VPACK", func(t *testing.B) { - if version.Version.CompareTo("3.7.1") < 1 { - t.Skipf("Not supported") - } - w(t, newClient(t, connectionVPACKHttp2(t))) - }) - t.Run("HTTP2 JSON", func(t *testing.B) { if version.Version.CompareTo("3.7.1") < 1 { t.Skipf("Not supported") @@ -320,31 +272,6 @@ func connectionJsonHttp(t testing.TB) connection.Connection { return c } -func connectionVPACKHttp(t testing.TB) connection.Connection { - h := connection.HttpConfiguration{ - Endpoint: getRandomEndpointsManager(t), - ContentType: connection.ApplicationVPack, - Transport: &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 90 * time.Second, - }).DialContext, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - }, - } - - c := connection.NewHttpConnection(h) - - withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) { - c = createAuthenticationFromEnv(t, c) - }) - return c -} - func connectionJsonHttp2(t testing.TB) connection.Connection { endpoints := getRandomEndpointsManager(t) h := connection.Http2Configuration{ @@ -366,27 +293,6 @@ func connectionJsonHttp2(t testing.TB) connection.Connection { return c } -func connectionVPACKHttp2(t testing.TB) connection.Connection { - endpoints := getRandomEndpointsManager(t) - h := connection.Http2Configuration{ - Endpoint: endpoints, - ContentType: connection.ApplicationVPack, - Transport: &http2.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, - AllowHTTP: true, - - DialTLSContext: connection.NewHTTP2DialForEndpoint(endpoints), - }, - } - - c := connection.NewHttp2Connection(h) - - withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) { - c = createAuthenticationFromEnv(t, c) - }) - return c -} - func withContext(timeout time.Duration, f func(ctx context.Context) error) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel()