Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate client code for 2024-10 #86

Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion codegen/apis
Submodule apis updated from 9d3a41 to 39e90e
14 changes: 11 additions & 3 deletions internal/gen/db_control/db_control_2024-10.oas.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions pinecone/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@ func (c *Client) CreatePodIndex(ctx context.Context, in *CreatePodIndexRequest)

deletionProtection := pointerOrNil(db_control.DeletionProtection(in.DeletionProtection))
metric := pointerOrNil(db_control.CreateIndexRequestMetric(in.Metric))
pods := in.TotalCount()
replicas := in.ReplicaCount()
shards := in.ShardCount()

req := db_control.CreateIndexRequest{
Name: in.Name,
Expand All @@ -556,9 +559,9 @@ func (c *Client) CreatePodIndex(ctx context.Context, in *CreatePodIndexRequest)
Pod: &db_control.PodSpec{
Environment: in.Environment,
PodType: in.PodType,
Pods: in.TotalCount(),
Replicas: in.ReplicaCount(),
Shards: in.ShardCount(),
Pods: &pods,
Replicas: &replicas,
Shards: &shards,
SourceCollection: in.SourceCollection,
},
}
Expand Down Expand Up @@ -1506,9 +1509,9 @@ func toIndex(idx *db_control.IndexModel) *Index {
spec.Pod = &PodSpec{
Environment: idx.Spec.Pod.Environment,
PodType: idx.Spec.Pod.PodType,
PodCount: int32(idx.Spec.Pod.Pods),
Replicas: idx.Spec.Pod.Replicas,
ShardCount: idx.Spec.Pod.Shards,
PodCount: derefOrDefault(idx.Spec.Pod.Pods, 0),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these should ever realistically be nil when coming back from the server.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree... maybe the default should be 1 (as that's the count if all other defaults are used)

Replicas: derefOrDefault(idx.Spec.Pod.Replicas, 0),
ShardCount: derefOrDefault(idx.Spec.Pod.Shards, 0),
SourceCollection: idx.Spec.Pod.SourceCollection,
}
if idx.Spec.Pod.MetadataConfig != nil {
Expand Down
9 changes: 6 additions & 3 deletions pinecone/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,9 @@ func TestEnsureURLSchemeUnit(t *testing.T) {
func TestToIndexUnit(t *testing.T) {
deletionProtectionEnabled := db_control.Enabled
deletionProtectionDisabled := db_control.Disabled
pods := 1
replicas := int32(1)
shards := int32(1)

tests := []struct {
name string
Expand Down Expand Up @@ -999,9 +1002,9 @@ func TestToIndexUnit(t *testing.T) {
}{Pod: &db_control.PodSpec{
Environment: "test-environ",
PodType: "p1.x2",
Pods: 1,
Replicas: 1,
Shards: 1,
Pods: &pods,
Replicas: &replicas,
Shards: &shards,
SourceCollection: nil,
MetadataConfig: nil,
}}),
Expand Down
2 changes: 1 addition & 1 deletion pinecone/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ type PodSpecMetadataConfig struct {
type PodSpec struct {
Environment string `json:"environment"`
PodType string `json:"pod_type"`
PodCount int32 `json:"pod_count"`
PodCount int `json:"pod_count"`
Replicas int32 `json:"replicas"`
ShardCount int32 `json:"shard_count"`
SourceCollection *string `json:"source_collection,omitempty"`
Expand Down