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

chore: combine keyvalue provider into couchbase provider #27

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by `wit-bindgen-wrpc-go` 0.9.1. DO NOT EDIT!
// Generated by `wit-bindgen-wrpc-go` 0.11.0. DO NOT EDIT!
package atomics

import (
Expand Down Expand Up @@ -64,6 +64,9 @@ func ServeInterface(s wrpc.Server, h Handler) (stop func() error, err error) {
}
if b < 0x80 {
x = x | uint32(b)<<s
if x == 0 {
return "", nil
}
buf := make([]byte, x)
slog.Debug("reading string bytes", "len", x)
_, err = r.Read(buf)
Expand Down Expand Up @@ -109,6 +112,9 @@ func ServeInterface(s wrpc.Server, h Handler) (stop func() error, err error) {
}
if b < 0x80 {
x = x | uint32(b)<<s
if x == 0 {
return "", nil
}
buf := make([]byte, x)
slog.Debug("reading string bytes", "len", x)
_, err = r.Read(buf)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by `wit-bindgen-wrpc-go` 0.9.1. DO NOT EDIT!
// Generated by `wit-bindgen-wrpc-go` 0.11.0. DO NOT EDIT!
package store

import (
Expand Down Expand Up @@ -434,6 +434,9 @@ func ServeInterface(s wrpc.Server, h Handler) (stop func() error, err error) {
}
if b < 0x80 {
x = x | uint32(b)<<s
if x == 0 {
return "", nil
}
buf := make([]byte, x)
slog.Debug("reading string bytes", "len", x)
_, err = r.Read(buf)
Expand Down Expand Up @@ -479,6 +482,9 @@ func ServeInterface(s wrpc.Server, h Handler) (stop func() error, err error) {
}
if b < 0x80 {
x = x | uint32(b)<<s
if x == 0 {
return "", nil
}
buf := make([]byte, x)
slog.Debug("reading string bytes", "len", x)
_, err = r.Read(buf)
Expand Down Expand Up @@ -700,6 +706,9 @@ func ServeInterface(s wrpc.Server, h Handler) (stop func() error, err error) {
}
if b < 0x80 {
x = x | uint32(b)<<s
if x == 0 {
return "", nil
}
buf := make([]byte, x)
slog.Debug("reading string bytes", "len", x)
_, err = r.Read(buf)
Expand Down Expand Up @@ -745,6 +754,9 @@ func ServeInterface(s wrpc.Server, h Handler) (stop func() error, err error) {
}
if b < 0x80 {
x = x | uint32(b)<<s
if x == 0 {
return "", nil
}
buf := make([]byte, x)
slog.Debug("reading string bytes", "len", x)
_, err = r.Read(buf)
Expand Down Expand Up @@ -785,11 +797,14 @@ func ServeInterface(s wrpc.Server, h Handler) (stop func() error, err error) {
}
return nil, fmt.Errorf("failed to read byte list length byte: %w", err)
}
if s == 28 && b > 0x0f {
return nil, errors.New("byte list length overflows a 32-bit integer")
}
if b < 0x80 {
if i == 4 && b > 1 {
return nil, errors.New("byte list length overflows a 32-bit integer")
}
x = x | uint32(b)<<s
if x == 0 {
return nil, nil
}
buf := make([]byte, x)
slog.Debug("reading byte list contents", "len", x)
_, err = io.ReadFull(r, buf)
Expand Down Expand Up @@ -921,6 +936,9 @@ func ServeInterface(s wrpc.Server, h Handler) (stop func() error, err error) {
}
if b < 0x80 {
x = x | uint32(b)<<s
if x == 0 {
return "", nil
}
buf := make([]byte, x)
slog.Debug("reading string bytes", "len", x)
_, err = r.Read(buf)
Expand Down Expand Up @@ -966,6 +984,9 @@ func ServeInterface(s wrpc.Server, h Handler) (stop func() error, err error) {
}
if b < 0x80 {
x = x | uint32(b)<<s
if x == 0 {
return "", nil
}
buf := make([]byte, x)
slog.Debug("reading string bytes", "len", x)
_, err = r.Read(buf)
Expand Down Expand Up @@ -1100,6 +1121,9 @@ func ServeInterface(s wrpc.Server, h Handler) (stop func() error, err error) {
}
if b < 0x80 {
x = x | uint32(b)<<s
if x == 0 {
return "", nil
}
buf := make([]byte, x)
slog.Debug("reading string bytes", "len", x)
_, err = r.Read(buf)
Expand Down Expand Up @@ -1145,6 +1169,9 @@ func ServeInterface(s wrpc.Server, h Handler) (stop func() error, err error) {
}
if b < 0x80 {
x = x | uint32(b)<<s
if x == 0 {
return "", nil
}
buf := make([]byte, x)
slog.Debug("reading string bytes", "len", x)
_, err = r.Read(buf)
Expand Down Expand Up @@ -1294,6 +1321,9 @@ func ServeInterface(s wrpc.Server, h Handler) (stop func() error, err error) {
}
if b < 0x80 {
x = x | uint32(b)<<s
if x == 0 {
return "", nil
}
buf := make([]byte, x)
slog.Debug("reading string bytes", "len", x)
_, err = r.Read(buf)
Expand Down
24 changes: 21 additions & 3 deletions bindings/interfaces.wrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ package interfaces

import (
exports__wasmcloud__couchbase__document "github.com/couchbase-examples/wasmcloud-provider-couchbase/bindings/exports/wasmcloud/couchbase/document"
exports__wrpc__keyvalue__atomics "github.com/couchbase-examples/wasmcloud-provider-couchbase/bindings/exports/wrpc/keyvalue/atomics"
exports__wrpc__keyvalue__store "github.com/couchbase-examples/wasmcloud-provider-couchbase/bindings/exports/wrpc/keyvalue/store"
wrpc "wrpc.io/go"
)

func Serve(s wrpc.Server, h0 exports__wasmcloud__couchbase__document.Handler) (stop func() error, err error) {
stops := make([]func() error, 0, 1)
func Serve(s wrpc.Server, h0 exports__wrpc__keyvalue__store.Handler, h1 exports__wrpc__keyvalue__atomics.Handler, h2 exports__wasmcloud__couchbase__document.Handler) (stop func() error, err error) {
stops := make([]func() error, 0, 3)
stop = func() error {
for _, stop := range stops {
if err := stop(); err != nil {
Expand All @@ -17,15 +19,31 @@ func Serve(s wrpc.Server, h0 exports__wasmcloud__couchbase__document.Handler) (s
}
return nil
}
stop0, err := exports__wasmcloud__couchbase__document.ServeInterface(s, h0)
stop0, err := exports__wrpc__keyvalue__store.ServeInterface(s, h0)
if err != nil {
return
}
stops = append(stops, stop0)
stop1, err := exports__wrpc__keyvalue__atomics.ServeInterface(s, h1)
if err != nil {
return
}
stops = append(stops, stop1)
stop2, err := exports__wasmcloud__couchbase__document.ServeInterface(s, h2)
if err != nil {
return
}
stops = append(stops, stop2)
stop = func() error {
if err := stop0(); err != nil {
return err
}
if err := stop1(); err != nil {
return err
}
if err := stop2(); err != nil {
return err
}
return nil
}
return
Expand Down
65 changes: 0 additions & 65 deletions examples/wasi-keyvalue/README.md

This file was deleted.

41 changes: 0 additions & 41 deletions examples/wasi-keyvalue/bindings/interfaces.wrpc.go

This file was deleted.

44 changes: 0 additions & 44 deletions examples/wasi-keyvalue/config.go

This file was deleted.

57 changes: 0 additions & 57 deletions examples/wasi-keyvalue/go.mod

This file was deleted.

Loading