Skip to content

Commit

Permalink
Update to latest version of goprotostellar
Browse files Browse the repository at this point in the history
Change-Id: Ie3804f0c437d06c1cd3e7c961d9a061b41b35c33
Reviewed-on: https://review.couchbase.org/c/gocb/+/200732
Tested-by: Charles Dixon <chvckd@gmail.com>
Reviewed-by: Dimitris Christodoulou <dimitris.christodoulou@couchbase.com>
  • Loading branch information
chvck committed Nov 14, 2023
1 parent fa2c37b commit 8b441b6
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 17 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module github.com/couchbase/gocb/v2

require (
github.com/couchbase/gocbcore/v10 v10.2.6-0.20231018082520-2fad08b5c8d1
github.com/couchbase/gocbcoreps v0.0.0-20231031081914-427437bce69f
github.com/couchbase/goprotostellar v0.0.1-3.0.20231026130943-2a7a7c48d499
github.com/couchbase/gocbcoreps v0.0.0-20231113141308-5f0347744035
github.com/couchbase/goprotostellar v0.0.1-3.0.20231102140456-4b5bcf407d9d
github.com/couchbaselabs/gocaves/client v0.0.0-20230404095311-05e3ba4f0259
github.com/couchbaselabs/gocbconnstr/v2 v2.0.0-20230515165046-68b522a21131
github.com/google/uuid v1.3.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/couchbase/gocbcore/v10 v10.2.6-0.20231018082520-2fad08b5c8d1 h1:sdFzMvIGHWsFLc+wXDSV8tbkWV3FHbhqjgnPAoqixro=
github.com/couchbase/gocbcore/v10 v10.2.6-0.20231018082520-2fad08b5c8d1/go.mod h1:lYQIIk+tzoMcwtwU5GzPbDdqEkwkH3isI2rkSpfL0oM=
github.com/couchbase/gocbcoreps v0.0.0-20231031081914-427437bce69f h1:H7QIWp9iZAFRC5Ji+ePy7m6FN4wQs+zoJynC7AksiDQ=
github.com/couchbase/gocbcoreps v0.0.0-20231031081914-427437bce69f/go.mod h1:dyilEkFXjQcI/uAAAR1im/HhA/S9XXztbYBQEFyey1g=
github.com/couchbase/goprotostellar v0.0.1-3.0.20231026130943-2a7a7c48d499 h1:XAPVPCJGX3WH59dMeez9OyLVbKniBppDt4jInCX/UXU=
github.com/couchbase/goprotostellar v0.0.1-3.0.20231026130943-2a7a7c48d499/go.mod h1:gs1eioLVOHETTFWxDY4v7Q/kRPMgqmX6t/TPcI429ls=
github.com/couchbase/gocbcoreps v0.0.0-20231113141308-5f0347744035 h1:WGd1UJoW/Wa2qx7ZzWK1DeJvyGYetjvXlRid6zM9PDM=
github.com/couchbase/gocbcoreps v0.0.0-20231113141308-5f0347744035/go.mod h1:hwy2m5dFJDwMNln5fR5llMTnIbuwGuXtLxoMgA/NOFA=
github.com/couchbase/goprotostellar v0.0.1-3.0.20231102140456-4b5bcf407d9d h1:0w7U/19DufAhamFZ7ewheJpTPlkN1veAnAt14WKDxSo=
github.com/couchbase/goprotostellar v0.0.1-3.0.20231102140456-4b5bcf407d9d/go.mod h1:gs1eioLVOHETTFWxDY4v7Q/kRPMgqmX6t/TPcI429ls=
github.com/couchbaselabs/gocaves/client v0.0.0-20230307083111-cc3960c624b1/go.mod h1:AVekAZwIY2stsJOMWLAS/0uA/+qdp7pjO8EHnl61QkY=
github.com/couchbaselabs/gocaves/client v0.0.0-20230404095311-05e3ba4f0259 h1:2TXy68EGEzIMHOx9UvczR5ApVecwCfQZ0LjkmwMI6g4=
github.com/couchbaselabs/gocaves/client v0.0.0-20230404095311-05e3ba4f0259/go.mod h1:AVekAZwIY2stsJOMWLAS/0uA/+qdp7pjO8EHnl61QkY=
Expand Down
34 changes: 29 additions & 5 deletions kvbulk_provider_ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,21 @@ func (p *kvBulkProviderPs) Get(ctx context.Context, item *GetOp, tracectx Reques
return
}

var content []byte
switch c := res.Content.(type) {
case *kv_v1.GetResponse_ContentUncompressed:
content = c.ContentUncompressed
case *kv_v1.GetResponse_ContentCompressed:
content = c.ContentCompressed
logWarnf("couchbase2 does not currently support compressed content, passing through compressed value")
}

item.Result = &GetResult{
Result: Result{
cas: Cas(res.Cas),
},
transcoder: transcoder,
contents: res.Content,
contents: content,
flags: res.ContentFlags,
}
signal <- item
Expand Down Expand Up @@ -141,12 +150,21 @@ func (p *kvBulkProviderPs) GetAndTouch(ctx context.Context, item *GetAndTouchOp,
return
}

var content []byte
switch c := res.Content.(type) {
case *kv_v1.GetAndTouchResponse_ContentUncompressed:
content = c.ContentUncompressed
case *kv_v1.GetAndTouchResponse_ContentCompressed:
content = c.ContentCompressed
logWarnf("couchbase2 does not currently support compressed content, passing through compressed value")
}

item.Result = &GetResult{
Result: Result{
cas: Cas(res.Cas),
},
transcoder: transcoder,
contents: res.Content,
contents: content,
flags: res.ContentFlags,
}
signal <- item
Expand Down Expand Up @@ -256,12 +274,14 @@ func (p *kvBulkProviderPs) Upsert(ctx context.Context, item *UpsertOp, tracectx
expiry = &kv_v1.UpsertRequest_ExpirySecs{ExpirySecs: uint32(item.Expiry.Seconds())}
}

content := &kv_v1.UpsertRequest_ContentUncompressed{ContentUncompressed: bytes}

request := &kv_v1.UpsertRequest{
Key: item.ID,
BucketName: c.bucketName(),
ScopeName: c.ScopeName(),
CollectionName: c.name(),
Content: bytes,
Content: content,
ContentFlags: flags,

Expiry: expiry,
Expand Down Expand Up @@ -309,12 +329,14 @@ func (p *kvBulkProviderPs) Insert(ctx context.Context, item *InsertOp, tracectx
expiry = &kv_v1.InsertRequest_ExpirySecs{ExpirySecs: uint32(item.Expiry.Seconds())}
}

content := &kv_v1.InsertRequest_ContentUncompressed{ContentUncompressed: bytes}

request := &kv_v1.InsertRequest{
Key: item.ID,
BucketName: c.bucketName(),
ScopeName: c.ScopeName(),
CollectionName: c.name(),
Content: bytes,
Content: content,
ContentFlags: flags,

Expiry: expiry,
Expand Down Expand Up @@ -367,12 +389,14 @@ func (p *kvBulkProviderPs) Replace(ctx context.Context, item *ReplaceOp, tracect
expiry = &kv_v1.ReplaceRequest_ExpirySecs{ExpirySecs: uint32(item.Expiry.Seconds())}
}

content := &kv_v1.ReplaceRequest_ContentUncompressed{ContentUncompressed: bytes}

request := &kv_v1.ReplaceRequest{
Key: item.ID,
BucketName: c.bucketName(),
ScopeName: c.ScopeName(),
CollectionName: c.name(),
Content: bytes,
Content: content,
ContentFlags: flags,
Cas: cas,

Expand Down
45 changes: 39 additions & 6 deletions kvprovider_ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,15 @@ func (p *kvProviderPs) Insert(c *Collection, id string, val interface{}, opts *I
expiry = &kv_v1.InsertRequest_ExpirySecs{ExpirySecs: uint32(opts.Expiry.Seconds())}
}

content := &kv_v1.InsertRequest_ContentUncompressed{ContentUncompressed: opm.ValueBytes()}

request := &kv_v1.InsertRequest{
BucketName: opm.BucketName(),
ScopeName: opm.ScopeName(),
CollectionName: opm.CollectionName(),

Key: opm.DocumentID(),
Content: opm.ValueBytes(),
Content: content,
ContentFlags: opm.ValueFlags(),

Expiry: expiry,
Expand Down Expand Up @@ -351,12 +353,14 @@ func (p *kvProviderPs) Upsert(c *Collection, id string, val interface{}, opts *U
expiry = &kv_v1.UpsertRequest_ExpirySecs{ExpirySecs: uint32(opts.Expiry.Seconds())}
}

content := &kv_v1.UpsertRequest_ContentUncompressed{ContentUncompressed: opm.ValueBytes()}

request := &kv_v1.UpsertRequest{
Key: opm.DocumentID(),
BucketName: opm.BucketName(),
ScopeName: opm.ScopeName(),
CollectionName: opm.CollectionName(),
Content: opm.ValueBytes(),
Content: content,
ContentFlags: opm.ValueFlags(),

Expiry: expiry,
Expand Down Expand Up @@ -413,9 +417,11 @@ func (p *kvProviderPs) Replace(c *Collection, id string, val interface{}, opts *
expiry = &kv_v1.ReplaceRequest_ExpirySecs{ExpirySecs: uint32(opts.Expiry.Seconds())}
}

content := &kv_v1.ReplaceRequest_ContentUncompressed{ContentUncompressed: opm.ValueBytes()}

request := &kv_v1.ReplaceRequest{
Key: opm.DocumentID(),
Content: opm.ValueBytes(),
Content: content,
ContentFlags: opm.ValueFlags(),

Cas: cas,
Expand Down Expand Up @@ -490,10 +496,19 @@ func (p *kvProviderPs) Get(c *Collection, id string, opts *GetOptions) (*GetResu
return nil, errors.New("response was not expected type, please file a bug")
}

var content []byte
switch c := res.Content.(type) {
case *kv_v1.GetResponse_ContentUncompressed:
content = c.ContentUncompressed
case *kv_v1.GetResponse_ContentCompressed:
content = c.ContentCompressed
logWarnf("couchbase2 does not currently support compressed content, passing through compressed value")
}

resOut := GetResult{
Result: Result{Cas(res.Cas)},

contents: res.Content,
contents: content,
flags: res.ContentFlags,

transcoder: opm.Transcoder(),
Expand Down Expand Up @@ -545,11 +560,20 @@ func (p *kvProviderPs) GetAndTouch(c *Collection, id string, expiry time.Duratio
return nil, errors.New("response was not expected type, please file a bug")
}

var content []byte
switch c := res.Content.(type) {
case *kv_v1.GetAndTouchResponse_ContentUncompressed:
content = c.ContentUncompressed
case *kv_v1.GetAndTouchResponse_ContentCompressed:
content = c.ContentCompressed
logWarnf("couchbase2 does not currently support compressed content, passing through compressed value")
}

resOut := GetResult{
Result: Result{Cas(res.Cas)},
transcoder: opm.Transcoder(),

contents: res.Content,
contents: content,
flags: res.ContentFlags,
}
if res.Expiry != nil {
Expand Down Expand Up @@ -594,11 +618,20 @@ func (p *kvProviderPs) GetAndLock(c *Collection, id string, lockTime time.Durati
return nil, errors.New("response was not expected type, please file a bug")
}

var content []byte
switch c := res.Content.(type) {
case *kv_v1.GetAndLockResponse_ContentUncompressed:
content = c.ContentUncompressed
case *kv_v1.GetAndLockResponse_ContentCompressed:
content = c.ContentCompressed
logWarnf("couchbase2 does not currently support compressed content, passing through compressed value")
}

resOut := GetResult{
Result: Result{Cas(res.Cas)},
transcoder: opm.Transcoder(),

contents: res.Content,
contents: content,
flags: res.ContentFlags,
}
if res.Expiry != nil {
Expand Down

0 comments on commit 8b441b6

Please sign in to comment.