-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Roman Volosatovs <[email protected]>
- Loading branch information
1 parent
ce927ea
commit e8a4994
Showing
27 changed files
with
1,652 additions
and
1,898 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// Generated by `wit-bindgen-wrpc-go` 0.8.0. DO NOT EDIT! | ||
// Generated by `wit-bindgen-wrpc-go` 0.9.1. DO NOT EDIT! | ||
// server package contains wRPC bindings for `server` world | ||
package server |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Generated by `wit-bindgen-wrpc-go` 0.8.0. DO NOT EDIT! | ||
// Generated by `wit-bindgen-wrpc-go` 0.9.1. DO NOT EDIT! | ||
package monotonic_clock | ||
|
||
import ( | ||
|
@@ -10,7 +10,6 @@ import ( | |
wasi__io__poll "github.com/wasmCloud/provider-sdk-go/examples/http-server/bindings/wasi/io/poll" | ||
io "io" | ||
slog "log/slog" | ||
utf8 "unicode/utf8" | ||
wrpc "wrpc.io/go" | ||
) | ||
|
||
|
@@ -44,33 +43,29 @@ func Now(ctx__ context.Context, wrpc__ wrpc.Invoker) (r0__ uint64, err__ error) | |
if cErr__ := w__.Close(); cErr__ != nil { | ||
slog.DebugContext(ctx__, "failed to close outgoing stream", "instance", "wasi:clocks/[email protected]", "name", "now", "err", cErr__) | ||
} | ||
r0__, err__ = func() (Instant, error) { | ||
v, err := func(r io.ByteReader) (uint64, error) { | ||
var x uint64 | ||
var s uint8 | ||
for i := 0; i < 10; i++ { | ||
slog.Debug("reading u64 byte", "i", i) | ||
b, err := r.ReadByte() | ||
if err != nil { | ||
if i > 0 && err == io.EOF { | ||
err = io.ErrUnexpectedEOF | ||
} | ||
return x, fmt.Errorf("failed to read u64 byte: %w", err) | ||
} | ||
if s == 63 && b > 0x01 { | ||
return x, errors.New("varint overflows a 64-bit integer") | ||
} | ||
if b < 0x80 { | ||
return x | uint64(b)<<s, nil | ||
r0__, err__ = func(r io.ByteReader) (uint64, error) { | ||
var x uint64 | ||
var s uint8 | ||
for i := 0; i < 10; i++ { | ||
slog.Debug("reading u64 byte", "i", i) | ||
b, err := r.ReadByte() | ||
if err != nil { | ||
if i > 0 && err == io.EOF { | ||
err = io.ErrUnexpectedEOF | ||
} | ||
x |= uint64(b&0x7f) << s | ||
s += 7 | ||
return x, fmt.Errorf("failed to read u64 byte: %w", err) | ||
} | ||
return x, errors.New("varint overflows a 64-bit integer") | ||
}(r__) | ||
return (Instant)(v), err | ||
}() | ||
|
||
if s == 63 && b > 0x01 { | ||
return x, errors.New("varint overflows a 64-bit integer") | ||
} | ||
if b < 0x80 { | ||
return x | uint64(b)<<s, nil | ||
} | ||
x |= uint64(b&0x7f) << s | ||
s += 7 | ||
} | ||
return x, errors.New("varint overflows a 64-bit integer") | ||
}(r__) | ||
if err__ != nil { | ||
err__ = fmt.Errorf("failed to read result 0: %w", err__) | ||
return | ||
|
@@ -96,33 +91,29 @@ func Resolution(ctx__ context.Context, wrpc__ wrpc.Invoker) (r0__ uint64, err__ | |
if cErr__ := w__.Close(); cErr__ != nil { | ||
slog.DebugContext(ctx__, "failed to close outgoing stream", "instance", "wasi:clocks/[email protected]", "name", "resolution", "err", cErr__) | ||
} | ||
r0__, err__ = func() (Duration, error) { | ||
v, err := func(r io.ByteReader) (uint64, error) { | ||
var x uint64 | ||
var s uint8 | ||
for i := 0; i < 10; i++ { | ||
slog.Debug("reading u64 byte", "i", i) | ||
b, err := r.ReadByte() | ||
if err != nil { | ||
if i > 0 && err == io.EOF { | ||
err = io.ErrUnexpectedEOF | ||
} | ||
return x, fmt.Errorf("failed to read u64 byte: %w", err) | ||
} | ||
if s == 63 && b > 0x01 { | ||
return x, errors.New("varint overflows a 64-bit integer") | ||
} | ||
if b < 0x80 { | ||
return x | uint64(b)<<s, nil | ||
r0__, err__ = func(r io.ByteReader) (uint64, error) { | ||
var x uint64 | ||
var s uint8 | ||
for i := 0; i < 10; i++ { | ||
slog.Debug("reading u64 byte", "i", i) | ||
b, err := r.ReadByte() | ||
if err != nil { | ||
if i > 0 && err == io.EOF { | ||
err = io.ErrUnexpectedEOF | ||
} | ||
x |= uint64(b&0x7f) << s | ||
s += 7 | ||
return x, fmt.Errorf("failed to read u64 byte: %w", err) | ||
} | ||
return x, errors.New("varint overflows a 64-bit integer") | ||
}(r__) | ||
return (Duration)(v), err | ||
}() | ||
|
||
if s == 63 && b > 0x01 { | ||
return x, errors.New("varint overflows a 64-bit integer") | ||
} | ||
if b < 0x80 { | ||
return x | uint64(b)<<s, nil | ||
} | ||
x |= uint64(b&0x7f) << s | ||
s += 7 | ||
} | ||
return x, errors.New("varint overflows a 64-bit integer") | ||
}(r__) | ||
if err__ != nil { | ||
err__ = fmt.Errorf("failed to read result 0: %w", err__) | ||
return | ||
|
@@ -171,34 +162,31 @@ func SubscribeInstant(ctx__ context.Context, wrpc__ wrpc.Invoker, when uint64) ( | |
var x uint32 | ||
var s uint | ||
for i := 0; i < 5; i++ { | ||
slog.Debug("reading owned resource ID length byte", "i", i) | ||
slog.Debug("reading owned resource handle length byte", "i", i) | ||
b, err := r.ReadByte() | ||
if err != nil { | ||
if i > 0 && err == io.EOF { | ||
err = io.ErrUnexpectedEOF | ||
} | ||
return "", fmt.Errorf("failed to read owned resource ID length byte: %w", err) | ||
return nil, fmt.Errorf("failed to read owned resource handle length byte: %w", err) | ||
} | ||
if b < 0x80 { | ||
if i == 4 && b > 1 { | ||
return "", errors.New("owned resource ID length overflows a 32-bit integer") | ||
return nil, errors.New("owned resource handle length overflows a 32-bit integer") | ||
} | ||
x = x | uint32(b)<<s | ||
buf := make([]byte, x) | ||
slog.Debug("reading owned resource ID bytes", "len", x) | ||
slog.Debug("reading owned resource handle bytes", "len", x) | ||
_, err = r.Read(buf) | ||
if err != nil { | ||
return "", fmt.Errorf("failed to read owned resource ID bytes: %w", err) | ||
} | ||
if !utf8.Valid(buf) { | ||
return "", errors.New("owned resource ID is not valid UTF-8") | ||
return nil, fmt.Errorf("failed to read owned resource handle bytes: %w", err) | ||
} | ||
return wrpc.Own[Pollable](buf), nil | ||
} | ||
x |= uint32(b&0x7f) << s | ||
s += 7 | ||
} | ||
return "", errors.New("owned resource ID length overflows a 32-bit integer") | ||
return nil, errors.New("owned resource handle length overflows a 32-bit integer") | ||
}(r__) | ||
if err__ != nil { | ||
err__ = fmt.Errorf("failed to read result 0: %w", err__) | ||
|
@@ -249,34 +237,31 @@ func SubscribeDuration(ctx__ context.Context, wrpc__ wrpc.Invoker, when uint64) | |
var x uint32 | ||
var s uint | ||
for i := 0; i < 5; i++ { | ||
slog.Debug("reading owned resource ID length byte", "i", i) | ||
slog.Debug("reading owned resource handle length byte", "i", i) | ||
b, err := r.ReadByte() | ||
if err != nil { | ||
if i > 0 && err == io.EOF { | ||
err = io.ErrUnexpectedEOF | ||
} | ||
return "", fmt.Errorf("failed to read owned resource ID length byte: %w", err) | ||
return nil, fmt.Errorf("failed to read owned resource handle length byte: %w", err) | ||
} | ||
if b < 0x80 { | ||
if i == 4 && b > 1 { | ||
return "", errors.New("owned resource ID length overflows a 32-bit integer") | ||
return nil, errors.New("owned resource handle length overflows a 32-bit integer") | ||
} | ||
x = x | uint32(b)<<s | ||
buf := make([]byte, x) | ||
slog.Debug("reading owned resource ID bytes", "len", x) | ||
slog.Debug("reading owned resource handle bytes", "len", x) | ||
_, err = r.Read(buf) | ||
if err != nil { | ||
return "", fmt.Errorf("failed to read owned resource ID bytes: %w", err) | ||
} | ||
if !utf8.Valid(buf) { | ||
return "", errors.New("owned resource ID is not valid UTF-8") | ||
return nil, fmt.Errorf("failed to read owned resource handle bytes: %w", err) | ||
} | ||
return wrpc.Own[Pollable](buf), nil | ||
} | ||
x |= uint32(b&0x7f) << s | ||
s += 7 | ||
} | ||
return "", errors.New("owned resource ID length overflows a 32-bit integer") | ||
return nil, errors.New("owned resource handle length overflows a 32-bit integer") | ||
}(r__) | ||
if err__ != nil { | ||
err__ = fmt.Errorf("failed to read result 0: %w", err__) | ||
|
Oops, something went wrong.