-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor configs and disable collections and configure tests (#77)
## Problem Currently, the Java SDK has PineconeClientConfig and PineconeConnectionConfig which are required to be instantiated before a user can call any dataplane operations. Although, recently we did create a constructor that allowed users to call any data plane operations without having the need of instantiating both configs. But in order to improve the user-experience and align it with other SDK's, we would like to combine the two config classes. Secondly, the CollectionsTest and ConfigureIndexTest are failing consistently causing inconvenience in CI pipeline. ## Solution This PR removes PineconeClientConfig, PineconeConnectionConfig, and PineconeClient classes, and instead introduces PineconeConfig which has a required field of apiKey along with optional members such as host, usage-context, and customManagedChannel, where the customManagedChannel will allow the user to input custom gRPC channel for data plane operations. As a part of this PR, I have disabled ConfigureIndexTest and CollectionsTest to improve testing pipeline. ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [X] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [ ] Infrastructure change (CI configs, etc) - [ ] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## Test Plan Updated integration tests.
- Loading branch information
1 parent
7daa964
commit d762b37
Showing
10 changed files
with
120 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
119 changes: 0 additions & 119 deletions
119
src/main/java/io/pinecone/configs/PineconeClientConfig.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package io.pinecone.configs; | ||
|
||
import io.grpc.ManagedChannel; | ||
import io.pinecone.exceptions.PineconeValidationException; | ||
|
||
public class PineconeConfig { | ||
|
||
private String apiKey; | ||
private String host; | ||
private String integrationId; | ||
private ManagedChannel customManagedChannel; | ||
|
||
public PineconeConfig(String apiKey) { | ||
this.apiKey = apiKey; | ||
} | ||
|
||
public String getApiKey() { | ||
return apiKey; | ||
} | ||
|
||
public void setApiKey(String apiKey) { | ||
this.apiKey = apiKey; | ||
} | ||
|
||
public String getHost() { | ||
return host; | ||
} | ||
|
||
public void setHost(String host) { | ||
this.host = host; | ||
} | ||
|
||
public String getIntegrationId() { | ||
return integrationId; | ||
} | ||
|
||
public void setIntegrationId(String integrationId) { | ||
this.integrationId = integrationId; | ||
} | ||
|
||
public ManagedChannel getCustomManagedChannel() { | ||
return this.customManagedChannel; | ||
} | ||
|
||
public void setCustomManagedChannel(ManagedChannel customManagedChannel) { | ||
this.customManagedChannel = customManagedChannel; | ||
} | ||
|
||
public interface CustomChannelBuilder { | ||
ManagedChannel buildChannel(); | ||
} | ||
|
||
void validate() { | ||
if (apiKey == null) | ||
throw new PineconeValidationException("Invalid PineconeConfig: missing apiKey"); | ||
} | ||
|
||
public String getUserAgent() { | ||
String userAgentLanguage = "lang=java; pineconeClientVersion = v0.8.0"; | ||
if (this.getIntegrationId() == null) { | ||
return userAgentLanguage; | ||
} else { | ||
return userAgentLanguage + "; usageContext=" + this.getIntegrationId(); | ||
} | ||
} | ||
} |
Oops, something went wrong.