diff --git a/.gitattributes b/.gitattributes index 0cb4ce2..a8fcbae 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,3 @@ -docs/** linguist-generated=true src/spin_sdk/wit/** linguist-generated=true src/componentize_py_* linguist-generated=true src/componentize_py_*/** linguist-generated=true diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..24e4fc2 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,40 @@ +name: Build and Deploy Docs + +on: + push: + branches: [main] + tags: ['v*'] + +permissions: + contents: write + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Parse version + id: version + run: | + if [[ "${{ github.ref_type }}" == "tag" ]]; then + # Parse the major version + TAG="${{ github.ref_name }}" + echo "folder=${TAG%%.*}" >> $GITHUB_OUTPUT + else + # Default for pushes to main + echo "folder=canary" >> $GITHUB_OUTPUT + fi + + - name: Generate Documentation + run: | + pip install pdoc3 + ./scripts/generate_docs.py ${{ steps.version.outputs.folder }} + + - name: Deploy to versioned folder + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: docs + target-folder: docs + clean: false diff --git a/.gitignore b/.gitignore index 1f5a17c..904adf6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ __pycache__ src/spin_sdk.egg-info dist venv/ +docs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 02a6e72..008e28e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,13 +24,7 @@ bash regenerate_bindings.sh ### Updating docs -Any time you regenerate the bindings or edit files by hand, you'll want to -regenerate the HTML docs to match. First, install `pdoc` using `pip install -pdoc3`. Then, update the docs using: - -```bash -./scripts/generate_docs.py -``` +Docs are [updated automatically](.github/workflows/docs.yml) on merges to main and tag pushes. ### Building the distribution diff --git a/docs/http/index.html b/docs/http/index.html deleted file mode 100644 index 3f71247..0000000 --- a/docs/http/index.html +++ /dev/null @@ -1,612 +0,0 @@ - - - - - - -spin_sdk.http API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.http

-
-
-

Module with helpers for wasi http

-
- -Expand source code - -
"""Module with helpers for wasi http"""
-
-import traceback
-
-from spin_sdk.wit import exports
-from spin_sdk.wit.types import Ok, Err
-from spin_sdk.wit.imports import types, outgoing_handler
-from spin_sdk.wit.imports.types import (
-    Method, MethodGet, MethodHead, MethodPost, MethodPut, MethodDelete, MethodConnect, MethodOptions, MethodTrace,
-    MethodPatch, MethodOther, IncomingRequest, IncomingBody, ResponseOutparam, OutgoingResponse, Fields, Scheme,
-    SchemeHttp, SchemeHttps, SchemeOther, OutgoingRequest, OutgoingBody
-)
-from spin_sdk.wit.imports.streams import StreamErrorClosed
-from dataclasses import dataclass
-from collections.abc import Mapping
-from typing import Optional
-from urllib import parse
-
-@dataclass
-class Request:
-    """An HTTP request"""
-    method: str
-    uri: str
-    headers: Mapping[str, str]
-    body: Optional[bytes]
-
-@dataclass
-class Response:
-    """An HTTP response"""
-    status: int
-    headers: Mapping[str, str]
-    body: Optional[bytes]
-
-class IncomingHandler(exports.IncomingHandler):
-    """Simplified handler for incoming HTTP requests using blocking, buffered I/O."""
-    
-    def handle_request(self, request: Request) -> Response:
-        """Handle an incoming HTTP request and return a response or raise an error"""
-        raise NotImplementedError
-    
-    def handle(self, request: IncomingRequest, response_out: ResponseOutparam):
-        method = request.method()
-
-        if isinstance(method, MethodGet):
-            method_str = "GET"
-        elif isinstance(method, MethodHead):
-            method_str = "HEAD"
-        elif isinstance(method, MethodPost):
-            method_str = "POST"
-        elif isinstance(method, MethodPut):
-            method_str = "PUT"
-        elif isinstance(method, MethodDelete):
-            method_str = "DELETE"
-        elif isinstance(method, MethodConnect):
-            method_str = "CONNECT"
-        elif isinstance(method, MethodOptions):
-            method_str = "OPTIONS"
-        elif isinstance(method, MethodTrace):
-            method_str = "TRACE"
-        elif isinstance(method, MethodPatch):
-            method_str = "PATCH"
-        elif isinstance(method, MethodOther):
-            method_str = method.value
-        else:
-            raise AssertionError
-
-        request_body = request.consume()
-        request_stream = request_body.stream()
-        body = bytearray()
-        while True:
-            try:
-                body += request_stream.blocking_read(16 * 1024)
-            except Err as e:
-                if isinstance(e.value, StreamErrorClosed):
-                    request_stream.__exit__()
-                    IncomingBody.finish(request_body)
-                    break
-                else:
-                    raise e
-
-        request_uri = request.path_with_query()
-        if request_uri is None:
-            uri = "/"
-        else:
-            uri = request_uri
-
-        try:
-            simple_response = self.handle_request(Request(
-                method_str,
-                uri,
-                dict(map(lambda pair: (pair[0], str(pair[1], "utf-8")), request.headers().entries())),
-                bytes(body)
-            ))
-        except:
-            traceback.print_exc()
-
-            response = OutgoingResponse(Fields())
-            response.set_status_code(500)
-            ResponseOutparam.set(response_out, Ok(response))
-            return
-
-        response = OutgoingResponse(Fields.from_list(list(map(
-            lambda pair: (pair[0], bytes(pair[1], "utf-8")),
-            simple_response.headers.items()
-        ))))
-        response_body = response.body()
-        response.set_status_code(simple_response.status)
-        ResponseOutparam.set(response_out, Ok(response))
-        response_stream = response_body.write()
-        if simple_response.body is not None:
-            MAX_BLOCKING_WRITE_SIZE = 4096
-            offset = 0
-            while offset < len(simple_response.body):
-                count = min(len(simple_response.body) - offset, MAX_BLOCKING_WRITE_SIZE)
-                response_stream.blocking_write_and_flush(simple_response.body[offset:offset+count])
-                offset += count
-        response_stream.__exit__()
-        OutgoingBody.finish(response_body, None)
-    
-def send(request: Request) -> Response:
-    """Send an HTTP request and return a response or raise an error"""
-
-    match request.method:
-        case "GET":
-            method: Method = MethodGet()
-        case "HEAD":
-            method = MethodHead()
-        case "POST":
-            method = MethodPost()
-        case "PUT":
-            method = MethodPut()
-        case "DELETE":
-            method = MethodDelete()
-        case "CONNECT":
-            method = MethodConnect()
-        case "OPTIONS":
-            method = MethodOptions()
-        case "TRACE":
-            method = MethodTrace()
-        case "PATCH":
-            method = MethodPatch()
-        case _:
-            method = MethodOther(request.method)
-    
-    url_parsed = parse.urlparse(request.uri)
-
-    match url_parsed.scheme:
-        case "http":
-            scheme: Scheme = SchemeHttp()
-        case "https":
-            scheme = SchemeHttps()
-        case _:
-            scheme = SchemeOther(url_parsed.scheme)
-
-    outgoing_request = OutgoingRequest(Fields.from_list(list(map(
-        lambda pair: (pair[0], bytes(pair[1], "utf-8")),
-        request.headers.items()
-    ))))
-    outgoing_request.set_method(method)
-    outgoing_request.set_scheme(scheme)
-    outgoing_request.set_authority(url_parsed.netloc)
-    outgoing_request.set_path_with_query(url_parsed.path)
-
-    if request.body is not None:
-        raise NotImplementedError("todo: handle outgoing request bodies")
-
-    future = outgoing_handler.handle(outgoing_request, None)
-    pollable = future.subscribe()
-
-    while True:
-        response = future.get()
-        if response is None:
-            pollable.block()
-        else:
-            pollable.__exit__()
-            future.__exit__()
-            
-            if isinstance(response, Ok):
-                if isinstance(response.value, Ok):
-                    response_value = response.value.value
-                    response_body = response_value.consume()
-                    response_stream = response_body.stream()
-                    body = bytearray()
-                    while True:
-                        try:
-                            body += response_stream.blocking_read(16 * 1024)
-                        except Err as e:
-                            if isinstance(e.value, StreamErrorClosed):
-                                response_stream.__exit__()
-                                IncomingBody.finish(response_body)
-                                simple_response = Response(
-                                    response_value.status(),
-                                    dict(map(
-                                        lambda pair: (pair[0], str(pair[1], "utf-8")),
-                                        response_value.headers().entries()
-                                    )),
-                                    bytes(body)
-                                )
-                                response_value.__exit__()
-                                return simple_response
-                            else:
-                                raise e
-                else:
-                    raise response.value
-            else:
-                raise response
-
-
-
-

Sub-modules

-
-
spin_sdk.http.poll_loop
-
-

Defines a custom asyncio event loop backed by wasi:io/poll#poll

-
-
-
-
-
-
-

Functions

-
-
-def send(request: Request) ‑> Response -
-
-

Send an HTTP request and return a response or raise an error

-
- -Expand source code - -
def send(request: Request) -> Response:
-    """Send an HTTP request and return a response or raise an error"""
-
-    match request.method:
-        case "GET":
-            method: Method = MethodGet()
-        case "HEAD":
-            method = MethodHead()
-        case "POST":
-            method = MethodPost()
-        case "PUT":
-            method = MethodPut()
-        case "DELETE":
-            method = MethodDelete()
-        case "CONNECT":
-            method = MethodConnect()
-        case "OPTIONS":
-            method = MethodOptions()
-        case "TRACE":
-            method = MethodTrace()
-        case "PATCH":
-            method = MethodPatch()
-        case _:
-            method = MethodOther(request.method)
-    
-    url_parsed = parse.urlparse(request.uri)
-
-    match url_parsed.scheme:
-        case "http":
-            scheme: Scheme = SchemeHttp()
-        case "https":
-            scheme = SchemeHttps()
-        case _:
-            scheme = SchemeOther(url_parsed.scheme)
-
-    outgoing_request = OutgoingRequest(Fields.from_list(list(map(
-        lambda pair: (pair[0], bytes(pair[1], "utf-8")),
-        request.headers.items()
-    ))))
-    outgoing_request.set_method(method)
-    outgoing_request.set_scheme(scheme)
-    outgoing_request.set_authority(url_parsed.netloc)
-    outgoing_request.set_path_with_query(url_parsed.path)
-
-    if request.body is not None:
-        raise NotImplementedError("todo: handle outgoing request bodies")
-
-    future = outgoing_handler.handle(outgoing_request, None)
-    pollable = future.subscribe()
-
-    while True:
-        response = future.get()
-        if response is None:
-            pollable.block()
-        else:
-            pollable.__exit__()
-            future.__exit__()
-            
-            if isinstance(response, Ok):
-                if isinstance(response.value, Ok):
-                    response_value = response.value.value
-                    response_body = response_value.consume()
-                    response_stream = response_body.stream()
-                    body = bytearray()
-                    while True:
-                        try:
-                            body += response_stream.blocking_read(16 * 1024)
-                        except Err as e:
-                            if isinstance(e.value, StreamErrorClosed):
-                                response_stream.__exit__()
-                                IncomingBody.finish(response_body)
-                                simple_response = Response(
-                                    response_value.status(),
-                                    dict(map(
-                                        lambda pair: (pair[0], str(pair[1], "utf-8")),
-                                        response_value.headers().entries()
-                                    )),
-                                    bytes(body)
-                                )
-                                response_value.__exit__()
-                                return simple_response
-                            else:
-                                raise e
-                else:
-                    raise response.value
-            else:
-                raise response
-
-
-
-
-
-

Classes

-
-
-class IncomingHandler -(*args, **kwargs) -
-
-

Simplified handler for incoming HTTP requests using blocking, buffered I/O.

-
- -Expand source code - -
class IncomingHandler(exports.IncomingHandler):
-    """Simplified handler for incoming HTTP requests using blocking, buffered I/O."""
-    
-    def handle_request(self, request: Request) -> Response:
-        """Handle an incoming HTTP request and return a response or raise an error"""
-        raise NotImplementedError
-    
-    def handle(self, request: IncomingRequest, response_out: ResponseOutparam):
-        method = request.method()
-
-        if isinstance(method, MethodGet):
-            method_str = "GET"
-        elif isinstance(method, MethodHead):
-            method_str = "HEAD"
-        elif isinstance(method, MethodPost):
-            method_str = "POST"
-        elif isinstance(method, MethodPut):
-            method_str = "PUT"
-        elif isinstance(method, MethodDelete):
-            method_str = "DELETE"
-        elif isinstance(method, MethodConnect):
-            method_str = "CONNECT"
-        elif isinstance(method, MethodOptions):
-            method_str = "OPTIONS"
-        elif isinstance(method, MethodTrace):
-            method_str = "TRACE"
-        elif isinstance(method, MethodPatch):
-            method_str = "PATCH"
-        elif isinstance(method, MethodOther):
-            method_str = method.value
-        else:
-            raise AssertionError
-
-        request_body = request.consume()
-        request_stream = request_body.stream()
-        body = bytearray()
-        while True:
-            try:
-                body += request_stream.blocking_read(16 * 1024)
-            except Err as e:
-                if isinstance(e.value, StreamErrorClosed):
-                    request_stream.__exit__()
-                    IncomingBody.finish(request_body)
-                    break
-                else:
-                    raise e
-
-        request_uri = request.path_with_query()
-        if request_uri is None:
-            uri = "/"
-        else:
-            uri = request_uri
-
-        try:
-            simple_response = self.handle_request(Request(
-                method_str,
-                uri,
-                dict(map(lambda pair: (pair[0], str(pair[1], "utf-8")), request.headers().entries())),
-                bytes(body)
-            ))
-        except:
-            traceback.print_exc()
-
-            response = OutgoingResponse(Fields())
-            response.set_status_code(500)
-            ResponseOutparam.set(response_out, Ok(response))
-            return
-
-        response = OutgoingResponse(Fields.from_list(list(map(
-            lambda pair: (pair[0], bytes(pair[1], "utf-8")),
-            simple_response.headers.items()
-        ))))
-        response_body = response.body()
-        response.set_status_code(simple_response.status)
-        ResponseOutparam.set(response_out, Ok(response))
-        response_stream = response_body.write()
-        if simple_response.body is not None:
-            MAX_BLOCKING_WRITE_SIZE = 4096
-            offset = 0
-            while offset < len(simple_response.body):
-                count = min(len(simple_response.body) - offset, MAX_BLOCKING_WRITE_SIZE)
-                response_stream.blocking_write_and_flush(simple_response.body[offset:offset+count])
-                offset += count
-        response_stream.__exit__()
-        OutgoingBody.finish(response_body, None)
-
-

Ancestors

- -

Methods

-
-
-def handle_request(self, request: Request) ‑> Response -
-
-

Handle an incoming HTTP request and return a response or raise an error

-
- -Expand source code - -
def handle_request(self, request: Request) -> Response:
-    """Handle an incoming HTTP request and return a response or raise an error"""
-    raise NotImplementedError
-
-
-
-

Inherited members

- -
-
-class Request -(method: str, uri: str, headers: collections.abc.Mapping[str, str], body: Optional[bytes]) -
-
-

An HTTP request

-
- -Expand source code - -
@dataclass
-class Request:
-    """An HTTP request"""
-    method: str
-    uri: str
-    headers: Mapping[str, str]
-    body: Optional[bytes]
-
-

Class variables

-
-
var body : Optional[bytes]
-
-
-
-
var headers : collections.abc.Mapping[str, str]
-
-
-
-
var method : str
-
-
-
-
var uri : str
-
-
-
-
-
-
-class Response -(status: int, headers: collections.abc.Mapping[str, str], body: Optional[bytes]) -
-
-

An HTTP response

-
- -Expand source code - -
@dataclass
-class Response:
-    """An HTTP response"""
-    status: int
-    headers: Mapping[str, str]
-    body: Optional[bytes]
-
-

Class variables

-
-
var body : Optional[bytes]
-
-
-
-
var headers : collections.abc.Mapping[str, str]
-
-
-
-
var status : int
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/http/poll_loop.html b/docs/http/poll_loop.html deleted file mode 100644 index 64a28f2..0000000 --- a/docs/http/poll_loop.html +++ /dev/null @@ -1,1899 +0,0 @@ - - - - - - -spin_sdk.http.poll_loop API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.http.poll_loop

-
-
-

Defines a custom asyncio event loop backed by wasi:io/poll#poll.

-

This also includes helper classes and functions for working with wasi:http.

-

As of WASI Preview 2, there is not yet a standard for first-class, composable -asynchronous functions and streams. -We expect that little or none of this -boilerplate will be needed once those features arrive in Preview 3.

-
- -Expand source code - -
"""Defines a custom `asyncio` event loop backed by `wasi:io/poll#poll`.
-
-This also includes helper classes and functions for working with `wasi:http`.
-
-As of WASI Preview 2, there is not yet a standard for first-class, composable
-asynchronous functions and streams.  We expect that little or none of this
-boilerplate will be needed once those features arrive in Preview 3.
-"""
-
-import asyncio
-import socket
-import subprocess
-
-from spin_sdk.wit.types import Ok, Err
-from spin_sdk.wit.imports import types, streams, poll, outgoing_handler
-from spin_sdk.wit.imports.types import IncomingBody, OutgoingBody, OutgoingRequest, IncomingResponse
-from spin_sdk.wit.imports.streams import StreamErrorClosed, InputStream
-from spin_sdk.wit.imports.poll import Pollable
-from typing import Optional, cast
-
-# Maximum number of bytes to read at a time
-READ_SIZE: int = 16 * 1024
-
-async def send(request: OutgoingRequest) -> IncomingResponse:
-    """Send the specified request and wait asynchronously for the response."""
-    
-    future = outgoing_handler.handle(request, None)
-
-    while True:
-        response = future.get()
-        if response is None:
-            await register(cast(PollLoop, asyncio.get_event_loop()), future.subscribe())
-        else:
-            future.__exit__()
-            
-            if isinstance(response, Ok):
-                if isinstance(response.value, Ok):
-                    return response.value.value
-                else:
-                    raise response.value
-            else:
-                raise response
-
-class Stream:
-    """Reader abstraction over `wasi:http/types#incoming-body`."""
-    def __init__(self, body: IncomingBody):
-        self.body: Optional[IncomingBody] = body
-        self.stream: Optional[InputStream] = body.stream()
-
-    async def next(self) -> Optional[bytes]:
-        """Wait for the next chunk of data to arrive on the stream.
-
-        This will return `None` when the end of the stream has been reached.
-        """
-        while True:
-            try:
-                if self.stream is None:
-                    return None
-                else:
-                    buffer = self.stream.read(READ_SIZE)
-                    if len(buffer) == 0:
-                        await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-                    else:
-                        return buffer
-            except Err as e:
-                if isinstance(e.value, StreamErrorClosed):
-                    if self.stream is not None:
-                        self.stream.__exit__()
-                        self.stream = None
-                    if self.body is not None:
-                        IncomingBody.finish(self.body)
-                        self.body = None
-                else:
-                    raise e
-
-class Sink:
-    """Writer abstraction over `wasi-http/types#outgoing-body`."""
-    def __init__(self, body: OutgoingBody):
-        self.body = body
-        self.stream = body.write()
-
-    async def send(self, chunk: bytes):
-        """Write the specified bytes to the sink.
-
-        This may need to yield according to the backpressure requirements of the sink.
-        """
-        offset = 0
-        flushing = False
-        while True:
-            count = self.stream.check_write()
-            if count == 0:
-                await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-            elif offset == len(chunk):
-                if flushing:
-                    return
-                else:
-                    self.stream.flush()
-                    flushing = True
-            else:
-                count = min(count, len(chunk) - offset)
-                self.stream.write(chunk[offset:offset+count])
-                offset += count
-
-    def close(self):
-        """Close the stream, indicating no further data will be written."""
-
-        self.stream.__exit__()
-        self.stream = None
-        OutgoingBody.finish(self.body, None)
-        self.body = None
-        
-class PollLoop(asyncio.AbstractEventLoop):
-    """Custom `asyncio` event loop backed by `wasi:io/poll#poll`."""
-    
-    def __init__(self):
-        self.wakers = []
-        self.running = False
-        self.handles = []
-        self.exception = None
-
-    def get_debug(self):
-        return False
-
-    def run_until_complete(self, future):
-        future = asyncio.ensure_future(future, loop=self)
-
-        self.running = True
-        asyncio.events._set_running_loop(self)
-        while self.running and not future.done():
-            handle = self.handles[0]
-            self.handles = self.handles[1:]
-            if not handle._cancelled:
-                handle._run()
-                
-            if self.wakers:
-                [pollables, wakers] = list(map(list, zip(*self.wakers)))
-                
-                new_wakers = []
-                ready = [False] * len(pollables)
-                for index in poll.poll(pollables):
-                    ready[index] = True
-                
-                for (ready, pollable), waker in zip(zip(ready, pollables), wakers):
-                    if ready:
-                        pollable.__exit__()
-                        waker.set_result(None)
-                    else:
-                        new_wakers.append((pollable, waker))
-
-                self.wakers = new_wakers
-
-            if self.exception is not None:
-                raise self.exception
-            
-        future.result()
-
-    def is_running(self):
-        return self.running
-
-    def is_closed(self):
-        return not self.running
-
-    def stop(self):
-        self.running = False
-
-    def close(self):
-        self.running = False
-
-    def shutdown_asyncgens(self):
-        pass
-
-    def call_exception_handler(self, context):
-        self.exception = context.get('exception', None)
-
-    def call_soon(self, callback, *args, context=None):
-        handle = asyncio.Handle(callback, args, self, context)
-        self.handles.append(handle)
-        return handle
-
-    def create_task(self, coroutine):
-        return asyncio.Task(coroutine, loop=self)
-
-    def create_future(self):
-        return asyncio.Future(loop=self)
-
-    # The remaining methods should be irrelevant for our purposes and thus unimplemented
-
-    def run_forever(self):
-        raise NotImplementedError
-
-    async def shutdown_default_executor(self):
-        raise NotImplementedError
-
-    def _timer_handle_cancelled(self, handle):
-        raise NotImplementedError
-
-    def call_later(self, delay, callback, *args, context=None):
-        raise NotImplementedError
-
-    def call_at(self, when, callback, *args, context=None):
-        raise NotImplementedError
-
-    def time(self):
-        raise NotImplementedError
-
-    def call_soon_threadsafe(self, callback, *args, context=None):
-        raise NotImplementedError
-
-    def run_in_executor(self, executor, func, *args):
-        raise NotImplementedError
-
-    def set_default_executor(self, executor):
-        raise NotImplementedError
-
-    async def getaddrinfo(self, host, port, *,
-                          family=0, type=0, proto=0, flags=0):
-        raise NotImplementedError
-
-    async def getnameinfo(self, sockaddr, flags=0):
-        raise NotImplementedError
-
-    async def create_connection(
-            self, protocol_factory, host=None, port=None,
-            *, ssl=None, family=0, proto=0,
-            flags=0, sock=None, local_addr=None,
-            server_hostname=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            happy_eyeballs_delay=None, interleave=None):
-        raise NotImplementedError
-
-    async def create_server(
-            self, protocol_factory, host=None, port=None,
-            *, family=socket.AF_UNSPEC,
-            flags=socket.AI_PASSIVE, sock=None, backlog=100,
-            ssl=None, reuse_address=None, reuse_port=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            start_serving=True):
-        raise NotImplementedError
-
-    async def sendfile(self, transport, file, offset=0, count=None,
-                       *, fallback=True):
-        raise NotImplementedError
-
-    async def start_tls(self, transport, protocol, sslcontext, *,
-                        server_side=False,
-                        server_hostname=None,
-                        ssl_handshake_timeout=None,
-                        ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_unix_connection(
-            self, protocol_factory, path=None, *,
-            ssl=None, sock=None,
-            server_hostname=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_unix_server(
-            self, protocol_factory, path=None, *,
-            sock=None, backlog=100, ssl=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            start_serving=True):
-        raise NotImplementedError
-
-    async def connect_accepted_socket(
-            self, protocol_factory, sock,
-            *, ssl=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_datagram_endpoint(self, protocol_factory,
-                                       local_addr=None, remote_addr=None, *,
-                                       family=0, proto=0, flags=0,
-                                       reuse_address=None, reuse_port=None,
-                                       allow_broadcast=None, sock=None):
-        raise NotImplementedError
-
-    async def connect_read_pipe(self, protocol_factory, pipe):
-        raise NotImplementedError
-
-    async def connect_write_pipe(self, protocol_factory, pipe):
-        raise NotImplementedError
-
-    async def subprocess_shell(self, protocol_factory, cmd, *,
-                               stdin=subprocess.PIPE,
-                               stdout=subprocess.PIPE,
-                               stderr=subprocess.PIPE,
-                               **kwargs):
-        raise NotImplementedError
-
-    async def subprocess_exec(self, protocol_factory, *args,
-                              stdin=subprocess.PIPE,
-                              stdout=subprocess.PIPE,
-                              stderr=subprocess.PIPE,
-                              **kwargs):
-        raise NotImplementedError
-
-    def add_reader(self, fd, callback, *args):
-        raise NotImplementedError
-
-    def remove_reader(self, fd):
-        raise NotImplementedError
-
-    def add_writer(self, fd, callback, *args):
-        raise NotImplementedError
-
-    def remove_writer(self, fd):
-        raise NotImplementedError
-
-    async def sock_recv(self, sock, nbytes):
-        raise NotImplementedError
-
-    async def sock_recv_into(self, sock, buf):
-        raise NotImplementedError
-
-    async def sock_recvfrom(self, sock, bufsize):
-        raise NotImplementedError
-
-    async def sock_recvfrom_into(self, sock, buf, nbytes=0):
-        raise NotImplementedError
-
-    async def sock_sendall(self, sock, data):
-        raise NotImplementedError
-
-    async def sock_sendto(self, sock, data, address):
-        raise NotImplementedError
-
-    async def sock_connect(self, sock, address):
-        raise NotImplementedError
-
-    async def sock_accept(self, sock):
-        raise NotImplementedError
-
-    async def sock_sendfile(self, sock, file, offset=0, count=None,
-                            *, fallback=None):
-        raise NotImplementedError
-
-    def add_signal_handler(self, sig, callback, *args):
-        raise NotImplementedError
-
-    def remove_signal_handler(self, sig):
-        raise NotImplementedError
-
-    def set_task_factory(self, factory):
-        raise NotImplementedError
-
-    def get_task_factory(self):
-        raise NotImplementedError
-
-    def get_exception_handler(self):
-        raise NotImplementedError
-
-    def set_exception_handler(self, handler):
-        raise NotImplementedError
-
-    def default_exception_handler(self, context):
-        raise NotImplementedError
-
-    def set_debug(self, enabled):
-        raise NotImplementedError
-
-async def register(loop: PollLoop, pollable: Pollable):
-    waker = loop.create_future()
-    loop.wakers.append((pollable, waker))
-    await waker
-
-
-
-
-
-
-
-

Functions

-
-
-async def register(loop: PollLoop, pollable: Pollable) -
-
-
-
- -Expand source code - -
async def register(loop: PollLoop, pollable: Pollable):
-    waker = loop.create_future()
-    loop.wakers.append((pollable, waker))
-    await waker
-
-
-
-async def send(request: OutgoingRequest) ‑> IncomingResponse -
-
-

Send the specified request and wait asynchronously for the response.

-
- -Expand source code - -
async def send(request: OutgoingRequest) -> IncomingResponse:
-    """Send the specified request and wait asynchronously for the response."""
-    
-    future = outgoing_handler.handle(request, None)
-
-    while True:
-        response = future.get()
-        if response is None:
-            await register(cast(PollLoop, asyncio.get_event_loop()), future.subscribe())
-        else:
-            future.__exit__()
-            
-            if isinstance(response, Ok):
-                if isinstance(response.value, Ok):
-                    return response.value.value
-                else:
-                    raise response.value
-            else:
-                raise response
-
-
-
-
-
-

Classes

-
-
-class PollLoop -
-
-

Custom asyncio event loop backed by wasi:io/poll#poll.

-
- -Expand source code - -
class PollLoop(asyncio.AbstractEventLoop):
-    """Custom `asyncio` event loop backed by `wasi:io/poll#poll`."""
-    
-    def __init__(self):
-        self.wakers = []
-        self.running = False
-        self.handles = []
-        self.exception = None
-
-    def get_debug(self):
-        return False
-
-    def run_until_complete(self, future):
-        future = asyncio.ensure_future(future, loop=self)
-
-        self.running = True
-        asyncio.events._set_running_loop(self)
-        while self.running and not future.done():
-            handle = self.handles[0]
-            self.handles = self.handles[1:]
-            if not handle._cancelled:
-                handle._run()
-                
-            if self.wakers:
-                [pollables, wakers] = list(map(list, zip(*self.wakers)))
-                
-                new_wakers = []
-                ready = [False] * len(pollables)
-                for index in poll.poll(pollables):
-                    ready[index] = True
-                
-                for (ready, pollable), waker in zip(zip(ready, pollables), wakers):
-                    if ready:
-                        pollable.__exit__()
-                        waker.set_result(None)
-                    else:
-                        new_wakers.append((pollable, waker))
-
-                self.wakers = new_wakers
-
-            if self.exception is not None:
-                raise self.exception
-            
-        future.result()
-
-    def is_running(self):
-        return self.running
-
-    def is_closed(self):
-        return not self.running
-
-    def stop(self):
-        self.running = False
-
-    def close(self):
-        self.running = False
-
-    def shutdown_asyncgens(self):
-        pass
-
-    def call_exception_handler(self, context):
-        self.exception = context.get('exception', None)
-
-    def call_soon(self, callback, *args, context=None):
-        handle = asyncio.Handle(callback, args, self, context)
-        self.handles.append(handle)
-        return handle
-
-    def create_task(self, coroutine):
-        return asyncio.Task(coroutine, loop=self)
-
-    def create_future(self):
-        return asyncio.Future(loop=self)
-
-    # The remaining methods should be irrelevant for our purposes and thus unimplemented
-
-    def run_forever(self):
-        raise NotImplementedError
-
-    async def shutdown_default_executor(self):
-        raise NotImplementedError
-
-    def _timer_handle_cancelled(self, handle):
-        raise NotImplementedError
-
-    def call_later(self, delay, callback, *args, context=None):
-        raise NotImplementedError
-
-    def call_at(self, when, callback, *args, context=None):
-        raise NotImplementedError
-
-    def time(self):
-        raise NotImplementedError
-
-    def call_soon_threadsafe(self, callback, *args, context=None):
-        raise NotImplementedError
-
-    def run_in_executor(self, executor, func, *args):
-        raise NotImplementedError
-
-    def set_default_executor(self, executor):
-        raise NotImplementedError
-
-    async def getaddrinfo(self, host, port, *,
-                          family=0, type=0, proto=0, flags=0):
-        raise NotImplementedError
-
-    async def getnameinfo(self, sockaddr, flags=0):
-        raise NotImplementedError
-
-    async def create_connection(
-            self, protocol_factory, host=None, port=None,
-            *, ssl=None, family=0, proto=0,
-            flags=0, sock=None, local_addr=None,
-            server_hostname=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            happy_eyeballs_delay=None, interleave=None):
-        raise NotImplementedError
-
-    async def create_server(
-            self, protocol_factory, host=None, port=None,
-            *, family=socket.AF_UNSPEC,
-            flags=socket.AI_PASSIVE, sock=None, backlog=100,
-            ssl=None, reuse_address=None, reuse_port=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            start_serving=True):
-        raise NotImplementedError
-
-    async def sendfile(self, transport, file, offset=0, count=None,
-                       *, fallback=True):
-        raise NotImplementedError
-
-    async def start_tls(self, transport, protocol, sslcontext, *,
-                        server_side=False,
-                        server_hostname=None,
-                        ssl_handshake_timeout=None,
-                        ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_unix_connection(
-            self, protocol_factory, path=None, *,
-            ssl=None, sock=None,
-            server_hostname=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_unix_server(
-            self, protocol_factory, path=None, *,
-            sock=None, backlog=100, ssl=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            start_serving=True):
-        raise NotImplementedError
-
-    async def connect_accepted_socket(
-            self, protocol_factory, sock,
-            *, ssl=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_datagram_endpoint(self, protocol_factory,
-                                       local_addr=None, remote_addr=None, *,
-                                       family=0, proto=0, flags=0,
-                                       reuse_address=None, reuse_port=None,
-                                       allow_broadcast=None, sock=None):
-        raise NotImplementedError
-
-    async def connect_read_pipe(self, protocol_factory, pipe):
-        raise NotImplementedError
-
-    async def connect_write_pipe(self, protocol_factory, pipe):
-        raise NotImplementedError
-
-    async def subprocess_shell(self, protocol_factory, cmd, *,
-                               stdin=subprocess.PIPE,
-                               stdout=subprocess.PIPE,
-                               stderr=subprocess.PIPE,
-                               **kwargs):
-        raise NotImplementedError
-
-    async def subprocess_exec(self, protocol_factory, *args,
-                              stdin=subprocess.PIPE,
-                              stdout=subprocess.PIPE,
-                              stderr=subprocess.PIPE,
-                              **kwargs):
-        raise NotImplementedError
-
-    def add_reader(self, fd, callback, *args):
-        raise NotImplementedError
-
-    def remove_reader(self, fd):
-        raise NotImplementedError
-
-    def add_writer(self, fd, callback, *args):
-        raise NotImplementedError
-
-    def remove_writer(self, fd):
-        raise NotImplementedError
-
-    async def sock_recv(self, sock, nbytes):
-        raise NotImplementedError
-
-    async def sock_recv_into(self, sock, buf):
-        raise NotImplementedError
-
-    async def sock_recvfrom(self, sock, bufsize):
-        raise NotImplementedError
-
-    async def sock_recvfrom_into(self, sock, buf, nbytes=0):
-        raise NotImplementedError
-
-    async def sock_sendall(self, sock, data):
-        raise NotImplementedError
-
-    async def sock_sendto(self, sock, data, address):
-        raise NotImplementedError
-
-    async def sock_connect(self, sock, address):
-        raise NotImplementedError
-
-    async def sock_accept(self, sock):
-        raise NotImplementedError
-
-    async def sock_sendfile(self, sock, file, offset=0, count=None,
-                            *, fallback=None):
-        raise NotImplementedError
-
-    def add_signal_handler(self, sig, callback, *args):
-        raise NotImplementedError
-
-    def remove_signal_handler(self, sig):
-        raise NotImplementedError
-
-    def set_task_factory(self, factory):
-        raise NotImplementedError
-
-    def get_task_factory(self):
-        raise NotImplementedError
-
-    def get_exception_handler(self):
-        raise NotImplementedError
-
-    def set_exception_handler(self, handler):
-        raise NotImplementedError
-
-    def default_exception_handler(self, context):
-        raise NotImplementedError
-
-    def set_debug(self, enabled):
-        raise NotImplementedError
-
-

Ancestors

-
    -
  • asyncio.events.AbstractEventLoop
  • -
-

Methods

-
-
-def add_reader(self, fd, callback, *args) -
-
-
-
- -Expand source code - -
def add_reader(self, fd, callback, *args):
-    raise NotImplementedError
-
-
-
-def add_signal_handler(self, sig, callback, *args) -
-
-
-
- -Expand source code - -
def add_signal_handler(self, sig, callback, *args):
-    raise NotImplementedError
-
-
-
-def add_writer(self, fd, callback, *args) -
-
-
-
- -Expand source code - -
def add_writer(self, fd, callback, *args):
-    raise NotImplementedError
-
-
-
-def call_at(self, when, callback, *args, context=None) -
-
-
-
- -Expand source code - -
def call_at(self, when, callback, *args, context=None):
-    raise NotImplementedError
-
-
-
-def call_exception_handler(self, context) -
-
-
-
- -Expand source code - -
def call_exception_handler(self, context):
-    self.exception = context.get('exception', None)
-
-
-
-def call_later(self, delay, callback, *args, context=None) -
-
-
-
- -Expand source code - -
def call_later(self, delay, callback, *args, context=None):
-    raise NotImplementedError
-
-
-
-def call_soon(self, callback, *args, context=None) -
-
-
-
- -Expand source code - -
def call_soon(self, callback, *args, context=None):
-    handle = asyncio.Handle(callback, args, self, context)
-    self.handles.append(handle)
-    return handle
-
-
-
-def call_soon_threadsafe(self, callback, *args, context=None) -
-
-
-
- -Expand source code - -
def call_soon_threadsafe(self, callback, *args, context=None):
-    raise NotImplementedError
-
-
-
-def close(self) -
-
-

Close the loop.

-

The loop should not be running.

-

This is idempotent and irreversible.

-

No other methods should be called after this one.

-
- -Expand source code - -
def close(self):
-    self.running = False
-
-
-
-async def connect_accepted_socket(self, protocol_factory, sock, *, ssl=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None) -
-
-

Handle an accepted connection.

-

This is used by servers that accept connections outside of -asyncio, but use asyncio to handle connections.

-

This method is a coroutine. -When completed, the coroutine -returns a (transport, protocol) pair.

-
- -Expand source code - -
async def connect_accepted_socket(
-        self, protocol_factory, sock,
-        *, ssl=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None):
-    raise NotImplementedError
-
-
-
-async def connect_read_pipe(self, protocol_factory, pipe) -
-
-

Register read pipe in event loop. Set the pipe to non-blocking mode.

-

protocol_factory should instantiate object with Protocol interface. -pipe is a file-like object. -Return pair (transport, protocol), where transport supports the -ReadTransport interface.

-
- -Expand source code - -
async def connect_read_pipe(self, protocol_factory, pipe):
-    raise NotImplementedError
-
-
-
-async def connect_write_pipe(self, protocol_factory, pipe) -
-
-

Register write pipe in event loop.

-

protocol_factory should instantiate object with BaseProtocol interface. -Pipe is file-like object already switched to nonblocking. -Return pair (transport, protocol), where transport support -WriteTransport interface.

-
- -Expand source code - -
async def connect_write_pipe(self, protocol_factory, pipe):
-    raise NotImplementedError
-
-
-
-async def create_connection(self, protocol_factory, host=None, port=None, *, ssl=None, family=0, proto=0, flags=0, sock=None, local_addr=None, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, happy_eyeballs_delay=None, interleave=None) -
-
-
-
- -Expand source code - -
async def create_connection(
-        self, protocol_factory, host=None, port=None,
-        *, ssl=None, family=0, proto=0,
-        flags=0, sock=None, local_addr=None,
-        server_hostname=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None,
-        happy_eyeballs_delay=None, interleave=None):
-    raise NotImplementedError
-
-
-
-async def create_datagram_endpoint(self, protocol_factory, local_addr=None, remote_addr=None, *, family=0, proto=0, flags=0, reuse_address=None, reuse_port=None, allow_broadcast=None, sock=None) -
-
-

A coroutine which creates a datagram endpoint.

-

This method will try to establish the endpoint in the background. -When successful, the coroutine returns a (transport, protocol) pair.

-

protocol_factory must be a callable returning a protocol instance.

-

socket family AF_INET, socket.AF_INET6 or socket.AF_UNIX depending on -host (or family if specified), socket type SOCK_DGRAM.

-

reuse_address tells the kernel to reuse a local socket in -TIME_WAIT state, without waiting for its natural timeout to -expire. If not specified it will automatically be set to True on -UNIX.

-

reuse_port tells the kernel to allow this endpoint to be bound to -the same port as other existing endpoints are bound to, so long as -they all set this flag when being created. This option is not -supported on Windows and some UNIX's. If the -:py:data:~socket.SO_REUSEPORT constant is not defined then this -capability is unsupported.

-

allow_broadcast tells the kernel to allow this endpoint to send -messages to the broadcast address.

-

sock can optionally be specified in order to use a preexisting -socket object.

-
- -Expand source code - -
async def create_datagram_endpoint(self, protocol_factory,
-                                   local_addr=None, remote_addr=None, *,
-                                   family=0, proto=0, flags=0,
-                                   reuse_address=None, reuse_port=None,
-                                   allow_broadcast=None, sock=None):
-    raise NotImplementedError
-
-
-
-def create_future(self) -
-
-
-
- -Expand source code - -
def create_future(self):
-    return asyncio.Future(loop=self)
-
-
-
-async def create_server(self, protocol_factory, host=None, port=None, *, family=0, flags=1, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True) -
-
-

A coroutine which creates a TCP server bound to host and port.

-

The return value is a Server object which can be used to stop -the service.

-

If host is an empty string or None all interfaces are assumed -and a list of multiple sockets will be returned (most likely -one for IPv4 and another one for IPv6). The host parameter can also be -a sequence (e.g. list) of hosts to bind to.

-

family can be set to either AF_INET or AF_INET6 to force the -socket to use IPv4 or IPv6. If not set it will be determined -from host (defaults to AF_UNSPEC).

-

flags is a bitmask for getaddrinfo().

-

sock can optionally be specified in order to use a preexisting -socket object.

-

backlog is the maximum number of queued connections passed to -listen() (defaults to 100).

-

ssl can be set to an SSLContext to enable SSL over the -accepted connections.

-

reuse_address tells the kernel to reuse a local socket in -TIME_WAIT state, without waiting for its natural timeout to -expire. If not specified will automatically be set to True on -UNIX.

-

reuse_port tells the kernel to allow this endpoint to be bound to -the same port as other existing endpoints are bound to, so long as -they all set this flag when being created. This option is not -supported on Windows.

-

ssl_handshake_timeout is the time in seconds that an SSL server -will wait for completion of the SSL handshake before aborting the -connection. Default is 60s.

-

ssl_shutdown_timeout is the time in seconds that an SSL server -will wait for completion of the SSL shutdown procedure -before aborting the connection. Default is 30s.

-

start_serving set to True (default) causes the created server -to start accepting connections immediately. -When set to False, -the user should await Server.start_serving() or Server.serve_forever() -to make the server to start accepting connections.

-
- -Expand source code - -
async def create_server(
-        self, protocol_factory, host=None, port=None,
-        *, family=socket.AF_UNSPEC,
-        flags=socket.AI_PASSIVE, sock=None, backlog=100,
-        ssl=None, reuse_address=None, reuse_port=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None,
-        start_serving=True):
-    raise NotImplementedError
-
-
-
-def create_task(self, coroutine) -
-
-
-
- -Expand source code - -
def create_task(self, coroutine):
-    return asyncio.Task(coroutine, loop=self)
-
-
-
-async def create_unix_connection(self, protocol_factory, path=None, *, ssl=None, sock=None, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None) -
-
-
-
- -Expand source code - -
async def create_unix_connection(
-        self, protocol_factory, path=None, *,
-        ssl=None, sock=None,
-        server_hostname=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None):
-    raise NotImplementedError
-
-
-
-async def create_unix_server(self, protocol_factory, path=None, *, sock=None, backlog=100, ssl=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True) -
-
-

A coroutine which creates a UNIX Domain Socket server.

-

The return value is a Server object, which can be used to stop -the service.

-

path is a str, representing a file system path to bind the -server socket to.

-

sock can optionally be specified in order to use a preexisting -socket object.

-

backlog is the maximum number of queued connections passed to -listen() (defaults to 100).

-

ssl can be set to an SSLContext to enable SSL over the -accepted connections.

-

ssl_handshake_timeout is the time in seconds that an SSL server -will wait for the SSL handshake to complete (defaults to 60s).

-

ssl_shutdown_timeout is the time in seconds that an SSL server -will wait for the SSL shutdown to finish (defaults to 30s).

-

start_serving set to True (default) causes the created server -to start accepting connections immediately. -When set to False, -the user should await Server.start_serving() or Server.serve_forever() -to make the server to start accepting connections.

-
- -Expand source code - -
async def create_unix_server(
-        self, protocol_factory, path=None, *,
-        sock=None, backlog=100, ssl=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None,
-        start_serving=True):
-    raise NotImplementedError
-
-
-
-def default_exception_handler(self, context) -
-
-
-
- -Expand source code - -
def default_exception_handler(self, context):
-    raise NotImplementedError
-
-
-
-def get_debug(self) -
-
-
-
- -Expand source code - -
def get_debug(self):
-    return False
-
-
-
-def get_exception_handler(self) -
-
-
-
- -Expand source code - -
def get_exception_handler(self):
-    raise NotImplementedError
-
-
-
-def get_task_factory(self) -
-
-
-
- -Expand source code - -
def get_task_factory(self):
-    raise NotImplementedError
-
-
-
-async def getaddrinfo(self, host, port, *, family=0, type=0, proto=0, flags=0) -
-
-
-
- -Expand source code - -
async def getaddrinfo(self, host, port, *,
-                      family=0, type=0, proto=0, flags=0):
-    raise NotImplementedError
-
-
-
-async def getnameinfo(self, sockaddr, flags=0) -
-
-
-
- -Expand source code - -
async def getnameinfo(self, sockaddr, flags=0):
-    raise NotImplementedError
-
-
-
-def is_closed(self) -
-
-

Returns True if the event loop was closed.

-
- -Expand source code - -
def is_closed(self):
-    return not self.running
-
-
-
-def is_running(self) -
-
-

Return whether the event loop is currently running.

-
- -Expand source code - -
def is_running(self):
-    return self.running
-
-
-
-def remove_reader(self, fd) -
-
-
-
- -Expand source code - -
def remove_reader(self, fd):
-    raise NotImplementedError
-
-
-
-def remove_signal_handler(self, sig) -
-
-
-
- -Expand source code - -
def remove_signal_handler(self, sig):
-    raise NotImplementedError
-
-
-
-def remove_writer(self, fd) -
-
-
-
- -Expand source code - -
def remove_writer(self, fd):
-    raise NotImplementedError
-
-
-
-def run_forever(self) -
-
-

Run the event loop until stop() is called.

-
- -Expand source code - -
def run_forever(self):
-    raise NotImplementedError
-
-
-
-def run_in_executor(self, executor, func, *args) -
-
-
-
- -Expand source code - -
def run_in_executor(self, executor, func, *args):
-    raise NotImplementedError
-
-
-
-def run_until_complete(self, future) -
-
-

Run the event loop until a Future is done.

-

Return the Future's result, or raise its exception.

-
- -Expand source code - -
def run_until_complete(self, future):
-    future = asyncio.ensure_future(future, loop=self)
-
-    self.running = True
-    asyncio.events._set_running_loop(self)
-    while self.running and not future.done():
-        handle = self.handles[0]
-        self.handles = self.handles[1:]
-        if not handle._cancelled:
-            handle._run()
-            
-        if self.wakers:
-            [pollables, wakers] = list(map(list, zip(*self.wakers)))
-            
-            new_wakers = []
-            ready = [False] * len(pollables)
-            for index in poll.poll(pollables):
-                ready[index] = True
-            
-            for (ready, pollable), waker in zip(zip(ready, pollables), wakers):
-                if ready:
-                    pollable.__exit__()
-                    waker.set_result(None)
-                else:
-                    new_wakers.append((pollable, waker))
-
-            self.wakers = new_wakers
-
-        if self.exception is not None:
-            raise self.exception
-        
-    future.result()
-
-
-
-async def sendfile(self, transport, file, offset=0, count=None, *, fallback=True) -
-
-

Send a file through a transport.

-

Return an amount of sent bytes.

-
- -Expand source code - -
async def sendfile(self, transport, file, offset=0, count=None,
-                   *, fallback=True):
-    raise NotImplementedError
-
-
-
-def set_debug(self, enabled) -
-
-
-
- -Expand source code - -
def set_debug(self, enabled):
-    raise NotImplementedError
-
-
-
-def set_default_executor(self, executor) -
-
-
-
- -Expand source code - -
def set_default_executor(self, executor):
-    raise NotImplementedError
-
-
-
-def set_exception_handler(self, handler) -
-
-
-
- -Expand source code - -
def set_exception_handler(self, handler):
-    raise NotImplementedError
-
-
-
-def set_task_factory(self, factory) -
-
-
-
- -Expand source code - -
def set_task_factory(self, factory):
-    raise NotImplementedError
-
-
-
-def shutdown_asyncgens(self) -
-
-

Shutdown all active asynchronous generators.

-
- -Expand source code - -
def shutdown_asyncgens(self):
-    pass
-
-
-
-async def shutdown_default_executor(self) -
-
-

Schedule the shutdown of the default executor.

-
- -Expand source code - -
async def shutdown_default_executor(self):
-    raise NotImplementedError
-
-
-
-async def sock_accept(self, sock) -
-
-
-
- -Expand source code - -
async def sock_accept(self, sock):
-    raise NotImplementedError
-
-
-
-async def sock_connect(self, sock, address) -
-
-
-
- -Expand source code - -
async def sock_connect(self, sock, address):
-    raise NotImplementedError
-
-
-
-async def sock_recv(self, sock, nbytes) -
-
-
-
- -Expand source code - -
async def sock_recv(self, sock, nbytes):
-    raise NotImplementedError
-
-
-
-async def sock_recv_into(self, sock, buf) -
-
-
-
- -Expand source code - -
async def sock_recv_into(self, sock, buf):
-    raise NotImplementedError
-
-
-
-async def sock_recvfrom(self, sock, bufsize) -
-
-
-
- -Expand source code - -
async def sock_recvfrom(self, sock, bufsize):
-    raise NotImplementedError
-
-
-
-async def sock_recvfrom_into(self, sock, buf, nbytes=0) -
-
-
-
- -Expand source code - -
async def sock_recvfrom_into(self, sock, buf, nbytes=0):
-    raise NotImplementedError
-
-
-
-async def sock_sendall(self, sock, data) -
-
-
-
- -Expand source code - -
async def sock_sendall(self, sock, data):
-    raise NotImplementedError
-
-
-
-async def sock_sendfile(self, sock, file, offset=0, count=None, *, fallback=None) -
-
-
-
- -Expand source code - -
async def sock_sendfile(self, sock, file, offset=0, count=None,
-                        *, fallback=None):
-    raise NotImplementedError
-
-
-
-async def sock_sendto(self, sock, data, address) -
-
-
-
- -Expand source code - -
async def sock_sendto(self, sock, data, address):
-    raise NotImplementedError
-
-
-
-async def start_tls(self, transport, protocol, sslcontext, *, server_side=False, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None) -
-
-

Upgrade a transport to TLS.

-

Return a new transport that protocol should start using -immediately.

-
- -Expand source code - -
async def start_tls(self, transport, protocol, sslcontext, *,
-                    server_side=False,
-                    server_hostname=None,
-                    ssl_handshake_timeout=None,
-                    ssl_shutdown_timeout=None):
-    raise NotImplementedError
-
-
-
-def stop(self) -
-
-

Stop the event loop as soon as reasonable.

-

Exactly how soon that is may depend on the implementation, but -no more I/O callbacks should be scheduled.

-
- -Expand source code - -
def stop(self):
-    self.running = False
-
-
-
-async def subprocess_exec(self, protocol_factory, *args, stdin=-1, stdout=-1, stderr=-1, **kwargs) -
-
-
-
- -Expand source code - -
async def subprocess_exec(self, protocol_factory, *args,
-                          stdin=subprocess.PIPE,
-                          stdout=subprocess.PIPE,
-                          stderr=subprocess.PIPE,
-                          **kwargs):
-    raise NotImplementedError
-
-
-
-async def subprocess_shell(self, protocol_factory, cmd, *, stdin=-1, stdout=-1, stderr=-1, **kwargs) -
-
-
-
- -Expand source code - -
async def subprocess_shell(self, protocol_factory, cmd, *,
-                           stdin=subprocess.PIPE,
-                           stdout=subprocess.PIPE,
-                           stderr=subprocess.PIPE,
-                           **kwargs):
-    raise NotImplementedError
-
-
-
-def time(self) -
-
-
-
- -Expand source code - -
def time(self):
-    raise NotImplementedError
-
-
-
-
-
-class Sink -(body: OutgoingBody) -
-
-

Writer abstraction over wasi-http/types#outgoing-body.

-
- -Expand source code - -
class Sink:
-    """Writer abstraction over `wasi-http/types#outgoing-body`."""
-    def __init__(self, body: OutgoingBody):
-        self.body = body
-        self.stream = body.write()
-
-    async def send(self, chunk: bytes):
-        """Write the specified bytes to the sink.
-
-        This may need to yield according to the backpressure requirements of the sink.
-        """
-        offset = 0
-        flushing = False
-        while True:
-            count = self.stream.check_write()
-            if count == 0:
-                await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-            elif offset == len(chunk):
-                if flushing:
-                    return
-                else:
-                    self.stream.flush()
-                    flushing = True
-            else:
-                count = min(count, len(chunk) - offset)
-                self.stream.write(chunk[offset:offset+count])
-                offset += count
-
-    def close(self):
-        """Close the stream, indicating no further data will be written."""
-
-        self.stream.__exit__()
-        self.stream = None
-        OutgoingBody.finish(self.body, None)
-        self.body = None
-
-

Methods

-
-
-def close(self) -
-
-

Close the stream, indicating no further data will be written.

-
- -Expand source code - -
def close(self):
-    """Close the stream, indicating no further data will be written."""
-
-    self.stream.__exit__()
-    self.stream = None
-    OutgoingBody.finish(self.body, None)
-    self.body = None
-
-
-
-async def send(self, chunk: bytes) -
-
-

Write the specified bytes to the sink.

-

This may need to yield according to the backpressure requirements of the sink.

-
- -Expand source code - -
async def send(self, chunk: bytes):
-    """Write the specified bytes to the sink.
-
-    This may need to yield according to the backpressure requirements of the sink.
-    """
-    offset = 0
-    flushing = False
-    while True:
-        count = self.stream.check_write()
-        if count == 0:
-            await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-        elif offset == len(chunk):
-            if flushing:
-                return
-            else:
-                self.stream.flush()
-                flushing = True
-        else:
-            count = min(count, len(chunk) - offset)
-            self.stream.write(chunk[offset:offset+count])
-            offset += count
-
-
-
-
-
-class Stream -(body: IncomingBody) -
-
-

Reader abstraction over wasi:http/types#incoming-body.

-
- -Expand source code - -
class Stream:
-    """Reader abstraction over `wasi:http/types#incoming-body`."""
-    def __init__(self, body: IncomingBody):
-        self.body: Optional[IncomingBody] = body
-        self.stream: Optional[InputStream] = body.stream()
-
-    async def next(self) -> Optional[bytes]:
-        """Wait for the next chunk of data to arrive on the stream.
-
-        This will return `None` when the end of the stream has been reached.
-        """
-        while True:
-            try:
-                if self.stream is None:
-                    return None
-                else:
-                    buffer = self.stream.read(READ_SIZE)
-                    if len(buffer) == 0:
-                        await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-                    else:
-                        return buffer
-            except Err as e:
-                if isinstance(e.value, StreamErrorClosed):
-                    if self.stream is not None:
-                        self.stream.__exit__()
-                        self.stream = None
-                    if self.body is not None:
-                        IncomingBody.finish(self.body)
-                        self.body = None
-                else:
-                    raise e
-
-

Methods

-
-
-async def next(self) ‑> Optional[bytes] -
-
-

Wait for the next chunk of data to arrive on the stream.

-

This will return None when the end of the stream has been reached.

-
- -Expand source code - -
async def next(self) -> Optional[bytes]:
-    """Wait for the next chunk of data to arrive on the stream.
-
-    This will return `None` when the end of the stream has been reached.
-    """
-    while True:
-        try:
-            if self.stream is None:
-                return None
-            else:
-                buffer = self.stream.read(READ_SIZE)
-                if len(buffer) == 0:
-                    await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-                else:
-                    return buffer
-        except Err as e:
-            if isinstance(e.value, StreamErrorClosed):
-                if self.stream is not None:
-                    self.stream.__exit__()
-                    self.stream = None
-                if self.body is not None:
-                    IncomingBody.finish(self.body)
-                    self.body = None
-            else:
-                raise e
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index b62d587..0000000 --- a/docs/index.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -spin_sdk API documentation - - - - - - - - - - - -
-
-
-

Package spin_sdk

-
-
-

Spin Python SDK

-

This is an SDK for creating Spin apps using Python.

-

Note that this SDK supercedes an earlier, experimental version, the documentation for which may be found here.

-
- -Expand source code - -
"""Spin Python SDK
-
-This is an SDK for creating [Spin](https://github.com/spinframework/spin) apps using Python.
-
-Note that this SDK supercedes an earlier, experimental version, the documentation for which may be found [here](https://spinframework.github.io/spin-python-sdk/v1/index.html).
-"""
-
-
-
-

Sub-modules

-
-
spin_sdk.http
-
-

Module with helpers for wasi http

-
-
spin_sdk.key_value
-
-

Module for accessing Spin key-value stores

-
-
spin_sdk.llm
-
-

Module for working with the Spin large language model API

-
-
spin_sdk.mysql
-
-

Module for interacting with a MySQL database

-
-
spin_sdk.postgres
-
-

Module for interacting with a Postgres database

-
-
spin_sdk.redis
-
-

Module for interacting with a Redis database

-
-
spin_sdk.sqlite
-
-

Module for interacting with an SQLite database

-
-
spin_sdk.variables
-
-

Module for interacting with Spin Variables

-
-
spin_sdk.wit
-
-

Module with the bindings generated from the wit by componentize-py

-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/key_value.html b/docs/key_value.html deleted file mode 100644 index d92aa03..0000000 --- a/docs/key_value.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - -spin_sdk.key_value API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.key_value

-
-
-

Module for accessing Spin key-value stores

-
- -Expand source code - -
"""Module for accessing Spin key-value stores"""
-
-from spin_sdk.wit.imports.key_value import Store
-
-def open(name: str) -> Store:
-    """
-    Open the store with the specified name.
-  
-    If `name` is "default", the default store is opened.  Otherwise, `name` must
-    refer to a store defined and configured in a runtime configuration file
-    supplied with the application.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorNoSuchStore)` will be raised if the `name` is not recognized.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorAccessDenied)` will be raised if the requesting component does not have
-    access to the specified store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorStoreTableFull)` will be raised if too many stores have been opened simultaneously.
-    Closing one or more previously opened stores might address this using the `__exit__` method.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorOther(str))` will be raised if some implementation specific error has occured (e.g I/O)
-    """
-    return Store.open(name)
-
-def open_default() -> Store:
-    """
-    Open the default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorAccessDenied)`
-    will be raised if the requesting component does not have access to the
-    default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorStoreTableFull)` will be raised if too many stores have been opened simultaneously.
-    Closing one or more previously opened stores might address this using the `__exit__` method.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorOther(str))` will be raised if some implementation specific error has occured (e.g I/O)
-    """
-    return Store.open("default")
-
-
-
-
-
-
-
-

Functions

-
-
-def open(name: str) ‑> Store -
-
-

Open the store with the specified name.

-

If name is "default", the default store is opened. -Otherwise, name must -refer to a store defined and configured in a runtime configuration file -supplied with the application.

-

A Err(ErrorNoSuchStore) will be raised if the name is not recognized.

-

A Err(ErrorAccessDenied) will be raised if the requesting component does not have -access to the specified store.

-

A Err(ErrorStoreTableFull) will be raised if too many stores have been opened simultaneously. -Closing one or more previously opened stores might address this using the __exit__ method.

-

A Err(ErrorOther(str)) will be raised if some implementation specific error has occured (e.g I/O)

-
- -Expand source code - -
def open(name: str) -> Store:
-    """
-    Open the store with the specified name.
-  
-    If `name` is "default", the default store is opened.  Otherwise, `name` must
-    refer to a store defined and configured in a runtime configuration file
-    supplied with the application.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorNoSuchStore)` will be raised if the `name` is not recognized.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorAccessDenied)` will be raised if the requesting component does not have
-    access to the specified store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorStoreTableFull)` will be raised if too many stores have been opened simultaneously.
-    Closing one or more previously opened stores might address this using the `__exit__` method.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorOther(str))` will be raised if some implementation specific error has occured (e.g I/O)
-    """
-    return Store.open(name)
-
-
-
-def open_default() ‑> Store -
-
-

Open the default store.

-

A Err(ErrorAccessDenied) -will be raised if the requesting component does not have access to the -default store.

-

A Err(ErrorStoreTableFull) will be raised if too many stores have been opened simultaneously. -Closing one or more previously opened stores might address this using the __exit__ method.

-

A Err(ErrorOther(str)) will be raised if some implementation specific error has occured (e.g I/O)

-
- -Expand source code - -
def open_default() -> Store:
-    """
-    Open the default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorAccessDenied)`
-    will be raised if the requesting component does not have access to the
-    default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorStoreTableFull)` will be raised if too many stores have been opened simultaneously.
-    Closing one or more previously opened stores might address this using the `__exit__` method.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorOther(str))` will be raised if some implementation specific error has occured (e.g I/O)
-    """
-    return Store.open("default")
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/llm.html b/docs/llm.html deleted file mode 100644 index f68a472..0000000 --- a/docs/llm.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - -spin_sdk.llm API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.llm

-
-
-

Module for working with the Spin large language model API

-
- -Expand source code - -
"""Module for working with the Spin large language model API"""
-
-from dataclasses import dataclass
-from typing import Optional, Sequence
-from spin_sdk.wit.imports import llm as spin_llm
-
-@dataclass
-class InferencingParams:
-    max_tokens: int = 100
-    repeat_penalty: float = 1.1
-    repeat_penalty_last_n_token_count: int = 64
-    temperature: float = 0.8
-    top_k: int = 40
-    top_p: float = 0.9
-    
-
-def generate_embeddings(model: str, text: Sequence[str]) -> spin_llm.EmbeddingsResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorRuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorInvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    return spin_llm.generate_embeddings(model, text)
-
-def infer_with_options(model: str, prompt: str, options: Optional[InferencingParams]) -> spin_llm.InferencingResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorRuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorInvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    options = options or InferencingParams
-    return spin_llm.infer(model, prompt, options)
-
-def infer(model: str, prompt: str) -> spin_llm.InferencingResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorRuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorInvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    options = InferencingParams
-    return spin_llm.infer(model, prompt, options)
-
-
-
-
-
-
-
-

Functions

-
-
-def generate_embeddings(model: str, text: Sequence[str]) ‑> EmbeddingsResult -
-
-

A Err(ErrorModelNotSupported) will be raised if the component does not have access to the specified model.

-

A Err(ErrorRuntimeError(str)) will be raised if there are any runtime errors.

-

A Err(ErrorInvalidInput(str)) will be raised if an invalid input is provided.

-
- -Expand source code - -
def generate_embeddings(model: str, text: Sequence[str]) -> spin_llm.EmbeddingsResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorRuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorInvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    return spin_llm.generate_embeddings(model, text)
-
-
-
-def infer(model: str, prompt: str) ‑> InferencingResult -
-
-

A Err(ErrorModelNotSupported) will be raised if the component does not have access to the specified model.

-

A Err(ErrorRuntimeError(str)) will be raised if there are any runtime errors.

-

A Err(ErrorInvalidInput(str)) will be raised if an invalid input is provided.

-
- -Expand source code - -
def infer(model: str, prompt: str) -> spin_llm.InferencingResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorRuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorInvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    options = InferencingParams
-    return spin_llm.infer(model, prompt, options)
-
-
-
-def infer_with_options(model: str, prompt: str, options: Optional[InferencingParams]) ‑> InferencingResult -
-
-

A Err(ErrorModelNotSupported) will be raised if the component does not have access to the specified model.

-

A Err(ErrorRuntimeError(str)) will be raised if there are any runtime errors.

-

A Err(ErrorInvalidInput(str)) will be raised if an invalid input is provided.

-
- -Expand source code - -
def infer_with_options(model: str, prompt: str, options: Optional[InferencingParams]) -> spin_llm.InferencingResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorRuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorInvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    options = options or InferencingParams
-    return spin_llm.infer(model, prompt, options)
-
-
-
-
-
-

Classes

-
-
-class InferencingParams -(max_tokens: int = 100, repeat_penalty: float = 1.1, repeat_penalty_last_n_token_count: int = 64, temperature: float = 0.8, top_k: int = 40, top_p: float = 0.9) -
-
-

InferencingParams(max_tokens: int = 100, repeat_penalty: float = 1.1, repeat_penalty_last_n_token_count: int = 64, temperature: float = 0.8, top_k: int = 40, top_p: float = 0.9)

-
- -Expand source code - -
@dataclass
-class InferencingParams:
-    max_tokens: int = 100
-    repeat_penalty: float = 1.1
-    repeat_penalty_last_n_token_count: int = 64
-    temperature: float = 0.8
-    top_k: int = 40
-    top_p: float = 0.9
-
-

Class variables

-
-
var max_tokens : int
-
-
-
-
var repeat_penalty : float
-
-
-
-
var repeat_penalty_last_n_token_count : int
-
-
-
-
var temperature : float
-
-
-
-
var top_k : int
-
-
-
-
var top_p : float
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/mysql.html b/docs/mysql.html deleted file mode 100644 index 8df7ffd..0000000 --- a/docs/mysql.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - -spin_sdk.mysql API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.mysql

-
-
-

Module for interacting with a MySQL database

-
- -Expand source code - -
"""Module for interacting with a MySQL database"""
-
-from spin_sdk.wit.imports.mysql import Connection
-
-def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a MySQL database.
-    
-    The connection_string is the MySQL URL connection string.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.ErrorConnectionFailed(str))` when a connection fails.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.import.rdbms_types.ErrorOther(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-
-
-
-
-
-
-

Functions

-
-
-def open(connection_string: str) ‑> Connection -
-
-

Open a connection with a MySQL database.

-

The connection_string is the MySQL URL connection string.

-

A Err(ErrorConnectionFailed(str)) when a connection fails.

-

A Err(spin_sdk.wit.import.rdbms_types.ErrorOther(str)) when some other error occurs.

-
- -Expand source code - -
def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a MySQL database.
-    
-    The connection_string is the MySQL URL connection string.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.ErrorConnectionFailed(str))` when a connection fails.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.import.rdbms_types.ErrorOther(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/postgres.html b/docs/postgres.html deleted file mode 100644 index 132e27e..0000000 --- a/docs/postgres.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - -spin_sdk.postgres API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.postgres

-
-
-

Module for interacting with a Postgres database

-
- -Expand source code - -
"""Module for interacting with a Postgres database"""
-
-from spin_sdk.wit.imports.postgres import Connection
-
-def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a Postgres database.
-    
-    The connection_string is the Postgres URL connection string.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.ErrorConnectionFailed(str))` when a connection fails.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.ErrorOther(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-
-
-
-
-
-
-

Functions

-
-
-def open(connection_string: str) ‑> Connection -
-
-

Open a connection with a Postgres database.

-

The connection_string is the Postgres URL connection string.

-

A Err(ErrorConnectionFailed(str)) when a connection fails.

-

A Err(ErrorOther(str)) when some other error occurs.

-
- -Expand source code - -
def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a Postgres database.
-    
-    The connection_string is the Postgres URL connection string.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.ErrorConnectionFailed(str))` when a connection fails.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.ErrorOther(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/redis.html b/docs/redis.html deleted file mode 100644 index 2a4c826..0000000 --- a/docs/redis.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - -spin_sdk.redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.redis

-
-
-

Module for interacting with a Redis database

-
- -Expand source code - -
"""Module for interacting with a Redis database"""
-
-from spin_sdk.wit.imports.redis import Connection 
-
-def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a Redis database.
-    
-    The connection_string is the Redis URL to connect to.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.ErrorInvalidAddress)` will be raised if the connection string is invalid.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.ErrorTooManyConnection)` will be raised if there are too many open connections. Closing one or more previously opened connection using the `__exit__` method might help.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.ErrorOther(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-
-
-
-
-
-
-

Functions

-
-
-def open(connection_string: str) ‑> Connection -
-
-

Open a connection with a Redis database.

-

The connection_string is the Redis URL to connect to.

-

A Err(ErrorInvalidAddress) will be raised if the connection string is invalid.

-

A Err(spin_sdk.wit.imports.redis.ErrorTooManyConnection) will be raised if there are too many open connections. Closing one or more previously opened connection using the __exit__ method might help.

-

A Err(ErrorOther(str)) when some other error occurs.

-
- -Expand source code - -
def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a Redis database.
-    
-    The connection_string is the Redis URL to connect to.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.ErrorInvalidAddress)` will be raised if the connection string is invalid.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.ErrorTooManyConnection)` will be raised if there are too many open connections. Closing one or more previously opened connection using the `__exit__` method might help.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.ErrorOther(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/sqlite.html b/docs/sqlite.html deleted file mode 100644 index 40dd5b1..0000000 --- a/docs/sqlite.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - -spin_sdk.sqlite API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.sqlite

-
-
-

Module for interacting with an SQLite database

-
- -Expand source code - -
"""Module for interacting with an SQLite database"""
-
-from typing import List
-from spin_sdk.wit.imports.sqlite import Connection, ValueInteger, ValueReal, ValueText, ValueBlob
-
-def open(name: str) -> Connection:
-    """Open a connection to a named database instance.
-
-    If `database` is "default", the default instance is opened.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorAccessDenied)` will be raised when the component does not have access to the specified database.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorNoSuchDatabase)` will be raised when the host does not recognize the database name requested.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorInvalidConnection)` will be raised when the provided connection string is not valid.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorIo(str))` will be raised when implementation-specific error occured (e.g. I/O)
-    """
-    return Connection.open(name)
-
-def open_default() -> Connection:
-    """Open the default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorAccessDenied)` will be raised when the component does not have access to the default database.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorIo(str))` will be raised when implementation-specific error occured (e.g. I/O)
-    """
-    return Connection.open("default")
-
-ValueInteger = ValueInteger
-ValueReal = ValueReal
-ValueText = ValueText
-ValueBlob = ValueBlob
-
-
-
-
-
-
-
-

Functions

-
-
-def open(name: str) ‑> Connection -
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

A Err(ErrorAccessDenied) will be raised when the component does not have access to the specified database.

-

A Err(ErrorNoSuchDatabase) will be raised when the host does not recognize the database name requested.

-

A Err(ErrorInvalidConnection) will be raised when the provided connection string is not valid.

-

A Err(ErrorIo(str)) will be raised when implementation-specific error occured (e.g. I/O)

-
- -Expand source code - -
def open(name: str) -> Connection:
-    """Open a connection to a named database instance.
-
-    If `database` is "default", the default instance is opened.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorAccessDenied)` will be raised when the component does not have access to the specified database.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorNoSuchDatabase)` will be raised when the host does not recognize the database name requested.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorInvalidConnection)` will be raised when the provided connection string is not valid.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorIo(str))` will be raised when implementation-specific error occured (e.g. I/O)
-    """
-    return Connection.open(name)
-
-
-
-def open_default() ‑> Connection -
-
-

Open the default store.

-

A Err(ErrorAccessDenied) will be raised when the component does not have access to the default database.

-

A Err(ErrorIo(str)) will be raised when implementation-specific error occured (e.g. I/O)

-
- -Expand source code - -
def open_default() -> Connection:
-    """Open the default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorAccessDenied)` will be raised when the component does not have access to the default database.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorIo(str))` will be raised when implementation-specific error occured (e.g. I/O)
-    """
-    return Connection.open("default")
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v1/index.html b/docs/v1/index.html deleted file mode 100644 index be4bbdb..0000000 --- a/docs/v1/index.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - -spin_sdk API documentation - - - - - - - - - - - -
-
-
-

Namespace spin_sdk

-
-
-
-
-

Sub-modules

-
-
spin_sdk.spin_config
-
-

Module for getting Spin configuration values

-
-
spin_sdk.spin_http
-
-

Module for sending outbound HTTP requests

-
-
spin_sdk.spin_key_value
-
-

Module for accessing Spin key-value stores

-
-
spin_sdk.spin_llm
-
-

Module for working with the Spin large language model API

-
-
spin_sdk.spin_redis
-
-

Module for interacting with a Redis database

-
-
spin_sdk.spin_sqlite
-
-

Module for interacting with an SQLite database

-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v1/spin_config.html b/docs/v1/spin_config.html deleted file mode 100644 index 95f47b4..0000000 --- a/docs/v1/spin_config.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -spin_sdk.spin_config API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.spin_config

-
-
-

Module for getting Spin configuration values

-
- -Expand source code - -
"""Module for getting Spin configuration values"""
-
-def config_get(key: str) -> str:
-    """Get a configuration value for the current component.
-
-    The config key must match one defined in in the component manifest.
-
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
-

Functions

-
-
-def config_get(key: str) ‑> str -
-
-

Get a configuration value for the current component.

-

The config key must match one defined in in the component manifest.

-
- -Expand source code - -
def config_get(key: str) -> str:
-    """Get a configuration value for the current component.
-
-    The config key must match one defined in in the component manifest.
-
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v1/spin_http.html b/docs/v1/spin_http.html deleted file mode 100644 index 0602ae4..0000000 --- a/docs/v1/spin_http.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - -spin_sdk.spin_http API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.spin_http

-
-
-

Module for sending outbound HTTP requests

-
- -Expand source code - -
"""Module for sending outbound HTTP requests"""
-
-from dataclasses import dataclass
-from collections.abc import Mapping
-from typing import Optional
-
-@dataclass
-class Request:
-    """An HTTP request"""
-    method: str
-    uri: str
-    headers: Mapping[str, str]
-    body: Optional[bytes]
-
-@dataclass
-class Response:
-    """An HTTP response"""
-    status: int
-    headers: Mapping[str, str]
-    body: Optional[bytes]
-
-def http_send(request: Request) -> Response:
-    """Send an HTTP request and return a response or raise an error"""
-    raise NotImplementedError
-
-
-
-
-
-
-
-

Functions

-
-
-def http_send(request: Request) ‑> Response -
-
-

Send an HTTP request and return a response or raise an error

-
- -Expand source code - -
def http_send(request: Request) -> Response:
-    """Send an HTTP request and return a response or raise an error"""
-    raise NotImplementedError
-
-
-
-
-
-

Classes

-
-
-class Request -(method: str, uri: str, headers: collections.abc.Mapping[str, str], body: Optional[bytes]) -
-
-

An HTTP request

-
- -Expand source code - -
@dataclass
-class Request:
-    """An HTTP request"""
-    method: str
-    uri: str
-    headers: Mapping[str, str]
-    body: Optional[bytes]
-
-

Class variables

-
-
var body : Optional[bytes]
-
-
-
-
var headers : collections.abc.Mapping[str, str]
-
-
-
-
var method : str
-
-
-
-
var uri : str
-
-
-
-
-
-
-class Response -(status: int, headers: collections.abc.Mapping[str, str], body: Optional[bytes]) -
-
-

An HTTP response

-
- -Expand source code - -
@dataclass
-class Response:
-    """An HTTP response"""
-    status: int
-    headers: Mapping[str, str]
-    body: Optional[bytes]
-
-

Class variables

-
-
var body : Optional[bytes]
-
-
-
-
var headers : collections.abc.Mapping[str, str]
-
-
-
-
var status : int
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v1/spin_key_value.html b/docs/v1/spin_key_value.html deleted file mode 100644 index 36eb79d..0000000 --- a/docs/v1/spin_key_value.html +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - -spin_sdk.spin_key_value API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.spin_key_value

-
-
-

Module for accessing Spin key-value stores

-
- -Expand source code - -
"""Module for accessing Spin key-value stores"""
-
-from collections.abc import Sequence
-from typing import Optional
-
-class Store:
-    """Represents an open key-value store"""
-    
-    def get(self, key: str) -> Optional[bytes]:
-        """Get the value associated with the specified `key` from the specified `store`,
-        or `None` if no such value exists.
-
-        """
-        raise NotImplementedError
-
-    def set(self, key: str, value: bytes):
-        """Set the `value` associated with the specified `key` in the specified `store`,
-        overwriting any existing value.
-
-        """
-        raise NotImplementedError
-
-    def delete(self, key: str):
-        """Delete the tuple with the specified `key` from the specified `store`, if it
-        exists.
-
-        """
-        raise NotImplementedError
-
-    def exists(self, key: str) -> bool:
-        """Return whether a tuple exists for the specified `key` in the specified
-        `store`.
-
-        """
-        raise NotImplementedError
-
-    def get_keys(self) -> Sequence[str]:
-        """Return a list of all the keys in the specified `store`."""
-        raise NotImplementedError        
-    
-def kv_open(name: str) -> Store:
-    """Open the store with the specified name.
-  
-    If `name` is "default", the default store is opened.  Otherwise, `name` must
-    refer to a store defined and configured in a runtime configuration file
-    supplied with the application.
-
-    An `AssertionError` will be raised if the `name` is not recognized or the
-    requesting component does not have access to the specified store.
-
-    """
-    raise NotImplementedError
-    
-def kv_open_default() -> Store:
-    """Open the default store.
-
-    An `AssertionError` will be raised if the requesting component does not have
-    access to the specified store.
-
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
-

Functions

-
-
-def kv_open(name: str) ‑> Store -
-
-

Open the store with the specified name.

-

If name is "default", the default store is opened. -Otherwise, name must -refer to a store defined and configured in a runtime configuration file -supplied with the application.

-

An AssertionError will be raised if the name is not recognized or the -requesting component does not have access to the specified store.

-
- -Expand source code - -
def kv_open(name: str) -> Store:
-    """Open the store with the specified name.
-  
-    If `name` is "default", the default store is opened.  Otherwise, `name` must
-    refer to a store defined and configured in a runtime configuration file
-    supplied with the application.
-
-    An `AssertionError` will be raised if the `name` is not recognized or the
-    requesting component does not have access to the specified store.
-
-    """
-    raise NotImplementedError
-
-
-
-def kv_open_default() ‑> Store -
-
-

Open the default store.

-

An AssertionError will be raised if the requesting component does not have -access to the specified store.

-
- -Expand source code - -
def kv_open_default() -> Store:
-    """Open the default store.
-
-    An `AssertionError` will be raised if the requesting component does not have
-    access to the specified store.
-
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Classes

-
-
-class Store -
-
-

Represents an open key-value store

-
- -Expand source code - -
class Store:
-    """Represents an open key-value store"""
-    
-    def get(self, key: str) -> Optional[bytes]:
-        """Get the value associated with the specified `key` from the specified `store`,
-        or `None` if no such value exists.
-
-        """
-        raise NotImplementedError
-
-    def set(self, key: str, value: bytes):
-        """Set the `value` associated with the specified `key` in the specified `store`,
-        overwriting any existing value.
-
-        """
-        raise NotImplementedError
-
-    def delete(self, key: str):
-        """Delete the tuple with the specified `key` from the specified `store`, if it
-        exists.
-
-        """
-        raise NotImplementedError
-
-    def exists(self, key: str) -> bool:
-        """Return whether a tuple exists for the specified `key` in the specified
-        `store`.
-
-        """
-        raise NotImplementedError
-
-    def get_keys(self) -> Sequence[str]:
-        """Return a list of all the keys in the specified `store`."""
-        raise NotImplementedError        
-
-

Methods

-
-
-def delete(self, key: str) -
-
-

Delete the tuple with the specified key from the specified store, if it -exists.

-
- -Expand source code - -
def delete(self, key: str):
-    """Delete the tuple with the specified `key` from the specified `store`, if it
-    exists.
-
-    """
-    raise NotImplementedError
-
-
-
-def exists(self, key: str) ‑> bool -
-
-

Return whether a tuple exists for the specified key in the specified -store.

-
- -Expand source code - -
def exists(self, key: str) -> bool:
-    """Return whether a tuple exists for the specified `key` in the specified
-    `store`.
-
-    """
-    raise NotImplementedError
-
-
-
-def get(self, key: str) ‑> Optional[bytes] -
-
-

Get the value associated with the specified key from the specified store, -or None if no such value exists.

-
- -Expand source code - -
def get(self, key: str) -> Optional[bytes]:
-    """Get the value associated with the specified `key` from the specified `store`,
-    or `None` if no such value exists.
-
-    """
-    raise NotImplementedError
-
-
-
-def get_keys(self) ‑> collections.abc.Sequence[str] -
-
-

Return a list of all the keys in the specified store.

-
- -Expand source code - -
def get_keys(self) -> Sequence[str]:
-    """Return a list of all the keys in the specified `store`."""
-    raise NotImplementedError        
-
-
-
-def set(self, key: str, value: bytes) -
-
-

Set the value associated with the specified key in the specified store, -overwriting any existing value.

-
- -Expand source code - -
def set(self, key: str, value: bytes):
-    """Set the `value` associated with the specified `key` in the specified `store`,
-    overwriting any existing value.
-
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v1/spin_llm.html b/docs/v1/spin_llm.html deleted file mode 100644 index 9de7d41..0000000 --- a/docs/v1/spin_llm.html +++ /dev/null @@ -1,447 +0,0 @@ - - - - - - -spin_sdk.spin_llm API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.spin_llm

-
-
-

Module for working with the Spin large language model API

-
- -Expand source code - -
"""Module for working with the Spin large language model API"""
-
-from dataclasses import dataclass
-from collections.abc import Sequence
-from typing import Optional
-
-@dataclass
-class LLMInferencingUsage:
-    """Usage information related to an inferencing result.
-
-    Attributes:
-        prompt_token_count (int): Number of tokens in the prompt.
-        generated_token_count (int): Number of tokens generated by the inferencing operation.
-
-    """
-    prompt_token_count: int
-    generated_token_count: int
-
-@dataclass
-class LLMInferencingResult:
-    """An inferencing result.
-
-    Attributes:
-        text (str): The text generated by the model.
-        usage (LLMInferencingUsage): Usage information related to the inferencing result.
-
-    """
-    text: str
-    usage: LLMInferencingUsage
-
-@dataclass
-class LLMInferencingParams:
-    """Inference request parameters
-
-    Attributes:
-        max_tokens (int): The maximum tokens that should be inferred.
-        repeat_penalty (float): The amount the model should avoid repeating tokens.
-        repeat_penalty_last_n_token_count (int): The number of tokens the model should apply the repeat penalty to.
-        temperature (float): The randomness with which the next token is selected.
-        top-k (int): The number of possible next tokens the model will choose from.
-        top-p: (float): The probability total of next tokens the model will choose from.
-
-    """
-    max_tokens: int
-    repeat_penalty: float
-    repeat_penalty_last_n_token_count: int
-    temperature: float
-    top_k: int
-    top_p: int
-        
-def llm_infer(model: str, prompt: str, options: Optional[LLMInferencingParams]) -> LLMInferencingResult:
-    """Perform inferencing using the provided model and prompt with the given optional params"""
-    raise NotImplementedError
-
-@dataclass
-class LLMEmbeddingsUsage:
-    """Usage information related to an embedding result.
-
-    Attributes:
-        prompt_token_count (int): Number of tokens in the prompt.
-
-    """
-    prompt_token_count: int
-
-@dataclass
-class LLMEmbeddingsResult:
-    """An embedding result.
-
-    Attributes:
-        embeddings (Sequence[Sequence[float]]): 
-        usage (LLMEmbeddingsUsage): Usage information related to the embeddings result.
-
-    """
-    embeddings: Sequence[Sequence[float]]
-    usage: LLMEmbeddingsUsage
-
-def generate_embeddings(model: str, text: Sequence[str]) -> LLMEmbeddingsResult:
-    """Generate embeddings for the supplied list of text"""
-    raise NotImplementedError
-
-
-
-
-
-
-
-

Functions

-
-
-def generate_embeddings(model: str, text: collections.abc.Sequence[str]) ‑> LLMEmbeddingsResult -
-
-

Generate embeddings for the supplied list of text

-
- -Expand source code - -
def generate_embeddings(model: str, text: Sequence[str]) -> LLMEmbeddingsResult:
-    """Generate embeddings for the supplied list of text"""
-    raise NotImplementedError
-
-
-
-def llm_infer(model: str, prompt: str, options: Optional[LLMInferencingParams]) ‑> LLMInferencingResult -
-
-

Perform inferencing using the provided model and prompt with the given optional params

-
- -Expand source code - -
def llm_infer(model: str, prompt: str, options: Optional[LLMInferencingParams]) -> LLMInferencingResult:
-    """Perform inferencing using the provided model and prompt with the given optional params"""
-    raise NotImplementedError
-
-
-
-
-
-

Classes

-
-
-class LLMEmbeddingsResult -(embeddings: collections.abc.Sequence[collections.abc.Sequence[float]], usage: LLMEmbeddingsUsage) -
-
-

An embedding result.

-

Attributes

-
-
embeddings : Sequence[Sequence[float]]
-
 
-
usage : LLMEmbeddingsUsage
-
Usage information related to the embeddings result.
-
-
- -Expand source code - -
@dataclass
-class LLMEmbeddingsResult:
-    """An embedding result.
-
-    Attributes:
-        embeddings (Sequence[Sequence[float]]): 
-        usage (LLMEmbeddingsUsage): Usage information related to the embeddings result.
-
-    """
-    embeddings: Sequence[Sequence[float]]
-    usage: LLMEmbeddingsUsage
-
-

Class variables

-
-
var embeddings : collections.abc.Sequence[collections.abc.Sequence[float]]
-
-
-
-
var usageLLMEmbeddingsUsage
-
-
-
-
-
-
-class LLMEmbeddingsUsage -(prompt_token_count: int) -
-
-

Usage information related to an embedding result.

-

Attributes

-
-
prompt_token_count : int
-
Number of tokens in the prompt.
-
-
- -Expand source code - -
@dataclass
-class LLMEmbeddingsUsage:
-    """Usage information related to an embedding result.
-
-    Attributes:
-        prompt_token_count (int): Number of tokens in the prompt.
-
-    """
-    prompt_token_count: int
-
-

Class variables

-
-
var prompt_token_count : int
-
-
-
-
-
-
-class LLMInferencingParams -(max_tokens: int, repeat_penalty: float, repeat_penalty_last_n_token_count: int, temperature: float, top_k: int, top_p: int) -
-
-

Inference request parameters

-

Attributes

-
-
max_tokens : int
-
The maximum tokens that should be inferred.
-
repeat_penalty : float
-
The amount the model should avoid repeating tokens.
-
repeat_penalty_last_n_token_count : int
-
The number of tokens the model should apply the repeat penalty to.
-
temperature : float
-
The randomness with which the next token is selected.
-
-

top-k (int): The number of possible next tokens the model will choose from. -top-p: (float): The probability total of next tokens the model will choose from.

-
- -Expand source code - -
@dataclass
-class LLMInferencingParams:
-    """Inference request parameters
-
-    Attributes:
-        max_tokens (int): The maximum tokens that should be inferred.
-        repeat_penalty (float): The amount the model should avoid repeating tokens.
-        repeat_penalty_last_n_token_count (int): The number of tokens the model should apply the repeat penalty to.
-        temperature (float): The randomness with which the next token is selected.
-        top-k (int): The number of possible next tokens the model will choose from.
-        top-p: (float): The probability total of next tokens the model will choose from.
-
-    """
-    max_tokens: int
-    repeat_penalty: float
-    repeat_penalty_last_n_token_count: int
-    temperature: float
-    top_k: int
-    top_p: int
-
-

Class variables

-
-
var max_tokens : int
-
-
-
-
var repeat_penalty : float
-
-
-
-
var repeat_penalty_last_n_token_count : int
-
-
-
-
var temperature : float
-
-
-
-
var top_k : int
-
-
-
-
var top_p : int
-
-
-
-
-
-
-class LLMInferencingResult -(text: str, usage: LLMInferencingUsage) -
-
-

An inferencing result.

-

Attributes

-
-
text : str
-
The text generated by the model.
-
usage : LLMInferencingUsage
-
Usage information related to the inferencing result.
-
-
- -Expand source code - -
@dataclass
-class LLMInferencingResult:
-    """An inferencing result.
-
-    Attributes:
-        text (str): The text generated by the model.
-        usage (LLMInferencingUsage): Usage information related to the inferencing result.
-
-    """
-    text: str
-    usage: LLMInferencingUsage
-
-

Class variables

-
-
var text : str
-
-
-
-
var usageLLMInferencingUsage
-
-
-
-
-
-
-class LLMInferencingUsage -(prompt_token_count: int, generated_token_count: int) -
-
-

Usage information related to an inferencing result.

-

Attributes

-
-
prompt_token_count : int
-
Number of tokens in the prompt.
-
generated_token_count : int
-
Number of tokens generated by the inferencing operation.
-
-
- -Expand source code - -
@dataclass
-class LLMInferencingUsage:
-    """Usage information related to an inferencing result.
-
-    Attributes:
-        prompt_token_count (int): Number of tokens in the prompt.
-        generated_token_count (int): Number of tokens generated by the inferencing operation.
-
-    """
-    prompt_token_count: int
-    generated_token_count: int
-
-

Class variables

-
-
var generated_token_count : int
-
-
-
-
var prompt_token_count : int
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v1/spin_redis.html b/docs/v1/spin_redis.html deleted file mode 100644 index e049bf7..0000000 --- a/docs/v1/spin_redis.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - -spin_sdk.spin_redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.spin_redis

-
-
-

Module for interacting with a Redis database

-
- -Expand source code - -
"""Module for interacting with a Redis database"""
-
-from collections.abc import Sequence
-
-def redis_del(address: str, keys: Sequence[str]) -> int:
-    """Removes the specified keys. A key is ignored if it does not exist."""
-    raise NotImplementedError
-
-def redis_get(address: str, key: str) -> bytes:
-    """Get the value of a key."""
-    raise NotImplementedError
-
-def redis_incr(address: str, key: str) -> int:
-    """Increments the number stored at key by one.
-
-    If the key does not exist, it is set to 0 before performing the operation.
-
-    An `AssertionError` is raised if the key contains a value of the wrong type
-    or contains a string that can not be represented as integer.
-
-    """
-    raise NotImplementedError
-
-def redis_publish(address: str, channel: str, payload: bytes):
-    """Publish a Redis message to the specificed channel."""
-    raise NotImplementedError
-
-def redis_sadd(address: str, key: str, values: Sequence[str]) -> int:
-    """Add the specified `values` to the set named `key`, returning the number of newly-added values."""
-    raise NotImplementedError
-
-def redis_set(address: str, key: str, value: bytes):
-    """Set key to value. If key alreads holds a value, it is overwritten."""
-    raise NotImplementedError
-
-def redis_smembers(address: str, key: str) -> Sequence[str]:
-    """ Retrieve the contents of the set named `key`."""
-    raise NotImplementedError
-
-def redis_srem(address: str, key: str, values: Sequence[str]) -> int:
-    """Remove the specified `values` from the set named `key`, returning the number of newly-removed values."""
-    raise NotImplementedError
-
-def redis_execute(address: str, command: str, arguments: Sequence[int | bytes]) -> Sequence[int | bytes | str | None]:
-    """Execute an arbitrary Redis command and receive the result."""    
-    raise NotImplementedError
-
-
-
-
-
-
-
-

Functions

-
-
-def redis_del(address: str, keys: collections.abc.Sequence[str]) ‑> int -
-
-

Removes the specified keys. A key is ignored if it does not exist.

-
- -Expand source code - -
def redis_del(address: str, keys: Sequence[str]) -> int:
-    """Removes the specified keys. A key is ignored if it does not exist."""
-    raise NotImplementedError
-
-
-
-def redis_execute(address: str, command: str, arguments: collections.abc.Sequence[int | bytes]) ‑> collections.abc.Sequence[int | bytes | str | None] -
-
-

Execute an arbitrary Redis command and receive the result.

-
- -Expand source code - -
def redis_execute(address: str, command: str, arguments: Sequence[int | bytes]) -> Sequence[int | bytes | str | None]:
-    """Execute an arbitrary Redis command and receive the result."""    
-    raise NotImplementedError
-
-
-
-def redis_get(address: str, key: str) ‑> bytes -
-
-

Get the value of a key.

-
- -Expand source code - -
def redis_get(address: str, key: str) -> bytes:
-    """Get the value of a key."""
-    raise NotImplementedError
-
-
-
-def redis_incr(address: str, key: str) ‑> int -
-
-

Increments the number stored at key by one.

-

If the key does not exist, it is set to 0 before performing the operation.

-

An AssertionError is raised if the key contains a value of the wrong type -or contains a string that can not be represented as integer.

-
- -Expand source code - -
def redis_incr(address: str, key: str) -> int:
-    """Increments the number stored at key by one.
-
-    If the key does not exist, it is set to 0 before performing the operation.
-
-    An `AssertionError` is raised if the key contains a value of the wrong type
-    or contains a string that can not be represented as integer.
-
-    """
-    raise NotImplementedError
-
-
-
-def redis_publish(address: str, channel: str, payload: bytes) -
-
-

Publish a Redis message to the specificed channel.

-
- -Expand source code - -
def redis_publish(address: str, channel: str, payload: bytes):
-    """Publish a Redis message to the specificed channel."""
-    raise NotImplementedError
-
-
-
-def redis_sadd(address: str, key: str, values: collections.abc.Sequence[str]) ‑> int -
-
-

Add the specified values to the set named key, returning the number of newly-added values.

-
- -Expand source code - -
def redis_sadd(address: str, key: str, values: Sequence[str]) -> int:
-    """Add the specified `values` to the set named `key`, returning the number of newly-added values."""
-    raise NotImplementedError
-
-
-
-def redis_set(address: str, key: str, value: bytes) -
-
-

Set key to value. If key alreads holds a value, it is overwritten.

-
- -Expand source code - -
def redis_set(address: str, key: str, value: bytes):
-    """Set key to value. If key alreads holds a value, it is overwritten."""
-    raise NotImplementedError
-
-
-
-def redis_smembers(address: str, key: str) ‑> collections.abc.Sequence[str] -
-
-

Retrieve the contents of the set named key.

-
- -Expand source code - -
def redis_smembers(address: str, key: str) -> Sequence[str]:
-    """ Retrieve the contents of the set named `key`."""
-    raise NotImplementedError
-
-
-
-def redis_srem(address: str, key: str, values: collections.abc.Sequence[str]) ‑> int -
-
-

Remove the specified values from the set named key, returning the number of newly-removed values.

-
- -Expand source code - -
def redis_srem(address: str, key: str, values: Sequence[str]) -> int:
-    """Remove the specified `values` from the set named `key`, returning the number of newly-removed values."""
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v1/spin_sqlite.html b/docs/v1/spin_sqlite.html deleted file mode 100644 index a68e353..0000000 --- a/docs/v1/spin_sqlite.html +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - -spin_sdk.spin_sqlite API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.spin_sqlite

-
-
-

Module for interacting with an SQLite database

-
- -Expand source code - -
"""Module for interacting with an SQLite database"""
-
-from collections.abc import Sequence
-
-class QueryResult:
-    """The result of a query"""
-    
-    def rows(self) -> Sequence[Sequence[int | float | str | bytes | None]]:
-        """The row results, each of which contains the values for all the columns in that row"""
-        raise NotImplementedError
-
-    def columns(self) -> Sequence[str]:
-        """The names of the columns retrieved in the query"""
-        raise NotImplementedError
-
-class SqliteConnection:
-    """Represents an open connection to an SQLite database"""
-    
-    def execute(self, query: str, parameters: Sequence[int | float | str | bytes | None]) -> QueryResult:
-        """Execute the specified statement"""
-        raise NotImplementedError
-
-def sqlite_open(database: str) -> SqliteConnection:
-    """Open a connection to a named database instance.
-
-    If `database` is "default", the default instance is opened.
-
-    An `AssertionError` will be raised if the `name` is not recognized.
-
-    """
-    raise NotImplementedError
-
-def sqlite_open_default() -> SqliteConnection:
-    """Open a connection to the default database"""
-    raise NotImplementedError
-
-
-
-
-
-
-
-

Functions

-
-
-def sqlite_open(database: str) ‑> SqliteConnection -
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

An AssertionError will be raised if the name is not recognized.

-
- -Expand source code - -
def sqlite_open(database: str) -> SqliteConnection:
-    """Open a connection to a named database instance.
-
-    If `database` is "default", the default instance is opened.
-
-    An `AssertionError` will be raised if the `name` is not recognized.
-
-    """
-    raise NotImplementedError
-
-
-
-def sqlite_open_default() ‑> SqliteConnection -
-
-

Open a connection to the default database

-
- -Expand source code - -
def sqlite_open_default() -> SqliteConnection:
-    """Open a connection to the default database"""
-    raise NotImplementedError
-
-
-
-
-
-

Classes

-
-
-class QueryResult -
-
-

The result of a query

-
- -Expand source code - -
class QueryResult:
-    """The result of a query"""
-    
-    def rows(self) -> Sequence[Sequence[int | float | str | bytes | None]]:
-        """The row results, each of which contains the values for all the columns in that row"""
-        raise NotImplementedError
-
-    def columns(self) -> Sequence[str]:
-        """The names of the columns retrieved in the query"""
-        raise NotImplementedError
-
-

Methods

-
-
-def columns(self) ‑> collections.abc.Sequence[str] -
-
-

The names of the columns retrieved in the query

-
- -Expand source code - -
def columns(self) -> Sequence[str]:
-    """The names of the columns retrieved in the query"""
-    raise NotImplementedError
-
-
-
-def rows(self) ‑> collections.abc.Sequence[collections.abc.Sequence[int | float | str | bytes | None]] -
-
-

The row results, each of which contains the values for all the columns in that row

-
- -Expand source code - -
def rows(self) -> Sequence[Sequence[int | float | str | bytes | None]]:
-    """The row results, each of which contains the values for all the columns in that row"""
-    raise NotImplementedError
-
-
-
-
-
-class SqliteConnection -
-
-

Represents an open connection to an SQLite database

-
- -Expand source code - -
class SqliteConnection:
-    """Represents an open connection to an SQLite database"""
-    
-    def execute(self, query: str, parameters: Sequence[int | float | str | bytes | None]) -> QueryResult:
-        """Execute the specified statement"""
-        raise NotImplementedError
-
-

Methods

-
-
-def execute(self, query: str, parameters: collections.abc.Sequence[int | float | str | bytes | None]) ‑> QueryResult -
-
-

Execute the specified statement

-
- -Expand source code - -
def execute(self, query: str, parameters: Sequence[int | float | str | bytes | None]) -> QueryResult:
-    """Execute the specified statement"""
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/http/index.html b/docs/v2/http/index.html deleted file mode 100644 index 3f71247..0000000 --- a/docs/v2/http/index.html +++ /dev/null @@ -1,612 +0,0 @@ - - - - - - -spin_sdk.http API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.http

-
-
-

Module with helpers for wasi http

-
- -Expand source code - -
"""Module with helpers for wasi http"""
-
-import traceback
-
-from spin_sdk.wit import exports
-from spin_sdk.wit.types import Ok, Err
-from spin_sdk.wit.imports import types, outgoing_handler
-from spin_sdk.wit.imports.types import (
-    Method, MethodGet, MethodHead, MethodPost, MethodPut, MethodDelete, MethodConnect, MethodOptions, MethodTrace,
-    MethodPatch, MethodOther, IncomingRequest, IncomingBody, ResponseOutparam, OutgoingResponse, Fields, Scheme,
-    SchemeHttp, SchemeHttps, SchemeOther, OutgoingRequest, OutgoingBody
-)
-from spin_sdk.wit.imports.streams import StreamErrorClosed
-from dataclasses import dataclass
-from collections.abc import Mapping
-from typing import Optional
-from urllib import parse
-
-@dataclass
-class Request:
-    """An HTTP request"""
-    method: str
-    uri: str
-    headers: Mapping[str, str]
-    body: Optional[bytes]
-
-@dataclass
-class Response:
-    """An HTTP response"""
-    status: int
-    headers: Mapping[str, str]
-    body: Optional[bytes]
-
-class IncomingHandler(exports.IncomingHandler):
-    """Simplified handler for incoming HTTP requests using blocking, buffered I/O."""
-    
-    def handle_request(self, request: Request) -> Response:
-        """Handle an incoming HTTP request and return a response or raise an error"""
-        raise NotImplementedError
-    
-    def handle(self, request: IncomingRequest, response_out: ResponseOutparam):
-        method = request.method()
-
-        if isinstance(method, MethodGet):
-            method_str = "GET"
-        elif isinstance(method, MethodHead):
-            method_str = "HEAD"
-        elif isinstance(method, MethodPost):
-            method_str = "POST"
-        elif isinstance(method, MethodPut):
-            method_str = "PUT"
-        elif isinstance(method, MethodDelete):
-            method_str = "DELETE"
-        elif isinstance(method, MethodConnect):
-            method_str = "CONNECT"
-        elif isinstance(method, MethodOptions):
-            method_str = "OPTIONS"
-        elif isinstance(method, MethodTrace):
-            method_str = "TRACE"
-        elif isinstance(method, MethodPatch):
-            method_str = "PATCH"
-        elif isinstance(method, MethodOther):
-            method_str = method.value
-        else:
-            raise AssertionError
-
-        request_body = request.consume()
-        request_stream = request_body.stream()
-        body = bytearray()
-        while True:
-            try:
-                body += request_stream.blocking_read(16 * 1024)
-            except Err as e:
-                if isinstance(e.value, StreamErrorClosed):
-                    request_stream.__exit__()
-                    IncomingBody.finish(request_body)
-                    break
-                else:
-                    raise e
-
-        request_uri = request.path_with_query()
-        if request_uri is None:
-            uri = "/"
-        else:
-            uri = request_uri
-
-        try:
-            simple_response = self.handle_request(Request(
-                method_str,
-                uri,
-                dict(map(lambda pair: (pair[0], str(pair[1], "utf-8")), request.headers().entries())),
-                bytes(body)
-            ))
-        except:
-            traceback.print_exc()
-
-            response = OutgoingResponse(Fields())
-            response.set_status_code(500)
-            ResponseOutparam.set(response_out, Ok(response))
-            return
-
-        response = OutgoingResponse(Fields.from_list(list(map(
-            lambda pair: (pair[0], bytes(pair[1], "utf-8")),
-            simple_response.headers.items()
-        ))))
-        response_body = response.body()
-        response.set_status_code(simple_response.status)
-        ResponseOutparam.set(response_out, Ok(response))
-        response_stream = response_body.write()
-        if simple_response.body is not None:
-            MAX_BLOCKING_WRITE_SIZE = 4096
-            offset = 0
-            while offset < len(simple_response.body):
-                count = min(len(simple_response.body) - offset, MAX_BLOCKING_WRITE_SIZE)
-                response_stream.blocking_write_and_flush(simple_response.body[offset:offset+count])
-                offset += count
-        response_stream.__exit__()
-        OutgoingBody.finish(response_body, None)
-    
-def send(request: Request) -> Response:
-    """Send an HTTP request and return a response or raise an error"""
-
-    match request.method:
-        case "GET":
-            method: Method = MethodGet()
-        case "HEAD":
-            method = MethodHead()
-        case "POST":
-            method = MethodPost()
-        case "PUT":
-            method = MethodPut()
-        case "DELETE":
-            method = MethodDelete()
-        case "CONNECT":
-            method = MethodConnect()
-        case "OPTIONS":
-            method = MethodOptions()
-        case "TRACE":
-            method = MethodTrace()
-        case "PATCH":
-            method = MethodPatch()
-        case _:
-            method = MethodOther(request.method)
-    
-    url_parsed = parse.urlparse(request.uri)
-
-    match url_parsed.scheme:
-        case "http":
-            scheme: Scheme = SchemeHttp()
-        case "https":
-            scheme = SchemeHttps()
-        case _:
-            scheme = SchemeOther(url_parsed.scheme)
-
-    outgoing_request = OutgoingRequest(Fields.from_list(list(map(
-        lambda pair: (pair[0], bytes(pair[1], "utf-8")),
-        request.headers.items()
-    ))))
-    outgoing_request.set_method(method)
-    outgoing_request.set_scheme(scheme)
-    outgoing_request.set_authority(url_parsed.netloc)
-    outgoing_request.set_path_with_query(url_parsed.path)
-
-    if request.body is not None:
-        raise NotImplementedError("todo: handle outgoing request bodies")
-
-    future = outgoing_handler.handle(outgoing_request, None)
-    pollable = future.subscribe()
-
-    while True:
-        response = future.get()
-        if response is None:
-            pollable.block()
-        else:
-            pollable.__exit__()
-            future.__exit__()
-            
-            if isinstance(response, Ok):
-                if isinstance(response.value, Ok):
-                    response_value = response.value.value
-                    response_body = response_value.consume()
-                    response_stream = response_body.stream()
-                    body = bytearray()
-                    while True:
-                        try:
-                            body += response_stream.blocking_read(16 * 1024)
-                        except Err as e:
-                            if isinstance(e.value, StreamErrorClosed):
-                                response_stream.__exit__()
-                                IncomingBody.finish(response_body)
-                                simple_response = Response(
-                                    response_value.status(),
-                                    dict(map(
-                                        lambda pair: (pair[0], str(pair[1], "utf-8")),
-                                        response_value.headers().entries()
-                                    )),
-                                    bytes(body)
-                                )
-                                response_value.__exit__()
-                                return simple_response
-                            else:
-                                raise e
-                else:
-                    raise response.value
-            else:
-                raise response
-
-
-
-

Sub-modules

-
-
spin_sdk.http.poll_loop
-
-

Defines a custom asyncio event loop backed by wasi:io/poll#poll

-
-
-
-
-
-
-

Functions

-
-
-def send(request: Request) ‑> Response -
-
-

Send an HTTP request and return a response or raise an error

-
- -Expand source code - -
def send(request: Request) -> Response:
-    """Send an HTTP request and return a response or raise an error"""
-
-    match request.method:
-        case "GET":
-            method: Method = MethodGet()
-        case "HEAD":
-            method = MethodHead()
-        case "POST":
-            method = MethodPost()
-        case "PUT":
-            method = MethodPut()
-        case "DELETE":
-            method = MethodDelete()
-        case "CONNECT":
-            method = MethodConnect()
-        case "OPTIONS":
-            method = MethodOptions()
-        case "TRACE":
-            method = MethodTrace()
-        case "PATCH":
-            method = MethodPatch()
-        case _:
-            method = MethodOther(request.method)
-    
-    url_parsed = parse.urlparse(request.uri)
-
-    match url_parsed.scheme:
-        case "http":
-            scheme: Scheme = SchemeHttp()
-        case "https":
-            scheme = SchemeHttps()
-        case _:
-            scheme = SchemeOther(url_parsed.scheme)
-
-    outgoing_request = OutgoingRequest(Fields.from_list(list(map(
-        lambda pair: (pair[0], bytes(pair[1], "utf-8")),
-        request.headers.items()
-    ))))
-    outgoing_request.set_method(method)
-    outgoing_request.set_scheme(scheme)
-    outgoing_request.set_authority(url_parsed.netloc)
-    outgoing_request.set_path_with_query(url_parsed.path)
-
-    if request.body is not None:
-        raise NotImplementedError("todo: handle outgoing request bodies")
-
-    future = outgoing_handler.handle(outgoing_request, None)
-    pollable = future.subscribe()
-
-    while True:
-        response = future.get()
-        if response is None:
-            pollable.block()
-        else:
-            pollable.__exit__()
-            future.__exit__()
-            
-            if isinstance(response, Ok):
-                if isinstance(response.value, Ok):
-                    response_value = response.value.value
-                    response_body = response_value.consume()
-                    response_stream = response_body.stream()
-                    body = bytearray()
-                    while True:
-                        try:
-                            body += response_stream.blocking_read(16 * 1024)
-                        except Err as e:
-                            if isinstance(e.value, StreamErrorClosed):
-                                response_stream.__exit__()
-                                IncomingBody.finish(response_body)
-                                simple_response = Response(
-                                    response_value.status(),
-                                    dict(map(
-                                        lambda pair: (pair[0], str(pair[1], "utf-8")),
-                                        response_value.headers().entries()
-                                    )),
-                                    bytes(body)
-                                )
-                                response_value.__exit__()
-                                return simple_response
-                            else:
-                                raise e
-                else:
-                    raise response.value
-            else:
-                raise response
-
-
-
-
-
-

Classes

-
-
-class IncomingHandler -(*args, **kwargs) -
-
-

Simplified handler for incoming HTTP requests using blocking, buffered I/O.

-
- -Expand source code - -
class IncomingHandler(exports.IncomingHandler):
-    """Simplified handler for incoming HTTP requests using blocking, buffered I/O."""
-    
-    def handle_request(self, request: Request) -> Response:
-        """Handle an incoming HTTP request and return a response or raise an error"""
-        raise NotImplementedError
-    
-    def handle(self, request: IncomingRequest, response_out: ResponseOutparam):
-        method = request.method()
-
-        if isinstance(method, MethodGet):
-            method_str = "GET"
-        elif isinstance(method, MethodHead):
-            method_str = "HEAD"
-        elif isinstance(method, MethodPost):
-            method_str = "POST"
-        elif isinstance(method, MethodPut):
-            method_str = "PUT"
-        elif isinstance(method, MethodDelete):
-            method_str = "DELETE"
-        elif isinstance(method, MethodConnect):
-            method_str = "CONNECT"
-        elif isinstance(method, MethodOptions):
-            method_str = "OPTIONS"
-        elif isinstance(method, MethodTrace):
-            method_str = "TRACE"
-        elif isinstance(method, MethodPatch):
-            method_str = "PATCH"
-        elif isinstance(method, MethodOther):
-            method_str = method.value
-        else:
-            raise AssertionError
-
-        request_body = request.consume()
-        request_stream = request_body.stream()
-        body = bytearray()
-        while True:
-            try:
-                body += request_stream.blocking_read(16 * 1024)
-            except Err as e:
-                if isinstance(e.value, StreamErrorClosed):
-                    request_stream.__exit__()
-                    IncomingBody.finish(request_body)
-                    break
-                else:
-                    raise e
-
-        request_uri = request.path_with_query()
-        if request_uri is None:
-            uri = "/"
-        else:
-            uri = request_uri
-
-        try:
-            simple_response = self.handle_request(Request(
-                method_str,
-                uri,
-                dict(map(lambda pair: (pair[0], str(pair[1], "utf-8")), request.headers().entries())),
-                bytes(body)
-            ))
-        except:
-            traceback.print_exc()
-
-            response = OutgoingResponse(Fields())
-            response.set_status_code(500)
-            ResponseOutparam.set(response_out, Ok(response))
-            return
-
-        response = OutgoingResponse(Fields.from_list(list(map(
-            lambda pair: (pair[0], bytes(pair[1], "utf-8")),
-            simple_response.headers.items()
-        ))))
-        response_body = response.body()
-        response.set_status_code(simple_response.status)
-        ResponseOutparam.set(response_out, Ok(response))
-        response_stream = response_body.write()
-        if simple_response.body is not None:
-            MAX_BLOCKING_WRITE_SIZE = 4096
-            offset = 0
-            while offset < len(simple_response.body):
-                count = min(len(simple_response.body) - offset, MAX_BLOCKING_WRITE_SIZE)
-                response_stream.blocking_write_and_flush(simple_response.body[offset:offset+count])
-                offset += count
-        response_stream.__exit__()
-        OutgoingBody.finish(response_body, None)
-
-

Ancestors

- -

Methods

-
-
-def handle_request(self, request: Request) ‑> Response -
-
-

Handle an incoming HTTP request and return a response or raise an error

-
- -Expand source code - -
def handle_request(self, request: Request) -> Response:
-    """Handle an incoming HTTP request and return a response or raise an error"""
-    raise NotImplementedError
-
-
-
-

Inherited members

- -
-
-class Request -(method: str, uri: str, headers: collections.abc.Mapping[str, str], body: Optional[bytes]) -
-
-

An HTTP request

-
- -Expand source code - -
@dataclass
-class Request:
-    """An HTTP request"""
-    method: str
-    uri: str
-    headers: Mapping[str, str]
-    body: Optional[bytes]
-
-

Class variables

-
-
var body : Optional[bytes]
-
-
-
-
var headers : collections.abc.Mapping[str, str]
-
-
-
-
var method : str
-
-
-
-
var uri : str
-
-
-
-
-
-
-class Response -(status: int, headers: collections.abc.Mapping[str, str], body: Optional[bytes]) -
-
-

An HTTP response

-
- -Expand source code - -
@dataclass
-class Response:
-    """An HTTP response"""
-    status: int
-    headers: Mapping[str, str]
-    body: Optional[bytes]
-
-

Class variables

-
-
var body : Optional[bytes]
-
-
-
-
var headers : collections.abc.Mapping[str, str]
-
-
-
-
var status : int
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/http/poll_loop.html b/docs/v2/http/poll_loop.html deleted file mode 100644 index 64a28f2..0000000 --- a/docs/v2/http/poll_loop.html +++ /dev/null @@ -1,1899 +0,0 @@ - - - - - - -spin_sdk.http.poll_loop API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.http.poll_loop

-
-
-

Defines a custom asyncio event loop backed by wasi:io/poll#poll.

-

This also includes helper classes and functions for working with wasi:http.

-

As of WASI Preview 2, there is not yet a standard for first-class, composable -asynchronous functions and streams. -We expect that little or none of this -boilerplate will be needed once those features arrive in Preview 3.

-
- -Expand source code - -
"""Defines a custom `asyncio` event loop backed by `wasi:io/poll#poll`.
-
-This also includes helper classes and functions for working with `wasi:http`.
-
-As of WASI Preview 2, there is not yet a standard for first-class, composable
-asynchronous functions and streams.  We expect that little or none of this
-boilerplate will be needed once those features arrive in Preview 3.
-"""
-
-import asyncio
-import socket
-import subprocess
-
-from spin_sdk.wit.types import Ok, Err
-from spin_sdk.wit.imports import types, streams, poll, outgoing_handler
-from spin_sdk.wit.imports.types import IncomingBody, OutgoingBody, OutgoingRequest, IncomingResponse
-from spin_sdk.wit.imports.streams import StreamErrorClosed, InputStream
-from spin_sdk.wit.imports.poll import Pollable
-from typing import Optional, cast
-
-# Maximum number of bytes to read at a time
-READ_SIZE: int = 16 * 1024
-
-async def send(request: OutgoingRequest) -> IncomingResponse:
-    """Send the specified request and wait asynchronously for the response."""
-    
-    future = outgoing_handler.handle(request, None)
-
-    while True:
-        response = future.get()
-        if response is None:
-            await register(cast(PollLoop, asyncio.get_event_loop()), future.subscribe())
-        else:
-            future.__exit__()
-            
-            if isinstance(response, Ok):
-                if isinstance(response.value, Ok):
-                    return response.value.value
-                else:
-                    raise response.value
-            else:
-                raise response
-
-class Stream:
-    """Reader abstraction over `wasi:http/types#incoming-body`."""
-    def __init__(self, body: IncomingBody):
-        self.body: Optional[IncomingBody] = body
-        self.stream: Optional[InputStream] = body.stream()
-
-    async def next(self) -> Optional[bytes]:
-        """Wait for the next chunk of data to arrive on the stream.
-
-        This will return `None` when the end of the stream has been reached.
-        """
-        while True:
-            try:
-                if self.stream is None:
-                    return None
-                else:
-                    buffer = self.stream.read(READ_SIZE)
-                    if len(buffer) == 0:
-                        await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-                    else:
-                        return buffer
-            except Err as e:
-                if isinstance(e.value, StreamErrorClosed):
-                    if self.stream is not None:
-                        self.stream.__exit__()
-                        self.stream = None
-                    if self.body is not None:
-                        IncomingBody.finish(self.body)
-                        self.body = None
-                else:
-                    raise e
-
-class Sink:
-    """Writer abstraction over `wasi-http/types#outgoing-body`."""
-    def __init__(self, body: OutgoingBody):
-        self.body = body
-        self.stream = body.write()
-
-    async def send(self, chunk: bytes):
-        """Write the specified bytes to the sink.
-
-        This may need to yield according to the backpressure requirements of the sink.
-        """
-        offset = 0
-        flushing = False
-        while True:
-            count = self.stream.check_write()
-            if count == 0:
-                await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-            elif offset == len(chunk):
-                if flushing:
-                    return
-                else:
-                    self.stream.flush()
-                    flushing = True
-            else:
-                count = min(count, len(chunk) - offset)
-                self.stream.write(chunk[offset:offset+count])
-                offset += count
-
-    def close(self):
-        """Close the stream, indicating no further data will be written."""
-
-        self.stream.__exit__()
-        self.stream = None
-        OutgoingBody.finish(self.body, None)
-        self.body = None
-        
-class PollLoop(asyncio.AbstractEventLoop):
-    """Custom `asyncio` event loop backed by `wasi:io/poll#poll`."""
-    
-    def __init__(self):
-        self.wakers = []
-        self.running = False
-        self.handles = []
-        self.exception = None
-
-    def get_debug(self):
-        return False
-
-    def run_until_complete(self, future):
-        future = asyncio.ensure_future(future, loop=self)
-
-        self.running = True
-        asyncio.events._set_running_loop(self)
-        while self.running and not future.done():
-            handle = self.handles[0]
-            self.handles = self.handles[1:]
-            if not handle._cancelled:
-                handle._run()
-                
-            if self.wakers:
-                [pollables, wakers] = list(map(list, zip(*self.wakers)))
-                
-                new_wakers = []
-                ready = [False] * len(pollables)
-                for index in poll.poll(pollables):
-                    ready[index] = True
-                
-                for (ready, pollable), waker in zip(zip(ready, pollables), wakers):
-                    if ready:
-                        pollable.__exit__()
-                        waker.set_result(None)
-                    else:
-                        new_wakers.append((pollable, waker))
-
-                self.wakers = new_wakers
-
-            if self.exception is not None:
-                raise self.exception
-            
-        future.result()
-
-    def is_running(self):
-        return self.running
-
-    def is_closed(self):
-        return not self.running
-
-    def stop(self):
-        self.running = False
-
-    def close(self):
-        self.running = False
-
-    def shutdown_asyncgens(self):
-        pass
-
-    def call_exception_handler(self, context):
-        self.exception = context.get('exception', None)
-
-    def call_soon(self, callback, *args, context=None):
-        handle = asyncio.Handle(callback, args, self, context)
-        self.handles.append(handle)
-        return handle
-
-    def create_task(self, coroutine):
-        return asyncio.Task(coroutine, loop=self)
-
-    def create_future(self):
-        return asyncio.Future(loop=self)
-
-    # The remaining methods should be irrelevant for our purposes and thus unimplemented
-
-    def run_forever(self):
-        raise NotImplementedError
-
-    async def shutdown_default_executor(self):
-        raise NotImplementedError
-
-    def _timer_handle_cancelled(self, handle):
-        raise NotImplementedError
-
-    def call_later(self, delay, callback, *args, context=None):
-        raise NotImplementedError
-
-    def call_at(self, when, callback, *args, context=None):
-        raise NotImplementedError
-
-    def time(self):
-        raise NotImplementedError
-
-    def call_soon_threadsafe(self, callback, *args, context=None):
-        raise NotImplementedError
-
-    def run_in_executor(self, executor, func, *args):
-        raise NotImplementedError
-
-    def set_default_executor(self, executor):
-        raise NotImplementedError
-
-    async def getaddrinfo(self, host, port, *,
-                          family=0, type=0, proto=0, flags=0):
-        raise NotImplementedError
-
-    async def getnameinfo(self, sockaddr, flags=0):
-        raise NotImplementedError
-
-    async def create_connection(
-            self, protocol_factory, host=None, port=None,
-            *, ssl=None, family=0, proto=0,
-            flags=0, sock=None, local_addr=None,
-            server_hostname=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            happy_eyeballs_delay=None, interleave=None):
-        raise NotImplementedError
-
-    async def create_server(
-            self, protocol_factory, host=None, port=None,
-            *, family=socket.AF_UNSPEC,
-            flags=socket.AI_PASSIVE, sock=None, backlog=100,
-            ssl=None, reuse_address=None, reuse_port=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            start_serving=True):
-        raise NotImplementedError
-
-    async def sendfile(self, transport, file, offset=0, count=None,
-                       *, fallback=True):
-        raise NotImplementedError
-
-    async def start_tls(self, transport, protocol, sslcontext, *,
-                        server_side=False,
-                        server_hostname=None,
-                        ssl_handshake_timeout=None,
-                        ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_unix_connection(
-            self, protocol_factory, path=None, *,
-            ssl=None, sock=None,
-            server_hostname=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_unix_server(
-            self, protocol_factory, path=None, *,
-            sock=None, backlog=100, ssl=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            start_serving=True):
-        raise NotImplementedError
-
-    async def connect_accepted_socket(
-            self, protocol_factory, sock,
-            *, ssl=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_datagram_endpoint(self, protocol_factory,
-                                       local_addr=None, remote_addr=None, *,
-                                       family=0, proto=0, flags=0,
-                                       reuse_address=None, reuse_port=None,
-                                       allow_broadcast=None, sock=None):
-        raise NotImplementedError
-
-    async def connect_read_pipe(self, protocol_factory, pipe):
-        raise NotImplementedError
-
-    async def connect_write_pipe(self, protocol_factory, pipe):
-        raise NotImplementedError
-
-    async def subprocess_shell(self, protocol_factory, cmd, *,
-                               stdin=subprocess.PIPE,
-                               stdout=subprocess.PIPE,
-                               stderr=subprocess.PIPE,
-                               **kwargs):
-        raise NotImplementedError
-
-    async def subprocess_exec(self, protocol_factory, *args,
-                              stdin=subprocess.PIPE,
-                              stdout=subprocess.PIPE,
-                              stderr=subprocess.PIPE,
-                              **kwargs):
-        raise NotImplementedError
-
-    def add_reader(self, fd, callback, *args):
-        raise NotImplementedError
-
-    def remove_reader(self, fd):
-        raise NotImplementedError
-
-    def add_writer(self, fd, callback, *args):
-        raise NotImplementedError
-
-    def remove_writer(self, fd):
-        raise NotImplementedError
-
-    async def sock_recv(self, sock, nbytes):
-        raise NotImplementedError
-
-    async def sock_recv_into(self, sock, buf):
-        raise NotImplementedError
-
-    async def sock_recvfrom(self, sock, bufsize):
-        raise NotImplementedError
-
-    async def sock_recvfrom_into(self, sock, buf, nbytes=0):
-        raise NotImplementedError
-
-    async def sock_sendall(self, sock, data):
-        raise NotImplementedError
-
-    async def sock_sendto(self, sock, data, address):
-        raise NotImplementedError
-
-    async def sock_connect(self, sock, address):
-        raise NotImplementedError
-
-    async def sock_accept(self, sock):
-        raise NotImplementedError
-
-    async def sock_sendfile(self, sock, file, offset=0, count=None,
-                            *, fallback=None):
-        raise NotImplementedError
-
-    def add_signal_handler(self, sig, callback, *args):
-        raise NotImplementedError
-
-    def remove_signal_handler(self, sig):
-        raise NotImplementedError
-
-    def set_task_factory(self, factory):
-        raise NotImplementedError
-
-    def get_task_factory(self):
-        raise NotImplementedError
-
-    def get_exception_handler(self):
-        raise NotImplementedError
-
-    def set_exception_handler(self, handler):
-        raise NotImplementedError
-
-    def default_exception_handler(self, context):
-        raise NotImplementedError
-
-    def set_debug(self, enabled):
-        raise NotImplementedError
-
-async def register(loop: PollLoop, pollable: Pollable):
-    waker = loop.create_future()
-    loop.wakers.append((pollable, waker))
-    await waker
-
-
-
-
-
-
-
-

Functions

-
-
-async def register(loop: PollLoop, pollable: Pollable) -
-
-
-
- -Expand source code - -
async def register(loop: PollLoop, pollable: Pollable):
-    waker = loop.create_future()
-    loop.wakers.append((pollable, waker))
-    await waker
-
-
-
-async def send(request: OutgoingRequest) ‑> IncomingResponse -
-
-

Send the specified request and wait asynchronously for the response.

-
- -Expand source code - -
async def send(request: OutgoingRequest) -> IncomingResponse:
-    """Send the specified request and wait asynchronously for the response."""
-    
-    future = outgoing_handler.handle(request, None)
-
-    while True:
-        response = future.get()
-        if response is None:
-            await register(cast(PollLoop, asyncio.get_event_loop()), future.subscribe())
-        else:
-            future.__exit__()
-            
-            if isinstance(response, Ok):
-                if isinstance(response.value, Ok):
-                    return response.value.value
-                else:
-                    raise response.value
-            else:
-                raise response
-
-
-
-
-
-

Classes

-
-
-class PollLoop -
-
-

Custom asyncio event loop backed by wasi:io/poll#poll.

-
- -Expand source code - -
class PollLoop(asyncio.AbstractEventLoop):
-    """Custom `asyncio` event loop backed by `wasi:io/poll#poll`."""
-    
-    def __init__(self):
-        self.wakers = []
-        self.running = False
-        self.handles = []
-        self.exception = None
-
-    def get_debug(self):
-        return False
-
-    def run_until_complete(self, future):
-        future = asyncio.ensure_future(future, loop=self)
-
-        self.running = True
-        asyncio.events._set_running_loop(self)
-        while self.running and not future.done():
-            handle = self.handles[0]
-            self.handles = self.handles[1:]
-            if not handle._cancelled:
-                handle._run()
-                
-            if self.wakers:
-                [pollables, wakers] = list(map(list, zip(*self.wakers)))
-                
-                new_wakers = []
-                ready = [False] * len(pollables)
-                for index in poll.poll(pollables):
-                    ready[index] = True
-                
-                for (ready, pollable), waker in zip(zip(ready, pollables), wakers):
-                    if ready:
-                        pollable.__exit__()
-                        waker.set_result(None)
-                    else:
-                        new_wakers.append((pollable, waker))
-
-                self.wakers = new_wakers
-
-            if self.exception is not None:
-                raise self.exception
-            
-        future.result()
-
-    def is_running(self):
-        return self.running
-
-    def is_closed(self):
-        return not self.running
-
-    def stop(self):
-        self.running = False
-
-    def close(self):
-        self.running = False
-
-    def shutdown_asyncgens(self):
-        pass
-
-    def call_exception_handler(self, context):
-        self.exception = context.get('exception', None)
-
-    def call_soon(self, callback, *args, context=None):
-        handle = asyncio.Handle(callback, args, self, context)
-        self.handles.append(handle)
-        return handle
-
-    def create_task(self, coroutine):
-        return asyncio.Task(coroutine, loop=self)
-
-    def create_future(self):
-        return asyncio.Future(loop=self)
-
-    # The remaining methods should be irrelevant for our purposes and thus unimplemented
-
-    def run_forever(self):
-        raise NotImplementedError
-
-    async def shutdown_default_executor(self):
-        raise NotImplementedError
-
-    def _timer_handle_cancelled(self, handle):
-        raise NotImplementedError
-
-    def call_later(self, delay, callback, *args, context=None):
-        raise NotImplementedError
-
-    def call_at(self, when, callback, *args, context=None):
-        raise NotImplementedError
-
-    def time(self):
-        raise NotImplementedError
-
-    def call_soon_threadsafe(self, callback, *args, context=None):
-        raise NotImplementedError
-
-    def run_in_executor(self, executor, func, *args):
-        raise NotImplementedError
-
-    def set_default_executor(self, executor):
-        raise NotImplementedError
-
-    async def getaddrinfo(self, host, port, *,
-                          family=0, type=0, proto=0, flags=0):
-        raise NotImplementedError
-
-    async def getnameinfo(self, sockaddr, flags=0):
-        raise NotImplementedError
-
-    async def create_connection(
-            self, protocol_factory, host=None, port=None,
-            *, ssl=None, family=0, proto=0,
-            flags=0, sock=None, local_addr=None,
-            server_hostname=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            happy_eyeballs_delay=None, interleave=None):
-        raise NotImplementedError
-
-    async def create_server(
-            self, protocol_factory, host=None, port=None,
-            *, family=socket.AF_UNSPEC,
-            flags=socket.AI_PASSIVE, sock=None, backlog=100,
-            ssl=None, reuse_address=None, reuse_port=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            start_serving=True):
-        raise NotImplementedError
-
-    async def sendfile(self, transport, file, offset=0, count=None,
-                       *, fallback=True):
-        raise NotImplementedError
-
-    async def start_tls(self, transport, protocol, sslcontext, *,
-                        server_side=False,
-                        server_hostname=None,
-                        ssl_handshake_timeout=None,
-                        ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_unix_connection(
-            self, protocol_factory, path=None, *,
-            ssl=None, sock=None,
-            server_hostname=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_unix_server(
-            self, protocol_factory, path=None, *,
-            sock=None, backlog=100, ssl=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            start_serving=True):
-        raise NotImplementedError
-
-    async def connect_accepted_socket(
-            self, protocol_factory, sock,
-            *, ssl=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_datagram_endpoint(self, protocol_factory,
-                                       local_addr=None, remote_addr=None, *,
-                                       family=0, proto=0, flags=0,
-                                       reuse_address=None, reuse_port=None,
-                                       allow_broadcast=None, sock=None):
-        raise NotImplementedError
-
-    async def connect_read_pipe(self, protocol_factory, pipe):
-        raise NotImplementedError
-
-    async def connect_write_pipe(self, protocol_factory, pipe):
-        raise NotImplementedError
-
-    async def subprocess_shell(self, protocol_factory, cmd, *,
-                               stdin=subprocess.PIPE,
-                               stdout=subprocess.PIPE,
-                               stderr=subprocess.PIPE,
-                               **kwargs):
-        raise NotImplementedError
-
-    async def subprocess_exec(self, protocol_factory, *args,
-                              stdin=subprocess.PIPE,
-                              stdout=subprocess.PIPE,
-                              stderr=subprocess.PIPE,
-                              **kwargs):
-        raise NotImplementedError
-
-    def add_reader(self, fd, callback, *args):
-        raise NotImplementedError
-
-    def remove_reader(self, fd):
-        raise NotImplementedError
-
-    def add_writer(self, fd, callback, *args):
-        raise NotImplementedError
-
-    def remove_writer(self, fd):
-        raise NotImplementedError
-
-    async def sock_recv(self, sock, nbytes):
-        raise NotImplementedError
-
-    async def sock_recv_into(self, sock, buf):
-        raise NotImplementedError
-
-    async def sock_recvfrom(self, sock, bufsize):
-        raise NotImplementedError
-
-    async def sock_recvfrom_into(self, sock, buf, nbytes=0):
-        raise NotImplementedError
-
-    async def sock_sendall(self, sock, data):
-        raise NotImplementedError
-
-    async def sock_sendto(self, sock, data, address):
-        raise NotImplementedError
-
-    async def sock_connect(self, sock, address):
-        raise NotImplementedError
-
-    async def sock_accept(self, sock):
-        raise NotImplementedError
-
-    async def sock_sendfile(self, sock, file, offset=0, count=None,
-                            *, fallback=None):
-        raise NotImplementedError
-
-    def add_signal_handler(self, sig, callback, *args):
-        raise NotImplementedError
-
-    def remove_signal_handler(self, sig):
-        raise NotImplementedError
-
-    def set_task_factory(self, factory):
-        raise NotImplementedError
-
-    def get_task_factory(self):
-        raise NotImplementedError
-
-    def get_exception_handler(self):
-        raise NotImplementedError
-
-    def set_exception_handler(self, handler):
-        raise NotImplementedError
-
-    def default_exception_handler(self, context):
-        raise NotImplementedError
-
-    def set_debug(self, enabled):
-        raise NotImplementedError
-
-

Ancestors

-
    -
  • asyncio.events.AbstractEventLoop
  • -
-

Methods

-
-
-def add_reader(self, fd, callback, *args) -
-
-
-
- -Expand source code - -
def add_reader(self, fd, callback, *args):
-    raise NotImplementedError
-
-
-
-def add_signal_handler(self, sig, callback, *args) -
-
-
-
- -Expand source code - -
def add_signal_handler(self, sig, callback, *args):
-    raise NotImplementedError
-
-
-
-def add_writer(self, fd, callback, *args) -
-
-
-
- -Expand source code - -
def add_writer(self, fd, callback, *args):
-    raise NotImplementedError
-
-
-
-def call_at(self, when, callback, *args, context=None) -
-
-
-
- -Expand source code - -
def call_at(self, when, callback, *args, context=None):
-    raise NotImplementedError
-
-
-
-def call_exception_handler(self, context) -
-
-
-
- -Expand source code - -
def call_exception_handler(self, context):
-    self.exception = context.get('exception', None)
-
-
-
-def call_later(self, delay, callback, *args, context=None) -
-
-
-
- -Expand source code - -
def call_later(self, delay, callback, *args, context=None):
-    raise NotImplementedError
-
-
-
-def call_soon(self, callback, *args, context=None) -
-
-
-
- -Expand source code - -
def call_soon(self, callback, *args, context=None):
-    handle = asyncio.Handle(callback, args, self, context)
-    self.handles.append(handle)
-    return handle
-
-
-
-def call_soon_threadsafe(self, callback, *args, context=None) -
-
-
-
- -Expand source code - -
def call_soon_threadsafe(self, callback, *args, context=None):
-    raise NotImplementedError
-
-
-
-def close(self) -
-
-

Close the loop.

-

The loop should not be running.

-

This is idempotent and irreversible.

-

No other methods should be called after this one.

-
- -Expand source code - -
def close(self):
-    self.running = False
-
-
-
-async def connect_accepted_socket(self, protocol_factory, sock, *, ssl=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None) -
-
-

Handle an accepted connection.

-

This is used by servers that accept connections outside of -asyncio, but use asyncio to handle connections.

-

This method is a coroutine. -When completed, the coroutine -returns a (transport, protocol) pair.

-
- -Expand source code - -
async def connect_accepted_socket(
-        self, protocol_factory, sock,
-        *, ssl=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None):
-    raise NotImplementedError
-
-
-
-async def connect_read_pipe(self, protocol_factory, pipe) -
-
-

Register read pipe in event loop. Set the pipe to non-blocking mode.

-

protocol_factory should instantiate object with Protocol interface. -pipe is a file-like object. -Return pair (transport, protocol), where transport supports the -ReadTransport interface.

-
- -Expand source code - -
async def connect_read_pipe(self, protocol_factory, pipe):
-    raise NotImplementedError
-
-
-
-async def connect_write_pipe(self, protocol_factory, pipe) -
-
-

Register write pipe in event loop.

-

protocol_factory should instantiate object with BaseProtocol interface. -Pipe is file-like object already switched to nonblocking. -Return pair (transport, protocol), where transport support -WriteTransport interface.

-
- -Expand source code - -
async def connect_write_pipe(self, protocol_factory, pipe):
-    raise NotImplementedError
-
-
-
-async def create_connection(self, protocol_factory, host=None, port=None, *, ssl=None, family=0, proto=0, flags=0, sock=None, local_addr=None, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, happy_eyeballs_delay=None, interleave=None) -
-
-
-
- -Expand source code - -
async def create_connection(
-        self, protocol_factory, host=None, port=None,
-        *, ssl=None, family=0, proto=0,
-        flags=0, sock=None, local_addr=None,
-        server_hostname=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None,
-        happy_eyeballs_delay=None, interleave=None):
-    raise NotImplementedError
-
-
-
-async def create_datagram_endpoint(self, protocol_factory, local_addr=None, remote_addr=None, *, family=0, proto=0, flags=0, reuse_address=None, reuse_port=None, allow_broadcast=None, sock=None) -
-
-

A coroutine which creates a datagram endpoint.

-

This method will try to establish the endpoint in the background. -When successful, the coroutine returns a (transport, protocol) pair.

-

protocol_factory must be a callable returning a protocol instance.

-

socket family AF_INET, socket.AF_INET6 or socket.AF_UNIX depending on -host (or family if specified), socket type SOCK_DGRAM.

-

reuse_address tells the kernel to reuse a local socket in -TIME_WAIT state, without waiting for its natural timeout to -expire. If not specified it will automatically be set to True on -UNIX.

-

reuse_port tells the kernel to allow this endpoint to be bound to -the same port as other existing endpoints are bound to, so long as -they all set this flag when being created. This option is not -supported on Windows and some UNIX's. If the -:py:data:~socket.SO_REUSEPORT constant is not defined then this -capability is unsupported.

-

allow_broadcast tells the kernel to allow this endpoint to send -messages to the broadcast address.

-

sock can optionally be specified in order to use a preexisting -socket object.

-
- -Expand source code - -
async def create_datagram_endpoint(self, protocol_factory,
-                                   local_addr=None, remote_addr=None, *,
-                                   family=0, proto=0, flags=0,
-                                   reuse_address=None, reuse_port=None,
-                                   allow_broadcast=None, sock=None):
-    raise NotImplementedError
-
-
-
-def create_future(self) -
-
-
-
- -Expand source code - -
def create_future(self):
-    return asyncio.Future(loop=self)
-
-
-
-async def create_server(self, protocol_factory, host=None, port=None, *, family=0, flags=1, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True) -
-
-

A coroutine which creates a TCP server bound to host and port.

-

The return value is a Server object which can be used to stop -the service.

-

If host is an empty string or None all interfaces are assumed -and a list of multiple sockets will be returned (most likely -one for IPv4 and another one for IPv6). The host parameter can also be -a sequence (e.g. list) of hosts to bind to.

-

family can be set to either AF_INET or AF_INET6 to force the -socket to use IPv4 or IPv6. If not set it will be determined -from host (defaults to AF_UNSPEC).

-

flags is a bitmask for getaddrinfo().

-

sock can optionally be specified in order to use a preexisting -socket object.

-

backlog is the maximum number of queued connections passed to -listen() (defaults to 100).

-

ssl can be set to an SSLContext to enable SSL over the -accepted connections.

-

reuse_address tells the kernel to reuse a local socket in -TIME_WAIT state, without waiting for its natural timeout to -expire. If not specified will automatically be set to True on -UNIX.

-

reuse_port tells the kernel to allow this endpoint to be bound to -the same port as other existing endpoints are bound to, so long as -they all set this flag when being created. This option is not -supported on Windows.

-

ssl_handshake_timeout is the time in seconds that an SSL server -will wait for completion of the SSL handshake before aborting the -connection. Default is 60s.

-

ssl_shutdown_timeout is the time in seconds that an SSL server -will wait for completion of the SSL shutdown procedure -before aborting the connection. Default is 30s.

-

start_serving set to True (default) causes the created server -to start accepting connections immediately. -When set to False, -the user should await Server.start_serving() or Server.serve_forever() -to make the server to start accepting connections.

-
- -Expand source code - -
async def create_server(
-        self, protocol_factory, host=None, port=None,
-        *, family=socket.AF_UNSPEC,
-        flags=socket.AI_PASSIVE, sock=None, backlog=100,
-        ssl=None, reuse_address=None, reuse_port=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None,
-        start_serving=True):
-    raise NotImplementedError
-
-
-
-def create_task(self, coroutine) -
-
-
-
- -Expand source code - -
def create_task(self, coroutine):
-    return asyncio.Task(coroutine, loop=self)
-
-
-
-async def create_unix_connection(self, protocol_factory, path=None, *, ssl=None, sock=None, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None) -
-
-
-
- -Expand source code - -
async def create_unix_connection(
-        self, protocol_factory, path=None, *,
-        ssl=None, sock=None,
-        server_hostname=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None):
-    raise NotImplementedError
-
-
-
-async def create_unix_server(self, protocol_factory, path=None, *, sock=None, backlog=100, ssl=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True) -
-
-

A coroutine which creates a UNIX Domain Socket server.

-

The return value is a Server object, which can be used to stop -the service.

-

path is a str, representing a file system path to bind the -server socket to.

-

sock can optionally be specified in order to use a preexisting -socket object.

-

backlog is the maximum number of queued connections passed to -listen() (defaults to 100).

-

ssl can be set to an SSLContext to enable SSL over the -accepted connections.

-

ssl_handshake_timeout is the time in seconds that an SSL server -will wait for the SSL handshake to complete (defaults to 60s).

-

ssl_shutdown_timeout is the time in seconds that an SSL server -will wait for the SSL shutdown to finish (defaults to 30s).

-

start_serving set to True (default) causes the created server -to start accepting connections immediately. -When set to False, -the user should await Server.start_serving() or Server.serve_forever() -to make the server to start accepting connections.

-
- -Expand source code - -
async def create_unix_server(
-        self, protocol_factory, path=None, *,
-        sock=None, backlog=100, ssl=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None,
-        start_serving=True):
-    raise NotImplementedError
-
-
-
-def default_exception_handler(self, context) -
-
-
-
- -Expand source code - -
def default_exception_handler(self, context):
-    raise NotImplementedError
-
-
-
-def get_debug(self) -
-
-
-
- -Expand source code - -
def get_debug(self):
-    return False
-
-
-
-def get_exception_handler(self) -
-
-
-
- -Expand source code - -
def get_exception_handler(self):
-    raise NotImplementedError
-
-
-
-def get_task_factory(self) -
-
-
-
- -Expand source code - -
def get_task_factory(self):
-    raise NotImplementedError
-
-
-
-async def getaddrinfo(self, host, port, *, family=0, type=0, proto=0, flags=0) -
-
-
-
- -Expand source code - -
async def getaddrinfo(self, host, port, *,
-                      family=0, type=0, proto=0, flags=0):
-    raise NotImplementedError
-
-
-
-async def getnameinfo(self, sockaddr, flags=0) -
-
-
-
- -Expand source code - -
async def getnameinfo(self, sockaddr, flags=0):
-    raise NotImplementedError
-
-
-
-def is_closed(self) -
-
-

Returns True if the event loop was closed.

-
- -Expand source code - -
def is_closed(self):
-    return not self.running
-
-
-
-def is_running(self) -
-
-

Return whether the event loop is currently running.

-
- -Expand source code - -
def is_running(self):
-    return self.running
-
-
-
-def remove_reader(self, fd) -
-
-
-
- -Expand source code - -
def remove_reader(self, fd):
-    raise NotImplementedError
-
-
-
-def remove_signal_handler(self, sig) -
-
-
-
- -Expand source code - -
def remove_signal_handler(self, sig):
-    raise NotImplementedError
-
-
-
-def remove_writer(self, fd) -
-
-
-
- -Expand source code - -
def remove_writer(self, fd):
-    raise NotImplementedError
-
-
-
-def run_forever(self) -
-
-

Run the event loop until stop() is called.

-
- -Expand source code - -
def run_forever(self):
-    raise NotImplementedError
-
-
-
-def run_in_executor(self, executor, func, *args) -
-
-
-
- -Expand source code - -
def run_in_executor(self, executor, func, *args):
-    raise NotImplementedError
-
-
-
-def run_until_complete(self, future) -
-
-

Run the event loop until a Future is done.

-

Return the Future's result, or raise its exception.

-
- -Expand source code - -
def run_until_complete(self, future):
-    future = asyncio.ensure_future(future, loop=self)
-
-    self.running = True
-    asyncio.events._set_running_loop(self)
-    while self.running and not future.done():
-        handle = self.handles[0]
-        self.handles = self.handles[1:]
-        if not handle._cancelled:
-            handle._run()
-            
-        if self.wakers:
-            [pollables, wakers] = list(map(list, zip(*self.wakers)))
-            
-            new_wakers = []
-            ready = [False] * len(pollables)
-            for index in poll.poll(pollables):
-                ready[index] = True
-            
-            for (ready, pollable), waker in zip(zip(ready, pollables), wakers):
-                if ready:
-                    pollable.__exit__()
-                    waker.set_result(None)
-                else:
-                    new_wakers.append((pollable, waker))
-
-            self.wakers = new_wakers
-
-        if self.exception is not None:
-            raise self.exception
-        
-    future.result()
-
-
-
-async def sendfile(self, transport, file, offset=0, count=None, *, fallback=True) -
-
-

Send a file through a transport.

-

Return an amount of sent bytes.

-
- -Expand source code - -
async def sendfile(self, transport, file, offset=0, count=None,
-                   *, fallback=True):
-    raise NotImplementedError
-
-
-
-def set_debug(self, enabled) -
-
-
-
- -Expand source code - -
def set_debug(self, enabled):
-    raise NotImplementedError
-
-
-
-def set_default_executor(self, executor) -
-
-
-
- -Expand source code - -
def set_default_executor(self, executor):
-    raise NotImplementedError
-
-
-
-def set_exception_handler(self, handler) -
-
-
-
- -Expand source code - -
def set_exception_handler(self, handler):
-    raise NotImplementedError
-
-
-
-def set_task_factory(self, factory) -
-
-
-
- -Expand source code - -
def set_task_factory(self, factory):
-    raise NotImplementedError
-
-
-
-def shutdown_asyncgens(self) -
-
-

Shutdown all active asynchronous generators.

-
- -Expand source code - -
def shutdown_asyncgens(self):
-    pass
-
-
-
-async def shutdown_default_executor(self) -
-
-

Schedule the shutdown of the default executor.

-
- -Expand source code - -
async def shutdown_default_executor(self):
-    raise NotImplementedError
-
-
-
-async def sock_accept(self, sock) -
-
-
-
- -Expand source code - -
async def sock_accept(self, sock):
-    raise NotImplementedError
-
-
-
-async def sock_connect(self, sock, address) -
-
-
-
- -Expand source code - -
async def sock_connect(self, sock, address):
-    raise NotImplementedError
-
-
-
-async def sock_recv(self, sock, nbytes) -
-
-
-
- -Expand source code - -
async def sock_recv(self, sock, nbytes):
-    raise NotImplementedError
-
-
-
-async def sock_recv_into(self, sock, buf) -
-
-
-
- -Expand source code - -
async def sock_recv_into(self, sock, buf):
-    raise NotImplementedError
-
-
-
-async def sock_recvfrom(self, sock, bufsize) -
-
-
-
- -Expand source code - -
async def sock_recvfrom(self, sock, bufsize):
-    raise NotImplementedError
-
-
-
-async def sock_recvfrom_into(self, sock, buf, nbytes=0) -
-
-
-
- -Expand source code - -
async def sock_recvfrom_into(self, sock, buf, nbytes=0):
-    raise NotImplementedError
-
-
-
-async def sock_sendall(self, sock, data) -
-
-
-
- -Expand source code - -
async def sock_sendall(self, sock, data):
-    raise NotImplementedError
-
-
-
-async def sock_sendfile(self, sock, file, offset=0, count=None, *, fallback=None) -
-
-
-
- -Expand source code - -
async def sock_sendfile(self, sock, file, offset=0, count=None,
-                        *, fallback=None):
-    raise NotImplementedError
-
-
-
-async def sock_sendto(self, sock, data, address) -
-
-
-
- -Expand source code - -
async def sock_sendto(self, sock, data, address):
-    raise NotImplementedError
-
-
-
-async def start_tls(self, transport, protocol, sslcontext, *, server_side=False, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None) -
-
-

Upgrade a transport to TLS.

-

Return a new transport that protocol should start using -immediately.

-
- -Expand source code - -
async def start_tls(self, transport, protocol, sslcontext, *,
-                    server_side=False,
-                    server_hostname=None,
-                    ssl_handshake_timeout=None,
-                    ssl_shutdown_timeout=None):
-    raise NotImplementedError
-
-
-
-def stop(self) -
-
-

Stop the event loop as soon as reasonable.

-

Exactly how soon that is may depend on the implementation, but -no more I/O callbacks should be scheduled.

-
- -Expand source code - -
def stop(self):
-    self.running = False
-
-
-
-async def subprocess_exec(self, protocol_factory, *args, stdin=-1, stdout=-1, stderr=-1, **kwargs) -
-
-
-
- -Expand source code - -
async def subprocess_exec(self, protocol_factory, *args,
-                          stdin=subprocess.PIPE,
-                          stdout=subprocess.PIPE,
-                          stderr=subprocess.PIPE,
-                          **kwargs):
-    raise NotImplementedError
-
-
-
-async def subprocess_shell(self, protocol_factory, cmd, *, stdin=-1, stdout=-1, stderr=-1, **kwargs) -
-
-
-
- -Expand source code - -
async def subprocess_shell(self, protocol_factory, cmd, *,
-                           stdin=subprocess.PIPE,
-                           stdout=subprocess.PIPE,
-                           stderr=subprocess.PIPE,
-                           **kwargs):
-    raise NotImplementedError
-
-
-
-def time(self) -
-
-
-
- -Expand source code - -
def time(self):
-    raise NotImplementedError
-
-
-
-
-
-class Sink -(body: OutgoingBody) -
-
-

Writer abstraction over wasi-http/types#outgoing-body.

-
- -Expand source code - -
class Sink:
-    """Writer abstraction over `wasi-http/types#outgoing-body`."""
-    def __init__(self, body: OutgoingBody):
-        self.body = body
-        self.stream = body.write()
-
-    async def send(self, chunk: bytes):
-        """Write the specified bytes to the sink.
-
-        This may need to yield according to the backpressure requirements of the sink.
-        """
-        offset = 0
-        flushing = False
-        while True:
-            count = self.stream.check_write()
-            if count == 0:
-                await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-            elif offset == len(chunk):
-                if flushing:
-                    return
-                else:
-                    self.stream.flush()
-                    flushing = True
-            else:
-                count = min(count, len(chunk) - offset)
-                self.stream.write(chunk[offset:offset+count])
-                offset += count
-
-    def close(self):
-        """Close the stream, indicating no further data will be written."""
-
-        self.stream.__exit__()
-        self.stream = None
-        OutgoingBody.finish(self.body, None)
-        self.body = None
-
-

Methods

-
-
-def close(self) -
-
-

Close the stream, indicating no further data will be written.

-
- -Expand source code - -
def close(self):
-    """Close the stream, indicating no further data will be written."""
-
-    self.stream.__exit__()
-    self.stream = None
-    OutgoingBody.finish(self.body, None)
-    self.body = None
-
-
-
-async def send(self, chunk: bytes) -
-
-

Write the specified bytes to the sink.

-

This may need to yield according to the backpressure requirements of the sink.

-
- -Expand source code - -
async def send(self, chunk: bytes):
-    """Write the specified bytes to the sink.
-
-    This may need to yield according to the backpressure requirements of the sink.
-    """
-    offset = 0
-    flushing = False
-    while True:
-        count = self.stream.check_write()
-        if count == 0:
-            await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-        elif offset == len(chunk):
-            if flushing:
-                return
-            else:
-                self.stream.flush()
-                flushing = True
-        else:
-            count = min(count, len(chunk) - offset)
-            self.stream.write(chunk[offset:offset+count])
-            offset += count
-
-
-
-
-
-class Stream -(body: IncomingBody) -
-
-

Reader abstraction over wasi:http/types#incoming-body.

-
- -Expand source code - -
class Stream:
-    """Reader abstraction over `wasi:http/types#incoming-body`."""
-    def __init__(self, body: IncomingBody):
-        self.body: Optional[IncomingBody] = body
-        self.stream: Optional[InputStream] = body.stream()
-
-    async def next(self) -> Optional[bytes]:
-        """Wait for the next chunk of data to arrive on the stream.
-
-        This will return `None` when the end of the stream has been reached.
-        """
-        while True:
-            try:
-                if self.stream is None:
-                    return None
-                else:
-                    buffer = self.stream.read(READ_SIZE)
-                    if len(buffer) == 0:
-                        await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-                    else:
-                        return buffer
-            except Err as e:
-                if isinstance(e.value, StreamErrorClosed):
-                    if self.stream is not None:
-                        self.stream.__exit__()
-                        self.stream = None
-                    if self.body is not None:
-                        IncomingBody.finish(self.body)
-                        self.body = None
-                else:
-                    raise e
-
-

Methods

-
-
-async def next(self) ‑> Optional[bytes] -
-
-

Wait for the next chunk of data to arrive on the stream.

-

This will return None when the end of the stream has been reached.

-
- -Expand source code - -
async def next(self) -> Optional[bytes]:
-    """Wait for the next chunk of data to arrive on the stream.
-
-    This will return `None` when the end of the stream has been reached.
-    """
-    while True:
-        try:
-            if self.stream is None:
-                return None
-            else:
-                buffer = self.stream.read(READ_SIZE)
-                if len(buffer) == 0:
-                    await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-                else:
-                    return buffer
-        except Err as e:
-            if isinstance(e.value, StreamErrorClosed):
-                if self.stream is not None:
-                    self.stream.__exit__()
-                    self.stream = None
-                if self.body is not None:
-                    IncomingBody.finish(self.body)
-                    self.body = None
-            else:
-                raise e
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/index.html b/docs/v2/index.html deleted file mode 100644 index b62d587..0000000 --- a/docs/v2/index.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -spin_sdk API documentation - - - - - - - - - - - -
-
-
-

Package spin_sdk

-
-
-

Spin Python SDK

-

This is an SDK for creating Spin apps using Python.

-

Note that this SDK supercedes an earlier, experimental version, the documentation for which may be found here.

-
- -Expand source code - -
"""Spin Python SDK
-
-This is an SDK for creating [Spin](https://github.com/spinframework/spin) apps using Python.
-
-Note that this SDK supercedes an earlier, experimental version, the documentation for which may be found [here](https://spinframework.github.io/spin-python-sdk/v1/index.html).
-"""
-
-
-
-

Sub-modules

-
-
spin_sdk.http
-
-

Module with helpers for wasi http

-
-
spin_sdk.key_value
-
-

Module for accessing Spin key-value stores

-
-
spin_sdk.llm
-
-

Module for working with the Spin large language model API

-
-
spin_sdk.mysql
-
-

Module for interacting with a MySQL database

-
-
spin_sdk.postgres
-
-

Module for interacting with a Postgres database

-
-
spin_sdk.redis
-
-

Module for interacting with a Redis database

-
-
spin_sdk.sqlite
-
-

Module for interacting with an SQLite database

-
-
spin_sdk.variables
-
-

Module for interacting with Spin Variables

-
-
spin_sdk.wit
-
-

Module with the bindings generated from the wit by componentize-py

-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/key_value.html b/docs/v2/key_value.html deleted file mode 100644 index d92aa03..0000000 --- a/docs/v2/key_value.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - -spin_sdk.key_value API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.key_value

-
-
-

Module for accessing Spin key-value stores

-
- -Expand source code - -
"""Module for accessing Spin key-value stores"""
-
-from spin_sdk.wit.imports.key_value import Store
-
-def open(name: str) -> Store:
-    """
-    Open the store with the specified name.
-  
-    If `name` is "default", the default store is opened.  Otherwise, `name` must
-    refer to a store defined and configured in a runtime configuration file
-    supplied with the application.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorNoSuchStore)` will be raised if the `name` is not recognized.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorAccessDenied)` will be raised if the requesting component does not have
-    access to the specified store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorStoreTableFull)` will be raised if too many stores have been opened simultaneously.
-    Closing one or more previously opened stores might address this using the `__exit__` method.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorOther(str))` will be raised if some implementation specific error has occured (e.g I/O)
-    """
-    return Store.open(name)
-
-def open_default() -> Store:
-    """
-    Open the default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorAccessDenied)`
-    will be raised if the requesting component does not have access to the
-    default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorStoreTableFull)` will be raised if too many stores have been opened simultaneously.
-    Closing one or more previously opened stores might address this using the `__exit__` method.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorOther(str))` will be raised if some implementation specific error has occured (e.g I/O)
-    """
-    return Store.open("default")
-
-
-
-
-
-
-
-

Functions

-
-
-def open(name: str) ‑> Store -
-
-

Open the store with the specified name.

-

If name is "default", the default store is opened. -Otherwise, name must -refer to a store defined and configured in a runtime configuration file -supplied with the application.

-

A Err(ErrorNoSuchStore) will be raised if the name is not recognized.

-

A Err(ErrorAccessDenied) will be raised if the requesting component does not have -access to the specified store.

-

A Err(ErrorStoreTableFull) will be raised if too many stores have been opened simultaneously. -Closing one or more previously opened stores might address this using the __exit__ method.

-

A Err(ErrorOther(str)) will be raised if some implementation specific error has occured (e.g I/O)

-
- -Expand source code - -
def open(name: str) -> Store:
-    """
-    Open the store with the specified name.
-  
-    If `name` is "default", the default store is opened.  Otherwise, `name` must
-    refer to a store defined and configured in a runtime configuration file
-    supplied with the application.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorNoSuchStore)` will be raised if the `name` is not recognized.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorAccessDenied)` will be raised if the requesting component does not have
-    access to the specified store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorStoreTableFull)` will be raised if too many stores have been opened simultaneously.
-    Closing one or more previously opened stores might address this using the `__exit__` method.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorOther(str))` will be raised if some implementation specific error has occured (e.g I/O)
-    """
-    return Store.open(name)
-
-
-
-def open_default() ‑> Store -
-
-

Open the default store.

-

A Err(ErrorAccessDenied) -will be raised if the requesting component does not have access to the -default store.

-

A Err(ErrorStoreTableFull) will be raised if too many stores have been opened simultaneously. -Closing one or more previously opened stores might address this using the __exit__ method.

-

A Err(ErrorOther(str)) will be raised if some implementation specific error has occured (e.g I/O)

-
- -Expand source code - -
def open_default() -> Store:
-    """
-    Open the default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorAccessDenied)`
-    will be raised if the requesting component does not have access to the
-    default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorStoreTableFull)` will be raised if too many stores have been opened simultaneously.
-    Closing one or more previously opened stores might address this using the `__exit__` method.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.ErrorOther(str))` will be raised if some implementation specific error has occured (e.g I/O)
-    """
-    return Store.open("default")
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/llm.html b/docs/v2/llm.html deleted file mode 100644 index f68a472..0000000 --- a/docs/v2/llm.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - -spin_sdk.llm API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.llm

-
-
-

Module for working with the Spin large language model API

-
- -Expand source code - -
"""Module for working with the Spin large language model API"""
-
-from dataclasses import dataclass
-from typing import Optional, Sequence
-from spin_sdk.wit.imports import llm as spin_llm
-
-@dataclass
-class InferencingParams:
-    max_tokens: int = 100
-    repeat_penalty: float = 1.1
-    repeat_penalty_last_n_token_count: int = 64
-    temperature: float = 0.8
-    top_k: int = 40
-    top_p: float = 0.9
-    
-
-def generate_embeddings(model: str, text: Sequence[str]) -> spin_llm.EmbeddingsResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorRuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorInvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    return spin_llm.generate_embeddings(model, text)
-
-def infer_with_options(model: str, prompt: str, options: Optional[InferencingParams]) -> spin_llm.InferencingResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorRuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorInvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    options = options or InferencingParams
-    return spin_llm.infer(model, prompt, options)
-
-def infer(model: str, prompt: str) -> spin_llm.InferencingResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorRuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorInvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    options = InferencingParams
-    return spin_llm.infer(model, prompt, options)
-
-
-
-
-
-
-
-

Functions

-
-
-def generate_embeddings(model: str, text: Sequence[str]) ‑> EmbeddingsResult -
-
-

A Err(ErrorModelNotSupported) will be raised if the component does not have access to the specified model.

-

A Err(ErrorRuntimeError(str)) will be raised if there are any runtime errors.

-

A Err(ErrorInvalidInput(str)) will be raised if an invalid input is provided.

-
- -Expand source code - -
def generate_embeddings(model: str, text: Sequence[str]) -> spin_llm.EmbeddingsResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorRuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorInvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    return spin_llm.generate_embeddings(model, text)
-
-
-
-def infer(model: str, prompt: str) ‑> InferencingResult -
-
-

A Err(ErrorModelNotSupported) will be raised if the component does not have access to the specified model.

-

A Err(ErrorRuntimeError(str)) will be raised if there are any runtime errors.

-

A Err(ErrorInvalidInput(str)) will be raised if an invalid input is provided.

-
- -Expand source code - -
def infer(model: str, prompt: str) -> spin_llm.InferencingResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorRuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorInvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    options = InferencingParams
-    return spin_llm.infer(model, prompt, options)
-
-
-
-def infer_with_options(model: str, prompt: str, options: Optional[InferencingParams]) ‑> InferencingResult -
-
-

A Err(ErrorModelNotSupported) will be raised if the component does not have access to the specified model.

-

A Err(ErrorRuntimeError(str)) will be raised if there are any runtime errors.

-

A Err(ErrorInvalidInput(str)) will be raised if an invalid input is provided.

-
- -Expand source code - -
def infer_with_options(model: str, prompt: str, options: Optional[InferencingParams]) -> spin_llm.InferencingResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorRuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.ErrorInvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    options = options or InferencingParams
-    return spin_llm.infer(model, prompt, options)
-
-
-
-
-
-

Classes

-
-
-class InferencingParams -(max_tokens: int = 100, repeat_penalty: float = 1.1, repeat_penalty_last_n_token_count: int = 64, temperature: float = 0.8, top_k: int = 40, top_p: float = 0.9) -
-
-

InferencingParams(max_tokens: int = 100, repeat_penalty: float = 1.1, repeat_penalty_last_n_token_count: int = 64, temperature: float = 0.8, top_k: int = 40, top_p: float = 0.9)

-
- -Expand source code - -
@dataclass
-class InferencingParams:
-    max_tokens: int = 100
-    repeat_penalty: float = 1.1
-    repeat_penalty_last_n_token_count: int = 64
-    temperature: float = 0.8
-    top_k: int = 40
-    top_p: float = 0.9
-
-

Class variables

-
-
var max_tokens : int
-
-
-
-
var repeat_penalty : float
-
-
-
-
var repeat_penalty_last_n_token_count : int
-
-
-
-
var temperature : float
-
-
-
-
var top_k : int
-
-
-
-
var top_p : float
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/mysql.html b/docs/v2/mysql.html deleted file mode 100644 index 8df7ffd..0000000 --- a/docs/v2/mysql.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - -spin_sdk.mysql API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.mysql

-
-
-

Module for interacting with a MySQL database

-
- -Expand source code - -
"""Module for interacting with a MySQL database"""
-
-from spin_sdk.wit.imports.mysql import Connection
-
-def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a MySQL database.
-    
-    The connection_string is the MySQL URL connection string.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.ErrorConnectionFailed(str))` when a connection fails.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.import.rdbms_types.ErrorOther(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-
-
-
-
-
-
-

Functions

-
-
-def open(connection_string: str) ‑> Connection -
-
-

Open a connection with a MySQL database.

-

The connection_string is the MySQL URL connection string.

-

A Err(ErrorConnectionFailed(str)) when a connection fails.

-

A Err(spin_sdk.wit.import.rdbms_types.ErrorOther(str)) when some other error occurs.

-
- -Expand source code - -
def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a MySQL database.
-    
-    The connection_string is the MySQL URL connection string.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.ErrorConnectionFailed(str))` when a connection fails.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.import.rdbms_types.ErrorOther(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/postgres.html b/docs/v2/postgres.html deleted file mode 100644 index 132e27e..0000000 --- a/docs/v2/postgres.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - -spin_sdk.postgres API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.postgres

-
-
-

Module for interacting with a Postgres database

-
- -Expand source code - -
"""Module for interacting with a Postgres database"""
-
-from spin_sdk.wit.imports.postgres import Connection
-
-def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a Postgres database.
-    
-    The connection_string is the Postgres URL connection string.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.ErrorConnectionFailed(str))` when a connection fails.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.ErrorOther(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-
-
-
-
-
-
-

Functions

-
-
-def open(connection_string: str) ‑> Connection -
-
-

Open a connection with a Postgres database.

-

The connection_string is the Postgres URL connection string.

-

A Err(ErrorConnectionFailed(str)) when a connection fails.

-

A Err(ErrorOther(str)) when some other error occurs.

-
- -Expand source code - -
def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a Postgres database.
-    
-    The connection_string is the Postgres URL connection string.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.ErrorConnectionFailed(str))` when a connection fails.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.ErrorOther(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/redis.html b/docs/v2/redis.html deleted file mode 100644 index 2a4c826..0000000 --- a/docs/v2/redis.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - -spin_sdk.redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.redis

-
-
-

Module for interacting with a Redis database

-
- -Expand source code - -
"""Module for interacting with a Redis database"""
-
-from spin_sdk.wit.imports.redis import Connection 
-
-def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a Redis database.
-    
-    The connection_string is the Redis URL to connect to.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.ErrorInvalidAddress)` will be raised if the connection string is invalid.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.ErrorTooManyConnection)` will be raised if there are too many open connections. Closing one or more previously opened connection using the `__exit__` method might help.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.ErrorOther(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-
-
-
-
-
-
-

Functions

-
-
-def open(connection_string: str) ‑> Connection -
-
-

Open a connection with a Redis database.

-

The connection_string is the Redis URL to connect to.

-

A Err(ErrorInvalidAddress) will be raised if the connection string is invalid.

-

A Err(spin_sdk.wit.imports.redis.ErrorTooManyConnection) will be raised if there are too many open connections. Closing one or more previously opened connection using the __exit__ method might help.

-

A Err(ErrorOther(str)) when some other error occurs.

-
- -Expand source code - -
def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a Redis database.
-    
-    The connection_string is the Redis URL to connect to.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.ErrorInvalidAddress)` will be raised if the connection string is invalid.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.ErrorTooManyConnection)` will be raised if there are too many open connections. Closing one or more previously opened connection using the `__exit__` method might help.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.ErrorOther(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/sqlite.html b/docs/v2/sqlite.html deleted file mode 100644 index 40dd5b1..0000000 --- a/docs/v2/sqlite.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - -spin_sdk.sqlite API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.sqlite

-
-
-

Module for interacting with an SQLite database

-
- -Expand source code - -
"""Module for interacting with an SQLite database"""
-
-from typing import List
-from spin_sdk.wit.imports.sqlite import Connection, ValueInteger, ValueReal, ValueText, ValueBlob
-
-def open(name: str) -> Connection:
-    """Open a connection to a named database instance.
-
-    If `database` is "default", the default instance is opened.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorAccessDenied)` will be raised when the component does not have access to the specified database.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorNoSuchDatabase)` will be raised when the host does not recognize the database name requested.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorInvalidConnection)` will be raised when the provided connection string is not valid.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorIo(str))` will be raised when implementation-specific error occured (e.g. I/O)
-    """
-    return Connection.open(name)
-
-def open_default() -> Connection:
-    """Open the default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorAccessDenied)` will be raised when the component does not have access to the default database.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorIo(str))` will be raised when implementation-specific error occured (e.g. I/O)
-    """
-    return Connection.open("default")
-
-ValueInteger = ValueInteger
-ValueReal = ValueReal
-ValueText = ValueText
-ValueBlob = ValueBlob
-
-
-
-
-
-
-
-

Functions

-
-
-def open(name: str) ‑> Connection -
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

A Err(ErrorAccessDenied) will be raised when the component does not have access to the specified database.

-

A Err(ErrorNoSuchDatabase) will be raised when the host does not recognize the database name requested.

-

A Err(ErrorInvalidConnection) will be raised when the provided connection string is not valid.

-

A Err(ErrorIo(str)) will be raised when implementation-specific error occured (e.g. I/O)

-
- -Expand source code - -
def open(name: str) -> Connection:
-    """Open a connection to a named database instance.
-
-    If `database` is "default", the default instance is opened.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorAccessDenied)` will be raised when the component does not have access to the specified database.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorNoSuchDatabase)` will be raised when the host does not recognize the database name requested.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorInvalidConnection)` will be raised when the provided connection string is not valid.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorIo(str))` will be raised when implementation-specific error occured (e.g. I/O)
-    """
-    return Connection.open(name)
-
-
-
-def open_default() ‑> Connection -
-
-

Open the default store.

-

A Err(ErrorAccessDenied) will be raised when the component does not have access to the default database.

-

A Err(ErrorIo(str)) will be raised when implementation-specific error occured (e.g. I/O)

-
- -Expand source code - -
def open_default() -> Connection:
-    """Open the default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorAccessDenied)` will be raised when the component does not have access to the default database.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.ErrorIo(str))` will be raised when implementation-specific error occured (e.g. I/O)
-    """
-    return Connection.open("default")
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/variables.html b/docs/v2/variables.html deleted file mode 100644 index d56c7a4..0000000 --- a/docs/v2/variables.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - -spin_sdk.variables API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.variables

-
-
-

Module for interacting with Spin Variables

-
- -Expand source code - -
"""Module for interacting with Spin Variables"""
-
-from spin_sdk.wit.imports import variables
-
-def get(key: str):
-    """
-    Gets the value of the given key
-    """
-    return variables.get(key)
-
-
-
-
-
-
-
-

Functions

-
-
-def get(key: str) -
-
-

Gets the value of the given key

-
- -Expand source code - -
def get(key: str):
-    """
-    Gets the value of the given key
-    """
-    return variables.get(key)
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/exports/inbound_redis.html b/docs/v2/wit/exports/inbound_redis.html deleted file mode 100644 index 0e600a8..0000000 --- a/docs/v2/wit/exports/inbound_redis.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - -spin_sdk.wit.exports.inbound_redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports.inbound_redis

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/exports/incoming_handler.html b/docs/v2/wit/exports/incoming_handler.html deleted file mode 100644 index 7356a3b..0000000 --- a/docs/v2/wit/exports/incoming_handler.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - -spin_sdk.wit.exports.incoming_handler API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports.incoming_handler

-
-
-

This interface defines a handler of incoming HTTP Requests. It should -be exported by components which can respond to HTTP Requests.

-
- -Expand source code - -
"""
-This interface defines a handler of incoming HTTP Requests. It should
-be exported by components which can respond to HTTP Requests.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/exports/index.html b/docs/v2/wit/exports/index.html deleted file mode 100644 index 4f2b470..0000000 --- a/docs/v2/wit/exports/index.html +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - -spin_sdk.wit.exports API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import types
-
-class InboundRedis(Protocol):
-
-    @abstractmethod
-    def handle_message(self, message: bytes) -> None:
-        """
-        The entrypoint for a Redis handler.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)`
-        """
-        raise NotImplementedError
-
-
-class IncomingHandler(Protocol):
-
-    @abstractmethod
-    def handle(self, request: types.IncomingRequest, response_out: types.ResponseOutparam) -> None:
-        """
-        This function is invoked with an incoming HTTP Request, and a resource
-        `response-outparam` which provides the capability to reply with an HTTP
-        Response. The response is sent by calling the `response-outparam.set`
-        method, which allows execution to continue after the response has been
-        sent. This enables both streaming to the response body, and performing other
-        work.
-        
-        The implementor of this function must write a response to the
-        `response-outparam` before returning, or else the caller will respond
-        with an error on its behalf.
-        """
-        raise NotImplementedError
-
-
-
-

Sub-modules

-
-
spin_sdk.wit.exports.inbound_redis
-
-
-
-
spin_sdk.wit.exports.incoming_handler
-
-

This interface defines a handler of incoming HTTP Requests. It should -be exported by components which can respond to HTTP Requests.

-
-
-
-
-
-
-
-
-

Classes

-
-
-class InboundRedis -(*args, **kwargs) -
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto(Protocol[T]):
-    def meth(self) -> T:
-        ...
-
-
- -Expand source code - -
class InboundRedis(Protocol):
-
-    @abstractmethod
-    def handle_message(self, message: bytes) -> None:
-        """
-        The entrypoint for a Redis handler.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)`
-        """
-        raise NotImplementedError
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-

Methods

-
-
-def handle_message(self, message: bytes) ‑> None -
-
-

The entrypoint for a Redis handler.

-

Raises: Err(Error)

-
- -Expand source code - -
@abstractmethod
-def handle_message(self, message: bytes) -> None:
-    """
-    The entrypoint for a Redis handler.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class IncomingHandler -(*args, **kwargs) -
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto(Protocol[T]):
-    def meth(self) -> T:
-        ...
-
-
- -Expand source code - -
class IncomingHandler(Protocol):
-
-    @abstractmethod
-    def handle(self, request: types.IncomingRequest, response_out: types.ResponseOutparam) -> None:
-        """
-        This function is invoked with an incoming HTTP Request, and a resource
-        `response-outparam` which provides the capability to reply with an HTTP
-        Response. The response is sent by calling the `response-outparam.set`
-        method, which allows execution to continue after the response has been
-        sent. This enables both streaming to the response body, and performing other
-        work.
-        
-        The implementor of this function must write a response to the
-        `response-outparam` before returning, or else the caller will respond
-        with an error on its behalf.
-        """
-        raise NotImplementedError
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-

Subclasses

- -

Methods

-
-
-def handle(self, request: IncomingRequest, response_out: ResponseOutparam) ‑> None -
-
-

This function is invoked with an incoming HTTP Request, and a resource -response-outparam which provides the capability to reply with an HTTP -Response. The response is sent by calling the response-outparam.set -method, which allows execution to continue after the response has been -sent. This enables both streaming to the response body, and performing other -work.

-

The implementor of this function must write a response to the -response-outparam before returning, or else the caller will respond -with an error on its behalf.

-
- -Expand source code - -
@abstractmethod
-def handle(self, request: types.IncomingRequest, response_out: types.ResponseOutparam) -> None:
-    """
-    This function is invoked with an incoming HTTP Request, and a resource
-    `response-outparam` which provides the capability to reply with an HTTP
-    Response. The response is sent by calling the `response-outparam.set`
-    method, which allows execution to continue after the response has been
-    sent. This enables both streaming to the response body, and performing other
-    work.
-    
-    The implementor of this function must write a response to the
-    `response-outparam` before returning, or else the caller will respond
-    with an error on its behalf.
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/error.html b/docs/v2/wit/imports/error.html deleted file mode 100644 index c51ae8d..0000000 --- a/docs/v2/wit/imports/error.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - -spin_sdk.wit.imports.error API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.error

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-class Error:
-    """
-    A resource which represents some error information.
-    
-    The only method provided by this resource is `to-debug-string`,
-    which provides some human-readable information about the error.
-    
-    In the `wasi:io` package, this resource is returned through the
-    `wasi:io/streams/stream-error` type.
-    
-    To provide more specific error information, other interfaces may
-    provide functions to further "downcast" this error into more specific
-    error information. For example, `error`s returned in streams derived
-    from filesystem types to be described using the filesystem's own
-    error-code type, using the function
-    `wasi:filesystem/types/filesystem-error-code`, which takes a parameter
-    `borrow<error>` and returns
-    `option<wasi:filesystem/types/error-code>`.
-    
-    The set of functions which can "downcast" an `error` into a more
-    concrete type is open.
-    """
-    
-    def to_debug_string(self) -> str:
-        """
-        Returns a string that is suitable to assist humans in debugging
-        this error.
-        
-        WARNING: The returned string should not be consumed mechanically!
-        It may change across platforms, hosts, or other implementation
-        details. Parsing this string is a major platform-compatibility
-        hazard.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Error -
-
-

A resource which represents some error information.

-

The only method provided by this resource is to-debug-string, -which provides some human-readable information about the error.

-

In the wasi:io package, this resource is returned through the -wasi:io/streams/stream-error type.

-

To provide more specific error information, other interfaces may -provide functions to further "downcast" this error into more specific -error information. For example, errors returned in streams derived -from filesystem types to be described using the filesystem's own -error-code type, using the function -wasi:filesystem/types/filesystem-error-code, which takes a parameter -borrow<error> and returns -option<wasi:filesystem/types/error-code>.

-

The set of functions which can "downcast" an error into a more -concrete type is open.

-
- -Expand source code - -
class Error:
-    """
-    A resource which represents some error information.
-    
-    The only method provided by this resource is `to-debug-string`,
-    which provides some human-readable information about the error.
-    
-    In the `wasi:io` package, this resource is returned through the
-    `wasi:io/streams/stream-error` type.
-    
-    To provide more specific error information, other interfaces may
-    provide functions to further "downcast" this error into more specific
-    error information. For example, `error`s returned in streams derived
-    from filesystem types to be described using the filesystem's own
-    error-code type, using the function
-    `wasi:filesystem/types/filesystem-error-code`, which takes a parameter
-    `borrow<error>` and returns
-    `option<wasi:filesystem/types/error-code>`.
-    
-    The set of functions which can "downcast" an `error` into a more
-    concrete type is open.
-    """
-    
-    def to_debug_string(self) -> str:
-        """
-        Returns a string that is suitable to assist humans in debugging
-        this error.
-        
-        WARNING: The returned string should not be consumed mechanically!
-        It may change across platforms, hosts, or other implementation
-        details. Parsing this string is a major platform-compatibility
-        hazard.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def to_debug_string(self) ‑> str -
-
-

Returns a string that is suitable to assist humans in debugging -this error.

-

WARNING: The returned string should not be consumed mechanically! -It may change across platforms, hosts, or other implementation -details. Parsing this string is a major platform-compatibility -hazard.

-
- -Expand source code - -
def to_debug_string(self) -> str:
-    """
-    Returns a string that is suitable to assist humans in debugging
-    this error.
-    
-    WARNING: The returned string should not be consumed mechanically!
-    It may change across platforms, hosts, or other implementation
-    details. Parsing this string is a major platform-compatibility
-    hazard.
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/index.html b/docs/v2/wit/imports/index.html deleted file mode 100644 index c6a7994..0000000 --- a/docs/v2/wit/imports/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - -spin_sdk.wit.imports API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports

-
-
-
-
-

Sub-modules

-
-
spin_sdk.wit.imports.error
-
-
-
-
spin_sdk.wit.imports.key_value
-
-
-
-
spin_sdk.wit.imports.llm
-
-

A WASI interface dedicated to performing inferencing for Large Language Models.

-
-
spin_sdk.wit.imports.monotonic_clock
-
-

WASI Monotonic Clock is a clock API intended to let users measure elapsed -time …

-
-
spin_sdk.wit.imports.mysql
-
-
-
-
spin_sdk.wit.imports.outgoing_handler
-
-

This interface defines a handler of outgoing HTTP Requests. It should be -imported by components which wish to make HTTP Requests.

-
-
spin_sdk.wit.imports.poll
-
-

A poll API intended to let users wait for I/O events on multiple handles -at once.

-
-
spin_sdk.wit.imports.postgres
-
-
-
-
spin_sdk.wit.imports.rdbms_types
-
-
-
-
spin_sdk.wit.imports.redis
-
-
-
-
spin_sdk.wit.imports.redis_types
-
-
-
-
spin_sdk.wit.imports.sqlite
-
-
-
-
spin_sdk.wit.imports.streams
-
-

WASI I/O is an I/O abstraction API which is currently focused on providing -stream types …

-
-
spin_sdk.wit.imports.types
-
-

This interface defines all of the types and methods for implementing -HTTP Requests and Responses, both incoming and outgoing, as well as -their …

-
-
spin_sdk.wit.imports.variables
-
-
-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/key_value.html b/docs/v2/wit/imports/key_value.html deleted file mode 100644 index 778df1b..0000000 --- a/docs/v2/wit/imports/key_value.html +++ /dev/null @@ -1,489 +0,0 @@ - - - - - - -spin_sdk.wit.imports.key_value API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.key_value

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-@dataclass
-class ErrorStoreTableFull:
-    pass
-
-
-@dataclass
-class ErrorNoSuchStore:
-    pass
-
-
-@dataclass
-class ErrorAccessDenied:
-    pass
-
-
-@dataclass
-class ErrorOther:
-    value: str
-
-
-Error = Union[ErrorStoreTableFull, ErrorNoSuchStore, ErrorAccessDenied, ErrorOther]
-"""
-The set of errors which may be raised by functions in this interface
-"""
-
-
-class Store:
-    """
-    An open key-value store
-    """
-    
-    @classmethod
-    def open(cls, label: str) -> Self:
-        """
-        Open the store with the specified label.
-        
-        `label` must refer to a store allowed in the spin.toml manifest.
-        
-        `error::no-such-store` will be raised if the `label` is not recognized.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value associated with the specified `key`
-        
-        Returns `ok(none)` if the key does not exist.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set the `value` associated with the specified `key` overwriting any existing value.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def delete(self, key: str) -> None:
-        """
-        Delete the tuple with the specified `key`
-        
-        No error is raised if a tuple did not previously exist for `key`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def exists(self, key: str) -> int:
-        """
-        Return whether a tuple exists for the specified `key`
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def get_keys(self) -> List[str]:
-        """
-        Return a list of all the keys
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
-
-
-
-
-

Classes

-
-
-class ErrorAccessDenied -
-
-

ErrorAccessDenied()

-
- -Expand source code - -
@dataclass
-class ErrorAccessDenied:
-    pass
-
-
-
-class ErrorNoSuchStore -
-
-

ErrorNoSuchStore()

-
- -Expand source code - -
@dataclass
-class ErrorNoSuchStore:
-    pass
-
-
-
-class ErrorOther -(value: str) -
-
-

ErrorOther(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorOther:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorStoreTableFull -
-
-

ErrorStoreTableFull()

-
- -Expand source code - -
@dataclass
-class ErrorStoreTableFull:
-    pass
-
-
-
-class Store -
-
-

An open key-value store

-
- -Expand source code - -
class Store:
-    """
-    An open key-value store
-    """
-    
-    @classmethod
-    def open(cls, label: str) -> Self:
-        """
-        Open the store with the specified label.
-        
-        `label` must refer to a store allowed in the spin.toml manifest.
-        
-        `error::no-such-store` will be raised if the `label` is not recognized.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value associated with the specified `key`
-        
-        Returns `ok(none)` if the key does not exist.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set the `value` associated with the specified `key` overwriting any existing value.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def delete(self, key: str) -> None:
-        """
-        Delete the tuple with the specified `key`
-        
-        No error is raised if a tuple did not previously exist for `key`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def exists(self, key: str) -> int:
-        """
-        Return whether a tuple exists for the specified `key`
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def get_keys(self) -> List[str]:
-        """
-        Return a list of all the keys
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def open(label: str) ‑> Self -
-
-

Open the store with the specified label.

-

label must refer to a store allowed in the spin.toml manifest.

-

error::no-such-store will be raised if the label is not recognized.

-

Raises: Err(Error)

-
- -Expand source code - -
@classmethod
-def open(cls, label: str) -> Self:
-    """
-    Open the store with the specified label.
-    
-    `label` must refer to a store allowed in the spin.toml manifest.
-    
-    `error::no-such-store` will be raised if the `label` is not recognized.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def delete(self, key: str) ‑> None -
-
-

Delete the tuple with the specified key

-

No error is raised if a tuple did not previously exist for key.

-

Raises: Err(Error)

-
- -Expand source code - -
def delete(self, key: str) -> None:
-    """
-    Delete the tuple with the specified `key`
-    
-    No error is raised if a tuple did not previously exist for `key`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def exists(self, key: str) ‑> int -
-
-

Return whether a tuple exists for the specified key

-

Raises: Err(Error)

-
- -Expand source code - -
def exists(self, key: str) -> int:
-    """
-    Return whether a tuple exists for the specified `key`
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def get(self, key: str) ‑> Optional[bytes] -
-
-

Get the value associated with the specified key

-

Returns ok(none) if the key does not exist.

-

Raises: Err(Error)

-
- -Expand source code - -
def get(self, key: str) -> Optional[bytes]:
-    """
-    Get the value associated with the specified `key`
-    
-    Returns `ok(none)` if the key does not exist.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def get_keys(self) ‑> List[str] -
-
-

Return a list of all the keys

-

Raises: Err(Error)

-
- -Expand source code - -
def get_keys(self) -> List[str]:
-    """
-    Return a list of all the keys
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def set(self, key: str, value: bytes) ‑> None -
-
-

Set the value associated with the specified key overwriting any existing value.

-

Raises: Err(Error)

-
- -Expand source code - -
def set(self, key: str, value: bytes) -> None:
-    """
-    Set the `value` associated with the specified `key` overwriting any existing value.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/llm.html b/docs/v2/wit/imports/llm.html deleted file mode 100644 index 1578597..0000000 --- a/docs/v2/wit/imports/llm.html +++ /dev/null @@ -1,494 +0,0 @@ - - - - - - -spin_sdk.wit.imports.llm API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.llm

-
-
-

A WASI interface dedicated to performing inferencing for Large Language Models.

-
- -Expand source code - -
"""
-A WASI interface dedicated to performing inferencing for Large Language Models.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-@dataclass
-class InferencingParams:
-    """
-    Inference request parameters
-    """
-    max_tokens: int
-    repeat_penalty: float
-    repeat_penalty_last_n_token_count: int
-    temperature: float
-    top_k: int
-    top_p: float
-
-
-@dataclass
-class ErrorModelNotSupported:
-    pass
-
-
-@dataclass
-class ErrorRuntimeError:
-    value: str
-
-
-@dataclass
-class ErrorInvalidInput:
-    value: str
-
-
-Error = Union[ErrorModelNotSupported, ErrorRuntimeError, ErrorInvalidInput]
-"""
-The set of errors which may be raised by functions in this interface
-"""
-
-
-@dataclass
-class InferencingUsage:
-    """
-    Usage information related to the inferencing result
-    """
-    prompt_token_count: int
-    generated_token_count: int
-
-@dataclass
-class InferencingResult:
-    """
-    An inferencing result
-    """
-    text: str
-    usage: InferencingUsage
-
-@dataclass
-class EmbeddingsUsage:
-    """
-    Usage related to an embeddings generation request
-    """
-    prompt_token_count: int
-
-@dataclass
-class EmbeddingsResult:
-    """
-    Result of generating embeddings
-    """
-    embeddings: List[List[float]]
-    usage: EmbeddingsUsage
-
-
-def infer(model: str, prompt: str, params: Optional[InferencingParams]) -> InferencingResult:
-    """
-    Perform inferencing using the provided model and prompt with the given optional params
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error)`
-    """
-    raise NotImplementedError
-
-def generate_embeddings(model: str, text: List[str]) -> EmbeddingsResult:
-    """
-    Generate embeddings for the supplied list of text
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
-
-
-

Functions

-
-
-def generate_embeddings(model: str, text: List[str]) ‑> EmbeddingsResult -
-
-

Generate embeddings for the supplied list of text

-

Raises: Err(Error)

-
- -Expand source code - -
def generate_embeddings(model: str, text: List[str]) -> EmbeddingsResult:
-    """
-    Generate embeddings for the supplied list of text
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def infer(model: str, prompt: str, params: Optional[InferencingParams]) ‑> InferencingResult -
-
-

Perform inferencing using the provided model and prompt with the given optional params

-

Raises: Err(Error)

-
- -Expand source code - -
def infer(model: str, prompt: str, params: Optional[InferencingParams]) -> InferencingResult:
-    """
-    Perform inferencing using the provided model and prompt with the given optional params
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Classes

-
-
-class EmbeddingsResult -(embeddings: List[List[float]], usage: EmbeddingsUsage) -
-
-

Result of generating embeddings

-
- -Expand source code - -
@dataclass
-class EmbeddingsResult:
-    """
-    Result of generating embeddings
-    """
-    embeddings: List[List[float]]
-    usage: EmbeddingsUsage
-
-

Class variables

-
-
var embeddings : List[List[float]]
-
-
-
-
var usageEmbeddingsUsage
-
-
-
-
-
-
-class EmbeddingsUsage -(prompt_token_count: int) -
-
-

Usage related to an embeddings generation request

-
- -Expand source code - -
@dataclass
-class EmbeddingsUsage:
-    """
-    Usage related to an embeddings generation request
-    """
-    prompt_token_count: int
-
-

Class variables

-
-
var prompt_token_count : int
-
-
-
-
-
-
-class ErrorInvalidInput -(value: str) -
-
-

ErrorInvalidInput(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorInvalidInput:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorModelNotSupported -
-
-

ErrorModelNotSupported()

-
- -Expand source code - -
@dataclass
-class ErrorModelNotSupported:
-    pass
-
-
-
-class ErrorRuntimeError -(value: str) -
-
-

ErrorRuntimeError(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorRuntimeError:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class InferencingParams -(max_tokens: int, repeat_penalty: float, repeat_penalty_last_n_token_count: int, temperature: float, top_k: int, top_p: float) -
-
-

Inference request parameters

-
- -Expand source code - -
@dataclass
-class InferencingParams:
-    """
-    Inference request parameters
-    """
-    max_tokens: int
-    repeat_penalty: float
-    repeat_penalty_last_n_token_count: int
-    temperature: float
-    top_k: int
-    top_p: float
-
-

Class variables

-
-
var max_tokens : int
-
-
-
-
var repeat_penalty : float
-
-
-
-
var repeat_penalty_last_n_token_count : int
-
-
-
-
var temperature : float
-
-
-
-
var top_k : int
-
-
-
-
var top_p : float
-
-
-
-
-
-
-class InferencingResult -(text: str, usage: InferencingUsage) -
-
-

An inferencing result

-
- -Expand source code - -
@dataclass
-class InferencingResult:
-    """
-    An inferencing result
-    """
-    text: str
-    usage: InferencingUsage
-
-

Class variables

-
-
var text : str
-
-
-
-
var usageInferencingUsage
-
-
-
-
-
-
-class InferencingUsage -(prompt_token_count: int, generated_token_count: int) -
-
-

Usage information related to the inferencing result

-
- -Expand source code - -
@dataclass
-class InferencingUsage:
-    """
-    Usage information related to the inferencing result
-    """
-    prompt_token_count: int
-    generated_token_count: int
-
-

Class variables

-
-
var generated_token_count : int
-
-
-
-
var prompt_token_count : int
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/monotonic_clock.html b/docs/v2/wit/imports/monotonic_clock.html deleted file mode 100644 index f551ec8..0000000 --- a/docs/v2/wit/imports/monotonic_clock.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - -spin_sdk.wit.imports.monotonic_clock API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.monotonic_clock

-
-
-

WASI Monotonic Clock is a clock API intended to let users measure elapsed -time.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-

A monotonic clock is a clock which has an unspecified initial value, and -successive reads of the clock will produce non-decreasing values.

-

It is intended for measuring elapsed time.

-
- -Expand source code - -
"""
-WASI Monotonic Clock is a clock API intended to let users measure elapsed
-time.
-
-It is intended to be portable at least between Unix-family platforms and
-Windows.
-
-A monotonic clock is a clock which has an unspecified initial value, and
-successive reads of the clock will produce non-decreasing values.
-
-It is intended for measuring elapsed time.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import poll
-
-
-def now() -> int:
-    """
-    Read the current value of the clock.
-    
-    The clock is monotonic, therefore calling this function repeatedly will
-    produce a sequence of non-decreasing values.
-    """
-    raise NotImplementedError
-
-def resolution() -> int:
-    """
-    Query the resolution of the clock. Returns the duration of time
-    corresponding to a clock tick.
-    """
-    raise NotImplementedError
-
-def subscribe_instant(when: int) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the specified instant
-    occured.
-    """
-    raise NotImplementedError
-
-def subscribe_duration(when: int) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the given duration has
-    elapsed, starting at the time at which this function was called.
-    occured.
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
-

Functions

-
-
-def now() ‑> int -
-
-

Read the current value of the clock.

-

The clock is monotonic, therefore calling this function repeatedly will -produce a sequence of non-decreasing values.

-
- -Expand source code - -
def now() -> int:
-    """
-    Read the current value of the clock.
-    
-    The clock is monotonic, therefore calling this function repeatedly will
-    produce a sequence of non-decreasing values.
-    """
-    raise NotImplementedError
-
-
-
-def resolution() ‑> int -
-
-

Query the resolution of the clock. Returns the duration of time -corresponding to a clock tick.

-
- -Expand source code - -
def resolution() -> int:
-    """
-    Query the resolution of the clock. Returns the duration of time
-    corresponding to a clock tick.
-    """
-    raise NotImplementedError
-
-
-
-def subscribe_duration(when: int) ‑> Pollable -
-
-

Create a pollable which will resolve once the given duration has -elapsed, starting at the time at which this function was called. -occured.

-
- -Expand source code - -
def subscribe_duration(when: int) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the given duration has
-    elapsed, starting at the time at which this function was called.
-    occured.
-    """
-    raise NotImplementedError
-
-
-
-def subscribe_instant(when: int) ‑> Pollable -
-
-

Create a pollable which will resolve once the specified instant -occured.

-
- -Expand source code - -
def subscribe_instant(when: int) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the specified instant
-    occured.
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/mysql.html b/docs/v2/wit/imports/mysql.html deleted file mode 100644 index c1b3475..0000000 --- a/docs/v2/wit/imports/mysql.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - -spin_sdk.wit.imports.mysql API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.mysql

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import rdbms_types
-
-class Connection:
-    """
-    A connection to a MySQL database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the MySQL instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-        """
-        query the database: select
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> None:
-        """
-        execute command to the database: insert, update, delete
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-

A connection to a MySQL database.

-
- -Expand source code - -
class Connection:
-    """
-    A connection to a MySQL database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the MySQL instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-        """
-        query the database: select
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> None:
-        """
-        execute command to the database: insert, update, delete
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the MySQL instance at address.

-

Raises: Err(Error)

-
- -Expand source code - -
@classmethod
-def open(cls, address: str) -> Self:
-    """
-    Open a connection to the MySQL instance at `address`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def execute(self, statement: str, params: List[Union[ParameterValueBooleanParameterValueInt8ParameterValueInt16ParameterValueInt32ParameterValueInt64ParameterValueUint8ParameterValueUint16ParameterValueUint32ParameterValueUint64ParameterValueFloating32ParameterValueFloating64ParameterValueStrParameterValueBinaryParameterValueDbNull]]) ‑> None -
-
-

execute command to the database: insert, update, delete

-

Raises: Err(Error)

-
- -Expand source code - -
def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> None:
-    """
-    execute command to the database: insert, update, delete
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def query(self, statement: str, params: List[Union[ParameterValueBooleanParameterValueInt8ParameterValueInt16ParameterValueInt32ParameterValueInt64ParameterValueUint8ParameterValueUint16ParameterValueUint32ParameterValueUint64ParameterValueFloating32ParameterValueFloating64ParameterValueStrParameterValueBinaryParameterValueDbNull]]) ‑> RowSet -
-
-

query the database: select

-

Raises: Err(Error)

-
- -Expand source code - -
def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-    """
-    query the database: select
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/outgoing_handler.html b/docs/v2/wit/imports/outgoing_handler.html deleted file mode 100644 index 17f2598..0000000 --- a/docs/v2/wit/imports/outgoing_handler.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - -spin_sdk.wit.imports.outgoing_handler API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.outgoing_handler

-
-
-

This interface defines a handler of outgoing HTTP Requests. It should be -imported by components which wish to make HTTP Requests.

-
- -Expand source code - -
"""
-This interface defines a handler of outgoing HTTP Requests. It should be
-imported by components which wish to make HTTP Requests.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import types
-
-
-def handle(request: types.OutgoingRequest, options: Optional[types.RequestOptions]) -> types.FutureIncomingResponse:
-    """
-    This function is invoked with an outgoing HTTP Request, and it returns
-    a resource `future-incoming-response` which represents an HTTP Response
-    which may arrive in the future.
-    
-    The `options` argument accepts optional parameters for the HTTP
-    protocol's transport layer.
-    
-    This function may return an error if the `outgoing-request` is invalid
-    or not allowed to be made. Otherwise, protocol errors are reported
-    through the `future-incoming-response`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
-

Functions

-
-
-def handle(request: OutgoingRequest, options: Optional[RequestOptions]) ‑> FutureIncomingResponse -
-
-

This function is invoked with an outgoing HTTP Request, and it returns -a resource future-incoming-response which represents an HTTP Response -which may arrive in the future.

-

The options argument accepts optional parameters for the HTTP -protocol's transport layer.

-

This function may return an error if the outgoing-request is invalid -or not allowed to be made. Otherwise, protocol errors are reported -through the future-incoming-response.

-

Raises: Err(ErrorCode)

-
- -Expand source code - -
def handle(request: types.OutgoingRequest, options: Optional[types.RequestOptions]) -> types.FutureIncomingResponse:
-    """
-    This function is invoked with an outgoing HTTP Request, and it returns
-    a resource `future-incoming-response` which represents an HTTP Response
-    which may arrive in the future.
-    
-    The `options` argument accepts optional parameters for the HTTP
-    protocol's transport layer.
-    
-    This function may return an error if the `outgoing-request` is invalid
-    or not allowed to be made. Otherwise, protocol errors are reported
-    through the `future-incoming-response`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/poll.html b/docs/v2/wit/imports/poll.html deleted file mode 100644 index 58a789f..0000000 --- a/docs/v2/wit/imports/poll.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - -spin_sdk.wit.imports.poll API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.poll

-
-
-

A poll API intended to let users wait for I/O events on multiple handles -at once.

-
- -Expand source code - -
"""
-A poll API intended to let users wait for I/O events on multiple handles
-at once.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-class Pollable:
-    """
-    `pollable` represents a single I/O event which may be ready, or not.
-    """
-    
-    def ready(self) -> int:
-        """
-        Return the readiness of a pollable. This function never blocks.
-        
-        Returns `true` when the pollable is ready, and `false` otherwise.
-        """
-        raise NotImplementedError
-
-    def block(self) -> None:
-        """
-        `block` returns immediately if the pollable is ready, and otherwise
-        blocks until ready.
-        
-        This function is equivalent to calling `poll.poll` on a list
-        containing only this pollable.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-def poll(in_: List[Pollable]) -> List[int]:
-    """
-    Poll for completion on a set of pollables.
-    
-    This function takes a list of pollables, which identify I/O sources of
-    interest, and waits until one or more of the events is ready for I/O.
-    
-    The result `list<u32>` contains one or more indices of handles in the
-    argument list that is ready for I/O.
-    
-    If the list contains more elements than can be indexed with a `u32`
-    value, this function traps.
-    
-    A timeout can be implemented by adding a pollable from the
-    wasi-clocks API to the list.
-    
-    This function does not return a `result`; polling in itself does not
-    do any I/O so it doesn't fail. If any of the I/O sources identified by
-    the pollables has an error, it is indicated by marking the source as
-    being reaedy for I/O.
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
-

Functions

-
-
-def poll(in_: List[Pollable]) ‑> List[int] -
-
-

Poll for completion on a set of pollables.

-

This function takes a list of pollables, which identify I/O sources of -interest, and waits until one or more of the events is ready for I/O.

-

The result list<u32> contains one or more indices of handles in the -argument list that is ready for I/O.

-

If the list contains more elements than can be indexed with a u32 -value, this function traps.

-

A timeout can be implemented by adding a pollable from the -wasi-clocks API to the list.

-

This function does not return a result; polling in itself does not -do any I/O so it doesn't fail. If any of the I/O sources identified by -the pollables has an error, it is indicated by marking the source as -being reaedy for I/O.

-
- -Expand source code - -
def poll(in_: List[Pollable]) -> List[int]:
-    """
-    Poll for completion on a set of pollables.
-    
-    This function takes a list of pollables, which identify I/O sources of
-    interest, and waits until one or more of the events is ready for I/O.
-    
-    The result `list<u32>` contains one or more indices of handles in the
-    argument list that is ready for I/O.
-    
-    If the list contains more elements than can be indexed with a `u32`
-    value, this function traps.
-    
-    A timeout can be implemented by adding a pollable from the
-    wasi-clocks API to the list.
-    
-    This function does not return a `result`; polling in itself does not
-    do any I/O so it doesn't fail. If any of the I/O sources identified by
-    the pollables has an error, it is indicated by marking the source as
-    being reaedy for I/O.
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Classes

-
-
-class Pollable -
-
-

pollable represents a single I/O event which may be ready, or not.

-
- -Expand source code - -
class Pollable:
-    """
-    `pollable` represents a single I/O event which may be ready, or not.
-    """
-    
-    def ready(self) -> int:
-        """
-        Return the readiness of a pollable. This function never blocks.
-        
-        Returns `true` when the pollable is ready, and `false` otherwise.
-        """
-        raise NotImplementedError
-
-    def block(self) -> None:
-        """
-        `block` returns immediately if the pollable is ready, and otherwise
-        blocks until ready.
-        
-        This function is equivalent to calling `poll.poll` on a list
-        containing only this pollable.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def block(self) ‑> None -
-
-

block returns immediately if the pollable is ready, and otherwise -blocks until ready.

-

This function is equivalent to calling poll.poll on a list -containing only this pollable.

-
- -Expand source code - -
def block(self) -> None:
-    """
-    `block` returns immediately if the pollable is ready, and otherwise
-    blocks until ready.
-    
-    This function is equivalent to calling `poll.poll` on a list
-    containing only this pollable.
-    """
-    raise NotImplementedError
-
-
-
-def ready(self) ‑> int -
-
-

Return the readiness of a pollable. This function never blocks.

-

Returns true when the pollable is ready, and false otherwise.

-
- -Expand source code - -
def ready(self) -> int:
-    """
-    Return the readiness of a pollable. This function never blocks.
-    
-    Returns `true` when the pollable is ready, and `false` otherwise.
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/postgres.html b/docs/v2/wit/imports/postgres.html deleted file mode 100644 index bb33dee..0000000 --- a/docs/v2/wit/imports/postgres.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - -spin_sdk.wit.imports.postgres API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.postgres

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import rdbms_types
-
-class Connection:
-    """
-    A connection to a postgres database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Postgres instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-        """
-        Query the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> int:
-        """
-        Execute command to the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-

A connection to a postgres database.

-
- -Expand source code - -
class Connection:
-    """
-    A connection to a postgres database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Postgres instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-        """
-        Query the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> int:
-        """
-        Execute command to the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the Postgres instance at address.

-

Raises: Err(Error)

-
- -Expand source code - -
@classmethod
-def open(cls, address: str) -> Self:
-    """
-    Open a connection to the Postgres instance at `address`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def execute(self, statement: str, params: List[Union[ParameterValueBooleanParameterValueInt8ParameterValueInt16ParameterValueInt32ParameterValueInt64ParameterValueUint8ParameterValueUint16ParameterValueUint32ParameterValueUint64ParameterValueFloating32ParameterValueFloating64ParameterValueStrParameterValueBinaryParameterValueDbNull]]) ‑> int -
-
-

Execute command to the database.

-

Raises: Err(Error)

-
- -Expand source code - -
def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> int:
-    """
-    Execute command to the database.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def query(self, statement: str, params: List[Union[ParameterValueBooleanParameterValueInt8ParameterValueInt16ParameterValueInt32ParameterValueInt64ParameterValueUint8ParameterValueUint16ParameterValueUint32ParameterValueUint64ParameterValueFloating32ParameterValueFloating64ParameterValueStrParameterValueBinaryParameterValueDbNull]]) ‑> RowSet -
-
-

Query the database.

-

Raises: Err(Error)

-
- -Expand source code - -
def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-    """
-    Query the database.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/rdbms_types.html b/docs/v2/wit/imports/rdbms_types.html deleted file mode 100644 index 03ef7c3..0000000 --- a/docs/v2/wit/imports/rdbms_types.html +++ /dev/null @@ -1,1426 +0,0 @@ - - - - - - -spin_sdk.wit.imports.rdbms_types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.rdbms_types

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-@dataclass
-class ErrorConnectionFailed:
-    value: str
-
-
-@dataclass
-class ErrorBadParameter:
-    value: str
-
-
-@dataclass
-class ErrorQueryFailed:
-    value: str
-
-
-@dataclass
-class ErrorValueConversionFailed:
-    value: str
-
-
-@dataclass
-class ErrorOther:
-    value: str
-
-
-Error = Union[ErrorConnectionFailed, ErrorBadParameter, ErrorQueryFailed, ErrorValueConversionFailed, ErrorOther]
-"""
-Errors related to interacting with a database.
-"""
-
-
-class DbDataType(Enum):
-    """
-    Data types for a database column
-    """
-    BOOLEAN = 0
-    INT8 = 1
-    INT16 = 2
-    INT32 = 3
-    INT64 = 4
-    UINT8 = 5
-    UINT16 = 6
-    UINT32 = 7
-    UINT64 = 8
-    FLOATING32 = 9
-    FLOATING64 = 10
-    STR = 11
-    BINARY = 12
-    OTHER = 13
-
-
-@dataclass
-class DbValueBoolean:
-    value: int
-
-
-@dataclass
-class DbValueInt8:
-    value: int
-
-
-@dataclass
-class DbValueInt16:
-    value: int
-
-
-@dataclass
-class DbValueInt32:
-    value: int
-
-
-@dataclass
-class DbValueInt64:
-    value: int
-
-
-@dataclass
-class DbValueUint8:
-    value: int
-
-
-@dataclass
-class DbValueUint16:
-    value: int
-
-
-@dataclass
-class DbValueUint32:
-    value: int
-
-
-@dataclass
-class DbValueUint64:
-    value: int
-
-
-@dataclass
-class DbValueFloating32:
-    value: float
-
-
-@dataclass
-class DbValueFloating64:
-    value: float
-
-
-@dataclass
-class DbValueStr:
-    value: str
-
-
-@dataclass
-class DbValueBinary:
-    value: bytes
-
-
-@dataclass
-class DbValueDbNull:
-    pass
-
-
-@dataclass
-class DbValueUnsupported:
-    pass
-
-
-DbValue = Union[DbValueBoolean, DbValueInt8, DbValueInt16, DbValueInt32, DbValueInt64, DbValueUint8, DbValueUint16, DbValueUint32, DbValueUint64, DbValueFloating32, DbValueFloating64, DbValueStr, DbValueBinary, DbValueDbNull, DbValueUnsupported]
-"""
-Database values
-"""
-
-
-
-@dataclass
-class ParameterValueBoolean:
-    value: int
-
-
-@dataclass
-class ParameterValueInt8:
-    value: int
-
-
-@dataclass
-class ParameterValueInt16:
-    value: int
-
-
-@dataclass
-class ParameterValueInt32:
-    value: int
-
-
-@dataclass
-class ParameterValueInt64:
-    value: int
-
-
-@dataclass
-class ParameterValueUint8:
-    value: int
-
-
-@dataclass
-class ParameterValueUint16:
-    value: int
-
-
-@dataclass
-class ParameterValueUint32:
-    value: int
-
-
-@dataclass
-class ParameterValueUint64:
-    value: int
-
-
-@dataclass
-class ParameterValueFloating32:
-    value: float
-
-
-@dataclass
-class ParameterValueFloating64:
-    value: float
-
-
-@dataclass
-class ParameterValueStr:
-    value: str
-
-
-@dataclass
-class ParameterValueBinary:
-    value: bytes
-
-
-@dataclass
-class ParameterValueDbNull:
-    pass
-
-
-ParameterValue = Union[ParameterValueBoolean, ParameterValueInt8, ParameterValueInt16, ParameterValueInt32, ParameterValueInt64, ParameterValueUint8, ParameterValueUint16, ParameterValueUint32, ParameterValueUint64, ParameterValueFloating32, ParameterValueFloating64, ParameterValueStr, ParameterValueBinary, ParameterValueDbNull]
-"""
-Values used in parameterized queries
-"""
-
-
-@dataclass
-class Column:
-    """
-    A database column
-    """
-    name: str
-    data_type: DbDataType
-
-@dataclass
-class RowSet:
-    """
-    A set of database rows
-    """
-    columns: List[Column]
-    rows: List[List[DbValue]]
-
-
-
-
-
-

Global variables

-
-
var DbValue
-
-

Database values

-
-
var Error
-
-

Errors related to interacting with a database.

-
-
var ParameterValue
-
-

Values used in parameterized queries

-
-
-
-
-
-
-

Classes

-
-
-class Column -(name: str, data_type: DbDataType) -
-
-

A database column

-
- -Expand source code - -
@dataclass
-class Column:
-    """
-    A database column
-    """
-    name: str
-    data_type: DbDataType
-
-

Class variables

-
-
var data_typeDbDataType
-
-
-
-
var name : str
-
-
-
-
-
-
-class DbDataType -(*args, **kwds) -
-
-

Data types for a database column

-
- -Expand source code - -
class DbDataType(Enum):
-    """
-    Data types for a database column
-    """
-    BOOLEAN = 0
-    INT8 = 1
-    INT16 = 2
-    INT32 = 3
-    INT64 = 4
-    UINT8 = 5
-    UINT16 = 6
-    UINT32 = 7
-    UINT64 = 8
-    FLOATING32 = 9
-    FLOATING64 = 10
-    STR = 11
-    BINARY = 12
-    OTHER = 13
-
-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var BINARY
-
-
-
-
var BOOLEAN
-
-
-
-
var FLOATING32
-
-
-
-
var FLOATING64
-
-
-
-
var INT16
-
-
-
-
var INT32
-
-
-
-
var INT64
-
-
-
-
var INT8
-
-
-
-
var OTHER
-
-
-
-
var STR
-
-
-
-
var UINT16
-
-
-
-
var UINT32
-
-
-
-
var UINT64
-
-
-
-
var UINT8
-
-
-
-
-
-
-class DbValueBinary -(value: bytes) -
-
-

DbValueBinary(value: bytes)

-
- -Expand source code - -
@dataclass
-class DbValueBinary:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValueBoolean -(value: int) -
-
-

DbValueBoolean(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueBoolean:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueDbNull -
-
-

DbValueDbNull()

-
- -Expand source code - -
@dataclass
-class DbValueDbNull:
-    pass
-
-
-
-class DbValueFloating32 -(value: float) -
-
-

DbValueFloating32(value: float)

-
- -Expand source code - -
@dataclass
-class DbValueFloating32:
-    value: float
-
-

Class variables

-
-
var value : float
-
-
-
-
-
-
-class DbValueFloating64 -(value: float) -
-
-

DbValueFloating64(value: float)

-
- -Expand source code - -
@dataclass
-class DbValueFloating64:
-    value: float
-
-

Class variables

-
-
var value : float
-
-
-
-
-
-
-class DbValueInt16 -(value: int) -
-
-

DbValueInt16(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueInt16:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueInt32 -(value: int) -
-
-

DbValueInt32(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueInt32:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueInt64 -(value: int) -
-
-

DbValueInt64(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueInt64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueInt8 -(value: int) -
-
-

DbValueInt8(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueInt8:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueStr -(value: str) -
-
-

DbValueStr(value: str)

-
- -Expand source code - -
@dataclass
-class DbValueStr:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class DbValueUint16 -(value: int) -
-
-

DbValueUint16(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueUint16:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueUint32 -(value: int) -
-
-

DbValueUint32(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueUint32:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueUint64 -(value: int) -
-
-

DbValueUint64(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueUint64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueUint8 -(value: int) -
-
-

DbValueUint8(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueUint8:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueUnsupported -
-
-

DbValueUnsupported()

-
- -Expand source code - -
@dataclass
-class DbValueUnsupported:
-    pass
-
-
-
-class ErrorBadParameter -(value: str) -
-
-

ErrorBadParameter(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorBadParameter:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorConnectionFailed -(value: str) -
-
-

ErrorConnectionFailed(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorConnectionFailed:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorOther -(value: str) -
-
-

ErrorOther(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorOther:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorQueryFailed -(value: str) -
-
-

ErrorQueryFailed(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorQueryFailed:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorValueConversionFailed -(value: str) -
-
-

ErrorValueConversionFailed(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorValueConversionFailed:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValueBinary -(value: bytes) -
-
-

ParameterValueBinary(value: bytes)

-
- -Expand source code - -
@dataclass
-class ParameterValueBinary:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class ParameterValueBoolean -(value: int) -
-
-

ParameterValueBoolean(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueBoolean:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueDbNull -
-
-

ParameterValueDbNull()

-
- -Expand source code - -
@dataclass
-class ParameterValueDbNull:
-    pass
-
-
-
-class ParameterValueFloating32 -(value: float) -
-
-

ParameterValueFloating32(value: float)

-
- -Expand source code - -
@dataclass
-class ParameterValueFloating32:
-    value: float
-
-

Class variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValueFloating64 -(value: float) -
-
-

ParameterValueFloating64(value: float)

-
- -Expand source code - -
@dataclass
-class ParameterValueFloating64:
-    value: float
-
-

Class variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValueInt16 -(value: int) -
-
-

ParameterValueInt16(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueInt16:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueInt32 -(value: int) -
-
-

ParameterValueInt32(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueInt32:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueInt64 -(value: int) -
-
-

ParameterValueInt64(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueInt64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueInt8 -(value: int) -
-
-

ParameterValueInt8(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueInt8:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueStr -(value: str) -
-
-

ParameterValueStr(value: str)

-
- -Expand source code - -
@dataclass
-class ParameterValueStr:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValueUint16 -(value: int) -
-
-

ParameterValueUint16(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueUint16:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueUint32 -(value: int) -
-
-

ParameterValueUint32(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueUint32:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueUint64 -(value: int) -
-
-

ParameterValueUint64(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueUint64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueUint8 -(value: int) -
-
-

ParameterValueUint8(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueUint8:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class RowSet -(columns: List[Column], rows: List[List[Union[DbValueBooleanDbValueInt8DbValueInt16DbValueInt32DbValueInt64DbValueUint8DbValueUint16DbValueUint32DbValueUint64DbValueFloating32DbValueFloating64DbValueStrDbValueBinaryDbValueDbNullDbValueUnsupported]]]) -
-
-

A set of database rows

-
- -Expand source code - -
@dataclass
-class RowSet:
-    """
-    A set of database rows
-    """
-    columns: List[Column]
-    rows: List[List[DbValue]]
-
-

Class variables

-
-
var columns : List[Column]
-
-
-
-
var rows : List[List[Union[DbValueBooleanDbValueInt8DbValueInt16DbValueInt32DbValueInt64DbValueUint8DbValueUint16DbValueUint32DbValueUint64DbValueFloating32DbValueFloating64DbValueStrDbValueBinaryDbValueDbNullDbValueUnsupported]]]
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/redis.html b/docs/v2/wit/imports/redis.html deleted file mode 100644 index 640f4ff..0000000 --- a/docs/v2/wit/imports/redis.html +++ /dev/null @@ -1,839 +0,0 @@ - - - - - - -spin_sdk.wit.imports.redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.redis

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-@dataclass
-class ErrorInvalidAddress:
-    pass
-
-
-@dataclass
-class ErrorTooManyConnections:
-    pass
-
-
-@dataclass
-class ErrorTypeError:
-    pass
-
-
-@dataclass
-class ErrorOther:
-    value: str
-
-
-Error = Union[ErrorInvalidAddress, ErrorTooManyConnections, ErrorTypeError, ErrorOther]
-"""
-Errors related to interacting with Redis
-"""
-
-
-
-@dataclass
-class RedisParameterInt64:
-    value: int
-
-
-@dataclass
-class RedisParameterBinary:
-    value: bytes
-
-
-RedisParameter = Union[RedisParameterInt64, RedisParameterBinary]
-"""
-A parameter type for the general-purpose `execute` function.
-"""
-
-
-
-@dataclass
-class RedisResultNil:
-    pass
-
-
-@dataclass
-class RedisResultStatus:
-    value: str
-
-
-@dataclass
-class RedisResultInt64:
-    value: int
-
-
-@dataclass
-class RedisResultBinary:
-    value: bytes
-
-
-RedisResult = Union[RedisResultNil, RedisResultStatus, RedisResultInt64, RedisResultBinary]
-"""
-A return type for the general-purpose `execute` function.
-"""
-
-
-class Connection:
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Redis instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def publish(self, channel: str, payload: bytes) -> None:
-        """
-        Publish a Redis message to the specified channel.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value of a key.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set key to value.
-        
-        If key already holds a value, it is overwritten.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def incr(self, key: str) -> int:
-        """
-        Increments the number stored at key by one.
-        
-        If the key does not exist, it is set to 0 before performing the operation.
-        An `error::type-error` is returned if the key contains a value of the wrong type
-        or contains a string that can not be represented as integer.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def del_(self, keys: List[str]) -> int:
-        """
-        Removes the specified keys.
-        
-        A key is ignored if it does not exist. Returns the number of keys deleted.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def sadd(self, key: str, values: List[str]) -> int:
-        """
-        Add the specified `values` to the set named `key`, returning the number of newly-added values.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def smembers(self, key: str) -> List[str]:
-        """
-        Retrieve the contents of the set named `key`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def srem(self, key: str, values: List[str]) -> int:
-        """
-        Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
-        """
-        Execute an arbitrary Redis command and receive the result.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

Errors related to interacting with Redis

-
-
var RedisParameter
-
-

A parameter type for the general-purpose execute function.

-
-
var RedisResult
-
-

A return type for the general-purpose execute function.

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
-
- -Expand source code - -
class Connection:
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Redis instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def publish(self, channel: str, payload: bytes) -> None:
-        """
-        Publish a Redis message to the specified channel.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value of a key.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set key to value.
-        
-        If key already holds a value, it is overwritten.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def incr(self, key: str) -> int:
-        """
-        Increments the number stored at key by one.
-        
-        If the key does not exist, it is set to 0 before performing the operation.
-        An `error::type-error` is returned if the key contains a value of the wrong type
-        or contains a string that can not be represented as integer.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def del_(self, keys: List[str]) -> int:
-        """
-        Removes the specified keys.
-        
-        A key is ignored if it does not exist. Returns the number of keys deleted.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def sadd(self, key: str, values: List[str]) -> int:
-        """
-        Add the specified `values` to the set named `key`, returning the number of newly-added values.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def smembers(self, key: str) -> List[str]:
-        """
-        Retrieve the contents of the set named `key`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def srem(self, key: str, values: List[str]) -> int:
-        """
-        Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
-        """
-        Execute an arbitrary Redis command and receive the result.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the Redis instance at address.

-

Raises: Err(Error)

-
- -Expand source code - -
@classmethod
-def open(cls, address: str) -> Self:
-    """
-    Open a connection to the Redis instance at `address`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def del_(self, keys: List[str]) ‑> int -
-
-

Removes the specified keys.

-

A key is ignored if it does not exist. Returns the number of keys deleted.

-

Raises: Err(Error)

-
- -Expand source code - -
def del_(self, keys: List[str]) -> int:
-    """
-    Removes the specified keys.
-    
-    A key is ignored if it does not exist. Returns the number of keys deleted.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def execute(self, command: str, arguments: List[Union[RedisParameterInt64RedisParameterBinary]]) ‑> List[Union[RedisResultNilRedisResultStatusRedisResultInt64RedisResultBinary]] -
-
-

Execute an arbitrary Redis command and receive the result.

-

Raises: Err(Error)

-
- -Expand source code - -
def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
-    """
-    Execute an arbitrary Redis command and receive the result.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def get(self, key: str) ‑> Optional[bytes] -
-
-

Get the value of a key.

-

Raises: Err(Error)

-
- -Expand source code - -
def get(self, key: str) -> Optional[bytes]:
-    """
-    Get the value of a key.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def incr(self, key: str) ‑> int -
-
-

Increments the number stored at key by one.

-

If the key does not exist, it is set to 0 before performing the operation. -An error::type-error is returned if the key contains a value of the wrong type -or contains a string that can not be represented as integer.

-

Raises: Err(Error)

-
- -Expand source code - -
def incr(self, key: str) -> int:
-    """
-    Increments the number stored at key by one.
-    
-    If the key does not exist, it is set to 0 before performing the operation.
-    An `error::type-error` is returned if the key contains a value of the wrong type
-    or contains a string that can not be represented as integer.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def publish(self, channel: str, payload: bytes) ‑> None -
-
-

Publish a Redis message to the specified channel.

-

Raises: Err(Error)

-
- -Expand source code - -
def publish(self, channel: str, payload: bytes) -> None:
-    """
-    Publish a Redis message to the specified channel.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def sadd(self, key: str, values: List[str]) ‑> int -
-
-

Add the specified values to the set named key, returning the number of newly-added values.

-

Raises: Err(Error)

-
- -Expand source code - -
def sadd(self, key: str, values: List[str]) -> int:
-    """
-    Add the specified `values` to the set named `key`, returning the number of newly-added values.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def set(self, key: str, value: bytes) ‑> None -
-
-

Set key to value.

-

If key already holds a value, it is overwritten.

-

Raises: Err(Error)

-
- -Expand source code - -
def set(self, key: str, value: bytes) -> None:
-    """
-    Set key to value.
-    
-    If key already holds a value, it is overwritten.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def smembers(self, key: str) ‑> List[str] -
-
-

Retrieve the contents of the set named key.

-

Raises: Err(Error)

-
- -Expand source code - -
def smembers(self, key: str) -> List[str]:
-    """
-    Retrieve the contents of the set named `key`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def srem(self, key: str, values: List[str]) ‑> int -
-
-

Remove the specified values from the set named key, returning the number of newly-removed values.

-

Raises: Err(Error)

-
- -Expand source code - -
def srem(self, key: str, values: List[str]) -> int:
-    """
-    Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class ErrorInvalidAddress -
-
-

ErrorInvalidAddress()

-
- -Expand source code - -
@dataclass
-class ErrorInvalidAddress:
-    pass
-
-
-
-class ErrorOther -(value: str) -
-
-

ErrorOther(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorOther:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorTooManyConnections -
-
-

ErrorTooManyConnections()

-
- -Expand source code - -
@dataclass
-class ErrorTooManyConnections:
-    pass
-
-
-
-class ErrorTypeError -
-
-

ErrorTypeError()

-
- -Expand source code - -
@dataclass
-class ErrorTypeError:
-    pass
-
-
-
-class RedisParameterBinary -(value: bytes) -
-
-

RedisParameterBinary(value: bytes)

-
- -Expand source code - -
@dataclass
-class RedisParameterBinary:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisParameterInt64 -(value: int) -
-
-

RedisParameterInt64(value: int)

-
- -Expand source code - -
@dataclass
-class RedisParameterInt64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResultBinary -(value: bytes) -
-
-

RedisResultBinary(value: bytes)

-
- -Expand source code - -
@dataclass
-class RedisResultBinary:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisResultInt64 -(value: int) -
-
-

RedisResultInt64(value: int)

-
- -Expand source code - -
@dataclass
-class RedisResultInt64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResultNil -
-
-

RedisResultNil()

-
- -Expand source code - -
@dataclass
-class RedisResultNil:
-    pass
-
-
-
-class RedisResultStatus -(value: str) -
-
-

RedisResultStatus(value: str)

-
- -Expand source code - -
@dataclass
-class RedisResultStatus:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/redis_types.html b/docs/v2/wit/imports/redis_types.html deleted file mode 100644 index 7558f05..0000000 --- a/docs/v2/wit/imports/redis_types.html +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - -spin_sdk.wit.imports.redis_types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.redis_types

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-class Error(Enum):
-    """
-    General purpose error.
-    """
-    SUCCESS = 0
-    ERROR = 1
-
-
-@dataclass
-class RedisParameterInt64:
-    value: int
-
-
-@dataclass
-class RedisParameterBinary:
-    value: bytes
-
-
-RedisParameter = Union[RedisParameterInt64, RedisParameterBinary]
-"""
-A parameter type for the general-purpose `execute` function.
-"""
-
-
-
-@dataclass
-class RedisResultNil:
-    pass
-
-
-@dataclass
-class RedisResultStatus:
-    value: str
-
-
-@dataclass
-class RedisResultInt64:
-    value: int
-
-
-@dataclass
-class RedisResultBinary:
-    value: bytes
-
-
-RedisResult = Union[RedisResultNil, RedisResultStatus, RedisResultInt64, RedisResultBinary]
-"""
-A return type for the general-purpose `execute` function.
-"""
-
-
-
-
-
-

Global variables

-
-
var RedisParameter
-
-

A parameter type for the general-purpose execute function.

-
-
var RedisResult
-
-

A return type for the general-purpose execute function.

-
-
-
-
-
-
-

Classes

-
-
-class Error -(*args, **kwds) -
-
-

General purpose error.

-
- -Expand source code - -
class Error(Enum):
-    """
-    General purpose error.
-    """
-    SUCCESS = 0
-    ERROR = 1
-
-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var ERROR
-
-
-
-
var SUCCESS
-
-
-
-
-
-
-class RedisParameterBinary -(value: bytes) -
-
-

RedisParameterBinary(value: bytes)

-
- -Expand source code - -
@dataclass
-class RedisParameterBinary:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisParameterInt64 -(value: int) -
-
-

RedisParameterInt64(value: int)

-
- -Expand source code - -
@dataclass
-class RedisParameterInt64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResultBinary -(value: bytes) -
-
-

RedisResultBinary(value: bytes)

-
- -Expand source code - -
@dataclass
-class RedisResultBinary:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisResultInt64 -(value: int) -
-
-

RedisResultInt64(value: int)

-
- -Expand source code - -
@dataclass
-class RedisResultInt64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResultNil -
-
-

RedisResultNil()

-
- -Expand source code - -
@dataclass
-class RedisResultNil:
-    pass
-
-
-
-class RedisResultStatus -(value: str) -
-
-

RedisResultStatus(value: str)

-
- -Expand source code - -
@dataclass
-class RedisResultStatus:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/sqlite.html b/docs/v2/wit/imports/sqlite.html deleted file mode 100644 index 39f5ac1..0000000 --- a/docs/v2/wit/imports/sqlite.html +++ /dev/null @@ -1,602 +0,0 @@ - - - - - - -spin_sdk.wit.imports.sqlite API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.sqlite

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-@dataclass
-class ErrorNoSuchDatabase:
-    pass
-
-
-@dataclass
-class ErrorAccessDenied:
-    pass
-
-
-@dataclass
-class ErrorInvalidConnection:
-    pass
-
-
-@dataclass
-class ErrorDatabaseFull:
-    pass
-
-
-@dataclass
-class ErrorIo:
-    value: str
-
-
-Error = Union[ErrorNoSuchDatabase, ErrorAccessDenied, ErrorInvalidConnection, ErrorDatabaseFull, ErrorIo]
-"""
-The set of errors which may be raised by functions in this interface
-"""
-
-
-
-@dataclass
-class ValueInteger:
-    value: int
-
-
-@dataclass
-class ValueReal:
-    value: float
-
-
-@dataclass
-class ValueText:
-    value: str
-
-
-@dataclass
-class ValueBlob:
-    value: bytes
-
-
-@dataclass
-class ValueNull:
-    pass
-
-
-Value = Union[ValueInteger, ValueReal, ValueText, ValueBlob, ValueNull]
-"""
-A single column's result from a database query
-"""
-
-
-@dataclass
-class RowResult:
-    """
-    A set of values for each of the columns in a query-result
-    """
-    values: List[Value]
-
-@dataclass
-class QueryResult:
-    """
-    A result of a query
-    """
-    columns: List[str]
-    rows: List[RowResult]
-
-class Connection:
-    """
-    A handle to an open sqlite instance
-    """
-    
-    @classmethod
-    def open(cls, database: str) -> Self:
-        """
-        Open a connection to a named database instance.
-        
-        If `database` is "default", the default instance is opened.
-        
-        `error::no-such-database` will be raised if the `name` is not recognized.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-        """
-        Execute a statement returning back data if there is any
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
var Value
-
-

A single column's result from a database query

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-

A handle to an open sqlite instance

-
- -Expand source code - -
class Connection:
-    """
-    A handle to an open sqlite instance
-    """
-    
-    @classmethod
-    def open(cls, database: str) -> Self:
-        """
-        Open a connection to a named database instance.
-        
-        If `database` is "default", the default instance is opened.
-        
-        `error::no-such-database` will be raised if the `name` is not recognized.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-        """
-        Execute a statement returning back data if there is any
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def open(database: str) ‑> Self -
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

error::no-such-database will be raised if the name is not recognized.

-

Raises: Err(Error)

-
- -Expand source code - -
@classmethod
-def open(cls, database: str) -> Self:
-    """
-    Open a connection to a named database instance.
-    
-    If `database` is "default", the default instance is opened.
-    
-    `error::no-such-database` will be raised if the `name` is not recognized.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def execute(self, statement: str, parameters: List[Union[ValueIntegerValueRealValueTextValueBlobValueNull]]) ‑> QueryResult -
-
-

Execute a statement returning back data if there is any

-

Raises: Err(Error)

-
- -Expand source code - -
def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-    """
-    Execute a statement returning back data if there is any
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class ErrorAccessDenied -
-
-

ErrorAccessDenied()

-
- -Expand source code - -
@dataclass
-class ErrorAccessDenied:
-    pass
-
-
-
-class ErrorDatabaseFull -
-
-

ErrorDatabaseFull()

-
- -Expand source code - -
@dataclass
-class ErrorDatabaseFull:
-    pass
-
-
-
-class ErrorInvalidConnection -
-
-

ErrorInvalidConnection()

-
- -Expand source code - -
@dataclass
-class ErrorInvalidConnection:
-    pass
-
-
-
-class ErrorIo -(value: str) -
-
-

ErrorIo(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorIo:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorNoSuchDatabase -
-
-

ErrorNoSuchDatabase()

-
- -Expand source code - -
@dataclass
-class ErrorNoSuchDatabase:
-    pass
-
-
-
-class QueryResult -(columns: List[str], rows: List[RowResult]) -
-
-

A result of a query

-
- -Expand source code - -
@dataclass
-class QueryResult:
-    """
-    A result of a query
-    """
-    columns: List[str]
-    rows: List[RowResult]
-
-

Class variables

-
-
var columns : List[str]
-
-
-
-
var rows : List[RowResult]
-
-
-
-
-
-
-class RowResult -(values: List[Union[ValueIntegerValueRealValueTextValueBlobValueNull]]) -
-
-

A set of values for each of the columns in a query-result

-
- -Expand source code - -
@dataclass
-class RowResult:
-    """
-    A set of values for each of the columns in a query-result
-    """
-    values: List[Value]
-
-

Class variables

-
-
var values : List[Union[ValueIntegerValueRealValueTextValueBlobValueNull]]
-
-
-
-
-
-
-class ValueBlob -(value: bytes) -
-
-

ValueBlob(value: bytes)

-
- -Expand source code - -
@dataclass
-class ValueBlob:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class ValueInteger -(value: int) -
-
-

ValueInteger(value: int)

-
- -Expand source code - -
@dataclass
-class ValueInteger:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ValueNull -
-
-

ValueNull()

-
- -Expand source code - -
@dataclass
-class ValueNull:
-    pass
-
-
-
-class ValueReal -(value: float) -
-
-

ValueReal(value: float)

-
- -Expand source code - -
@dataclass
-class ValueReal:
-    value: float
-
-

Class variables

-
-
var value : float
-
-
-
-
-
-
-class ValueText -(value: str) -
-
-

ValueText(value: str)

-
- -Expand source code - -
@dataclass
-class ValueText:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/streams.html b/docs/v2/wit/imports/streams.html deleted file mode 100644 index f4c0572..0000000 --- a/docs/v2/wit/imports/streams.html +++ /dev/null @@ -1,1361 +0,0 @@ - - - - - - -spin_sdk.wit.imports.streams API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.streams

-
-
-

WASI I/O is an I/O abstraction API which is currently focused on providing -stream types.

-

In the future, the component model is expected to add built-in stream types; -when it does, they are expected to subsume this API.

-
- -Expand source code - -
"""
-WASI I/O is an I/O abstraction API which is currently focused on providing
-stream types.
-
-In the future, the component model is expected to add built-in stream types;
-when it does, they are expected to subsume this API.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import poll
-from ..imports import error
-
-
-@dataclass
-class StreamErrorLastOperationFailed:
-    value: error.Error
-
-
-@dataclass
-class StreamErrorClosed:
-    pass
-
-
-StreamError = Union[StreamErrorLastOperationFailed, StreamErrorClosed]
-"""
-An error for input-stream and output-stream operations.
-"""
-
-
-class InputStream:
-    """
-    An input bytestream.
-    
-    `input-stream`s are *non-blocking* to the extent practical on underlying
-    platforms. I/O operations always return promptly; if fewer bytes are
-    promptly available than requested, they return the number of bytes promptly
-    available, which could even be zero. To wait for data to be available,
-    use the `subscribe` function to obtain a `pollable` which can be polled
-    for using `wasi:io/poll`.
-    """
-    
-    def read(self, len: int) -> bytes:
-        """
-        Perform a non-blocking read from the stream.
-        
-        When the source of a `read` is binary data, the bytes from the source
-        are returned verbatim. When the source of a `read` is known to the
-        implementation to be text, bytes containing the UTF-8 encoding of the
-        text are returned.
-        
-        This function returns a list of bytes containing the read data,
-        when successful. The returned list will contain up to `len` bytes;
-        it may return fewer than requested, but not more. The list is
-        empty when no bytes are available for reading at this time. The
-        pollable given by `subscribe` will be ready when more bytes are
-        available.
-        
-        This function fails with a `stream-error` when the operation
-        encounters an error, giving `last-operation-failed`, or when the
-        stream is closed, giving `closed`.
-        
-        When the caller gives a `len` of 0, it represents a request to
-        read 0 bytes. If the stream is still open, this call should
-        succeed and return an empty list, or otherwise fail with `closed`.
-        
-        The `len` parameter is a `u64`, which could represent a list of u8 which
-        is not possible to allocate in wasm32, or not desirable to allocate as
-        as a return value by the callee. The callee may return a list of bytes
-        less than `len` in size while more bytes are available for reading.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_read(self, len: int) -> bytes:
-        """
-        Read bytes from a stream, after blocking until at least one byte can
-        be read. Except for blocking, behavior is identical to `read`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream. Returns number of bytes skipped.
-        
-        Behaves identical to `read`, except instead of returning a list
-        of bytes, returns the number of bytes consumed from the stream.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream, after blocking until at least one byte
-        can be skipped. Except for blocking behavior, identical to `skip`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def subscribe(self) -> poll.Pollable:
-        """
-        Create a `pollable` which will resolve once either the specified stream
-        has bytes available to read or the other end of the stream has been
-        closed.
-        The created `pollable` is a child resource of the `input-stream`.
-        Implementations may trap if the `input-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class OutputStream:
-    """
-    An output bytestream.
-    
-    `output-stream`s are *non-blocking* to the extent practical on
-    underlying platforms. Except where specified otherwise, I/O operations also
-    always return promptly, after the number of bytes that can be written
-    promptly, which could even be zero. To wait for the stream to be ready to
-    accept data, the `subscribe` function to obtain a `pollable` which can be
-    polled for using `wasi:io/poll`.
-    """
-    
-    def check_write(self) -> int:
-        """
-        Check readiness for writing. This function never blocks.
-        
-        Returns the number of bytes permitted for the next call to `write`,
-        or an error. Calling `write` with more bytes than this function has
-        permitted will trap.
-        
-        When this function returns 0 bytes, the `subscribe` pollable will
-        become ready when this function will report at least 1 byte, or an
-        error.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def write(self, contents: bytes) -> None:
-        """
-        Perform a write. This function never blocks.
-        
-        When the destination of a `write` is binary data, the bytes from
-        `contents` are written verbatim. When the destination of a `write` is
-        known to the implementation to be text, the bytes of `contents` are
-        transcoded from UTF-8 into the encoding of the destination and then
-        written.
-        
-        Precondition: check-write gave permit of Ok(n) and contents has a
-        length of less than or equal to n. Otherwise, this function will trap.
-        
-        returns Err(closed) without writing if the stream has closed since
-        the last call to check-write provided a permit.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_write_and_flush(self, contents: bytes) -> None:
-        """
-        Perform a write of up to 4096 bytes, and then flush the stream. Block
-        until all of these operations are complete, or an error occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write`, and `flush`, and is implemented with the
-        following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while !contents.is_empty() {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, contents.len());
-        let (chunk, rest) = contents.split_at(len);
-        this.write(chunk  );            // eliding error handling
-        contents = rest;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def flush(self) -> None:
-        """
-        Request to flush buffered output. This function never blocks.
-        
-        This tells the output-stream that the caller intends any buffered
-        output to be flushed. the output which is expected to be flushed
-        is all that has been passed to `write` prior to this call.
-        
-        Upon calling this function, the `output-stream` will not accept any
-        writes (`check-write` will return `ok(0)`) until the flush has
-        completed. The `subscribe` pollable will become ready when the
-        flush has completed and the stream can accept more writes.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_flush(self) -> None:
-        """
-        Request to flush buffered output, and block until flush completes
-        and stream is ready for writing again.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def subscribe(self) -> poll.Pollable:
-        """
-        Create a `pollable` which will resolve once the output-stream
-        is ready for more writing, or an error has occured. When this
-        pollable is ready, `check-write` will return `ok(n)` with n>0, or an
-        error.
-        
-        If the stream is closed, this pollable is always ready immediately.
-        
-        The created `pollable` is a child resource of the `output-stream`.
-        Implementations may trap if the `output-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-
-    def write_zeroes(self, len: int) -> None:
-        """
-        Write zeroes to a stream.
-        
-        This should be used precisely like `write` with the exact same
-        preconditions (must use check-write first), but instead of
-        passing a list of bytes, you simply pass the number of zero-bytes
-        that should be written.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_write_zeroes_and_flush(self, len: int) -> None:
-        """
-        Perform a write of up to 4096 zeroes, and then flush the stream.
-        Block until all of these operations are complete, or an error
-        occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write-zeroes`, and `flush`, and is implemented with
-        the following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while num_zeroes != 0 {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, num_zeroes);
-        this.write-zeroes(len);         // eliding error handling
-        num_zeroes -= len;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another.
-        
-        The behavior of splice is equivelant to:
-        1. calling `check-write` on the `output-stream`
-        2. calling `read` on the `input-stream` with the smaller of the
-        `check-write` permitted length and the `len` provided to `splice`
-        3. calling `write` on the `output-stream` with that read data.
-        
-        Any error reported by the call to `check-write`, `read`, or
-        `write` ends the splice and reports that error.
-        
-        This function returns the number of bytes transferred; it may be less
-        than `len`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another, with blocking.
-        
-        This is similar to `splice`, except that it blocks until the
-        `output-stream` is ready for writing, and the `input-stream`
-        is ready for reading, before performing the `splice`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var StreamError
-
-

An error for input-stream and output-stream operations.

-
-
-
-
-
-
-

Classes

-
-
-class InputStream -
-
-

An input bytestream.

-

input-streams are non-blocking to the extent practical on underlying -platforms. I/O operations always return promptly; if fewer bytes are -promptly available than requested, they return the number of bytes promptly -available, which could even be zero. To wait for data to be available, -use the subscribe function to obtain a pollable which can be polled -for using wasi:io/poll.

-
- -Expand source code - -
class InputStream:
-    """
-    An input bytestream.
-    
-    `input-stream`s are *non-blocking* to the extent practical on underlying
-    platforms. I/O operations always return promptly; if fewer bytes are
-    promptly available than requested, they return the number of bytes promptly
-    available, which could even be zero. To wait for data to be available,
-    use the `subscribe` function to obtain a `pollable` which can be polled
-    for using `wasi:io/poll`.
-    """
-    
-    def read(self, len: int) -> bytes:
-        """
-        Perform a non-blocking read from the stream.
-        
-        When the source of a `read` is binary data, the bytes from the source
-        are returned verbatim. When the source of a `read` is known to the
-        implementation to be text, bytes containing the UTF-8 encoding of the
-        text are returned.
-        
-        This function returns a list of bytes containing the read data,
-        when successful. The returned list will contain up to `len` bytes;
-        it may return fewer than requested, but not more. The list is
-        empty when no bytes are available for reading at this time. The
-        pollable given by `subscribe` will be ready when more bytes are
-        available.
-        
-        This function fails with a `stream-error` when the operation
-        encounters an error, giving `last-operation-failed`, or when the
-        stream is closed, giving `closed`.
-        
-        When the caller gives a `len` of 0, it represents a request to
-        read 0 bytes. If the stream is still open, this call should
-        succeed and return an empty list, or otherwise fail with `closed`.
-        
-        The `len` parameter is a `u64`, which could represent a list of u8 which
-        is not possible to allocate in wasm32, or not desirable to allocate as
-        as a return value by the callee. The callee may return a list of bytes
-        less than `len` in size while more bytes are available for reading.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_read(self, len: int) -> bytes:
-        """
-        Read bytes from a stream, after blocking until at least one byte can
-        be read. Except for blocking, behavior is identical to `read`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream. Returns number of bytes skipped.
-        
-        Behaves identical to `read`, except instead of returning a list
-        of bytes, returns the number of bytes consumed from the stream.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream, after blocking until at least one byte
-        can be skipped. Except for blocking behavior, identical to `skip`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def subscribe(self) -> poll.Pollable:
-        """
-        Create a `pollable` which will resolve once either the specified stream
-        has bytes available to read or the other end of the stream has been
-        closed.
-        The created `pollable` is a child resource of the `input-stream`.
-        Implementations may trap if the `input-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def blocking_read(self, len: int) ‑> bytes -
-
-

Read bytes from a stream, after blocking until at least one byte can -be read. Except for blocking, behavior is identical to read.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def blocking_read(self, len: int) -> bytes:
-    """
-    Read bytes from a stream, after blocking until at least one byte can
-    be read. Except for blocking, behavior is identical to `read`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def blocking_skip(self, len: int) ‑> int -
-
-

Skip bytes from a stream, after blocking until at least one byte -can be skipped. Except for blocking behavior, identical to skip.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def blocking_skip(self, len: int) -> int:
-    """
-    Skip bytes from a stream, after blocking until at least one byte
-    can be skipped. Except for blocking behavior, identical to `skip`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def read(self, len: int) ‑> bytes -
-
-

Perform a non-blocking read from the stream.

-

When the source of a read is binary data, the bytes from the source -are returned verbatim. When the source of a read is known to the -implementation to be text, bytes containing the UTF-8 encoding of the -text are returned.

-

This function returns a list of bytes containing the read data, -when successful. The returned list will contain up to len bytes; -it may return fewer than requested, but not more. The list is -empty when no bytes are available for reading at this time. The -pollable given by subscribe will be ready when more bytes are -available.

-

This function fails with a stream-error when the operation -encounters an error, giving last-operation-failed, or when the -stream is closed, giving closed.

-

When the caller gives a len of 0, it represents a request to -read 0 bytes. If the stream is still open, this call should -succeed and return an empty list, or otherwise fail with closed.

-

The len parameter is a u64, which could represent a list of u8 which -is not possible to allocate in wasm32, or not desirable to allocate as -as a return value by the callee. The callee may return a list of bytes -less than len in size while more bytes are available for reading.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def read(self, len: int) -> bytes:
-    """
-    Perform a non-blocking read from the stream.
-    
-    When the source of a `read` is binary data, the bytes from the source
-    are returned verbatim. When the source of a `read` is known to the
-    implementation to be text, bytes containing the UTF-8 encoding of the
-    text are returned.
-    
-    This function returns a list of bytes containing the read data,
-    when successful. The returned list will contain up to `len` bytes;
-    it may return fewer than requested, but not more. The list is
-    empty when no bytes are available for reading at this time. The
-    pollable given by `subscribe` will be ready when more bytes are
-    available.
-    
-    This function fails with a `stream-error` when the operation
-    encounters an error, giving `last-operation-failed`, or when the
-    stream is closed, giving `closed`.
-    
-    When the caller gives a `len` of 0, it represents a request to
-    read 0 bytes. If the stream is still open, this call should
-    succeed and return an empty list, or otherwise fail with `closed`.
-    
-    The `len` parameter is a `u64`, which could represent a list of u8 which
-    is not possible to allocate in wasm32, or not desirable to allocate as
-    as a return value by the callee. The callee may return a list of bytes
-    less than `len` in size while more bytes are available for reading.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def skip(self, len: int) ‑> int -
-
-

Skip bytes from a stream. Returns number of bytes skipped.

-

Behaves identical to read, except instead of returning a list -of bytes, returns the number of bytes consumed from the stream.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def skip(self, len: int) -> int:
-    """
-    Skip bytes from a stream. Returns number of bytes skipped.
-    
-    Behaves identical to `read`, except instead of returning a list
-    of bytes, returns the number of bytes consumed from the stream.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def subscribe(self) ‑> Pollable -
-
-

Create a pollable which will resolve once either the specified stream -has bytes available to read or the other end of the stream has been -closed. -The created pollable is a child resource of the input-stream. -Implementations may trap if the input-stream is dropped before -all derived pollables created with this function are dropped.

-
- -Expand source code - -
def subscribe(self) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once either the specified stream
-    has bytes available to read or the other end of the stream has been
-    closed.
-    The created `pollable` is a child resource of the `input-stream`.
-    Implementations may trap if the `input-stream` is dropped before
-    all derived `pollable`s created with this function are dropped.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class OutputStream -
-
-

An output bytestream.

-

output-streams are non-blocking to the extent practical on -underlying platforms. Except where specified otherwise, I/O operations also -always return promptly, after the number of bytes that can be written -promptly, which could even be zero. To wait for the stream to be ready to -accept data, the subscribe function to obtain a pollable which can be -polled for using wasi:io/poll.

-
- -Expand source code - -
class OutputStream:
-    """
-    An output bytestream.
-    
-    `output-stream`s are *non-blocking* to the extent practical on
-    underlying platforms. Except where specified otherwise, I/O operations also
-    always return promptly, after the number of bytes that can be written
-    promptly, which could even be zero. To wait for the stream to be ready to
-    accept data, the `subscribe` function to obtain a `pollable` which can be
-    polled for using `wasi:io/poll`.
-    """
-    
-    def check_write(self) -> int:
-        """
-        Check readiness for writing. This function never blocks.
-        
-        Returns the number of bytes permitted for the next call to `write`,
-        or an error. Calling `write` with more bytes than this function has
-        permitted will trap.
-        
-        When this function returns 0 bytes, the `subscribe` pollable will
-        become ready when this function will report at least 1 byte, or an
-        error.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def write(self, contents: bytes) -> None:
-        """
-        Perform a write. This function never blocks.
-        
-        When the destination of a `write` is binary data, the bytes from
-        `contents` are written verbatim. When the destination of a `write` is
-        known to the implementation to be text, the bytes of `contents` are
-        transcoded from UTF-8 into the encoding of the destination and then
-        written.
-        
-        Precondition: check-write gave permit of Ok(n) and contents has a
-        length of less than or equal to n. Otherwise, this function will trap.
-        
-        returns Err(closed) without writing if the stream has closed since
-        the last call to check-write provided a permit.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_write_and_flush(self, contents: bytes) -> None:
-        """
-        Perform a write of up to 4096 bytes, and then flush the stream. Block
-        until all of these operations are complete, or an error occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write`, and `flush`, and is implemented with the
-        following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while !contents.is_empty() {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, contents.len());
-        let (chunk, rest) = contents.split_at(len);
-        this.write(chunk  );            // eliding error handling
-        contents = rest;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def flush(self) -> None:
-        """
-        Request to flush buffered output. This function never blocks.
-        
-        This tells the output-stream that the caller intends any buffered
-        output to be flushed. the output which is expected to be flushed
-        is all that has been passed to `write` prior to this call.
-        
-        Upon calling this function, the `output-stream` will not accept any
-        writes (`check-write` will return `ok(0)`) until the flush has
-        completed. The `subscribe` pollable will become ready when the
-        flush has completed and the stream can accept more writes.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_flush(self) -> None:
-        """
-        Request to flush buffered output, and block until flush completes
-        and stream is ready for writing again.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def subscribe(self) -> poll.Pollable:
-        """
-        Create a `pollable` which will resolve once the output-stream
-        is ready for more writing, or an error has occured. When this
-        pollable is ready, `check-write` will return `ok(n)` with n>0, or an
-        error.
-        
-        If the stream is closed, this pollable is always ready immediately.
-        
-        The created `pollable` is a child resource of the `output-stream`.
-        Implementations may trap if the `output-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-
-    def write_zeroes(self, len: int) -> None:
-        """
-        Write zeroes to a stream.
-        
-        This should be used precisely like `write` with the exact same
-        preconditions (must use check-write first), but instead of
-        passing a list of bytes, you simply pass the number of zero-bytes
-        that should be written.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_write_zeroes_and_flush(self, len: int) -> None:
-        """
-        Perform a write of up to 4096 zeroes, and then flush the stream.
-        Block until all of these operations are complete, or an error
-        occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write-zeroes`, and `flush`, and is implemented with
-        the following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while num_zeroes != 0 {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, num_zeroes);
-        this.write-zeroes(len);         // eliding error handling
-        num_zeroes -= len;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another.
-        
-        The behavior of splice is equivelant to:
-        1. calling `check-write` on the `output-stream`
-        2. calling `read` on the `input-stream` with the smaller of the
-        `check-write` permitted length and the `len` provided to `splice`
-        3. calling `write` on the `output-stream` with that read data.
-        
-        Any error reported by the call to `check-write`, `read`, or
-        `write` ends the splice and reports that error.
-        
-        This function returns the number of bytes transferred; it may be less
-        than `len`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another, with blocking.
-        
-        This is similar to `splice`, except that it blocks until the
-        `output-stream` is ready for writing, and the `input-stream`
-        is ready for reading, before performing the `splice`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def blocking_flush(self) ‑> None -
-
-

Request to flush buffered output, and block until flush completes -and stream is ready for writing again.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def blocking_flush(self) -> None:
-    """
-    Request to flush buffered output, and block until flush completes
-    and stream is ready for writing again.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def blocking_splice(self, src: InputStream, len: int) ‑> int -
-
-

Read from one stream and write to another, with blocking.

-

This is similar to splice, except that it blocks until the -output-stream is ready for writing, and the input-stream -is ready for reading, before performing the splice.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def blocking_splice(self, src: InputStream, len: int) -> int:
-    """
-    Read from one stream and write to another, with blocking.
-    
-    This is similar to `splice`, except that it blocks until the
-    `output-stream` is ready for writing, and the `input-stream`
-    is ready for reading, before performing the `splice`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def blocking_write_and_flush(self, contents: bytes) ‑> None -
-
-

Perform a write of up to 4096 bytes, and then flush the stream. Block -until all of these operations are complete, or an error occurs.

-

This is a convenience wrapper around the use of check-write, -subscribe, write, and flush, and is implemented with the -following pseudo-code:

-
let pollable = this.subscribe();
-while !contents.is_empty() {
-// Wait for the stream to become writable
-pollable.block();
-let Ok(n) = this.check-write(); // eliding error handling
-let len = min(n, contents.len());
-let (chunk, rest) = contents.split_at(len);
-this.write(chunk  );            // eliding error handling
-contents = rest;
-}
-this.flush();
-// Wait for completion of `flush`
-pollable.block();
-// Check for any errors that arose during `flush`
-let _ = this.check-write();         // eliding error handling
-
-

Raises: Err(StreamError)

-
- -Expand source code - -
def blocking_write_and_flush(self, contents: bytes) -> None:
-    """
-    Perform a write of up to 4096 bytes, and then flush the stream. Block
-    until all of these operations are complete, or an error occurs.
-    
-    This is a convenience wrapper around the use of `check-write`,
-    `subscribe`, `write`, and `flush`, and is implemented with the
-    following pseudo-code:
-    
-    ```text
-    let pollable = this.subscribe();
-    while !contents.is_empty() {
-    // Wait for the stream to become writable
-    pollable.block();
-    let Ok(n) = this.check-write(); // eliding error handling
-    let len = min(n, contents.len());
-    let (chunk, rest) = contents.split_at(len);
-    this.write(chunk  );            // eliding error handling
-    contents = rest;
-    }
-    this.flush();
-    // Wait for completion of `flush`
-    pollable.block();
-    // Check for any errors that arose during `flush`
-    let _ = this.check-write();         // eliding error handling
-    ```
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def blocking_write_zeroes_and_flush(self, len: int) ‑> None -
-
-

Perform a write of up to 4096 zeroes, and then flush the stream. -Block until all of these operations are complete, or an error -occurs.

-

This is a convenience wrapper around the use of check-write, -subscribe, write-zeroes, and flush, and is implemented with -the following pseudo-code:

-
let pollable = this.subscribe();
-while num_zeroes != 0 {
-// Wait for the stream to become writable
-pollable.block();
-let Ok(n) = this.check-write(); // eliding error handling
-let len = min(n, num_zeroes);
-this.write-zeroes(len);         // eliding error handling
-num_zeroes -= len;
-}
-this.flush();
-// Wait for completion of `flush`
-pollable.block();
-// Check for any errors that arose during `flush`
-let _ = this.check-write();         // eliding error handling
-
-

Raises: Err(StreamError)

-
- -Expand source code - -
def blocking_write_zeroes_and_flush(self, len: int) -> None:
-    """
-    Perform a write of up to 4096 zeroes, and then flush the stream.
-    Block until all of these operations are complete, or an error
-    occurs.
-    
-    This is a convenience wrapper around the use of `check-write`,
-    `subscribe`, `write-zeroes`, and `flush`, and is implemented with
-    the following pseudo-code:
-    
-    ```text
-    let pollable = this.subscribe();
-    while num_zeroes != 0 {
-    // Wait for the stream to become writable
-    pollable.block();
-    let Ok(n) = this.check-write(); // eliding error handling
-    let len = min(n, num_zeroes);
-    this.write-zeroes(len);         // eliding error handling
-    num_zeroes -= len;
-    }
-    this.flush();
-    // Wait for completion of `flush`
-    pollable.block();
-    // Check for any errors that arose during `flush`
-    let _ = this.check-write();         // eliding error handling
-    ```
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def check_write(self) ‑> int -
-
-

Check readiness for writing. This function never blocks.

-

Returns the number of bytes permitted for the next call to write, -or an error. Calling write with more bytes than this function has -permitted will trap.

-

When this function returns 0 bytes, the subscribe pollable will -become ready when this function will report at least 1 byte, or an -error.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def check_write(self) -> int:
-    """
-    Check readiness for writing. This function never blocks.
-    
-    Returns the number of bytes permitted for the next call to `write`,
-    or an error. Calling `write` with more bytes than this function has
-    permitted will trap.
-    
-    When this function returns 0 bytes, the `subscribe` pollable will
-    become ready when this function will report at least 1 byte, or an
-    error.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def flush(self) ‑> None -
-
-

Request to flush buffered output. This function never blocks.

-

This tells the output-stream that the caller intends any buffered -output to be flushed. the output which is expected to be flushed -is all that has been passed to write prior to this call.

-

Upon calling this function, the output-stream will not accept any -writes (check-write will return ok(0)) until the flush has -completed. The subscribe pollable will become ready when the -flush has completed and the stream can accept more writes.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def flush(self) -> None:
-    """
-    Request to flush buffered output. This function never blocks.
-    
-    This tells the output-stream that the caller intends any buffered
-    output to be flushed. the output which is expected to be flushed
-    is all that has been passed to `write` prior to this call.
-    
-    Upon calling this function, the `output-stream` will not accept any
-    writes (`check-write` will return `ok(0)`) until the flush has
-    completed. The `subscribe` pollable will become ready when the
-    flush has completed and the stream can accept more writes.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def splice(self, src: InputStream, len: int) ‑> int -
-
-

Read from one stream and write to another.

-

The behavior of splice is equivelant to: -1. calling check-write on the output-stream -2. calling read on the input-stream with the smaller of the -check-write permitted length and the len provided to splice -3. calling write on the output-stream with that read data.

-

Any error reported by the call to check-write, read, or -write ends the splice and reports that error.

-

This function returns the number of bytes transferred; it may be less -than len.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def splice(self, src: InputStream, len: int) -> int:
-    """
-    Read from one stream and write to another.
-    
-    The behavior of splice is equivelant to:
-    1. calling `check-write` on the `output-stream`
-    2. calling `read` on the `input-stream` with the smaller of the
-    `check-write` permitted length and the `len` provided to `splice`
-    3. calling `write` on the `output-stream` with that read data.
-    
-    Any error reported by the call to `check-write`, `read`, or
-    `write` ends the splice and reports that error.
-    
-    This function returns the number of bytes transferred; it may be less
-    than `len`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def subscribe(self) ‑> Pollable -
-
-

Create a pollable which will resolve once the output-stream -is ready for more writing, or an error has occured. When this -pollable is ready, check-write will return ok(n) with n>0, or an -error.

-

If the stream is closed, this pollable is always ready immediately.

-

The created pollable is a child resource of the output-stream. -Implementations may trap if the output-stream is dropped before -all derived pollables created with this function are dropped.

-
- -Expand source code - -
def subscribe(self) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the output-stream
-    is ready for more writing, or an error has occured. When this
-    pollable is ready, `check-write` will return `ok(n)` with n>0, or an
-    error.
-    
-    If the stream is closed, this pollable is always ready immediately.
-    
-    The created `pollable` is a child resource of the `output-stream`.
-    Implementations may trap if the `output-stream` is dropped before
-    all derived `pollable`s created with this function are dropped.
-    """
-    raise NotImplementedError
-
-
-
-def write(self, contents: bytes) ‑> None -
-
-

Perform a write. This function never blocks.

-

When the destination of a write is binary data, the bytes from -contents are written verbatim. When the destination of a write is -known to the implementation to be text, the bytes of contents are -transcoded from UTF-8 into the encoding of the destination and then -written.

-

Precondition: check-write gave permit of Ok(n) and contents has a -length of less than or equal to n. Otherwise, this function will trap.

-

returns Err(closed) without writing if the stream has closed since -the last call to check-write provided a permit.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def write(self, contents: bytes) -> None:
-    """
-    Perform a write. This function never blocks.
-    
-    When the destination of a `write` is binary data, the bytes from
-    `contents` are written verbatim. When the destination of a `write` is
-    known to the implementation to be text, the bytes of `contents` are
-    transcoded from UTF-8 into the encoding of the destination and then
-    written.
-    
-    Precondition: check-write gave permit of Ok(n) and contents has a
-    length of less than or equal to n. Otherwise, this function will trap.
-    
-    returns Err(closed) without writing if the stream has closed since
-    the last call to check-write provided a permit.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def write_zeroes(self, len: int) ‑> None -
-
-

Write zeroes to a stream.

-

This should be used precisely like write with the exact same -preconditions (must use check-write first), but instead of -passing a list of bytes, you simply pass the number of zero-bytes -that should be written.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def write_zeroes(self, len: int) -> None:
-    """
-    Write zeroes to a stream.
-    
-    This should be used precisely like `write` with the exact same
-    preconditions (must use check-write first), but instead of
-    passing a list of bytes, you simply pass the number of zero-bytes
-    that should be written.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class StreamErrorClosed -
-
-

StreamErrorClosed()

-
- -Expand source code - -
@dataclass
-class StreamErrorClosed:
-    pass
-
-
-
-class StreamErrorLastOperationFailed -(value: Error) -
-
-

StreamErrorLastOperationFailed(value: spin_sdk.wit.imports.error.Error)

-
- -Expand source code - -
@dataclass
-class StreamErrorLastOperationFailed:
-    value: error.Error
-
-

Class variables

-
-
var valueError
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/types.html b/docs/v2/wit/imports/types.html deleted file mode 100644 index 1cab3b1..0000000 --- a/docs/v2/wit/imports/types.html +++ /dev/null @@ -1,4620 +0,0 @@ - - - - - - -spin_sdk.wit.imports.types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.types

-
-
-

This interface defines all of the types and methods for implementing -HTTP Requests and Responses, both incoming and outgoing, as well as -their headers, trailers, and bodies.

-
- -Expand source code - -
"""
-This interface defines all of the types and methods for implementing
-HTTP Requests and Responses, both incoming and outgoing, as well as
-their headers, trailers, and bodies.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import poll
-from ..imports import streams
-from ..imports import error
-
-
-@dataclass
-class MethodGet:
-    pass
-
-
-@dataclass
-class MethodHead:
-    pass
-
-
-@dataclass
-class MethodPost:
-    pass
-
-
-@dataclass
-class MethodPut:
-    pass
-
-
-@dataclass
-class MethodDelete:
-    pass
-
-
-@dataclass
-class MethodConnect:
-    pass
-
-
-@dataclass
-class MethodOptions:
-    pass
-
-
-@dataclass
-class MethodTrace:
-    pass
-
-
-@dataclass
-class MethodPatch:
-    pass
-
-
-@dataclass
-class MethodOther:
-    value: str
-
-
-Method = Union[MethodGet, MethodHead, MethodPost, MethodPut, MethodDelete, MethodConnect, MethodOptions, MethodTrace, MethodPatch, MethodOther]
-"""
-This type corresponds to HTTP standard Methods.
-"""
-
-
-
-@dataclass
-class SchemeHttp:
-    pass
-
-
-@dataclass
-class SchemeHttps:
-    pass
-
-
-@dataclass
-class SchemeOther:
-    value: str
-
-
-Scheme = Union[SchemeHttp, SchemeHttps, SchemeOther]
-"""
-This type corresponds to HTTP standard Related Schemes.
-"""
-
-
-@dataclass
-class DnsErrorPayload:
-    """
-    Defines the case payload type for `DNS-error` above:
-    """
-    rcode: Optional[str]
-    info_code: Optional[int]
-
-@dataclass
-class TlsAlertReceivedPayload:
-    """
-    Defines the case payload type for `TLS-alert-received` above:
-    """
-    alert_id: Optional[int]
-    alert_message: Optional[str]
-
-@dataclass
-class FieldSizePayload:
-    """
-    Defines the case payload type for `HTTP-response-{header,trailer}-size` above:
-    """
-    field_name: Optional[str]
-    field_size: Optional[int]
-
-
-@dataclass
-class ErrorCodeDnsTimeout:
-    pass
-
-
-@dataclass
-class ErrorCodeDnsError:
-    value: DnsErrorPayload
-
-
-@dataclass
-class ErrorCodeDestinationNotFound:
-    pass
-
-
-@dataclass
-class ErrorCodeDestinationUnavailable:
-    pass
-
-
-@dataclass
-class ErrorCodeDestinationIpProhibited:
-    pass
-
-
-@dataclass
-class ErrorCodeDestinationIpUnroutable:
-    pass
-
-
-@dataclass
-class ErrorCodeConnectionRefused:
-    pass
-
-
-@dataclass
-class ErrorCodeConnectionTerminated:
-    pass
-
-
-@dataclass
-class ErrorCodeConnectionTimeout:
-    pass
-
-
-@dataclass
-class ErrorCodeConnectionReadTimeout:
-    pass
-
-
-@dataclass
-class ErrorCodeConnectionWriteTimeout:
-    pass
-
-
-@dataclass
-class ErrorCodeConnectionLimitReached:
-    pass
-
-
-@dataclass
-class ErrorCodeTlsProtocolError:
-    pass
-
-
-@dataclass
-class ErrorCodeTlsCertificateError:
-    pass
-
-
-@dataclass
-class ErrorCodeTlsAlertReceived:
-    value: TlsAlertReceivedPayload
-
-
-@dataclass
-class ErrorCodeHttpRequestDenied:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpRequestLengthRequired:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpRequestBodySize:
-    value: Optional[int]
-
-
-@dataclass
-class ErrorCodeHttpRequestMethodInvalid:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpRequestUriInvalid:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpRequestUriTooLong:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpRequestHeaderSectionSize:
-    value: Optional[int]
-
-
-@dataclass
-class ErrorCodeHttpRequestHeaderSize:
-    value: Optional[FieldSizePayload]
-
-
-@dataclass
-class ErrorCodeHttpRequestTrailerSectionSize:
-    value: Optional[int]
-
-
-@dataclass
-class ErrorCodeHttpRequestTrailerSize:
-    value: FieldSizePayload
-
-
-@dataclass
-class ErrorCodeHttpResponseIncomplete:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpResponseHeaderSectionSize:
-    value: Optional[int]
-
-
-@dataclass
-class ErrorCodeHttpResponseHeaderSize:
-    value: FieldSizePayload
-
-
-@dataclass
-class ErrorCodeHttpResponseBodySize:
-    value: Optional[int]
-
-
-@dataclass
-class ErrorCodeHttpResponseTrailerSectionSize:
-    value: Optional[int]
-
-
-@dataclass
-class ErrorCodeHttpResponseTrailerSize:
-    value: FieldSizePayload
-
-
-@dataclass
-class ErrorCodeHttpResponseTransferCoding:
-    value: Optional[str]
-
-
-@dataclass
-class ErrorCodeHttpResponseContentCoding:
-    value: Optional[str]
-
-
-@dataclass
-class ErrorCodeHttpResponseTimeout:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpUpgradeFailed:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpProtocolError:
-    pass
-
-
-@dataclass
-class ErrorCodeLoopDetected:
-    pass
-
-
-@dataclass
-class ErrorCodeConfigurationError:
-    pass
-
-
-@dataclass
-class ErrorCodeInternalError:
-    value: Optional[str]
-
-
-ErrorCode = Union[ErrorCodeDnsTimeout, ErrorCodeDnsError, ErrorCodeDestinationNotFound, ErrorCodeDestinationUnavailable, ErrorCodeDestinationIpProhibited, ErrorCodeDestinationIpUnroutable, ErrorCodeConnectionRefused, ErrorCodeConnectionTerminated, ErrorCodeConnectionTimeout, ErrorCodeConnectionReadTimeout, ErrorCodeConnectionWriteTimeout, ErrorCodeConnectionLimitReached, ErrorCodeTlsProtocolError, ErrorCodeTlsCertificateError, ErrorCodeTlsAlertReceived, ErrorCodeHttpRequestDenied, ErrorCodeHttpRequestLengthRequired, ErrorCodeHttpRequestBodySize, ErrorCodeHttpRequestMethodInvalid, ErrorCodeHttpRequestUriInvalid, ErrorCodeHttpRequestUriTooLong, ErrorCodeHttpRequestHeaderSectionSize, ErrorCodeHttpRequestHeaderSize, ErrorCodeHttpRequestTrailerSectionSize, ErrorCodeHttpRequestTrailerSize, ErrorCodeHttpResponseIncomplete, ErrorCodeHttpResponseHeaderSectionSize, ErrorCodeHttpResponseHeaderSize, ErrorCodeHttpResponseBodySize, ErrorCodeHttpResponseTrailerSectionSize, ErrorCodeHttpResponseTrailerSize, ErrorCodeHttpResponseTransferCoding, ErrorCodeHttpResponseContentCoding, ErrorCodeHttpResponseTimeout, ErrorCodeHttpUpgradeFailed, ErrorCodeHttpProtocolError, ErrorCodeLoopDetected, ErrorCodeConfigurationError, ErrorCodeInternalError]
-"""
-These cases are inspired by the IANA HTTP Proxy Error Types:
-https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types
-"""
-
-
-
-@dataclass
-class HeaderErrorInvalidSyntax:
-    pass
-
-
-@dataclass
-class HeaderErrorForbidden:
-    pass
-
-
-@dataclass
-class HeaderErrorImmutable:
-    pass
-
-
-HeaderError = Union[HeaderErrorInvalidSyntax, HeaderErrorForbidden, HeaderErrorImmutable]
-"""
-This type enumerates the different kinds of errors that may occur when
-setting or appending to a `fields` resource.
-"""
-
-
-class Fields:
-    """
-    This following block defines the `fields` resource which corresponds to
-    HTTP standard Fields. Fields are a common representation used for both
-    Headers and Trailers.
-    
-    A `fields` may be mutable or immutable. A `fields` created using the
-    constructor, `from-list`, or `clone` will be mutable, but a `fields`
-    resource given by other means (including, but not limited to,
-    `incoming-request.headers`, `outgoing-request.headers`) might be be
-    immutable. In an immutable fields, the `set`, `append`, and `delete`
-    operations will fail with `header-error.immutable`.
-    """
-    
-    def __init__(self):
-        """
-        Construct an empty HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def from_list(cls, entries: List[Tuple[str, bytes]]) -> Self:
-        """
-        Construct an HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        
-        The list represents each key-value pair in the Fields. Keys
-        which have multiple values are represented by multiple entries in this
-        list with the same key.
-        
-        The tuple is a pair of the field key, represented as a string, and
-        Value, represented as a list of bytes. In a valid Fields, all keys
-        and values are valid UTF-8 strings. However, values are not always
-        well-formed, so they are represented as a raw list of bytes.
-        
-        An error result will be returned if any header or value was
-        syntactically invalid, or if a header was forbidden.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def get(self, name: str) -> List[bytes]:
-        """
-        Get all of the values corresponding to a key. If the key is not present
-        in this `fields`, an empty list is returned. However, if the key is
-        present but empty, this is represented by a list with one or more
-        empty field-values present.
-        """
-        raise NotImplementedError
-
-    def has(self, name: str) -> int:
-        """
-        Returns `true` when the key is present in this `fields`. If the key is
-        syntactically invalid, `false` is returned.
-        """
-        raise NotImplementedError
-
-    def set(self, name: str, value: List[bytes]) -> None:
-        """
-        Set all of the values for a key. Clears any existing values for that
-        key, if they have been set.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def delete(self, name: str) -> None:
-        """
-        Delete all values for a key. Does nothing if no values for the key
-        exist.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def append(self, name: str, value: bytes) -> None:
-        """
-        Append a value for a key. Does not change or delete any existing
-        values for that key.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def entries(self) -> List[Tuple[str, bytes]]:
-        """
-        Retrieve the full set of keys and values in the Fields. Like the
-        constructor, the list represents each key-value pair.
-        
-        The outer list represents each key-value pair in the Fields. Keys
-        which have multiple values are represented by multiple entries in this
-        list with the same key.
-        """
-        raise NotImplementedError
-
-    def clone(self) -> Self:
-        """
-        Make a deep copy of the Fields. Equivelant in behavior to calling the
-        `fields` constructor on the return value of `entries`. The resulting
-        `fields` is mutable.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class FutureTrailers:
-    """
-    Represents a future which may eventaully return trailers, or an error.
-    
-    In the case that the incoming HTTP Request or Response did not have any
-    trailers, this future will resolve to the empty set of trailers once the
-    complete Request or Response body has been received.
-    """
-    
-    def subscribe(self) -> poll.Pollable:
-        """
-        Returns a pollable which becomes ready when either the trailers have
-        been received, or an error has occured. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-
-    def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
-        """
-        Returns the contents of the trailers, or an error which occured,
-        once the future is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the trailers or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the HTTP Request or Response
-        body, as well as any trailers, were received successfully, or that an
-        error occured receiving them. The optional `trailers` indicates whether
-        or not trailers were present in the body.
-        
-        When some `trailers` are returned by this method, the `trailers`
-        resource is immutable, and a child. Use of the `set`, `append`, or
-        `delete` methods will return an error, and the resource must be
-        dropped before the parent `future-trailers` is dropped.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class IncomingBody:
-    """
-    Represents an incoming HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, indicating that the full contents of the
-    body have been received. This resource represents the contents as
-    an `input-stream` and the delivery of trailers as a `future-trailers`,
-    and ensures that the user of this interface may only be consuming either
-    the body contents or waiting on trailers at any given time.
-    """
-    
-    def stream(self) -> streams.InputStream:
-        """
-        Returns the contents of the body, as a stream of bytes.
-        
-        Returns success on first call: the stream representing the contents
-        can be retrieved at most once. Subsequent calls will return error.
-        
-        The returned `input-stream` resource is a child: it must be dropped
-        before the parent `incoming-body` is dropped, or consumed by
-        `incoming-body.finish`.
-        
-        This invariant ensures that the implementation can determine whether
-        the user is consuming the contents of the body, waiting on the
-        `future-trailers` to be ready, or neither. This allows for network
-        backpressure is to be applied when the user is consuming the body,
-        and for that backpressure to not inhibit delivery of the trailers if
-        the user does not read the entire body.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def finish(cls, this: Self) -> FutureTrailers:
-        """
-        Takes ownership of `incoming-body`, and returns a `future-trailers`.
-        This function will trap if the `input-stream` child is still alive.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class IncomingRequest:
-    """
-    Represents an incoming HTTP Request.
-    """
-    
-    def method(self) -> Method:
-        """
-        Returns the method of the incoming request.
-        """
-        raise NotImplementedError
-
-    def path_with_query(self) -> Optional[str]:
-        """
-        Returns the path with query parameters from the request, as a string.
-        """
-        raise NotImplementedError
-
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Returns the protocol scheme from the request.
-        """
-        raise NotImplementedError
-
-    def authority(self) -> Optional[str]:
-        """
-        Returns the authority from the request, if it was present.
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Get the `headers` associated with the request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        The `headers` returned are a child resource: it must be dropped before
-        the parent `incoming-request` is dropped. Dropping this
-        `incoming-request` before all children are dropped will trap.
-        """
-        raise NotImplementedError
-
-    def consume(self) -> IncomingBody:
-        """
-        Gives the `incoming-body` associated with this request. Will only
-        return success at most once, and subsequent calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class OutgoingBody:
-    """
-    Represents an outgoing HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, inducating the full contents of the body
-    have been sent. This resource represents the contents as an
-    `output-stream` child resource, and the completion of the body (with
-    optional trailers) with a static function that consumes the
-    `outgoing-body` resource, and ensures that the user of this interface
-    may not write to the body contents after the body has been finished.
-    
-    If the user code drops this resource, as opposed to calling the static
-    method `finish`, the implementation should treat the body as incomplete,
-    and that an error has occured. The implementation should propogate this
-    error to the HTTP protocol by whatever means it has available,
-    including: corrupting the body on the wire, aborting the associated
-    Request, or sending a late status code for the Response.
-    """
-    
-    def write(self) -> streams.OutputStream:
-        """
-        Returns a stream for writing the body contents.
-        
-        The returned `output-stream` is a child resource: it must be dropped
-        before the parent `outgoing-body` resource is dropped (or finished),
-        otherwise the `outgoing-body` drop or `finish` will trap.
-        
-        Returns success on the first call: the `output-stream` resource for
-        this `outgoing-body` may be retrieved at most once. Subsequent calls
-        will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def finish(cls, this: Self, trailers: Optional[Fields]) -> None:
-        """
-        Finalize an outgoing body, optionally providing trailers. This must be
-        called to signal that the response is complete. If the `outgoing-body`
-        is dropped without calling `outgoing-body.finalize`, the implementation
-        should treat the body as corrupted.
-        
-        Fails if the body's `outgoing-request` or `outgoing-response` was
-        constructed with a Content-Length header, and the contents written
-        to the body (via `write`) does not match the value given in the
-        Content-Length.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class OutgoingRequest:
-    """
-    Represents an outgoing HTTP Request.
-    """
-    
-    def __init__(self, headers: Fields):
-        """
-        Construct a new `outgoing-request` with a default `method` of `GET`, and
-        `none` values for `path-with-query`, `scheme`, and `authority`.
-        
-        * `headers` is the HTTP Headers for the Request.
-        
-        It is possible to construct, or manipulate with the accessor functions
-        below, an `outgoing-request` with an invalid combination of `scheme`
-        and `authority`, or `headers` which are not permitted to be sent.
-        It is the obligation of the `outgoing-handler.handle` implementation
-        to reject invalid constructions of `outgoing-request`.
-        """
-        raise NotImplementedError
-
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this
-        Request.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-request` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def method(self) -> Method:
-        """
-        Get the Method for the Request.
-        """
-        raise NotImplementedError
-
-    def set_method(self, method: Method) -> None:
-        """
-        Set the Method for the Request. Fails if the string present in a
-        `method.other` argument is not a syntactically valid method.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def path_with_query(self) -> Optional[str]:
-        """
-        Get the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query.
-        """
-        raise NotImplementedError
-
-    def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-        """
-        Set the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query. Fails is the
-        string given is not a syntactically valid path and query uri component.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Get the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme.
-        """
-        raise NotImplementedError
-
-    def set_scheme(self, scheme: Optional[Scheme]) -> None:
-        """
-        Set the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme. Fails if the
-        string given is not a syntactically valid uri scheme.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def authority(self) -> Optional[str]:
-        """
-        Get the HTTP Authority for the Request. A value of `none` may be used
-        with Related Schemes which do not require an Authority. The HTTP and
-        HTTPS schemes always require an authority.
-        """
-        raise NotImplementedError
-
-    def set_authority(self, authority: Optional[str]) -> None:
-        """
-        Set the HTTP Authority for the Request. A value of `none` may be used
-        with Related Schemes which do not require an Authority. The HTTP and
-        HTTPS schemes always require an authority. Fails if the string given is
-        not a syntactically valid uri authority.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transfered to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class RequestOptions:
-    """
-    Parameters for making an HTTP Request. Each of these parameters is
-    currently an optional timeout applicable to the transport layer of the
-    HTTP protocol.
-    
-    These timeouts are separate from any the user may use to bound a
-    blocking call to `wasi:io/poll.poll`.
-    """
-    
-    def __init__(self):
-        """
-        Construct a default `request-options` value.
-        """
-        raise NotImplementedError
-
-    def connect_timeout(self) -> Optional[int]:
-        """
-        The timeout for the initial connect to the HTTP Server.
-        """
-        raise NotImplementedError
-
-    def set_connect_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for the initial connect to the HTTP Server. An error
-        return value indicates that this timeout is not supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def first_byte_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving the first byte of the Response body.
-        """
-        raise NotImplementedError
-
-    def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving the first byte of the Response body. An
-        error return value indicates that this timeout is not supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def between_bytes_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving subsequent chunks of bytes in the Response
-        body stream.
-        """
-        raise NotImplementedError
-
-    def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving subsequent chunks of bytes in the Response
-        body stream. An error return value indicates that this timeout is not
-        supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class OutgoingResponse:
-    """
-    Represents an outgoing HTTP Response.
-    """
-    
-    def __init__(self, headers: Fields):
-        """
-        Construct an `outgoing-response`, with a default `status-code` of `200`.
-        If a different `status-code` is needed, it must be set via the
-        `set-status-code` method.
-        
-        * `headers` is the HTTP Headers for the Response.
-        """
-        raise NotImplementedError
-
-    def status_code(self) -> int:
-        """
-        Get the HTTP Status Code for the Response.
-        """
-        raise NotImplementedError
-
-    def set_status_code(self, status_code: int) -> None:
-        """
-        Set the HTTP Status Code for the Response. Fails if the status-code
-        given is not a valid http status code.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transfered to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this Response.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-response` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class ResponseOutparam:
-    """
-    Represents the ability to send an HTTP Response.
-    
-    This resource is used by the `wasi:http/incoming-handler` interface to
-    allow a Response to be sent corresponding to the Request provided as the
-    other argument to `incoming-handler.handle`.
-    """
-    
-    @classmethod
-    def set(cls, param: Self, response: Result[OutgoingResponse, ErrorCode]) -> None:
-        """
-        Set the value of the `response-outparam` to either send a response,
-        or indicate an error.
-        
-        This method consumes the `response-outparam` to ensure that it is
-        called at most once. If it is never called, the implementation
-        will respond with an error.
-        
-        The user may provide an `error` to `response` to allow the
-        implementation determine how to respond with an HTTP error response.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class IncomingResponse:
-    """
-    Represents an incoming HTTP Response.
-    """
-    
-    def status(self) -> int:
-        """
-        Returns the status code from the incoming response.
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Returns the headers from the incoming response.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `incoming-response` is dropped.
-        """
-        raise NotImplementedError
-
-    def consume(self) -> IncomingBody:
-        """
-        Returns the incoming body. May be called at most once. Returns error
-        if called additional times.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class FutureIncomingResponse:
-    """
-    Represents a future which may eventaully return an incoming HTTP
-    Response, or an error.
-    
-    This resource is returned by the `wasi:http/outgoing-handler` interface to
-    provide the HTTP Response corresponding to the sent Request.
-    """
-    
-    def subscribe(self) -> poll.Pollable:
-        """
-        Returns a pollable which becomes ready when either the Response has
-        been received, or an error has occured. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-
-    def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
-        """
-        Returns the incoming HTTP Response, or an error, once one is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the response or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the incoming HTTP Response
-        status and headers have recieved successfully, or that an error
-        occured. Errors may also occur while consuming the response body,
-        but those will be reported by the `incoming-body` and its
-        `output-stream` child.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-def http_error_code(err: error.Error) -> Optional[ErrorCode]:
-    """
-    Attempts to extract a http-related `error` from the wasi:io `error`
-    provided.
-    
-    Stream operations which return
-    `wasi:io/stream/stream-error::last-operation-failed` have a payload of
-    type `wasi:io/error/error` with more information about the operation
-    that failed. This payload can be passed through to this function to see
-    if there's http-related information about the error to return.
-    
-    Note that this function is fallible because not all io-errors are
-    http-related errors.
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var ErrorCode
-
- -
-
var HeaderError
-
-

This type enumerates the different kinds of errors that may occur when -setting or appending to a fields resource.

-
-
var Method
-
-

This type corresponds to HTTP standard Methods.

-
-
var Scheme
-
-

This type corresponds to HTTP standard Related Schemes.

-
-
-
-
-

Functions

-
-
-def http_error_code(err: Error) ‑> Union[ErrorCodeDnsTimeoutErrorCodeDnsErrorErrorCodeDestinationNotFoundErrorCodeDestinationUnavailableErrorCodeDestinationIpProhibitedErrorCodeDestinationIpUnroutableErrorCodeConnectionRefusedErrorCodeConnectionTerminatedErrorCodeConnectionTimeoutErrorCodeConnectionReadTimeoutErrorCodeConnectionWriteTimeoutErrorCodeConnectionLimitReachedErrorCodeTlsProtocolErrorErrorCodeTlsCertificateErrorErrorCodeTlsAlertReceivedErrorCodeHttpRequestDeniedErrorCodeHttpRequestLengthRequiredErrorCodeHttpRequestBodySizeErrorCodeHttpRequestMethodInvalidErrorCodeHttpRequestUriInvalidErrorCodeHttpRequestUriTooLongErrorCodeHttpRequestHeaderSectionSizeErrorCodeHttpRequestHeaderSizeErrorCodeHttpRequestTrailerSectionSizeErrorCodeHttpRequestTrailerSizeErrorCodeHttpResponseIncompleteErrorCodeHttpResponseHeaderSectionSizeErrorCodeHttpResponseHeaderSizeErrorCodeHttpResponseBodySizeErrorCodeHttpResponseTrailerSectionSizeErrorCodeHttpResponseTrailerSizeErrorCodeHttpResponseTransferCodingErrorCodeHttpResponseContentCodingErrorCodeHttpResponseTimeoutErrorCodeHttpUpgradeFailedErrorCodeHttpProtocolErrorErrorCodeLoopDetectedErrorCodeConfigurationErrorErrorCodeInternalError, ForwardRef(None)] -
-
-

Attempts to extract a http-related error from the wasi:io error -provided.

-

Stream operations which return -wasi:io/stream/stream-error::last-operation-failed have a payload of -type wasi:io/error/error with more information about the operation -that failed. This payload can be passed through to this function to see -if there's http-related information about the error to return.

-

Note that this function is fallible because not all io-errors are -http-related errors.

-
- -Expand source code - -
def http_error_code(err: error.Error) -> Optional[ErrorCode]:
-    """
-    Attempts to extract a http-related `error` from the wasi:io `error`
-    provided.
-    
-    Stream operations which return
-    `wasi:io/stream/stream-error::last-operation-failed` have a payload of
-    type `wasi:io/error/error` with more information about the operation
-    that failed. This payload can be passed through to this function to see
-    if there's http-related information about the error to return.
-    
-    Note that this function is fallible because not all io-errors are
-    http-related errors.
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Classes

-
-
-class DnsErrorPayload -(rcode: Optional[str], info_code: Optional[int]) -
-
-

Defines the case payload type for DNS-error above:

-
- -Expand source code - -
@dataclass
-class DnsErrorPayload:
-    """
-    Defines the case payload type for `DNS-error` above:
-    """
-    rcode: Optional[str]
-    info_code: Optional[int]
-
-

Class variables

-
-
var info_code : Optional[int]
-
-
-
-
var rcode : Optional[str]
-
-
-
-
-
-
-class ErrorCodeConfigurationError -
-
-

ErrorCodeConfigurationError()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConfigurationError:
-    pass
-
-
-
-class ErrorCodeConnectionLimitReached -
-
-

ErrorCodeConnectionLimitReached()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConnectionLimitReached:
-    pass
-
-
-
-class ErrorCodeConnectionReadTimeout -
-
-

ErrorCodeConnectionReadTimeout()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConnectionReadTimeout:
-    pass
-
-
-
-class ErrorCodeConnectionRefused -
-
-

ErrorCodeConnectionRefused()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConnectionRefused:
-    pass
-
-
-
-class ErrorCodeConnectionTerminated -
-
-

ErrorCodeConnectionTerminated()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConnectionTerminated:
-    pass
-
-
-
-class ErrorCodeConnectionTimeout -
-
-

ErrorCodeConnectionTimeout()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConnectionTimeout:
-    pass
-
-
-
-class ErrorCodeConnectionWriteTimeout -
-
-

ErrorCodeConnectionWriteTimeout()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConnectionWriteTimeout:
-    pass
-
-
-
-class ErrorCodeDestinationIpProhibited -
-
-

ErrorCodeDestinationIpProhibited()

-
- -Expand source code - -
@dataclass
-class ErrorCodeDestinationIpProhibited:
-    pass
-
-
-
-class ErrorCodeDestinationIpUnroutable -
-
-

ErrorCodeDestinationIpUnroutable()

-
- -Expand source code - -
@dataclass
-class ErrorCodeDestinationIpUnroutable:
-    pass
-
-
-
-class ErrorCodeDestinationNotFound -
-
-

ErrorCodeDestinationNotFound()

-
- -Expand source code - -
@dataclass
-class ErrorCodeDestinationNotFound:
-    pass
-
-
-
-class ErrorCodeDestinationUnavailable -
-
-

ErrorCodeDestinationUnavailable()

-
- -Expand source code - -
@dataclass
-class ErrorCodeDestinationUnavailable:
-    pass
-
-
-
-class ErrorCodeDnsError -(value: DnsErrorPayload) -
-
-

ErrorCodeDnsError(value: spin_sdk.wit.imports.types.DnsErrorPayload)

-
- -Expand source code - -
@dataclass
-class ErrorCodeDnsError:
-    value: DnsErrorPayload
-
-

Class variables

-
-
var valueDnsErrorPayload
-
-
-
-
-
-
-class ErrorCodeDnsTimeout -
-
-

ErrorCodeDnsTimeout()

-
- -Expand source code - -
@dataclass
-class ErrorCodeDnsTimeout:
-    pass
-
-
-
-class ErrorCodeHttpProtocolError -
-
-

ErrorCodeHttpProtocolError()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpProtocolError:
-    pass
-
-
-
-class ErrorCodeHttpRequestBodySize -(value: Optional[int]) -
-
-

ErrorCodeHttpRequestBodySize(value: Optional[int])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestBodySize:
-    value: Optional[int]
-
-

Class variables

-
-
var value : Optional[int]
-
-
-
-
-
-
-class ErrorCodeHttpRequestDenied -
-
-

ErrorCodeHttpRequestDenied()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestDenied:
-    pass
-
-
-
-class ErrorCodeHttpRequestHeaderSectionSize -(value: Optional[int]) -
-
-

ErrorCodeHttpRequestHeaderSectionSize(value: Optional[int])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestHeaderSectionSize:
-    value: Optional[int]
-
-

Class variables

-
-
var value : Optional[int]
-
-
-
-
-
-
-class ErrorCodeHttpRequestHeaderSize -(value: Optional[FieldSizePayload]) -
-
-

ErrorCodeHttpRequestHeaderSize(value: Optional[spin_sdk.wit.imports.types.FieldSizePayload])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestHeaderSize:
-    value: Optional[FieldSizePayload]
-
-

Class variables

-
-
var value : Optional[FieldSizePayload]
-
-
-
-
-
-
-class ErrorCodeHttpRequestLengthRequired -
-
-

ErrorCodeHttpRequestLengthRequired()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestLengthRequired:
-    pass
-
-
-
-class ErrorCodeHttpRequestMethodInvalid -
-
-

ErrorCodeHttpRequestMethodInvalid()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestMethodInvalid:
-    pass
-
-
-
-class ErrorCodeHttpRequestTrailerSectionSize -(value: Optional[int]) -
-
-

ErrorCodeHttpRequestTrailerSectionSize(value: Optional[int])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestTrailerSectionSize:
-    value: Optional[int]
-
-

Class variables

-
-
var value : Optional[int]
-
-
-
-
-
-
-class ErrorCodeHttpRequestTrailerSize -(value: FieldSizePayload) -
-
-

ErrorCodeHttpRequestTrailerSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestTrailerSize:
-    value: FieldSizePayload
-
-

Class variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCodeHttpRequestUriInvalid -
-
-

ErrorCodeHttpRequestUriInvalid()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestUriInvalid:
-    pass
-
-
-
-class ErrorCodeHttpRequestUriTooLong -
-
-

ErrorCodeHttpRequestUriTooLong()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestUriTooLong:
-    pass
-
-
-
-class ErrorCodeHttpResponseBodySize -(value: Optional[int]) -
-
-

ErrorCodeHttpResponseBodySize(value: Optional[int])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseBodySize:
-    value: Optional[int]
-
-

Class variables

-
-
var value : Optional[int]
-
-
-
-
-
-
-class ErrorCodeHttpResponseContentCoding -(value: Optional[str]) -
-
-

ErrorCodeHttpResponseContentCoding(value: Optional[str])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseContentCoding:
-    value: Optional[str]
-
-

Class variables

-
-
var value : Optional[str]
-
-
-
-
-
-
-class ErrorCodeHttpResponseHeaderSectionSize -(value: Optional[int]) -
-
-

ErrorCodeHttpResponseHeaderSectionSize(value: Optional[int])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseHeaderSectionSize:
-    value: Optional[int]
-
-

Class variables

-
-
var value : Optional[int]
-
-
-
-
-
-
-class ErrorCodeHttpResponseHeaderSize -(value: FieldSizePayload) -
-
-

ErrorCodeHttpResponseHeaderSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseHeaderSize:
-    value: FieldSizePayload
-
-

Class variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCodeHttpResponseIncomplete -
-
-

ErrorCodeHttpResponseIncomplete()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseIncomplete:
-    pass
-
-
-
-class ErrorCodeHttpResponseTimeout -
-
-

ErrorCodeHttpResponseTimeout()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseTimeout:
-    pass
-
-
-
-class ErrorCodeHttpResponseTrailerSectionSize -(value: Optional[int]) -
-
-

ErrorCodeHttpResponseTrailerSectionSize(value: Optional[int])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseTrailerSectionSize:
-    value: Optional[int]
-
-

Class variables

-
-
var value : Optional[int]
-
-
-
-
-
-
-class ErrorCodeHttpResponseTrailerSize -(value: FieldSizePayload) -
-
-

ErrorCodeHttpResponseTrailerSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseTrailerSize:
-    value: FieldSizePayload
-
-

Class variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCodeHttpResponseTransferCoding -(value: Optional[str]) -
-
-

ErrorCodeHttpResponseTransferCoding(value: Optional[str])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseTransferCoding:
-    value: Optional[str]
-
-

Class variables

-
-
var value : Optional[str]
-
-
-
-
-
-
-class ErrorCodeHttpUpgradeFailed -
-
-

ErrorCodeHttpUpgradeFailed()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpUpgradeFailed:
-    pass
-
-
-
-class ErrorCodeInternalError -(value: Optional[str]) -
-
-

ErrorCodeInternalError(value: Optional[str])

-
- -Expand source code - -
@dataclass
-class ErrorCodeInternalError:
-    value: Optional[str]
-
-

Class variables

-
-
var value : Optional[str]
-
-
-
-
-
-
-class ErrorCodeLoopDetected -
-
-

ErrorCodeLoopDetected()

-
- -Expand source code - -
@dataclass
-class ErrorCodeLoopDetected:
-    pass
-
-
-
-class ErrorCodeTlsAlertReceived -(value: TlsAlertReceivedPayload) -
-
-

ErrorCodeTlsAlertReceived(value: spin_sdk.wit.imports.types.TlsAlertReceivedPayload)

-
- -Expand source code - -
@dataclass
-class ErrorCodeTlsAlertReceived:
-    value: TlsAlertReceivedPayload
-
-

Class variables

-
-
var valueTlsAlertReceivedPayload
-
-
-
-
-
-
-class ErrorCodeTlsCertificateError -
-
-

ErrorCodeTlsCertificateError()

-
- -Expand source code - -
@dataclass
-class ErrorCodeTlsCertificateError:
-    pass
-
-
-
-class ErrorCodeTlsProtocolError -
-
-

ErrorCodeTlsProtocolError()

-
- -Expand source code - -
@dataclass
-class ErrorCodeTlsProtocolError:
-    pass
-
-
-
-class FieldSizePayload -(field_name: Optional[str], field_size: Optional[int]) -
-
-

Defines the case payload type for HTTP-response-{header,trailer}-size above:

-
- -Expand source code - -
@dataclass
-class FieldSizePayload:
-    """
-    Defines the case payload type for `HTTP-response-{header,trailer}-size` above:
-    """
-    field_name: Optional[str]
-    field_size: Optional[int]
-
-

Class variables

-
-
var field_name : Optional[str]
-
-
-
-
var field_size : Optional[int]
-
-
-
-
-
-
-class Fields -
-
-

This following block defines the fields resource which corresponds to -HTTP standard Fields. Fields are a common representation used for both -Headers and Trailers.

-

A fields may be mutable or immutable. A fields created using the -constructor, from-list, or clone will be mutable, but a fields -resource given by other means (including, but not limited to, -incoming-request.headers, outgoing-request.headers) might be be -immutable. In an immutable fields, the set, append, and delete -operations will fail with header-error.immutable.

-

Construct an empty HTTP Fields.

-

The resulting fields is mutable.

-
- -Expand source code - -
class Fields:
-    """
-    This following block defines the `fields` resource which corresponds to
-    HTTP standard Fields. Fields are a common representation used for both
-    Headers and Trailers.
-    
-    A `fields` may be mutable or immutable. A `fields` created using the
-    constructor, `from-list`, or `clone` will be mutable, but a `fields`
-    resource given by other means (including, but not limited to,
-    `incoming-request.headers`, `outgoing-request.headers`) might be be
-    immutable. In an immutable fields, the `set`, `append`, and `delete`
-    operations will fail with `header-error.immutable`.
-    """
-    
-    def __init__(self):
-        """
-        Construct an empty HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def from_list(cls, entries: List[Tuple[str, bytes]]) -> Self:
-        """
-        Construct an HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        
-        The list represents each key-value pair in the Fields. Keys
-        which have multiple values are represented by multiple entries in this
-        list with the same key.
-        
-        The tuple is a pair of the field key, represented as a string, and
-        Value, represented as a list of bytes. In a valid Fields, all keys
-        and values are valid UTF-8 strings. However, values are not always
-        well-formed, so they are represented as a raw list of bytes.
-        
-        An error result will be returned if any header or value was
-        syntactically invalid, or if a header was forbidden.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def get(self, name: str) -> List[bytes]:
-        """
-        Get all of the values corresponding to a key. If the key is not present
-        in this `fields`, an empty list is returned. However, if the key is
-        present but empty, this is represented by a list with one or more
-        empty field-values present.
-        """
-        raise NotImplementedError
-
-    def has(self, name: str) -> int:
-        """
-        Returns `true` when the key is present in this `fields`. If the key is
-        syntactically invalid, `false` is returned.
-        """
-        raise NotImplementedError
-
-    def set(self, name: str, value: List[bytes]) -> None:
-        """
-        Set all of the values for a key. Clears any existing values for that
-        key, if they have been set.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def delete(self, name: str) -> None:
-        """
-        Delete all values for a key. Does nothing if no values for the key
-        exist.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def append(self, name: str, value: bytes) -> None:
-        """
-        Append a value for a key. Does not change or delete any existing
-        values for that key.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def entries(self) -> List[Tuple[str, bytes]]:
-        """
-        Retrieve the full set of keys and values in the Fields. Like the
-        constructor, the list represents each key-value pair.
-        
-        The outer list represents each key-value pair in the Fields. Keys
-        which have multiple values are represented by multiple entries in this
-        list with the same key.
-        """
-        raise NotImplementedError
-
-    def clone(self) -> Self:
-        """
-        Make a deep copy of the Fields. Equivelant in behavior to calling the
-        `fields` constructor on the return value of `entries`. The resulting
-        `fields` is mutable.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def from_list(entries: List[Tuple[str, bytes]]) ‑> Self -
-
-

Construct an HTTP Fields.

-

The resulting fields is mutable.

-

The list represents each key-value pair in the Fields. Keys -which have multiple values are represented by multiple entries in this -list with the same key.

-

The tuple is a pair of the field key, represented as a string, and -Value, represented as a list of bytes. In a valid Fields, all keys -and values are valid UTF-8 strings. However, values are not always -well-formed, so they are represented as a raw list of bytes.

-

An error result will be returned if any header or value was -syntactically invalid, or if a header was forbidden.

-

Raises: Err(HeaderError)

-
- -Expand source code - -
@classmethod
-def from_list(cls, entries: List[Tuple[str, bytes]]) -> Self:
-    """
-    Construct an HTTP Fields.
-    
-    The resulting `fields` is mutable.
-    
-    The list represents each key-value pair in the Fields. Keys
-    which have multiple values are represented by multiple entries in this
-    list with the same key.
-    
-    The tuple is a pair of the field key, represented as a string, and
-    Value, represented as a list of bytes. In a valid Fields, all keys
-    and values are valid UTF-8 strings. However, values are not always
-    well-formed, so they are represented as a raw list of bytes.
-    
-    An error result will be returned if any header or value was
-    syntactically invalid, or if a header was forbidden.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def append(self, name: str, value: bytes) ‑> None -
-
-

Append a value for a key. Does not change or delete any existing -values for that key.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: Err(HeaderError)

-
- -Expand source code - -
def append(self, name: str, value: bytes) -> None:
-    """
-    Append a value for a key. Does not change or delete any existing
-    values for that key.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-    """
-    raise NotImplementedError
-
-
-
-def clone(self) ‑> Self -
-
-

Make a deep copy of the Fields. Equivelant in behavior to calling the -fields constructor on the return value of entries. The resulting -fields is mutable.

-
- -Expand source code - -
def clone(self) -> Self:
-    """
-    Make a deep copy of the Fields. Equivelant in behavior to calling the
-    `fields` constructor on the return value of `entries`. The resulting
-    `fields` is mutable.
-    """
-    raise NotImplementedError
-
-
-
-def delete(self, name: str) ‑> None -
-
-

Delete all values for a key. Does nothing if no values for the key -exist.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: Err(HeaderError)

-
- -Expand source code - -
def delete(self, name: str) -> None:
-    """
-    Delete all values for a key. Does nothing if no values for the key
-    exist.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-    """
-    raise NotImplementedError
-
-
-
-def entries(self) ‑> List[Tuple[str, bytes]] -
-
-

Retrieve the full set of keys and values in the Fields. Like the -constructor, the list represents each key-value pair.

-

The outer list represents each key-value pair in the Fields. Keys -which have multiple values are represented by multiple entries in this -list with the same key.

-
- -Expand source code - -
def entries(self) -> List[Tuple[str, bytes]]:
-    """
-    Retrieve the full set of keys and values in the Fields. Like the
-    constructor, the list represents each key-value pair.
-    
-    The outer list represents each key-value pair in the Fields. Keys
-    which have multiple values are represented by multiple entries in this
-    list with the same key.
-    """
-    raise NotImplementedError
-
-
-
-def get(self, name: str) ‑> List[bytes] -
-
-

Get all of the values corresponding to a key. If the key is not present -in this fields, an empty list is returned. However, if the key is -present but empty, this is represented by a list with one or more -empty field-values present.

-
- -Expand source code - -
def get(self, name: str) -> List[bytes]:
-    """
-    Get all of the values corresponding to a key. If the key is not present
-    in this `fields`, an empty list is returned. However, if the key is
-    present but empty, this is represented by a list with one or more
-    empty field-values present.
-    """
-    raise NotImplementedError
-
-
-
-def has(self, name: str) ‑> int -
-
-

Returns true when the key is present in this fields. If the key is -syntactically invalid, false is returned.

-
- -Expand source code - -
def has(self, name: str) -> int:
-    """
-    Returns `true` when the key is present in this `fields`. If the key is
-    syntactically invalid, `false` is returned.
-    """
-    raise NotImplementedError
-
-
-
-def set(self, name: str, value: List[bytes]) ‑> None -
-
-

Set all of the values for a key. Clears any existing values for that -key, if they have been set.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: Err(HeaderError)

-
- -Expand source code - -
def set(self, name: str, value: List[bytes]) -> None:
-    """
-    Set all of the values for a key. Clears any existing values for that
-    key, if they have been set.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class FutureIncomingResponse -
-
-

Represents a future which may eventaully return an incoming HTTP -Response, or an error.

-

This resource is returned by the wasi:http/outgoing-handler interface to -provide the HTTP Response corresponding to the sent Request.

-
- -Expand source code - -
class FutureIncomingResponse:
-    """
-    Represents a future which may eventaully return an incoming HTTP
-    Response, or an error.
-    
-    This resource is returned by the `wasi:http/outgoing-handler` interface to
-    provide the HTTP Response corresponding to the sent Request.
-    """
-    
-    def subscribe(self) -> poll.Pollable:
-        """
-        Returns a pollable which becomes ready when either the Response has
-        been received, or an error has occured. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-
-    def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
-        """
-        Returns the incoming HTTP Response, or an error, once one is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the response or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the incoming HTTP Response
-        status and headers have recieved successfully, or that an error
-        occured. Errors may also occur while consuming the response body,
-        but those will be reported by the `incoming-body` and its
-        `output-stream` child.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def get(self) ‑> Union[Ok[Union[Ok[IncomingResponse], Err[Union[ErrorCodeDnsTimeoutErrorCodeDnsErrorErrorCodeDestinationNotFoundErrorCodeDestinationUnavailableErrorCodeDestinationIpProhibitedErrorCodeDestinationIpUnroutableErrorCodeConnectionRefusedErrorCodeConnectionTerminatedErrorCodeConnectionTimeoutErrorCodeConnectionReadTimeoutErrorCodeConnectionWriteTimeoutErrorCodeConnectionLimitReachedErrorCodeTlsProtocolErrorErrorCodeTlsCertificateErrorErrorCodeTlsAlertReceivedErrorCodeHttpRequestDeniedErrorCodeHttpRequestLengthRequiredErrorCodeHttpRequestBodySizeErrorCodeHttpRequestMethodInvalidErrorCodeHttpRequestUriInvalidErrorCodeHttpRequestUriTooLongErrorCodeHttpRequestHeaderSectionSizeErrorCodeHttpRequestHeaderSizeErrorCodeHttpRequestTrailerSectionSizeErrorCodeHttpRequestTrailerSizeErrorCodeHttpResponseIncompleteErrorCodeHttpResponseHeaderSectionSizeErrorCodeHttpResponseHeaderSizeErrorCodeHttpResponseBodySizeErrorCodeHttpResponseTrailerSectionSizeErrorCodeHttpResponseTrailerSizeErrorCodeHttpResponseTransferCodingErrorCodeHttpResponseContentCodingErrorCodeHttpResponseTimeoutErrorCodeHttpUpgradeFailedErrorCodeHttpProtocolErrorErrorCodeLoopDetectedErrorCodeConfigurationErrorErrorCodeInternalError]]]], Err[None], ForwardRef(None)] -
-
-

Returns the incoming HTTP Response, or an error, once one is ready.

-

The outer option represents future readiness. Users can wait on this -option to become some using the subscribe method.

-

The outer result is used to retrieve the response or error at most -once. It will be success on the first call in which the outer option -is some, and error on subsequent calls.

-

The inner result represents that either the incoming HTTP Response -status and headers have recieved successfully, or that an error -occured. Errors may also occur while consuming the response body, -but those will be reported by the incoming-body and its -output-stream child.

-
- -Expand source code - -
def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
-    """
-    Returns the incoming HTTP Response, or an error, once one is ready.
-    
-    The outer `option` represents future readiness. Users can wait on this
-    `option` to become `some` using the `subscribe` method.
-    
-    The outer `result` is used to retrieve the response or error at most
-    once. It will be success on the first call in which the outer option
-    is `some`, and error on subsequent calls.
-    
-    The inner `result` represents that either the incoming HTTP Response
-    status and headers have recieved successfully, or that an error
-    occured. Errors may also occur while consuming the response body,
-    but those will be reported by the `incoming-body` and its
-    `output-stream` child.
-    """
-    raise NotImplementedError
-
-
-
-def subscribe(self) ‑> Pollable -
-
-

Returns a pollable which becomes ready when either the Response has -been received, or an error has occured. When this pollable is ready, -the get method will return some.

-
- -Expand source code - -
def subscribe(self) -> poll.Pollable:
-    """
-    Returns a pollable which becomes ready when either the Response has
-    been received, or an error has occured. When this pollable is ready,
-    the `get` method will return `some`.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class FutureTrailers -
-
-

Represents a future which may eventaully return trailers, or an error.

-

In the case that the incoming HTTP Request or Response did not have any -trailers, this future will resolve to the empty set of trailers once the -complete Request or Response body has been received.

-
- -Expand source code - -
class FutureTrailers:
-    """
-    Represents a future which may eventaully return trailers, or an error.
-    
-    In the case that the incoming HTTP Request or Response did not have any
-    trailers, this future will resolve to the empty set of trailers once the
-    complete Request or Response body has been received.
-    """
-    
-    def subscribe(self) -> poll.Pollable:
-        """
-        Returns a pollable which becomes ready when either the trailers have
-        been received, or an error has occured. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-
-    def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
-        """
-        Returns the contents of the trailers, or an error which occured,
-        once the future is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the trailers or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the HTTP Request or Response
-        body, as well as any trailers, were received successfully, or that an
-        error occured receiving them. The optional `trailers` indicates whether
-        or not trailers were present in the body.
-        
-        When some `trailers` are returned by this method, the `trailers`
-        resource is immutable, and a child. Use of the `set`, `append`, or
-        `delete` methods will return an error, and the resource must be
-        dropped before the parent `future-trailers` is dropped.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def get(self) ‑> Union[Ok[Union[Ok[Optional[Fields]], Err[Union[ErrorCodeDnsTimeoutErrorCodeDnsErrorErrorCodeDestinationNotFoundErrorCodeDestinationUnavailableErrorCodeDestinationIpProhibitedErrorCodeDestinationIpUnroutableErrorCodeConnectionRefusedErrorCodeConnectionTerminatedErrorCodeConnectionTimeoutErrorCodeConnectionReadTimeoutErrorCodeConnectionWriteTimeoutErrorCodeConnectionLimitReachedErrorCodeTlsProtocolErrorErrorCodeTlsCertificateErrorErrorCodeTlsAlertReceivedErrorCodeHttpRequestDeniedErrorCodeHttpRequestLengthRequiredErrorCodeHttpRequestBodySizeErrorCodeHttpRequestMethodInvalidErrorCodeHttpRequestUriInvalidErrorCodeHttpRequestUriTooLongErrorCodeHttpRequestHeaderSectionSizeErrorCodeHttpRequestHeaderSizeErrorCodeHttpRequestTrailerSectionSizeErrorCodeHttpRequestTrailerSizeErrorCodeHttpResponseIncompleteErrorCodeHttpResponseHeaderSectionSizeErrorCodeHttpResponseHeaderSizeErrorCodeHttpResponseBodySizeErrorCodeHttpResponseTrailerSectionSizeErrorCodeHttpResponseTrailerSizeErrorCodeHttpResponseTransferCodingErrorCodeHttpResponseContentCodingErrorCodeHttpResponseTimeoutErrorCodeHttpUpgradeFailedErrorCodeHttpProtocolErrorErrorCodeLoopDetectedErrorCodeConfigurationErrorErrorCodeInternalError]]]], Err[None], ForwardRef(None)] -
-
-

Returns the contents of the trailers, or an error which occured, -once the future is ready.

-

The outer option represents future readiness. Users can wait on this -option to become some using the subscribe method.

-

The outer result is used to retrieve the trailers or error at most -once. It will be success on the first call in which the outer option -is some, and error on subsequent calls.

-

The inner result represents that either the HTTP Request or Response -body, as well as any trailers, were received successfully, or that an -error occured receiving them. The optional trailers indicates whether -or not trailers were present in the body.

-

When some trailers are returned by this method, the trailers -resource is immutable, and a child. Use of the set, append, or -delete methods will return an error, and the resource must be -dropped before the parent future-trailers is dropped.

-
- -Expand source code - -
def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
-    """
-    Returns the contents of the trailers, or an error which occured,
-    once the future is ready.
-    
-    The outer `option` represents future readiness. Users can wait on this
-    `option` to become `some` using the `subscribe` method.
-    
-    The outer `result` is used to retrieve the trailers or error at most
-    once. It will be success on the first call in which the outer option
-    is `some`, and error on subsequent calls.
-    
-    The inner `result` represents that either the HTTP Request or Response
-    body, as well as any trailers, were received successfully, or that an
-    error occured receiving them. The optional `trailers` indicates whether
-    or not trailers were present in the body.
-    
-    When some `trailers` are returned by this method, the `trailers`
-    resource is immutable, and a child. Use of the `set`, `append`, or
-    `delete` methods will return an error, and the resource must be
-    dropped before the parent `future-trailers` is dropped.
-    """
-    raise NotImplementedError
-
-
-
-def subscribe(self) ‑> Pollable -
-
-

Returns a pollable which becomes ready when either the trailers have -been received, or an error has occured. When this pollable is ready, -the get method will return some.

-
- -Expand source code - -
def subscribe(self) -> poll.Pollable:
-    """
-    Returns a pollable which becomes ready when either the trailers have
-    been received, or an error has occured. When this pollable is ready,
-    the `get` method will return `some`.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class HeaderErrorForbidden -
-
-

HeaderErrorForbidden()

-
- -Expand source code - -
@dataclass
-class HeaderErrorForbidden:
-    pass
-
-
-
-class HeaderErrorImmutable -
-
-

HeaderErrorImmutable()

-
- -Expand source code - -
@dataclass
-class HeaderErrorImmutable:
-    pass
-
-
-
-class HeaderErrorInvalidSyntax -
-
-

HeaderErrorInvalidSyntax()

-
- -Expand source code - -
@dataclass
-class HeaderErrorInvalidSyntax:
-    pass
-
-
-
-class IncomingBody -
-
-

Represents an incoming HTTP Request or Response's Body.

-

A body has both its contents - a stream of bytes - and a (possibly -empty) set of trailers, indicating that the full contents of the -body have been received. This resource represents the contents as -an input-stream and the delivery of trailers as a future-trailers, -and ensures that the user of this interface may only be consuming either -the body contents or waiting on trailers at any given time.

-
- -Expand source code - -
class IncomingBody:
-    """
-    Represents an incoming HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, indicating that the full contents of the
-    body have been received. This resource represents the contents as
-    an `input-stream` and the delivery of trailers as a `future-trailers`,
-    and ensures that the user of this interface may only be consuming either
-    the body contents or waiting on trailers at any given time.
-    """
-    
-    def stream(self) -> streams.InputStream:
-        """
-        Returns the contents of the body, as a stream of bytes.
-        
-        Returns success on first call: the stream representing the contents
-        can be retrieved at most once. Subsequent calls will return error.
-        
-        The returned `input-stream` resource is a child: it must be dropped
-        before the parent `incoming-body` is dropped, or consumed by
-        `incoming-body.finish`.
-        
-        This invariant ensures that the implementation can determine whether
-        the user is consuming the contents of the body, waiting on the
-        `future-trailers` to be ready, or neither. This allows for network
-        backpressure is to be applied when the user is consuming the body,
-        and for that backpressure to not inhibit delivery of the trailers if
-        the user does not read the entire body.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def finish(cls, this: Self) -> FutureTrailers:
-        """
-        Takes ownership of `incoming-body`, and returns a `future-trailers`.
-        This function will trap if the `input-stream` child is still alive.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def finish(this: Self) ‑> FutureTrailers -
-
-

Takes ownership of incoming-body, and returns a future-trailers. -This function will trap if the input-stream child is still alive.

-
- -Expand source code - -
@classmethod
-def finish(cls, this: Self) -> FutureTrailers:
-    """
-    Takes ownership of `incoming-body`, and returns a `future-trailers`.
-    This function will trap if the `input-stream` child is still alive.
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def stream(self) ‑> InputStream -
-
-

Returns the contents of the body, as a stream of bytes.

-

Returns success on first call: the stream representing the contents -can be retrieved at most once. Subsequent calls will return error.

-

The returned input-stream resource is a child: it must be dropped -before the parent incoming-body is dropped, or consumed by -incoming-body.finish.

-

This invariant ensures that the implementation can determine whether -the user is consuming the contents of the body, waiting on the -future-trailers to be ready, or neither. This allows for network -backpressure is to be applied when the user is consuming the body, -and for that backpressure to not inhibit delivery of the trailers if -the user does not read the entire body.

-

Raises: Err(None)

-
- -Expand source code - -
def stream(self) -> streams.InputStream:
-    """
-    Returns the contents of the body, as a stream of bytes.
-    
-    Returns success on first call: the stream representing the contents
-    can be retrieved at most once. Subsequent calls will return error.
-    
-    The returned `input-stream` resource is a child: it must be dropped
-    before the parent `incoming-body` is dropped, or consumed by
-    `incoming-body.finish`.
-    
-    This invariant ensures that the implementation can determine whether
-    the user is consuming the contents of the body, waiting on the
-    `future-trailers` to be ready, or neither. This allows for network
-    backpressure is to be applied when the user is consuming the body,
-    and for that backpressure to not inhibit delivery of the trailers if
-    the user does not read the entire body.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class IncomingRequest -
-
-

Represents an incoming HTTP Request.

-
- -Expand source code - -
class IncomingRequest:
-    """
-    Represents an incoming HTTP Request.
-    """
-    
-    def method(self) -> Method:
-        """
-        Returns the method of the incoming request.
-        """
-        raise NotImplementedError
-
-    def path_with_query(self) -> Optional[str]:
-        """
-        Returns the path with query parameters from the request, as a string.
-        """
-        raise NotImplementedError
-
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Returns the protocol scheme from the request.
-        """
-        raise NotImplementedError
-
-    def authority(self) -> Optional[str]:
-        """
-        Returns the authority from the request, if it was present.
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Get the `headers` associated with the request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        The `headers` returned are a child resource: it must be dropped before
-        the parent `incoming-request` is dropped. Dropping this
-        `incoming-request` before all children are dropped will trap.
-        """
-        raise NotImplementedError
-
-    def consume(self) -> IncomingBody:
-        """
-        Gives the `incoming-body` associated with this request. Will only
-        return success at most once, and subsequent calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def authority(self) ‑> Optional[str] -
-
-

Returns the authority from the request, if it was present.

-
- -Expand source code - -
def authority(self) -> Optional[str]:
-    """
-    Returns the authority from the request, if it was present.
-    """
-    raise NotImplementedError
-
-
-
-def consume(self) ‑> IncomingBody -
-
-

Gives the incoming-body associated with this request. Will only -return success at most once, and subsequent calls will return error.

-

Raises: Err(None)

-
- -Expand source code - -
def consume(self) -> IncomingBody:
-    """
-    Gives the `incoming-body` associated with this request. Will only
-    return success at most once, and subsequent calls will return error.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def headers(self) ‑> Fields -
-
-

Get the headers associated with the request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

The headers returned are a child resource: it must be dropped before -the parent incoming-request is dropped. Dropping this -incoming-request before all children are dropped will trap.

-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the `headers` associated with the request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    The `headers` returned are a child resource: it must be dropped before
-    the parent `incoming-request` is dropped. Dropping this
-    `incoming-request` before all children are dropped will trap.
-    """
-    raise NotImplementedError
-
-
-
-def method(self) ‑> Union[MethodGetMethodHeadMethodPostMethodPutMethodDeleteMethodConnectMethodOptionsMethodTraceMethodPatchMethodOther] -
-
-

Returns the method of the incoming request.

-
- -Expand source code - -
def method(self) -> Method:
-    """
-    Returns the method of the incoming request.
-    """
-    raise NotImplementedError
-
-
-
-def path_with_query(self) ‑> Optional[str] -
-
-

Returns the path with query parameters from the request, as a string.

-
- -Expand source code - -
def path_with_query(self) -> Optional[str]:
-    """
-    Returns the path with query parameters from the request, as a string.
-    """
-    raise NotImplementedError
-
-
-
-def scheme(self) ‑> Union[SchemeHttpSchemeHttpsSchemeOther, ForwardRef(None)] -
-
-

Returns the protocol scheme from the request.

-
- -Expand source code - -
def scheme(self) -> Optional[Scheme]:
-    """
-    Returns the protocol scheme from the request.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class IncomingResponse -
-
-

Represents an incoming HTTP Response.

-
- -Expand source code - -
class IncomingResponse:
-    """
-    Represents an incoming HTTP Response.
-    """
-    
-    def status(self) -> int:
-        """
-        Returns the status code from the incoming response.
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Returns the headers from the incoming response.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `incoming-response` is dropped.
-        """
-        raise NotImplementedError
-
-    def consume(self) -> IncomingBody:
-        """
-        Returns the incoming body. May be called at most once. Returns error
-        if called additional times.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def consume(self) ‑> IncomingBody -
-
-

Returns the incoming body. May be called at most once. Returns error -if called additional times.

-

Raises: Err(None)

-
- -Expand source code - -
def consume(self) -> IncomingBody:
-    """
-    Returns the incoming body. May be called at most once. Returns error
-    if called additional times.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def headers(self) ‑> Fields -
-
-

Returns the headers from the incoming response.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -incoming-response is dropped.

-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Returns the headers from the incoming response.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `incoming-response` is dropped.
-    """
-    raise NotImplementedError
-
-
-
-def status(self) ‑> int -
-
-

Returns the status code from the incoming response.

-
- -Expand source code - -
def status(self) -> int:
-    """
-    Returns the status code from the incoming response.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class MethodConnect -
-
-

MethodConnect()

-
- -Expand source code - -
@dataclass
-class MethodConnect:
-    pass
-
-
-
-class MethodDelete -
-
-

MethodDelete()

-
- -Expand source code - -
@dataclass
-class MethodDelete:
-    pass
-
-
-
-class MethodGet -
-
-

MethodGet()

-
- -Expand source code - -
@dataclass
-class MethodGet:
-    pass
-
-
-
-class MethodHead -
-
-

MethodHead()

-
- -Expand source code - -
@dataclass
-class MethodHead:
-    pass
-
-
-
-class MethodOptions -
-
-

MethodOptions()

-
- -Expand source code - -
@dataclass
-class MethodOptions:
-    pass
-
-
-
-class MethodOther -(value: str) -
-
-

MethodOther(value: str)

-
- -Expand source code - -
@dataclass
-class MethodOther:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class MethodPatch -
-
-

MethodPatch()

-
- -Expand source code - -
@dataclass
-class MethodPatch:
-    pass
-
-
-
-class MethodPost -
-
-

MethodPost()

-
- -Expand source code - -
@dataclass
-class MethodPost:
-    pass
-
-
-
-class MethodPut -
-
-

MethodPut()

-
- -Expand source code - -
@dataclass
-class MethodPut:
-    pass
-
-
-
-class MethodTrace -
-
-

MethodTrace()

-
- -Expand source code - -
@dataclass
-class MethodTrace:
-    pass
-
-
-
-class OutgoingBody -
-
-

Represents an outgoing HTTP Request or Response's Body.

-

A body has both its contents - a stream of bytes - and a (possibly -empty) set of trailers, inducating the full contents of the body -have been sent. This resource represents the contents as an -output-stream child resource, and the completion of the body (with -optional trailers) with a static function that consumes the -outgoing-body resource, and ensures that the user of this interface -may not write to the body contents after the body has been finished.

-

If the user code drops this resource, as opposed to calling the static -method finish, the implementation should treat the body as incomplete, -and that an error has occured. The implementation should propogate this -error to the HTTP protocol by whatever means it has available, -including: corrupting the body on the wire, aborting the associated -Request, or sending a late status code for the Response.

-
- -Expand source code - -
class OutgoingBody:
-    """
-    Represents an outgoing HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, inducating the full contents of the body
-    have been sent. This resource represents the contents as an
-    `output-stream` child resource, and the completion of the body (with
-    optional trailers) with a static function that consumes the
-    `outgoing-body` resource, and ensures that the user of this interface
-    may not write to the body contents after the body has been finished.
-    
-    If the user code drops this resource, as opposed to calling the static
-    method `finish`, the implementation should treat the body as incomplete,
-    and that an error has occured. The implementation should propogate this
-    error to the HTTP protocol by whatever means it has available,
-    including: corrupting the body on the wire, aborting the associated
-    Request, or sending a late status code for the Response.
-    """
-    
-    def write(self) -> streams.OutputStream:
-        """
-        Returns a stream for writing the body contents.
-        
-        The returned `output-stream` is a child resource: it must be dropped
-        before the parent `outgoing-body` resource is dropped (or finished),
-        otherwise the `outgoing-body` drop or `finish` will trap.
-        
-        Returns success on the first call: the `output-stream` resource for
-        this `outgoing-body` may be retrieved at most once. Subsequent calls
-        will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def finish(cls, this: Self, trailers: Optional[Fields]) -> None:
-        """
-        Finalize an outgoing body, optionally providing trailers. This must be
-        called to signal that the response is complete. If the `outgoing-body`
-        is dropped without calling `outgoing-body.finalize`, the implementation
-        should treat the body as corrupted.
-        
-        Fails if the body's `outgoing-request` or `outgoing-response` was
-        constructed with a Content-Length header, and the contents written
-        to the body (via `write`) does not match the value given in the
-        Content-Length.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def finish(this: Self, trailers: Optional[Fields]) ‑> None -
-
-

Finalize an outgoing body, optionally providing trailers. This must be -called to signal that the response is complete. If the outgoing-body -is dropped without calling outgoing-body.finalize, the implementation -should treat the body as corrupted.

-

Fails if the body's outgoing-request or outgoing-response was -constructed with a Content-Length header, and the contents written -to the body (via write) does not match the value given in the -Content-Length.

-

Raises: Err(ErrorCode)

-
- -Expand source code - -
@classmethod
-def finish(cls, this: Self, trailers: Optional[Fields]) -> None:
-    """
-    Finalize an outgoing body, optionally providing trailers. This must be
-    called to signal that the response is complete. If the `outgoing-body`
-    is dropped without calling `outgoing-body.finalize`, the implementation
-    should treat the body as corrupted.
-    
-    Fails if the body's `outgoing-request` or `outgoing-response` was
-    constructed with a Content-Length header, and the contents written
-    to the body (via `write`) does not match the value given in the
-    Content-Length.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def write(self) ‑> OutputStream -
-
-

Returns a stream for writing the body contents.

-

The returned output-stream is a child resource: it must be dropped -before the parent outgoing-body resource is dropped (or finished), -otherwise the outgoing-body drop or finish will trap.

-

Returns success on the first call: the output-stream resource for -this outgoing-body may be retrieved at most once. Subsequent calls -will return error.

-

Raises: Err(None)

-
- -Expand source code - -
def write(self) -> streams.OutputStream:
-    """
-    Returns a stream for writing the body contents.
-    
-    The returned `output-stream` is a child resource: it must be dropped
-    before the parent `outgoing-body` resource is dropped (or finished),
-    otherwise the `outgoing-body` drop or `finish` will trap.
-    
-    Returns success on the first call: the `output-stream` resource for
-    this `outgoing-body` may be retrieved at most once. Subsequent calls
-    will return error.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class OutgoingRequest -(headers: Fields) -
-
-

Represents an outgoing HTTP Request.

-

Construct a new outgoing-request with a default method of GET, and -none values for path-with-query, scheme, and authority.

-
    -
  • headers is the HTTP Headers for the Request.
  • -
-

It is possible to construct, or manipulate with the accessor functions -below, an outgoing-request with an invalid combination of scheme -and authority, or headers which are not permitted to be sent. -It is the obligation of the outgoing-handler.handle implementation -to reject invalid constructions of outgoing-request.

-
- -Expand source code - -
class OutgoingRequest:
-    """
-    Represents an outgoing HTTP Request.
-    """
-    
-    def __init__(self, headers: Fields):
-        """
-        Construct a new `outgoing-request` with a default `method` of `GET`, and
-        `none` values for `path-with-query`, `scheme`, and `authority`.
-        
-        * `headers` is the HTTP Headers for the Request.
-        
-        It is possible to construct, or manipulate with the accessor functions
-        below, an `outgoing-request` with an invalid combination of `scheme`
-        and `authority`, or `headers` which are not permitted to be sent.
-        It is the obligation of the `outgoing-handler.handle` implementation
-        to reject invalid constructions of `outgoing-request`.
-        """
-        raise NotImplementedError
-
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this
-        Request.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-request` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def method(self) -> Method:
-        """
-        Get the Method for the Request.
-        """
-        raise NotImplementedError
-
-    def set_method(self, method: Method) -> None:
-        """
-        Set the Method for the Request. Fails if the string present in a
-        `method.other` argument is not a syntactically valid method.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def path_with_query(self) -> Optional[str]:
-        """
-        Get the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query.
-        """
-        raise NotImplementedError
-
-    def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-        """
-        Set the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query. Fails is the
-        string given is not a syntactically valid path and query uri component.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Get the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme.
-        """
-        raise NotImplementedError
-
-    def set_scheme(self, scheme: Optional[Scheme]) -> None:
-        """
-        Set the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme. Fails if the
-        string given is not a syntactically valid uri scheme.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def authority(self) -> Optional[str]:
-        """
-        Get the HTTP Authority for the Request. A value of `none` may be used
-        with Related Schemes which do not require an Authority. The HTTP and
-        HTTPS schemes always require an authority.
-        """
-        raise NotImplementedError
-
-    def set_authority(self, authority: Optional[str]) -> None:
-        """
-        Set the HTTP Authority for the Request. A value of `none` may be used
-        with Related Schemes which do not require an Authority. The HTTP and
-        HTTPS schemes always require an authority. Fails if the string given is
-        not a syntactically valid uri authority.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transfered to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def authority(self) ‑> Optional[str] -
-
-

Get the HTTP Authority for the Request. A value of none may be used -with Related Schemes which do not require an Authority. The HTTP and -HTTPS schemes always require an authority.

-
- -Expand source code - -
def authority(self) -> Optional[str]:
-    """
-    Get the HTTP Authority for the Request. A value of `none` may be used
-    with Related Schemes which do not require an Authority. The HTTP and
-    HTTPS schemes always require an authority.
-    """
-    raise NotImplementedError
-
-
-
-def body(self) ‑> OutgoingBody -
-
-

Returns the resource corresponding to the outgoing Body for this -Request.

-

Returns success on the first call: the outgoing-body resource for -this outgoing-request can be retrieved at most once. Subsequent -calls will return error.

-

Raises: Err(None)

-
- -Expand source code - -
def body(self) -> OutgoingBody:
-    """
-    Returns the resource corresponding to the outgoing Body for this
-    Request.
-    
-    Returns success on the first call: the `outgoing-body` resource for
-    this `outgoing-request` can be retrieved at most once. Subsequent
-    calls will return error.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def headers(self) ‑> Fields -
-
-

Get the headers associated with the Request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -outgoing-request is dropped, or its ownership is transfered to -another component by e.g. outgoing-handler.handle.

-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the headers associated with the Request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `outgoing-request` is dropped, or its ownership is transfered to
-    another component by e.g. `outgoing-handler.handle`.
-    """
-    raise NotImplementedError
-
-
-
-def method(self) ‑> Union[MethodGetMethodHeadMethodPostMethodPutMethodDeleteMethodConnectMethodOptionsMethodTraceMethodPatchMethodOther] -
-
-

Get the Method for the Request.

-
- -Expand source code - -
def method(self) -> Method:
-    """
-    Get the Method for the Request.
-    """
-    raise NotImplementedError
-
-
-
-def path_with_query(self) ‑> Optional[str] -
-
-

Get the combination of the HTTP Path and Query for the Request. -When none, this represents an empty Path and empty Query.

-
- -Expand source code - -
def path_with_query(self) -> Optional[str]:
-    """
-    Get the combination of the HTTP Path and Query for the Request.
-    When `none`, this represents an empty Path and empty Query.
-    """
-    raise NotImplementedError
-
-
-
-def scheme(self) ‑> Union[SchemeHttpSchemeHttpsSchemeOther, ForwardRef(None)] -
-
-

Get the HTTP Related Scheme for the Request. When none, the -implementation may choose an appropriate default scheme.

-
- -Expand source code - -
def scheme(self) -> Optional[Scheme]:
-    """
-    Get the HTTP Related Scheme for the Request. When `none`, the
-    implementation may choose an appropriate default scheme.
-    """
-    raise NotImplementedError
-
-
-
-def set_authority(self, authority: Optional[str]) ‑> None -
-
-

Set the HTTP Authority for the Request. A value of none may be used -with Related Schemes which do not require an Authority. The HTTP and -HTTPS schemes always require an authority. Fails if the string given is -not a syntactically valid uri authority.

-

Raises: Err(None)

-
- -Expand source code - -
def set_authority(self, authority: Optional[str]) -> None:
-    """
-    Set the HTTP Authority for the Request. A value of `none` may be used
-    with Related Schemes which do not require an Authority. The HTTP and
-    HTTPS schemes always require an authority. Fails if the string given is
-    not a syntactically valid uri authority.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def set_method(self, method: Union[MethodGetMethodHeadMethodPostMethodPutMethodDeleteMethodConnectMethodOptionsMethodTraceMethodPatchMethodOther]) ‑> None -
-
-

Set the Method for the Request. Fails if the string present in a -method.other argument is not a syntactically valid method.

-

Raises: Err(None)

-
- -Expand source code - -
def set_method(self, method: Method) -> None:
-    """
-    Set the Method for the Request. Fails if the string present in a
-    `method.other` argument is not a syntactically valid method.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def set_path_with_query(self, path_with_query: Optional[str]) ‑> None -
-
-

Set the combination of the HTTP Path and Query for the Request. -When none, this represents an empty Path and empty Query. Fails is the -string given is not a syntactically valid path and query uri component.

-

Raises: Err(None)

-
- -Expand source code - -
def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-    """
-    Set the combination of the HTTP Path and Query for the Request.
-    When `none`, this represents an empty Path and empty Query. Fails is the
-    string given is not a syntactically valid path and query uri component.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def set_scheme(self, scheme: Union[SchemeHttpSchemeHttpsSchemeOther, ForwardRef(None)]) ‑> None -
-
-

Set the HTTP Related Scheme for the Request. When none, the -implementation may choose an appropriate default scheme. Fails if the -string given is not a syntactically valid uri scheme.

-

Raises: Err(None)

-
- -Expand source code - -
def set_scheme(self, scheme: Optional[Scheme]) -> None:
-    """
-    Set the HTTP Related Scheme for the Request. When `none`, the
-    implementation may choose an appropriate default scheme. Fails if the
-    string given is not a syntactically valid uri scheme.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class OutgoingResponse -(headers: Fields) -
-
-

Represents an outgoing HTTP Response.

-

Construct an outgoing-response, with a default status-code of 200. -If a different status-code is needed, it must be set via the -set-status-code method.

-
    -
  • headers is the HTTP Headers for the Response.
  • -
-
- -Expand source code - -
class OutgoingResponse:
-    """
-    Represents an outgoing HTTP Response.
-    """
-    
-    def __init__(self, headers: Fields):
-        """
-        Construct an `outgoing-response`, with a default `status-code` of `200`.
-        If a different `status-code` is needed, it must be set via the
-        `set-status-code` method.
-        
-        * `headers` is the HTTP Headers for the Response.
-        """
-        raise NotImplementedError
-
-    def status_code(self) -> int:
-        """
-        Get the HTTP Status Code for the Response.
-        """
-        raise NotImplementedError
-
-    def set_status_code(self, status_code: int) -> None:
-        """
-        Set the HTTP Status Code for the Response. Fails if the status-code
-        given is not a valid http status code.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transfered to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this Response.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-response` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def body(self) ‑> OutgoingBody -
-
-

Returns the resource corresponding to the outgoing Body for this Response.

-

Returns success on the first call: the outgoing-body resource for -this outgoing-response can be retrieved at most once. Subsequent -calls will return error.

-

Raises: Err(None)

-
- -Expand source code - -
def body(self) -> OutgoingBody:
-    """
-    Returns the resource corresponding to the outgoing Body for this Response.
-    
-    Returns success on the first call: the `outgoing-body` resource for
-    this `outgoing-response` can be retrieved at most once. Subsequent
-    calls will return error.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def headers(self) ‑> Fields -
-
-

Get the headers associated with the Request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -outgoing-request is dropped, or its ownership is transfered to -another component by e.g. outgoing-handler.handle.

-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the headers associated with the Request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `outgoing-request` is dropped, or its ownership is transfered to
-    another component by e.g. `outgoing-handler.handle`.
-    """
-    raise NotImplementedError
-
-
-
-def set_status_code(self, status_code: int) ‑> None -
-
-

Set the HTTP Status Code for the Response. Fails if the status-code -given is not a valid http status code.

-

Raises: Err(None)

-
- -Expand source code - -
def set_status_code(self, status_code: int) -> None:
-    """
-    Set the HTTP Status Code for the Response. Fails if the status-code
-    given is not a valid http status code.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def status_code(self) ‑> int -
-
-

Get the HTTP Status Code for the Response.

-
- -Expand source code - -
def status_code(self) -> int:
-    """
-    Get the HTTP Status Code for the Response.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class RequestOptions -
-
-

Parameters for making an HTTP Request. Each of these parameters is -currently an optional timeout applicable to the transport layer of the -HTTP protocol.

-

These timeouts are separate from any the user may use to bound a -blocking call to wasi:io/poll.poll.

-

Construct a default request-options value.

-
- -Expand source code - -
class RequestOptions:
-    """
-    Parameters for making an HTTP Request. Each of these parameters is
-    currently an optional timeout applicable to the transport layer of the
-    HTTP protocol.
-    
-    These timeouts are separate from any the user may use to bound a
-    blocking call to `wasi:io/poll.poll`.
-    """
-    
-    def __init__(self):
-        """
-        Construct a default `request-options` value.
-        """
-        raise NotImplementedError
-
-    def connect_timeout(self) -> Optional[int]:
-        """
-        The timeout for the initial connect to the HTTP Server.
-        """
-        raise NotImplementedError
-
-    def set_connect_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for the initial connect to the HTTP Server. An error
-        return value indicates that this timeout is not supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def first_byte_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving the first byte of the Response body.
-        """
-        raise NotImplementedError
-
-    def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving the first byte of the Response body. An
-        error return value indicates that this timeout is not supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def between_bytes_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving subsequent chunks of bytes in the Response
-        body stream.
-        """
-        raise NotImplementedError
-
-    def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving subsequent chunks of bytes in the Response
-        body stream. An error return value indicates that this timeout is not
-        supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def between_bytes_timeout(self) ‑> Optional[int] -
-
-

The timeout for receiving subsequent chunks of bytes in the Response -body stream.

-
- -Expand source code - -
def between_bytes_timeout(self) -> Optional[int]:
-    """
-    The timeout for receiving subsequent chunks of bytes in the Response
-    body stream.
-    """
-    raise NotImplementedError
-
-
-
-def connect_timeout(self) ‑> Optional[int] -
-
-

The timeout for the initial connect to the HTTP Server.

-
- -Expand source code - -
def connect_timeout(self) -> Optional[int]:
-    """
-    The timeout for the initial connect to the HTTP Server.
-    """
-    raise NotImplementedError
-
-
-
-def first_byte_timeout(self) ‑> Optional[int] -
-
-

The timeout for receiving the first byte of the Response body.

-
- -Expand source code - -
def first_byte_timeout(self) -> Optional[int]:
-    """
-    The timeout for receiving the first byte of the Response body.
-    """
-    raise NotImplementedError
-
-
-
-def set_between_bytes_timeout(self, duration: Optional[int]) ‑> None -
-
-

Set the timeout for receiving subsequent chunks of bytes in the Response -body stream. An error return value indicates that this timeout is not -supported.

-

Raises: Err(None)

-
- -Expand source code - -
def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for receiving subsequent chunks of bytes in the Response
-    body stream. An error return value indicates that this timeout is not
-    supported.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def set_connect_timeout(self, duration: Optional[int]) ‑> None -
-
-

Set the timeout for the initial connect to the HTTP Server. An error -return value indicates that this timeout is not supported.

-

Raises: Err(None)

-
- -Expand source code - -
def set_connect_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for the initial connect to the HTTP Server. An error
-    return value indicates that this timeout is not supported.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def set_first_byte_timeout(self, duration: Optional[int]) ‑> None -
-
-

Set the timeout for receiving the first byte of the Response body. An -error return value indicates that this timeout is not supported.

-

Raises: Err(None)

-
- -Expand source code - -
def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for receiving the first byte of the Response body. An
-    error return value indicates that this timeout is not supported.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class ResponseOutparam -
-
-

Represents the ability to send an HTTP Response.

-

This resource is used by the wasi:http/incoming-handler interface to -allow a Response to be sent corresponding to the Request provided as the -other argument to incoming-handler.handle.

-
- -Expand source code - -
class ResponseOutparam:
-    """
-    Represents the ability to send an HTTP Response.
-    
-    This resource is used by the `wasi:http/incoming-handler` interface to
-    allow a Response to be sent corresponding to the Request provided as the
-    other argument to `incoming-handler.handle`.
-    """
-    
-    @classmethod
-    def set(cls, param: Self, response: Result[OutgoingResponse, ErrorCode]) -> None:
-        """
-        Set the value of the `response-outparam` to either send a response,
-        or indicate an error.
-        
-        This method consumes the `response-outparam` to ensure that it is
-        called at most once. If it is never called, the implementation
-        will respond with an error.
-        
-        The user may provide an `error` to `response` to allow the
-        implementation determine how to respond with an HTTP error response.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def set(param: Self, response: Union[Ok[OutgoingResponse], Err[Union[ErrorCodeDnsTimeoutErrorCodeDnsErrorErrorCodeDestinationNotFoundErrorCodeDestinationUnavailableErrorCodeDestinationIpProhibitedErrorCodeDestinationIpUnroutableErrorCodeConnectionRefusedErrorCodeConnectionTerminatedErrorCodeConnectionTimeoutErrorCodeConnectionReadTimeoutErrorCodeConnectionWriteTimeoutErrorCodeConnectionLimitReachedErrorCodeTlsProtocolErrorErrorCodeTlsCertificateErrorErrorCodeTlsAlertReceivedErrorCodeHttpRequestDeniedErrorCodeHttpRequestLengthRequiredErrorCodeHttpRequestBodySizeErrorCodeHttpRequestMethodInvalidErrorCodeHttpRequestUriInvalidErrorCodeHttpRequestUriTooLongErrorCodeHttpRequestHeaderSectionSizeErrorCodeHttpRequestHeaderSizeErrorCodeHttpRequestTrailerSectionSizeErrorCodeHttpRequestTrailerSizeErrorCodeHttpResponseIncompleteErrorCodeHttpResponseHeaderSectionSizeErrorCodeHttpResponseHeaderSizeErrorCodeHttpResponseBodySizeErrorCodeHttpResponseTrailerSectionSizeErrorCodeHttpResponseTrailerSizeErrorCodeHttpResponseTransferCodingErrorCodeHttpResponseContentCodingErrorCodeHttpResponseTimeoutErrorCodeHttpUpgradeFailedErrorCodeHttpProtocolErrorErrorCodeLoopDetectedErrorCodeConfigurationErrorErrorCodeInternalError]]]) ‑> None -
-
-

Set the value of the response-outparam to either send a response, -or indicate an error.

-

This method consumes the response-outparam to ensure that it is -called at most once. If it is never called, the implementation -will respond with an error.

-

The user may provide an error to response to allow the -implementation determine how to respond with an HTTP error response.

-
- -Expand source code - -
@classmethod
-def set(cls, param: Self, response: Result[OutgoingResponse, ErrorCode]) -> None:
-    """
-    Set the value of the `response-outparam` to either send a response,
-    or indicate an error.
-    
-    This method consumes the `response-outparam` to ensure that it is
-    called at most once. If it is never called, the implementation
-    will respond with an error.
-    
-    The user may provide an `error` to `response` to allow the
-    implementation determine how to respond with an HTTP error response.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class SchemeHttp -
-
-

SchemeHttp()

-
- -Expand source code - -
@dataclass
-class SchemeHttp:
-    pass
-
-
-
-class SchemeHttps -
-
-

SchemeHttps()

-
- -Expand source code - -
@dataclass
-class SchemeHttps:
-    pass
-
-
-
-class SchemeOther -(value: str) -
-
-

SchemeOther(value: str)

-
- -Expand source code - -
@dataclass
-class SchemeOther:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class TlsAlertReceivedPayload -(alert_id: Optional[int], alert_message: Optional[str]) -
-
-

Defines the case payload type for TLS-alert-received above:

-
- -Expand source code - -
@dataclass
-class TlsAlertReceivedPayload:
-    """
-    Defines the case payload type for `TLS-alert-received` above:
-    """
-    alert_id: Optional[int]
-    alert_message: Optional[str]
-
-

Class variables

-
-
var alert_id : Optional[int]
-
-
-
-
var alert_message : Optional[str]
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/imports/variables.html b/docs/v2/wit/imports/variables.html deleted file mode 100644 index d07e13d..0000000 --- a/docs/v2/wit/imports/variables.html +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - -spin_sdk.wit.imports.variables API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.variables

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-@dataclass
-class ErrorInvalidName:
-    value: str
-
-
-@dataclass
-class ErrorUndefined:
-    value: str
-
-
-@dataclass
-class ErrorProvider:
-    value: str
-
-
-@dataclass
-class ErrorOther:
-    value: str
-
-
-Error = Union[ErrorInvalidName, ErrorUndefined, ErrorProvider, ErrorOther]
-"""
-The set of errors which may be raised by functions in this interface.
-"""
-
-
-
-def get(name: str) -> str:
-    """
-    Get an application variable value for the current component.
-    
-    The name must match one defined in in the component manifest.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.variables.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface.

-
-
-
-
-

Functions

-
-
-def get(name: str) ‑> str -
-
-

Get an application variable value for the current component.

-

The name must match one defined in in the component manifest.

-

Raises: Err(Error)

-
- -Expand source code - -
def get(name: str) -> str:
-    """
-    Get an application variable value for the current component.
-    
-    The name must match one defined in in the component manifest.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.variables.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Classes

-
-
-class ErrorInvalidName -(value: str) -
-
-

ErrorInvalidName(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorInvalidName:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorOther -(value: str) -
-
-

ErrorOther(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorOther:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorProvider -(value: str) -
-
-

ErrorProvider(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorProvider:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorUndefined -(value: str) -
-
-

ErrorUndefined(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorUndefined:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/index.html b/docs/v2/wit/index.html deleted file mode 100644 index 3168b59..0000000 --- a/docs/v2/wit/index.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - -spin_sdk.wit API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit

-
-
-

Module with the bindings generated from the wit by componentize-py

-
- -Expand source code - -
""" Module with the bindings generated from the wit by componentize-py """
-
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from .types import Result, Ok, Err, Some
-
-
-
-class SpinAll(Protocol):
-    pass
-
-
-
-

Sub-modules

-
-
spin_sdk.wit.exports
-
-
-
-
spin_sdk.wit.imports
-
-
-
-
spin_sdk.wit.types
-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class SpinAll -(*args, **kwargs) -
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto(Protocol[T]):
-    def meth(self) -> T:
-        ...
-
-
- -Expand source code - -
class SpinAll(Protocol):
-    pass
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v2/wit/types.html b/docs/v2/wit/types.html deleted file mode 100644 index 407064b..0000000 --- a/docs/v2/wit/types.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - -spin_sdk.wit.types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.types

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-
-S = TypeVar('S')
-@dataclass
-class Some(Generic[S]):
-    value: S
-
-T = TypeVar('T')
-@dataclass
-class Ok(Generic[T]):
-    value: T
-
-E = TypeVar('E')
-@dataclass(frozen=True)
-class Err(Generic[E], Exception):
-    value: E
-
-Result = Union[Ok[T], Err[E]]
-            
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Err -(value: ~E) -
-
-

Err(value: ~E)

-
- -Expand source code - -
@dataclass(frozen=True)
-class Err(Generic[E], Exception):
-    value: E
-
-

Ancestors

-
    -
  • typing.Generic
  • -
  • builtins.Exception
  • -
  • builtins.BaseException
  • -
-

Class variables

-
-
var value : ~E
-
-
-
-
-
-
-class Ok -(value: ~T) -
-
-

Ok(value: ~T)

-
- -Expand source code - -
@dataclass
-class Ok(Generic[T]):
-    value: T
-
-

Ancestors

-
    -
  • typing.Generic
  • -
-

Class variables

-
-
var value : ~T
-
-
-
-
-
-
-class Some -(value: ~S) -
-
-

Some(value: ~S)

-
- -Expand source code - -
@dataclass
-class Some(Generic[S]):
-    value: S
-
-

Ancestors

-
    -
  • typing.Generic
  • -
-

Class variables

-
-
var value : ~S
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/v3/http/index.html b/docs/v3/http/index.html deleted file mode 100644 index 50f5070..0000000 --- a/docs/v3/http/index.html +++ /dev/null @@ -1,458 +0,0 @@ - - - - - - -spin_sdk.http API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.http

-
-
-

Module with helpers for wasi http

-
-
-

Sub-modules

-
-
spin_sdk.http.poll_loop
-
-

Defines a custom asyncio event loop backed by wasi:io/poll#poll

-
-
-
-
-
-
-

Functions

-
-
-def send(request: Request) ‑> Response -
-
-
- -Expand source code - -
def send(request: Request) -> Response:
-    """Send an HTTP request and return a response or raise an error"""
-    loop = PollLoop()
-    asyncio.set_event_loop(loop)
-    return loop.run_until_complete(send_async(request))
-
-

Send an HTTP request and return a response or raise an error

-
-
-async def send_and_close(sink: Sink,
data: bytes)
-
-
-
- -Expand source code - -
async def send_and_close(sink: Sink, data: bytes):
-    await sink.send(data)
-    sink.close()
-
-
-
-
-async def send_async(request: Request) ‑> Response -
-
-
- -Expand source code - -
async def send_async(request: Request) -> Response:
-    match request.method:
-        case "GET":
-            method: Method = Method_Get()
-        case "HEAD":
-            method = Method_Head()
-        case "POST":
-            method = Method_Post()
-        case "PUT":
-            method = Method_Put()
-        case "DELETE":
-            method = Method_Delete()
-        case "CONNECT":
-            method = Method_Connect()
-        case "OPTIONS":
-            method = Method_Options()
-        case "TRACE":
-            method = Method_Trace()
-        case "PATCH":
-            method = Method_Patch()
-        case _:
-            method = Method_Other(request.method)
-    
-    url_parsed = parse.urlparse(request.uri)
-
-    match url_parsed.scheme:
-        case "http":
-            scheme: Scheme = Scheme_Http()
-        case "https":
-            scheme = Scheme_Https()
-        case "":
-            scheme = Scheme_Http()
-        case _:
-            scheme = Scheme_Other(url_parsed.scheme)
-
-    headers_dict = request.headers
-
-    # Add a `content-length` header if the caller didn't include one, but did
-    # specify a body:
-    if headers_dict.get('content-length') is None:
-        content_length = len(request.body) if request.body is not None else 0
-        # Make a copy rather than mutate in place, since the caller might not
-        # expect us to mutate it:
-        headers_dict = headers_dict.copy()
-        headers_dict['content-length'] = str(content_length)
-
-    headers = list(map(
-        lambda pair: (pair[0], bytes(pair[1], "utf-8")),
-        headers_dict.items()
-    ))
-
-    outgoing_request = OutgoingRequest(Fields.from_list(headers))
-    outgoing_request.set_method(method)
-    outgoing_request.set_scheme(scheme)
-    if url_parsed.netloc == '':
-        if scheme == "http":
-            authority = ":80"
-        else:
-            authority = ":443"
-    else:
-        authority = url_parsed.netloc
-
-    outgoing_request.set_authority(authority)
-
-    path_and_query = url_parsed.path
-    if url_parsed.query:
-        path_and_query += '?' + url_parsed.query
-    outgoing_request.set_path_with_query(path_and_query)
-
-    outgoing_body = request.body if request.body is not None else bytearray()
-    sink = Sink(outgoing_request.body())
-    incoming_response: IncomingResponse = (await asyncio.gather(
-        poll_loop.send(outgoing_request),
-        send_and_close(sink, outgoing_body)
-    ))[0]
-
-    response_body = Stream(incoming_response.consume())
-    body = bytearray()
-    while True:
-        chunk = await response_body.next()
-        if chunk is None:
-            headers = incoming_response.headers()
-            simple_response = Response(
-                incoming_response.status(),
-                dict(map(
-                    lambda pair: (pair[0], str(pair[1], "utf-8")),
-                    headers.entries()
-                )),
-                bytes(body)
-            )
-            headers.__exit__(None, None, None)
-            incoming_response.__exit__(None, None, None)
-            return simple_response
-        else:
-            body += chunk
-
-
-
-
-
-
-

Classes

-
-
-class IncomingHandler -(*args, **kwargs) -
-
-
- -Expand source code - -
class IncomingHandler(Base):
-    """Simplified handler for incoming HTTP requests using blocking, buffered I/O."""
-
-    def handle_request(self, request: Request) -> Response:
-        """Handle an incoming HTTP request and return a response or raise an error"""
-        raise NotImplementedError
-
-    def handle(self, request: IncomingRequest, response_out: ResponseOutparam):
-        method = request.method()
-
-        if isinstance(method, Method_Get):
-            method_str = "GET"
-        elif isinstance(method, Method_Head):
-            method_str = "HEAD"
-        elif isinstance(method, Method_Post):
-            method_str = "POST"
-        elif isinstance(method, Method_Put):
-            method_str = "PUT"
-        elif isinstance(method, Method_Delete):
-            method_str = "DELETE"
-        elif isinstance(method, Method_Connect):
-            method_str = "CONNECT"
-        elif isinstance(method, Method_Options):
-            method_str = "OPTIONS"
-        elif isinstance(method, Method_Trace):
-            method_str = "TRACE"
-        elif isinstance(method, Method_Patch):
-            method_str = "PATCH"
-        elif isinstance(method, Method_Other):
-            method_str = method.value
-        else:
-            raise AssertionError
-
-        request_body = request.consume()
-        request_stream = request_body.stream()
-        body = bytearray()
-        while True:
-            try:
-                body += request_stream.blocking_read(16 * 1024)
-            except Err as e:
-                if isinstance(e.value, StreamError_Closed):
-                    request_stream.__exit__(None, None, None)
-                    IncomingBody.finish(request_body)
-                    break
-                else:
-                    raise e
-
-        request_uri = request.path_with_query()
-        if request_uri is None:
-            uri = "/"
-        else:
-            uri = request_uri
-
-        try:
-            simple_response = self.handle_request(Request(
-                method_str,
-                uri,
-                dict(map(lambda pair: (pair[0], str(pair[1], "utf-8")), request.headers().entries())),
-                bytes(body)
-            ))
-        except:
-            traceback.print_exc()
-
-            response = OutgoingResponse(Fields())
-            response.set_status_code(500)
-            ResponseOutparam.set(response_out, Ok(response))
-            return
-
-        if simple_response.headers.get('content-length') is None:
-            content_length = len(simple_response.body) if simple_response.body is not None else 0
-            simple_response.headers['content-length'] = str(content_length)
-
-        response = OutgoingResponse(Fields.from_list(list(map(
-            lambda pair: (pair[0], bytes(pair[1], "utf-8")),
-            simple_response.headers.items()
-        ))))
-        response_body = response.body()
-        response.set_status_code(simple_response.status)
-        ResponseOutparam.set(response_out, Ok(response))
-        response_stream = response_body.write()
-        if simple_response.body is not None:
-            MAX_BLOCKING_WRITE_SIZE = 4096
-            offset = 0
-            while offset < len(simple_response.body):
-                count = min(len(simple_response.body) - offset, MAX_BLOCKING_WRITE_SIZE)
-                response_stream.blocking_write_and_flush(simple_response.body[offset:offset+count])
-                offset += count
-        response_stream.__exit__(None, None, None)
-        OutgoingBody.finish(response_body, None)
-
-

Simplified handler for incoming HTTP requests using blocking, buffered I/O.

-

Ancestors

- -

Methods

-
-
-def handle_request(self,
request: Request) ‑> Response
-
-
-
- -Expand source code - -
def handle_request(self, request: Request) -> Response:
-    """Handle an incoming HTTP request and return a response or raise an error"""
-    raise NotImplementedError
-
-

Handle an incoming HTTP request and return a response or raise an error

-
-
-

Inherited members

- -
-
-class Request -(method: str, uri: str, headers: MutableMapping[str, str], body: bytes | None) -
-
-
- -Expand source code - -
@dataclass
-class Request:
-    """An HTTP request"""
-    method: str
-    uri: str
-    headers: MutableMapping[str, str]
-    body: Optional[bytes]
-
-

An HTTP request

-

Instance variables

-
-
var body : bytes | None
-
-
-
-
var headers : MutableMapping[str, str]
-
-
-
-
var method : str
-
-
-
-
var uri : str
-
-
-
-
-
-
-class Response -(status: int, headers: MutableMapping[str, str], body: bytes | None) -
-
-
- -Expand source code - -
@dataclass
-class Response:
-    """An HTTP response"""
-    status: int
-    headers: MutableMapping[str, str]
-    body: Optional[bytes]
-
-

An HTTP response

-

Instance variables

-
-
var body : bytes | None
-
-
-
-
var headers : MutableMapping[str, str]
-
-
-
-
var status : int
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/http/poll_loop.html b/docs/v3/http/poll_loop.html deleted file mode 100644 index ec829bd..0000000 --- a/docs/v3/http/poll_loop.html +++ /dev/null @@ -1,1539 +0,0 @@ - - - - - - -spin_sdk.http.poll_loop API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.http.poll_loop

-
-
-

Defines a custom asyncio event loop backed by wasi:io/poll#poll.

-

This also includes helper classes and functions for working with wasi:http.

-

As of WASI Preview 2, there is not yet a standard for first-class, composable -asynchronous functions and streams. -We expect that little or none of this -boilerplate will be needed once those features arrive in Preview 3.

-
-
-
-
-
-
-

Functions

-
-
-async def register(loop: PollLoop,
pollable: Pollable)
-
-
-
- -Expand source code - -
async def register(loop: PollLoop, pollable: Pollable):
-    waker = loop.create_future()
-    loop.wakers.append((pollable, waker))
-    await waker
-
-
-
-
-async def send(request: OutgoingRequest) ‑> IncomingResponse -
-
-
- -Expand source code - -
async def send(request: OutgoingRequest) -> IncomingResponse:
-    """Send the specified request and wait asynchronously for the response."""
-    
-    future = outgoing_handler.handle(request, None)
-
-    while True:
-        response = future.get()
-        if response is None:
-            await register(cast(PollLoop, asyncio.get_event_loop()), future.subscribe())
-        else:
-            future.__exit__(None, None, None)
-            
-            if isinstance(response, Ok):
-                if isinstance(response.value, Ok):
-                    return response.value.value
-                else:
-                    raise response.value
-            else:
-                raise response
-
-

Send the specified request and wait asynchronously for the response.

-
-
-
-
-

Classes

-
-
-class PollLoop -
-
-
- -Expand source code - -
class PollLoop(asyncio.AbstractEventLoop):
-    """Custom `asyncio` event loop backed by `wasi:io/poll#poll`."""
-    
-    def __init__(self):
-        self.wakers = []
-        self.running = False
-        self.handles = []
-        self.exception = None
-
-    def get_debug(self):
-        return False
-
-    def run_until_complete(self, future):
-        future = asyncio.ensure_future(future, loop=self)
-
-        self.running = True
-        asyncio.events._set_running_loop(self)
-        while self.running and not future.done():
-            handles = self.handles
-            self.handles = []
-            for handle in handles:
-                if not handle._cancelled:
-                    handle._run()
-                
-            if self.wakers:
-                [pollables, wakers] = list(map(list, zip(*self.wakers)))
-                
-                new_wakers = []
-                ready = [False] * len(pollables)
-                for index in poll.poll(pollables):
-                    ready[index] = True
-                
-                for (ready, pollable), waker in zip(zip(ready, pollables), wakers):
-                    if ready:
-                        pollable.__exit__(None, None, None)
-                        waker.set_result(None)
-                    else:
-                        new_wakers.append((pollable, waker))
-
-                self.wakers = new_wakers
-
-            if self.exception is not None:
-                raise self.exception
-            
-        return future.result()
-
-    def is_running(self):
-        return self.running
-
-    def is_closed(self):
-        return not self.running
-
-    def stop(self):
-        self.running = False
-
-    def close(self):
-        self.running = False
-
-    def shutdown_asyncgens(self):
-        pass
-
-    def call_exception_handler(self, context):
-        self.exception = context.get('exception', None)
-
-    def call_soon(self, callback, *args, context=None):
-        handle = asyncio.Handle(callback, args, self, context)
-        self.handles.append(handle)
-        return handle
-
-    def create_task(self, coroutine):
-        return asyncio.Task(coroutine, loop=self)
-
-    def create_future(self):
-        return asyncio.Future(loop=self)
-
-    # The remaining methods should be irrelevant for our purposes and thus unimplemented
-
-    def run_forever(self):
-        raise NotImplementedError
-
-    async def shutdown_default_executor(self):
-        raise NotImplementedError
-
-    def _timer_handle_cancelled(self, handle):
-        raise NotImplementedError
-
-    def call_later(self, delay, callback, *args, context=None):
-        raise NotImplementedError
-
-    def call_at(self, when, callback, *args, context=None):
-        raise NotImplementedError
-
-    def time(self):
-        raise NotImplementedError
-
-    def call_soon_threadsafe(self, callback, *args, context=None):
-        raise NotImplementedError
-
-    def run_in_executor(self, executor, func, *args):
-        raise NotImplementedError
-
-    def set_default_executor(self, executor):
-        raise NotImplementedError
-
-    async def getaddrinfo(self, host, port, *,
-                          family=0, type=0, proto=0, flags=0):
-        raise NotImplementedError
-
-    async def getnameinfo(self, sockaddr, flags=0):
-        raise NotImplementedError
-
-    async def create_connection(
-            self, protocol_factory, host=None, port=None,
-            *, ssl=None, family=0, proto=0,
-            flags=0, sock=None, local_addr=None,
-            server_hostname=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            happy_eyeballs_delay=None, interleave=None):
-        raise NotImplementedError
-
-    async def create_server(
-            self, protocol_factory, host=None, port=None,
-            *, family=socket.AF_UNSPEC,
-            flags=socket.AI_PASSIVE, sock=None, backlog=100,
-            ssl=None, reuse_address=None, reuse_port=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            start_serving=True):
-        raise NotImplementedError
-
-    async def sendfile(self, transport, file, offset=0, count=None,
-                       *, fallback=True):
-        raise NotImplementedError
-
-    async def start_tls(self, transport, protocol, sslcontext, *,
-                        server_side=False,
-                        server_hostname=None,
-                        ssl_handshake_timeout=None,
-                        ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_unix_connection(
-            self, protocol_factory, path=None, *,
-            ssl=None, sock=None,
-            server_hostname=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_unix_server(
-            self, protocol_factory, path=None, *,
-            sock=None, backlog=100, ssl=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None,
-            start_serving=True):
-        raise NotImplementedError
-
-    async def connect_accepted_socket(
-            self, protocol_factory, sock,
-            *, ssl=None,
-            ssl_handshake_timeout=None,
-            ssl_shutdown_timeout=None):
-        raise NotImplementedError
-
-    async def create_datagram_endpoint(self, protocol_factory,
-                                       local_addr=None, remote_addr=None, *,
-                                       family=0, proto=0, flags=0,
-                                       reuse_address=None, reuse_port=None,
-                                       allow_broadcast=None, sock=None):
-        raise NotImplementedError
-
-    async def connect_read_pipe(self, protocol_factory, pipe):
-        raise NotImplementedError
-
-    async def connect_write_pipe(self, protocol_factory, pipe):
-        raise NotImplementedError
-
-    async def subprocess_shell(self, protocol_factory, cmd, *,
-                               stdin=subprocess.PIPE,
-                               stdout=subprocess.PIPE,
-                               stderr=subprocess.PIPE,
-                               **kwargs):
-        raise NotImplementedError
-
-    async def subprocess_exec(self, protocol_factory, *args,
-                              stdin=subprocess.PIPE,
-                              stdout=subprocess.PIPE,
-                              stderr=subprocess.PIPE,
-                              **kwargs):
-        raise NotImplementedError
-
-    def add_reader(self, fd, callback, *args):
-        raise NotImplementedError
-
-    def remove_reader(self, fd):
-        raise NotImplementedError
-
-    def add_writer(self, fd, callback, *args):
-        raise NotImplementedError
-
-    def remove_writer(self, fd):
-        raise NotImplementedError
-
-    async def sock_recv(self, sock, nbytes):
-        raise NotImplementedError
-
-    async def sock_recv_into(self, sock, buf):
-        raise NotImplementedError
-
-    async def sock_recvfrom(self, sock, bufsize):
-        raise NotImplementedError
-
-    async def sock_recvfrom_into(self, sock, buf, nbytes=0):
-        raise NotImplementedError
-
-    async def sock_sendall(self, sock, data):
-        raise NotImplementedError
-
-    async def sock_sendto(self, sock, data, address):
-        raise NotImplementedError
-
-    async def sock_connect(self, sock, address):
-        raise NotImplementedError
-
-    async def sock_accept(self, sock):
-        raise NotImplementedError
-
-    async def sock_sendfile(self, sock, file, offset=0, count=None,
-                            *, fallback=None):
-        raise NotImplementedError
-
-    def add_signal_handler(self, sig, callback, *args):
-        raise NotImplementedError
-
-    def remove_signal_handler(self, sig):
-        raise NotImplementedError
-
-    def set_task_factory(self, factory):
-        raise NotImplementedError
-
-    def get_task_factory(self):
-        raise NotImplementedError
-
-    def get_exception_handler(self):
-        raise NotImplementedError
-
-    def set_exception_handler(self, handler):
-        raise NotImplementedError
-
-    def default_exception_handler(self, context):
-        raise NotImplementedError
-
-    def set_debug(self, enabled):
-        raise NotImplementedError
-
-

Custom asyncio event loop backed by wasi:io/poll#poll.

-

Ancestors

-
    -
  • asyncio.events.AbstractEventLoop
  • -
-

Methods

-
-
-def add_reader(self, fd, callback, *args) -
-
-
- -Expand source code - -
def add_reader(self, fd, callback, *args):
-    raise NotImplementedError
-
-
-
-
-def add_signal_handler(self, sig, callback, *args) -
-
-
- -Expand source code - -
def add_signal_handler(self, sig, callback, *args):
-    raise NotImplementedError
-
-
-
-
-def add_writer(self, fd, callback, *args) -
-
-
- -Expand source code - -
def add_writer(self, fd, callback, *args):
-    raise NotImplementedError
-
-
-
-
-def call_at(self, when, callback, *args, context=None) -
-
-
- -Expand source code - -
def call_at(self, when, callback, *args, context=None):
-    raise NotImplementedError
-
-
-
-
-def call_exception_handler(self, context) -
-
-
- -Expand source code - -
def call_exception_handler(self, context):
-    self.exception = context.get('exception', None)
-
-
-
-
-def call_later(self, delay, callback, *args, context=None) -
-
-
- -Expand source code - -
def call_later(self, delay, callback, *args, context=None):
-    raise NotImplementedError
-
-
-
-
-def call_soon(self, callback, *args, context=None) -
-
-
- -Expand source code - -
def call_soon(self, callback, *args, context=None):
-    handle = asyncio.Handle(callback, args, self, context)
-    self.handles.append(handle)
-    return handle
-
-
-
-
-def call_soon_threadsafe(self, callback, *args, context=None) -
-
-
- -Expand source code - -
def call_soon_threadsafe(self, callback, *args, context=None):
-    raise NotImplementedError
-
-
-
-
-def close(self) -
-
-
- -Expand source code - -
def close(self):
-    self.running = False
-
-

Close the loop.

-

The loop should not be running.

-

This is idempotent and irreversible.

-

No other methods should be called after this one.

-
-
-async def connect_accepted_socket(self,
protocol_factory,
sock,
*,
ssl=None,
ssl_handshake_timeout=None,
ssl_shutdown_timeout=None)
-
-
-
- -Expand source code - -
async def connect_accepted_socket(
-        self, protocol_factory, sock,
-        *, ssl=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None):
-    raise NotImplementedError
-
-

Handle an accepted connection.

-

This is used by servers that accept connections outside of -asyncio, but use asyncio to handle connections.

-

This method is a coroutine. -When completed, the coroutine -returns a (transport, protocol) pair.

-
-
-async def connect_read_pipe(self, protocol_factory, pipe) -
-
-
- -Expand source code - -
async def connect_read_pipe(self, protocol_factory, pipe):
-    raise NotImplementedError
-
-

Register read pipe in event loop. Set the pipe to non-blocking mode.

-

protocol_factory should instantiate object with Protocol interface. -pipe is a file-like object. -Return pair (transport, protocol), where transport supports the -ReadTransport interface.

-
-
-async def connect_write_pipe(self, protocol_factory, pipe) -
-
-
- -Expand source code - -
async def connect_write_pipe(self, protocol_factory, pipe):
-    raise NotImplementedError
-
-

Register write pipe in event loop.

-

protocol_factory should instantiate object with BaseProtocol interface. -Pipe is file-like object already switched to nonblocking. -Return pair (transport, protocol), where transport support -WriteTransport interface.

-
-
-async def create_connection(self,
protocol_factory,
host=None,
port=None,
*,
ssl=None,
family=0,
proto=0,
flags=0,
sock=None,
local_addr=None,
server_hostname=None,
ssl_handshake_timeout=None,
ssl_shutdown_timeout=None,
happy_eyeballs_delay=None,
interleave=None)
-
-
-
- -Expand source code - -
async def create_connection(
-        self, protocol_factory, host=None, port=None,
-        *, ssl=None, family=0, proto=0,
-        flags=0, sock=None, local_addr=None,
-        server_hostname=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None,
-        happy_eyeballs_delay=None, interleave=None):
-    raise NotImplementedError
-
-
-
-
-async def create_datagram_endpoint(self,
protocol_factory,
local_addr=None,
remote_addr=None,
*,
family=0,
proto=0,
flags=0,
reuse_address=None,
reuse_port=None,
allow_broadcast=None,
sock=None)
-
-
-
- -Expand source code - -
async def create_datagram_endpoint(self, protocol_factory,
-                                   local_addr=None, remote_addr=None, *,
-                                   family=0, proto=0, flags=0,
-                                   reuse_address=None, reuse_port=None,
-                                   allow_broadcast=None, sock=None):
-    raise NotImplementedError
-
-

A coroutine which creates a datagram endpoint.

-

This method will try to establish the endpoint in the background. -When successful, the coroutine returns a (transport, protocol) pair.

-

protocol_factory must be a callable returning a protocol instance.

-

socket family AF_INET, socket.AF_INET6 or socket.AF_UNIX depending on -host (or family if specified), socket type SOCK_DGRAM.

-

reuse_address tells the kernel to reuse a local socket in -TIME_WAIT state, without waiting for its natural timeout to -expire. If not specified it will automatically be set to True on -UNIX.

-

reuse_port tells the kernel to allow this endpoint to be bound to -the same port as other existing endpoints are bound to, so long as -they all set this flag when being created. This option is not -supported on Windows and some UNIX's. If the -:py:data:~socket.SO_REUSEPORT constant is not defined then this -capability is unsupported.

-

allow_broadcast tells the kernel to allow this endpoint to send -messages to the broadcast address.

-

sock can optionally be specified in order to use a preexisting -socket object.

-
-
-def create_future(self) -
-
-
- -Expand source code - -
def create_future(self):
-    return asyncio.Future(loop=self)
-
-
-
-
-async def create_server(self,
protocol_factory,
host=None,
port=None,
*,
family=0,
flags=1,
sock=None,
backlog=100,
ssl=None,
reuse_address=None,
reuse_port=None,
ssl_handshake_timeout=None,
ssl_shutdown_timeout=None,
start_serving=True)
-
-
-
- -Expand source code - -
async def create_server(
-        self, protocol_factory, host=None, port=None,
-        *, family=socket.AF_UNSPEC,
-        flags=socket.AI_PASSIVE, sock=None, backlog=100,
-        ssl=None, reuse_address=None, reuse_port=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None,
-        start_serving=True):
-    raise NotImplementedError
-
-

A coroutine which creates a TCP server bound to host and port.

-

The return value is a Server object which can be used to stop -the service.

-

If host is an empty string or None all interfaces are assumed -and a list of multiple sockets will be returned (most likely -one for IPv4 and another one for IPv6). The host parameter can also be -a sequence (e.g. list) of hosts to bind to.

-

family can be set to either AF_INET or AF_INET6 to force the -socket to use IPv4 or IPv6. If not set it will be determined -from host (defaults to AF_UNSPEC).

-

flags is a bitmask for getaddrinfo().

-

sock can optionally be specified in order to use a preexisting -socket object.

-

backlog is the maximum number of queued connections passed to -listen() (defaults to 100).

-

ssl can be set to an SSLContext to enable SSL over the -accepted connections.

-

reuse_address tells the kernel to reuse a local socket in -TIME_WAIT state, without waiting for its natural timeout to -expire. If not specified will automatically be set to True on -UNIX.

-

reuse_port tells the kernel to allow this endpoint to be bound to -the same port as other existing endpoints are bound to, so long as -they all set this flag when being created. This option is not -supported on Windows.

-

ssl_handshake_timeout is the time in seconds that an SSL server -will wait for completion of the SSL handshake before aborting the -connection. Default is 60s.

-

ssl_shutdown_timeout is the time in seconds that an SSL server -will wait for completion of the SSL shutdown procedure -before aborting the connection. Default is 30s.

-

start_serving set to True (default) causes the created server -to start accepting connections immediately. -When set to False, -the user should await Server.start_serving() or Server.serve_forever() -to make the server to start accepting connections.

-
-
-def create_task(self, coroutine) -
-
-
- -Expand source code - -
def create_task(self, coroutine):
-    return asyncio.Task(coroutine, loop=self)
-
-
-
-
-async def create_unix_connection(self,
protocol_factory,
path=None,
*,
ssl=None,
sock=None,
server_hostname=None,
ssl_handshake_timeout=None,
ssl_shutdown_timeout=None)
-
-
-
- -Expand source code - -
async def create_unix_connection(
-        self, protocol_factory, path=None, *,
-        ssl=None, sock=None,
-        server_hostname=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None):
-    raise NotImplementedError
-
-
-
-
-async def create_unix_server(self,
protocol_factory,
path=None,
*,
sock=None,
backlog=100,
ssl=None,
ssl_handshake_timeout=None,
ssl_shutdown_timeout=None,
start_serving=True)
-
-
-
- -Expand source code - -
async def create_unix_server(
-        self, protocol_factory, path=None, *,
-        sock=None, backlog=100, ssl=None,
-        ssl_handshake_timeout=None,
-        ssl_shutdown_timeout=None,
-        start_serving=True):
-    raise NotImplementedError
-
-

A coroutine which creates a UNIX Domain Socket server.

-

The return value is a Server object, which can be used to stop -the service.

-

path is a str, representing a file system path to bind the -server socket to.

-

sock can optionally be specified in order to use a preexisting -socket object.

-

backlog is the maximum number of queued connections passed to -listen() (defaults to 100).

-

ssl can be set to an SSLContext to enable SSL over the -accepted connections.

-

ssl_handshake_timeout is the time in seconds that an SSL server -will wait for the SSL handshake to complete (defaults to 60s).

-

ssl_shutdown_timeout is the time in seconds that an SSL server -will wait for the SSL shutdown to finish (defaults to 30s).

-

start_serving set to True (default) causes the created server -to start accepting connections immediately. -When set to False, -the user should await Server.start_serving() or Server.serve_forever() -to make the server to start accepting connections.

-
-
-def default_exception_handler(self, context) -
-
-
- -Expand source code - -
def default_exception_handler(self, context):
-    raise NotImplementedError
-
-
-
-
-def get_debug(self) -
-
-
- -Expand source code - -
def get_debug(self):
-    return False
-
-
-
-
-def get_exception_handler(self) -
-
-
- -Expand source code - -
def get_exception_handler(self):
-    raise NotImplementedError
-
-
-
-
-def get_task_factory(self) -
-
-
- -Expand source code - -
def get_task_factory(self):
-    raise NotImplementedError
-
-
-
-
-async def getaddrinfo(self, host, port, *, family=0, type=0, proto=0, flags=0) -
-
-
- -Expand source code - -
async def getaddrinfo(self, host, port, *,
-                      family=0, type=0, proto=0, flags=0):
-    raise NotImplementedError
-
-
-
-
-async def getnameinfo(self, sockaddr, flags=0) -
-
-
- -Expand source code - -
async def getnameinfo(self, sockaddr, flags=0):
-    raise NotImplementedError
-
-
-
-
-def is_closed(self) -
-
-
- -Expand source code - -
def is_closed(self):
-    return not self.running
-
-

Returns True if the event loop was closed.

-
-
-def is_running(self) -
-
-
- -Expand source code - -
def is_running(self):
-    return self.running
-
-

Return whether the event loop is currently running.

-
-
-def remove_reader(self, fd) -
-
-
- -Expand source code - -
def remove_reader(self, fd):
-    raise NotImplementedError
-
-
-
-
-def remove_signal_handler(self, sig) -
-
-
- -Expand source code - -
def remove_signal_handler(self, sig):
-    raise NotImplementedError
-
-
-
-
-def remove_writer(self, fd) -
-
-
- -Expand source code - -
def remove_writer(self, fd):
-    raise NotImplementedError
-
-
-
-
-def run_forever(self) -
-
-
- -Expand source code - -
def run_forever(self):
-    raise NotImplementedError
-
-

Run the event loop until stop() is called.

-
-
-def run_in_executor(self, executor, func, *args) -
-
-
- -Expand source code - -
def run_in_executor(self, executor, func, *args):
-    raise NotImplementedError
-
-
-
-
-def run_until_complete(self, future) -
-
-
- -Expand source code - -
def run_until_complete(self, future):
-    future = asyncio.ensure_future(future, loop=self)
-
-    self.running = True
-    asyncio.events._set_running_loop(self)
-    while self.running and not future.done():
-        handles = self.handles
-        self.handles = []
-        for handle in handles:
-            if not handle._cancelled:
-                handle._run()
-            
-        if self.wakers:
-            [pollables, wakers] = list(map(list, zip(*self.wakers)))
-            
-            new_wakers = []
-            ready = [False] * len(pollables)
-            for index in poll.poll(pollables):
-                ready[index] = True
-            
-            for (ready, pollable), waker in zip(zip(ready, pollables), wakers):
-                if ready:
-                    pollable.__exit__(None, None, None)
-                    waker.set_result(None)
-                else:
-                    new_wakers.append((pollable, waker))
-
-            self.wakers = new_wakers
-
-        if self.exception is not None:
-            raise self.exception
-        
-    return future.result()
-
-

Run the event loop until a Future is done.

-

Return the Future's result, or raise its exception.

-
-
-async def sendfile(self, transport, file, offset=0, count=None, *, fallback=True) -
-
-
- -Expand source code - -
async def sendfile(self, transport, file, offset=0, count=None,
-                   *, fallback=True):
-    raise NotImplementedError
-
-

Send a file through a transport.

-

Return an amount of sent bytes.

-
-
-def set_debug(self, enabled) -
-
-
- -Expand source code - -
def set_debug(self, enabled):
-    raise NotImplementedError
-
-
-
-
-def set_default_executor(self, executor) -
-
-
- -Expand source code - -
def set_default_executor(self, executor):
-    raise NotImplementedError
-
-
-
-
-def set_exception_handler(self, handler) -
-
-
- -Expand source code - -
def set_exception_handler(self, handler):
-    raise NotImplementedError
-
-
-
-
-def set_task_factory(self, factory) -
-
-
- -Expand source code - -
def set_task_factory(self, factory):
-    raise NotImplementedError
-
-
-
-
-def shutdown_asyncgens(self) -
-
-
- -Expand source code - -
def shutdown_asyncgens(self):
-    pass
-
-

Shutdown all active asynchronous generators.

-
-
-async def shutdown_default_executor(self) -
-
-
- -Expand source code - -
async def shutdown_default_executor(self):
-    raise NotImplementedError
-
-

Schedule the shutdown of the default executor.

-
-
-async def sock_accept(self, sock) -
-
-
- -Expand source code - -
async def sock_accept(self, sock):
-    raise NotImplementedError
-
-
-
-
-async def sock_connect(self, sock, address) -
-
-
- -Expand source code - -
async def sock_connect(self, sock, address):
-    raise NotImplementedError
-
-
-
-
-async def sock_recv(self, sock, nbytes) -
-
-
- -Expand source code - -
async def sock_recv(self, sock, nbytes):
-    raise NotImplementedError
-
-
-
-
-async def sock_recv_into(self, sock, buf) -
-
-
- -Expand source code - -
async def sock_recv_into(self, sock, buf):
-    raise NotImplementedError
-
-
-
-
-async def sock_recvfrom(self, sock, bufsize) -
-
-
- -Expand source code - -
async def sock_recvfrom(self, sock, bufsize):
-    raise NotImplementedError
-
-
-
-
-async def sock_recvfrom_into(self, sock, buf, nbytes=0) -
-
-
- -Expand source code - -
async def sock_recvfrom_into(self, sock, buf, nbytes=0):
-    raise NotImplementedError
-
-
-
-
-async def sock_sendall(self, sock, data) -
-
-
- -Expand source code - -
async def sock_sendall(self, sock, data):
-    raise NotImplementedError
-
-
-
-
-async def sock_sendfile(self, sock, file, offset=0, count=None, *, fallback=None) -
-
-
- -Expand source code - -
async def sock_sendfile(self, sock, file, offset=0, count=None,
-                        *, fallback=None):
-    raise NotImplementedError
-
-
-
-
-async def sock_sendto(self, sock, data, address) -
-
-
- -Expand source code - -
async def sock_sendto(self, sock, data, address):
-    raise NotImplementedError
-
-
-
-
-async def start_tls(self,
transport,
protocol,
sslcontext,
*,
server_side=False,
server_hostname=None,
ssl_handshake_timeout=None,
ssl_shutdown_timeout=None)
-
-
-
- -Expand source code - -
async def start_tls(self, transport, protocol, sslcontext, *,
-                    server_side=False,
-                    server_hostname=None,
-                    ssl_handshake_timeout=None,
-                    ssl_shutdown_timeout=None):
-    raise NotImplementedError
-
-

Upgrade a transport to TLS.

-

Return a new transport that protocol should start using -immediately.

-
-
-def stop(self) -
-
-
- -Expand source code - -
def stop(self):
-    self.running = False
-
-

Stop the event loop as soon as reasonable.

-

Exactly how soon that is may depend on the implementation, but -no more I/O callbacks should be scheduled.

-
-
-async def subprocess_exec(self, protocol_factory, *args, stdin=-1, stdout=-1, stderr=-1, **kwargs) -
-
-
- -Expand source code - -
async def subprocess_exec(self, protocol_factory, *args,
-                          stdin=subprocess.PIPE,
-                          stdout=subprocess.PIPE,
-                          stderr=subprocess.PIPE,
-                          **kwargs):
-    raise NotImplementedError
-
-
-
-
-async def subprocess_shell(self, protocol_factory, cmd, *, stdin=-1, stdout=-1, stderr=-1, **kwargs) -
-
-
- -Expand source code - -
async def subprocess_shell(self, protocol_factory, cmd, *,
-                           stdin=subprocess.PIPE,
-                           stdout=subprocess.PIPE,
-                           stderr=subprocess.PIPE,
-                           **kwargs):
-    raise NotImplementedError
-
-
-
-
-def time(self) -
-
-
- -Expand source code - -
def time(self):
-    raise NotImplementedError
-
-
-
-
-
-
-class Sink -(body: OutgoingBody) -
-
-
- -Expand source code - -
class Sink:
-    """Writer abstraction over `wasi-http/types#outgoing-body`."""
-    def __init__(self, body: OutgoingBody):
-        self.body = body
-        self.stream = body.write()
-
-    async def send(self, chunk: bytes):
-        """Write the specified bytes to the sink.
-
-        This may need to yield according to the backpressure requirements of the sink.
-        """
-        offset = 0
-        flushing = False
-        while True:
-            count = self.stream.check_write()
-            if count == 0:
-                await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-            elif offset == len(chunk):
-                if flushing:
-                    return
-                else:
-                    self.stream.flush()
-                    flushing = True
-            else:
-                count = min(count, len(chunk) - offset)
-                self.stream.write(chunk[offset:offset+count])
-                offset += count
-
-    def close(self):
-        """Close the stream, indicating no further data will be written."""
-
-        self.stream.__exit__(None, None, None)
-        self.stream = None
-        OutgoingBody.finish(self.body, None)
-        self.body = None
-
-

Writer abstraction over wasi-http/types#outgoing-body.

-

Methods

-
-
-def close(self) -
-
-
- -Expand source code - -
def close(self):
-    """Close the stream, indicating no further data will be written."""
-
-    self.stream.__exit__(None, None, None)
-    self.stream = None
-    OutgoingBody.finish(self.body, None)
-    self.body = None
-
-

Close the stream, indicating no further data will be written.

-
-
-async def send(self, chunk: bytes) -
-
-
- -Expand source code - -
async def send(self, chunk: bytes):
-    """Write the specified bytes to the sink.
-
-    This may need to yield according to the backpressure requirements of the sink.
-    """
-    offset = 0
-    flushing = False
-    while True:
-        count = self.stream.check_write()
-        if count == 0:
-            await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-        elif offset == len(chunk):
-            if flushing:
-                return
-            else:
-                self.stream.flush()
-                flushing = True
-        else:
-            count = min(count, len(chunk) - offset)
-            self.stream.write(chunk[offset:offset+count])
-            offset += count
-
-

Write the specified bytes to the sink.

-

This may need to yield according to the backpressure requirements of the sink.

-
-
-
-
-class Stream -(body: IncomingBody) -
-
-
- -Expand source code - -
class Stream:
-    """Reader abstraction over `wasi:http/types#incoming-body`."""
-    def __init__(self, body: IncomingBody):
-        self.body: Optional[IncomingBody] = body
-        self.stream: Optional[InputStream] = body.stream()
-
-    async def next(self) -> Optional[bytes]:
-        """Wait for the next chunk of data to arrive on the stream.
-
-        This will return `None` when the end of the stream has been reached.
-        """
-        while True:
-            try:
-                if self.stream is None:
-                    return None
-                else:
-                    buffer = self.stream.read(READ_SIZE)
-                    if len(buffer) == 0:
-                        await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-                    else:
-                        return buffer
-            except Err as e:
-                if isinstance(e.value, StreamError_Closed):
-                    if self.stream is not None:
-                        self.stream.__exit__(None, None, None)
-                        self.stream = None
-                    if self.body is not None:
-                        IncomingBody.finish(self.body)
-                        self.body = None
-                else:
-                    raise e
-
-

Reader abstraction over wasi:http/types#incoming-body.

-

Methods

-
-
-async def next(self) ‑> bytes | None -
-
-
- -Expand source code - -
async def next(self) -> Optional[bytes]:
-    """Wait for the next chunk of data to arrive on the stream.
-
-    This will return `None` when the end of the stream has been reached.
-    """
-    while True:
-        try:
-            if self.stream is None:
-                return None
-            else:
-                buffer = self.stream.read(READ_SIZE)
-                if len(buffer) == 0:
-                    await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
-                else:
-                    return buffer
-        except Err as e:
-            if isinstance(e.value, StreamError_Closed):
-                if self.stream is not None:
-                    self.stream.__exit__(None, None, None)
-                    self.stream = None
-                if self.body is not None:
-                    IncomingBody.finish(self.body)
-                    self.body = None
-            else:
-                raise e
-
-

Wait for the next chunk of data to arrive on the stream.

-

This will return None when the end of the stream has been reached.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/index.html b/docs/v3/index.html deleted file mode 100644 index 14ef5dd..0000000 --- a/docs/v3/index.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - -spin_sdk API documentation - - - - - - - - - - - -
-
-
-

Package spin_sdk

-
-
-

Spin Python SDK

-

This is an SDK for creating Spin apps using Python.

-

Note that this SDK supercedes an earlier, experimental version, the documentation for which may be found here.

-
-
-

Sub-modules

-
-
spin_sdk.http
-
-

Module with helpers for wasi http

-
-
spin_sdk.key_value
-
-

Module for accessing Spin key-value stores

-
-
spin_sdk.llm
-
-

Module for working with the Spin large language model API

-
-
spin_sdk.mqtt
-
-

Module for utilizing Spin Outbound MQTT

-
-
spin_sdk.mysql
-
-

Module for interacting with a MySQL database

-
-
spin_sdk.postgres
-
-

Module for interacting with a Postgres database

-
-
spin_sdk.redis
-
-

Module for interacting with a Redis database

-
-
spin_sdk.sqlite
-
-

Module for interacting with an SQLite database

-
-
spin_sdk.variables
-
-

Module for interacting with Spin Variables

-
-
spin_sdk.wit
-
-

Module with the bindings generated from the wit by componentize-py

-
-
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/key_value.html b/docs/v3/key_value.html deleted file mode 100644 index 5332031..0000000 --- a/docs/v3/key_value.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - -spin_sdk.key_value API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.key_value

-
-
-

Module for accessing Spin key-value stores

-
-
-
-
-
-
-

Functions

-
-
-def open(name: str) ‑> Store -
-
-
- -Expand source code - -
def open(name: str) -> Store:
-    """
-    Open the store with the specified name.
-  
-    If `name` is "default", the default store is opened.  Otherwise, `name` must
-    refer to a store defined and configured in a runtime configuration file
-    supplied with the application.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_NoSuchStore)` will be raised if the `name` is not recognized.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_AccessDenied)` will be raised if the requesting component does not have
-    access to the specified store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_StoreTableFull)` will be raised if too many stores have been opened simultaneously.
-    Closing one or more previously opened stores might address this using the `__exit__` method.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_Other(str))` will be raised if some implementation specific error has occured (e.g I/O)
-    """
-    return Store.open(name)
-
-

Open the store with the specified name.

-

If name is "default", the default store is opened. -Otherwise, name must -refer to a store defined and configured in a runtime configuration file -supplied with the application.

-

A Err(Error_NoSuchStore) will be raised if the name is not recognized.

-

A Err(Error_AccessDenied) will be raised if the requesting component does not have -access to the specified store.

-

A Err(Error_StoreTableFull) will be raised if too many stores have been opened simultaneously. -Closing one or more previously opened stores might address this using the __exit__ method.

-

A Err(Error_Other(str)) will be raised if some implementation specific error has occured (e.g I/O)

-
-
-def open_default() ‑> Store -
-
-
- -Expand source code - -
def open_default() -> Store:
-    """
-    Open the default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_AccessDenied)`
-    will be raised if the requesting component does not have access to the
-    default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_StoreTableFull)` will be raised if too many stores have been opened simultaneously.
-    Closing one or more previously opened stores might address this using the `__exit__` method.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_Other(str))` will be raised if some implementation specific error has occured (e.g I/O)
-    """
-    return Store.open("default")
-
-

Open the default store.

-

A Err(Error_AccessDenied) -will be raised if the requesting component does not have access to the -default store.

-

A Err(Error_StoreTableFull) will be raised if too many stores have been opened simultaneously. -Closing one or more previously opened stores might address this using the __exit__ method.

-

A Err(Error_Other(str)) will be raised if some implementation specific error has occured (e.g I/O)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/llm.html b/docs/v3/llm.html deleted file mode 100644 index a24a1c8..0000000 --- a/docs/v3/llm.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - -spin_sdk.llm API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.llm

-
-
-

Module for working with the Spin large language model API

-
-
-
-
-
-
-

Functions

-
-
-def generate_embeddings(model: str, text: Sequence[str]) ‑> EmbeddingsResult -
-
-
- -Expand source code - -
def generate_embeddings(model: str, text: Sequence[str]) -> spin_llm.EmbeddingsResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_ModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_RuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_InvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    return spin_llm.generate_embeddings(model, text)
-
-

A Err(Error_ModelNotSupported) will be raised if the component does not have access to the specified model.

-

A Err(Error_RuntimeError(str)) will be raised if there are any runtime errors.

-

A Err(Error_InvalidInput(str)) will be raised if an invalid input is provided.

-
-
-def infer(model: str, prompt: str) ‑> InferencingResult -
-
-
- -Expand source code - -
def infer(model: str, prompt: str) -> spin_llm.InferencingResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_ModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_RuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_InvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    options = InferencingParams
-    return spin_llm.infer(model, prompt, options)
-
-

A Err(Error_ModelNotSupported) will be raised if the component does not have access to the specified model.

-

A Err(Error_RuntimeError(str)) will be raised if there are any runtime errors.

-

A Err(Error_InvalidInput(str)) will be raised if an invalid input is provided.

-
-
-def infer_with_options(model: str,
prompt: str,
options: InferencingParams | None) ‑> InferencingResult
-
-
-
- -Expand source code - -
def infer_with_options(model: str, prompt: str, options: Optional[InferencingParams]) -> spin_llm.InferencingResult:
-    """
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_ModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_RuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_InvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    options = options or InferencingParams
-    return spin_llm.infer(model, prompt, options)
-
-

A Err(Error_ModelNotSupported) will be raised if the component does not have access to the specified model.

-

A Err(Error_RuntimeError(str)) will be raised if there are any runtime errors.

-

A Err(Error_InvalidInput(str)) will be raised if an invalid input is provided.

-
-
-
-
-

Classes

-
-
-class InferencingParams -(max_tokens: int = 100,
repeat_penalty: float = 1.1,
repeat_penalty_last_n_token_count: int = 64,
temperature: float = 0.8,
top_k: int = 40,
top_p: float = 0.9)
-
-
-
- -Expand source code - -
@dataclass
-class InferencingParams:
-    max_tokens: int = 100
-    repeat_penalty: float = 1.1
-    repeat_penalty_last_n_token_count: int = 64
-    temperature: float = 0.8
-    top_k: int = 40
-    top_p: float = 0.9
-
-

InferencingParams(max_tokens: int = 100, repeat_penalty: float = 1.1, repeat_penalty_last_n_token_count: int = 64, temperature: float = 0.8, top_k: int = 40, top_p: float = 0.9)

-

Instance variables

-
-
var max_tokens : int
-
-
-
-
var repeat_penalty : float
-
-
-
-
var repeat_penalty_last_n_token_count : int
-
-
-
-
var temperature : float
-
-
-
-
var top_k : int
-
-
-
-
var top_p : float
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/mqtt.html b/docs/v3/mqtt.html deleted file mode 100644 index abfde73..0000000 --- a/docs/v3/mqtt.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -spin_sdk.mqtt API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.mqtt

-
-
-

Module for utilizing Spin Outbound MQTT

-
-
-
-
-
-
-

Functions

-
-
-def open(address: str, username: str, password: str, keep_alive_interval_in_secs: int) ‑> Connection -
-
-
- -Expand source code - -
def open(address: str, username: str, password: str, keep_alive_interval_in_secs: int) -> Connection:
-    """
-    Open a connection to the Mqtt instance at `address`.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.mqtt.Error_InvalidAddress)` will be raised if the connection string is invalid.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.mqtt.Error_TooManyConnections)` will be raised if there are too many open connections. Closing one or more previously opened connection using the `__exit__` method might help.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.mqtt.Error_ConnectionFailed)` will be raised if the connection failed.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.mqtt.Error_Other(str))` when some other error occurs.
-    """
-    return Connection.open(address, username, password, keep_alive_interval_in_secs)
-
-

Open a connection to the Mqtt instance at address.

-

A Err(Error_InvalidAddress) will be raised if the connection string is invalid.

-

A Err(Error_TooManyConnections) will be raised if there are too many open connections. Closing one or more previously opened connection using the __exit__ method might help.

-

A Err(Error_ConnectionFailed) will be raised if the connection failed.

-

A Err(Error_Other(str)) when some other error occurs.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/mysql.html b/docs/v3/mysql.html deleted file mode 100644 index 5a364c8..0000000 --- a/docs/v3/mysql.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - -spin_sdk.mysql API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.mysql

-
-
-

Module for interacting with a MySQL database

-
-
-
-
-
-
-

Functions

-
-
-def open(connection_string: str) ‑> Connection -
-
-
- -Expand source code - -
def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a MySQL database.
-    
-    The connection_string is the MySQL URL connection string.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error_ConnectionFailed(str))` when a connection fails.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error_Other(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-

Open a connection with a MySQL database.

-

The connection_string is the MySQL URL connection string.

-

A Err(Error_ConnectionFailed(str)) when a connection fails.

-

A Err(Error_Other(str)) when some other error occurs.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/postgres.html b/docs/v3/postgres.html deleted file mode 100644 index 5fa8908..0000000 --- a/docs/v3/postgres.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - -spin_sdk.postgres API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.postgres

-
-
-

Module for interacting with a Postgres database

-
-
-
-
-
-
-

Functions

-
-
-def open(connection_string: str) ‑> Connection -
-
-
- -Expand source code - -
def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a Postgres database.
-    
-    The connection_string is the Postgres URL connection string.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error_ConnectionFailed(str))` when a connection fails.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error_Other(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-

Open a connection with a Postgres database.

-

The connection_string is the Postgres URL connection string.

-

A Err(Error_ConnectionFailed(str)) when a connection fails.

-

A Err(Error_Other(str)) when some other error occurs.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/redis.html b/docs/v3/redis.html deleted file mode 100644 index 17ec305..0000000 --- a/docs/v3/redis.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -spin_sdk.redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.redis

-
-
-

Module for interacting with a Redis database

-
-
-
-
-
-
-

Functions

-
-
-def open(connection_string: str) ‑> Connection -
-
-
- -Expand source code - -
def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a Redis database.
-    
-    The connection_string is the Redis URL to connect to.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error_InvalidAddress)` will be raised if the connection string is invalid.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error_TooManyConnections)` will be raised if there are too many open connections. Closing one or more previously opened connection using the `__exit__` method might help.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error_Other(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-

Open a connection with a Redis database.

-

The connection_string is the Redis URL to connect to.

-

A Err(Error_InvalidAddress) will be raised if the connection string is invalid.

-

A Err(Error_TooManyConnections) will be raised if there are too many open connections. Closing one or more previously opened connection using the __exit__ method might help.

-

A Err(Error_Other(str)) when some other error occurs.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/sqlite.html b/docs/v3/sqlite.html deleted file mode 100644 index 1c5680e..0000000 --- a/docs/v3/sqlite.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - -spin_sdk.sqlite API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.sqlite

-
-
-

Module for interacting with an SQLite database

-
-
-
-
-
-
-

Functions

-
-
-def open(name: str) ‑> Connection -
-
-
- -Expand source code - -
def open(name: str) -> Connection:
-    """Open a connection to a named database instance.
-
-    If `database` is "default", the default instance is opened.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error_AccessDenied)` will be raised when the component does not have access to the specified database.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error_NoSuchDatabase)` will be raised when the host does not recognize the database name requested.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error_InvalidConnection)` will be raised when the provided connection string is not valid.
-    
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error_Io(str))` will be raised when implementation-specific error occured (e.g. I/O)
-    """
-    return Connection.open(name)
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

A Err(Error_AccessDenied) will be raised when the component does not have access to the specified database.

-

A Err(Error_NoSuchDatabase) will be raised when the host does not recognize the database name requested.

-

A Err(Error_InvalidConnection) will be raised when the provided connection string is not valid.

-

A Err(Error_Io(str)) will be raised when implementation-specific error occured (e.g. I/O)

-
-
-def open_default() ‑> Connection -
-
-
- -Expand source code - -
def open_default() -> Connection:
-    """Open the default store.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error_AccessDenied)` will be raised when the component does not have access to the default database.
-
-    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error_Io(str))` will be raised when implementation-specific error occured (e.g. I/O)
-    """
-    return Connection.open("default")
-
-

Open the default store.

-

A Err(Error_AccessDenied) will be raised when the component does not have access to the default database.

-

A Err(Error_Io(str)) will be raised when implementation-specific error occured (e.g. I/O)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/variables.html b/docs/v3/variables.html deleted file mode 100644 index f06e1a9..0000000 --- a/docs/v3/variables.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - -spin_sdk.variables API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.variables

-
-
-

Module for interacting with Spin Variables

-
-
-
-
-
-
-

Functions

-
-
-def get(key: str) -
-
-
- -Expand source code - -
def get(key: str):
-    """
-    Gets the value of the given key
-    """
-    return variables.get(key)
-
-

Gets the value of the given key

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/exports/inbound_redis.html b/docs/v3/wit/exports/inbound_redis.html deleted file mode 100644 index 6d9e59f..0000000 --- a/docs/v3/wit/exports/inbound_redis.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - -spin_sdk.wit.exports.inbound_redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports.inbound_redis

-
-
-
-
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/exports/incoming_handler.html b/docs/v3/wit/exports/incoming_handler.html deleted file mode 100644 index 5ad87f0..0000000 --- a/docs/v3/wit/exports/incoming_handler.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - -spin_sdk.wit.exports.incoming_handler API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports.incoming_handler

-
-
-

This interface defines a handler of incoming HTTP Requests. It should -be exported by components which can respond to HTTP Requests.

-
-
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/exports/index.html b/docs/v3/wit/exports/index.html deleted file mode 100644 index 2ac6fde..0000000 --- a/docs/v3/wit/exports/index.html +++ /dev/null @@ -1,278 +0,0 @@ - - - - - - -spin_sdk.wit.exports API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports

-
-
-
-
-

Sub-modules

-
-
spin_sdk.wit.exports.inbound_redis
-
-
-
-
spin_sdk.wit.exports.incoming_handler
-
-

This interface defines a handler of incoming HTTP Requests. It should -be exported by components which can respond to HTTP Requests.

-
-
-
-
-
-
-
-
-

Classes

-
-
-class InboundRedis -(*args, **kwargs) -
-
-
- -Expand source code - -
class InboundRedis(Protocol):
-
-    @abstractmethod
-    def handle_message(self, message: bytes) -> None:
-        """
-        The entrypoint for a Redis handler.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)`
-        """
-        raise NotImplementedError
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto[T](Protocol):
-    def meth(self) -> T:
-        ...
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-

Methods

-
-
-def handle_message(self, message: bytes) ‑> None -
-
-
- -Expand source code - -
@abstractmethod
-def handle_message(self, message: bytes) -> None:
-    """
-    The entrypoint for a Redis handler.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)`
-    """
-    raise NotImplementedError
-
-

The entrypoint for a Redis handler.

-

Raises: Err(Error)

-
-
-
-
-class IncomingHandler -(*args, **kwargs) -
-
-
- -Expand source code - -
class IncomingHandler(Protocol):
-
-    @abstractmethod
-    def handle(self, request: types.IncomingRequest, response_out: types.ResponseOutparam) -> None:
-        """
-        This function is invoked with an incoming HTTP Request, and a resource
-        `response-outparam` which provides the capability to reply with an HTTP
-        Response. The response is sent by calling the `response-outparam.set`
-        method, which allows execution to continue after the response has been
-        sent. This enables both streaming to the response body, and performing other
-        work.
-        
-        The implementor of this function must write a response to the
-        `response-outparam` before returning, or else the caller will respond
-        with an error on its behalf.
-        """
-        raise NotImplementedError
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto[T](Protocol):
-    def meth(self) -> T:
-        ...
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-

Subclasses

- -

Methods

-
-
-def handle(self,
request: IncomingRequest,
response_out: ResponseOutparam) ‑> None
-
-
-
- -Expand source code - -
@abstractmethod
-def handle(self, request: types.IncomingRequest, response_out: types.ResponseOutparam) -> None:
-    """
-    This function is invoked with an incoming HTTP Request, and a resource
-    `response-outparam` which provides the capability to reply with an HTTP
-    Response. The response is sent by calling the `response-outparam.set`
-    method, which allows execution to continue after the response has been
-    sent. This enables both streaming to the response body, and performing other
-    work.
-    
-    The implementor of this function must write a response to the
-    `response-outparam` before returning, or else the caller will respond
-    with an error on its behalf.
-    """
-    raise NotImplementedError
-
-

This function is invoked with an incoming HTTP Request, and a resource -response-outparam which provides the capability to reply with an HTTP -Response. The response is sent by calling the response-outparam.set -method, which allows execution to continue after the response has been -sent. This enables both streaming to the response body, and performing other -work.

-

The implementor of this function must write a response to the -response-outparam before returning, or else the caller will respond -with an error on its behalf.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/atomics.html b/docs/v3/wit/imports/atomics.html deleted file mode 100644 index 78c8245..0000000 --- a/docs/v3/wit/imports/atomics.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - -spin_sdk.wit.imports.atomics API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.atomics

-
-
-

A keyvalue interface that provides atomic operations.

-

Atomic operations are single, indivisible operations. When a fault causes an atomic operation to -fail, it will appear to the invoker of the atomic operation that the action either completed -successfully or did nothing at all.

-

Please note that this interface is bare functions that take a reference to a bucket. This is to -get around the current lack of a way to "extend" a resource with additional methods inside of -wit. Future version of the interface will instead extend these methods on the base bucket -resource.

-
-
-
-
-

Global variables

-
-
var CasError
-
-

The error returned by a CAS operation

-
-
-
-
-

Functions

-
-
-def increment(bucket: Bucket,
key: str,
delta: int) ‑> int
-
-
-
- -Expand source code - -
def increment(bucket: wasi_keyvalue_store.Bucket, key: str, delta: int) -> int:
-    """
-    Atomically increment the value associated with the key in the store by the given delta. It
-    returns the new value.
-    
-    If the key does not exist in the store, it creates a new key-value pair with the value set
-    to the given delta.
-    
-    If any other error occurs, it returns an `Err(error)`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-    """
-    raise NotImplementedError
-
-

Atomically increment the value associated with the key in the store by the given delta. It -returns the new value.

-

If the key does not exist in the store, it creates a new key-value pair with the value set -to the given delta.

-

If any other error occurs, it returns an Err(error).

-

Raises: Err(Error)

-
-
-def swap(cas: Cas,
value: bytes) ‑> None
-
-
-
- -Expand source code - -
def swap(cas: Cas, value: bytes) -> None:
-    """
-    Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if
-    the CAS operation failed.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.atomics.CasError)`
-    """
-    raise NotImplementedError
-
-

Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if -the CAS operation failed.

-

Raises: Err(CasError)

-
-
-
-
-

Classes

-
-
-class Cas -
-
-
- -Expand source code - -
class Cas:
-    """
-    A handle to a CAS (compare-and-swap) operation.
-    """
-    
-    @classmethod
-    def new(cls, bucket: wasi_keyvalue_store.Bucket, key: str) -> Self:
-        """
-        Construct a new CAS operation. Implementors can map the underlying functionality
-        (transactions, versions, etc) as desired.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-        """
-        raise NotImplementedError
-    def current(self) -> Optional[bytes]:
-        """
-        Get the current value of the key (if it exists). This allows for avoiding reads if all
-        that is needed to ensure the atomicity of the operation
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A handle to a CAS (compare-and-swap) operation.

-

Static methods

-
-
-def new(bucket: Bucket,
key: str) ‑> Self
-
-
-

Construct a new CAS operation. Implementors can map the underlying functionality -(transactions, versions, etc) as desired.

-

Raises: Err(Error)

-
-
-

Methods

-
-
-def current(self) ‑> bytes | None -
-
-
- -Expand source code - -
def current(self) -> Optional[bytes]:
-    """
-    Get the current value of the key (if it exists). This allows for avoiding reads if all
-    that is needed to ensure the atomicity of the operation
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-    """
-    raise NotImplementedError
-
-

Get the current value of the key (if it exists). This allows for avoiding reads if all -that is needed to ensure the atomicity of the operation

-

Raises: Err(Error)

-
-
-
-
-class CasError_CasFailed -(value: Cas) -
-
-
- -Expand source code - -
@dataclass
-class CasError_CasFailed:
-    value: Cas
-
-

CasError_CasFailed(value: spin_sdk.wit.imports.atomics.Cas)

-

Instance variables

-
-
var valueCas
-
-
-
-
-
-
-class CasError_StoreError -(value: Error_NoSuchStore | Error_AccessDenied | Error_Other) -
-
-
- -Expand source code - -
@dataclass
-class CasError_StoreError:
-    value: wasi_keyvalue_store.Error
-
-

CasError_StoreError(value: Union[spin_sdk.wit.imports.wasi_keyvalue_store.Error_NoSuchStore, spin_sdk.wit.imports.wasi_keyvalue_store.Error_AccessDenied, spin_sdk.wit.imports.wasi_keyvalue_store.Error_Other])

-

Instance variables

-
-
var valueError_NoSuchStore | Error_AccessDenied | Error_Other
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/batch.html b/docs/v3/wit/imports/batch.html deleted file mode 100644 index 498a266..0000000 --- a/docs/v3/wit/imports/batch.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - -spin_sdk.wit.imports.batch API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.batch

-
-
-

A keyvalue interface that provides batch operations.

-

A batch operation is an operation that operates on multiple keys at once.

-

Batch operations are useful for reducing network round-trip time. For example, if you want to -get the values associated with 100 keys, you can either do 100 get operations or you can do 1 -batch get operation. The batch operation is faster because it only needs to make 1 network call -instead of 100.

-

A batch operation does not guarantee atomicity, meaning that if the batch operation fails, some -of the keys may have been modified and some may not.

-

This interface does has the same consistency guarantees as the store interface, meaning that -you should be able to "read your writes."

-

Please note that this interface is bare functions that take a reference to a bucket. This is to -get around the current lack of a way to "extend" a resource with additional methods inside of -wit. Future version of the interface will instead extend these methods on the base bucket -resource.

-
-
-
-
-
-
-

Functions

-
-
-def delete_many(bucket: Bucket,
keys: List[str]) ‑> None
-
-
-
- -Expand source code - -
def delete_many(bucket: wasi_keyvalue_store.Bucket, keys: List[str]) -> None:
-    """
-    Delete the key-value pairs associated with the keys in the store.
-    
-    Note that the key-value pairs are not guaranteed to be deleted in the order they are
-    provided.
-    
-    If any of the keys do not exist in the store, it skips the key.
-    
-    If any other error occurs, it returns an `Err(error)`. When an error occurs, it does not
-    rollback the key-value pairs that were already deleted. Thus, this batch operation does not
-    guarantee atomicity, implying that some key-value pairs could be deleted while others might
-    fail.
-    
-    Other concurrent operations may also be able to see the partial results.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-    """
-    raise NotImplementedError
-
-

Delete the key-value pairs associated with the keys in the store.

-

Note that the key-value pairs are not guaranteed to be deleted in the order they are -provided.

-

If any of the keys do not exist in the store, it skips the key.

-

If any other error occurs, it returns an Err(error). When an error occurs, it does not -rollback the key-value pairs that were already deleted. Thus, this batch operation does not -guarantee atomicity, implying that some key-value pairs could be deleted while others might -fail.

-

Other concurrent operations may also be able to see the partial results.

-

Raises: Err(Error)

-
-
-def get_many(bucket: Bucket,
keys: List[str]) ‑> List[Tuple[str, bytes | None]]
-
-
-
- -Expand source code - -
def get_many(bucket: wasi_keyvalue_store.Bucket, keys: List[str]) -> List[Tuple[str, Optional[bytes]]]:
-    """
-    Get the key-value pairs associated with the keys in the store. It returns a list of
-    key-value pairs.
-    
-    If any of the keys do not exist in the store, it returns a `none` value for that pair in the
-    list.
-    
-    MAY show an out-of-date value if there are concurrent writes to the store.
-    
-    If any other error occurs, it returns an `Err(error)`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-    """
-    raise NotImplementedError
-
-

Get the key-value pairs associated with the keys in the store. It returns a list of -key-value pairs.

-

If any of the keys do not exist in the store, it returns a none value for that pair in the -list.

-

MAY show an out-of-date value if there are concurrent writes to the store.

-

If any other error occurs, it returns an Err(error).

-

Raises: Err(Error)

-
-
-def set_many(bucket: Bucket,
key_values: List[Tuple[str, bytes]]) ‑> None
-
-
-
- -Expand source code - -
def set_many(bucket: wasi_keyvalue_store.Bucket, key_values: List[Tuple[str, bytes]]) -> None:
-    """
-    Set the values associated with the keys in the store. If the key already exists in the
-    store, it overwrites the value.
-    
-    Note that the key-value pairs are not guaranteed to be set in the order they are provided.
-    
-    If any of the keys do not exist in the store, it creates a new key-value pair.
-    
-    If any other error occurs, it returns an `Err(error)`. When an error occurs, it does not
-    rollback the key-value pairs that were already set. Thus, this batch operation does not
-    guarantee atomicity, implying that some key-value pairs could be set while others might
-    fail.
-    
-    Other concurrent operations may also be able to see the partial results.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-    """
-    raise NotImplementedError
-
-

Set the values associated with the keys in the store. If the key already exists in the -store, it overwrites the value.

-

Note that the key-value pairs are not guaranteed to be set in the order they are provided.

-

If any of the keys do not exist in the store, it creates a new key-value pair.

-

If any other error occurs, it returns an Err(error). When an error occurs, it does not -rollback the key-value pairs that were already set. Thus, this batch operation does not -guarantee atomicity, implying that some key-value pairs could be set while others might -fail.

-

Other concurrent operations may also be able to see the partial results.

-

Raises: Err(Error)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/error.html b/docs/v3/wit/imports/error.html deleted file mode 100644 index a401958..0000000 --- a/docs/v3/wit/imports/error.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - -spin_sdk.wit.imports.error API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.error

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Error -
-
-
- -Expand source code - -
class Error:
-    """
-    A resource which represents some error information.
-    
-    The only method provided by this resource is `to-debug-string`,
-    which provides some human-readable information about the error.
-    
-    In the `wasi:io` package, this resource is returned through the
-    `wasi:io/streams/stream-error` type.
-    
-    To provide more specific error information, other interfaces may
-    provide functions to further "downcast" this error into more specific
-    error information. For example, `error`s returned in streams derived
-    from filesystem types to be described using the filesystem's own
-    error-code type, using the function
-    `wasi:filesystem/types/filesystem-error-code`, which takes a parameter
-    `borrow<error>` and returns
-    `option<wasi:filesystem/types/error-code>`.
-    
-    The set of functions which can "downcast" an `error` into a more
-    concrete type is open.
-    """
-    
-    def to_debug_string(self) -> str:
-        """
-        Returns a string that is suitable to assist humans in debugging
-        this error.
-        
-        WARNING: The returned string should not be consumed mechanically!
-        It may change across platforms, hosts, or other implementation
-        details. Parsing this string is a major platform-compatibility
-        hazard.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A resource which represents some error information.

-

The only method provided by this resource is to-debug-string, -which provides some human-readable information about the error.

-

In the wasi:io package, this resource is returned through the -wasi:io/streams/stream-error type.

-

To provide more specific error information, other interfaces may -provide functions to further "downcast" this error into more specific -error information. For example, errors returned in streams derived -from filesystem types to be described using the filesystem's own -error-code type, using the function -wasi:filesystem/types/filesystem-error-code, which takes a parameter -borrow<error> and returns -option<wasi:filesystem/types/error-code>.

-

The set of functions which can "downcast" an error into a more -concrete type is open.

-

Methods

-
-
-def to_debug_string(self) ‑> str -
-
-
- -Expand source code - -
def to_debug_string(self) -> str:
-    """
-    Returns a string that is suitable to assist humans in debugging
-    this error.
-    
-    WARNING: The returned string should not be consumed mechanically!
-    It may change across platforms, hosts, or other implementation
-    details. Parsing this string is a major platform-compatibility
-    hazard.
-    """
-    raise NotImplementedError
-
-

Returns a string that is suitable to assist humans in debugging -this error.

-

WARNING: The returned string should not be consumed mechanically! -It may change across platforms, hosts, or other implementation -details. Parsing this string is a major platform-compatibility -hazard.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/index.html b/docs/v3/wit/imports/index.html deleted file mode 100644 index 0031320..0000000 --- a/docs/v3/wit/imports/index.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - -spin_sdk.wit.imports API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports

-
-
-
-
-

Sub-modules

-
-
spin_sdk.wit.imports.atomics
-
-

A keyvalue interface that provides atomic operations …

-
-
spin_sdk.wit.imports.batch
-
-

A keyvalue interface that provides batch operations …

-
-
spin_sdk.wit.imports.error
-
-
-
-
spin_sdk.wit.imports.key_value
-
-
-
-
spin_sdk.wit.imports.llm
-
-

A WASI interface dedicated to performing inferencing for Large Language Models.

-
-
spin_sdk.wit.imports.monotonic_clock
-
-

WASI Monotonic Clock is a clock API intended to let users measure elapsed -time …

-
-
spin_sdk.wit.imports.mqtt
-
-
-
-
spin_sdk.wit.imports.mysql
-
-
-
-
spin_sdk.wit.imports.outgoing_handler
-
-

This interface defines a handler of outgoing HTTP Requests. It should be -imported by components which wish to make HTTP Requests.

-
-
spin_sdk.wit.imports.poll
-
-

A poll API intended to let users wait for I/O events on multiple handles -at once.

-
-
spin_sdk.wit.imports.postgres
-
-
-
-
spin_sdk.wit.imports.rdbms_types
-
-
-
-
spin_sdk.wit.imports.redis
-
-
-
-
spin_sdk.wit.imports.redis_types
-
-
-
-
spin_sdk.wit.imports.spin_postgres_postgres
-
-
-
-
spin_sdk.wit.imports.spin_postgres_postgres_4_0_0
-
-
-
-
spin_sdk.wit.imports.spin_sqlite_sqlite
-
-
-
-
spin_sdk.wit.imports.sqlite
-
-
-
-
spin_sdk.wit.imports.streams
-
-

WASI I/O is an I/O abstraction API which is currently focused on providing -stream types …

-
-
spin_sdk.wit.imports.types
-
-

This interface defines all of the types and methods for implementing -HTTP Requests and Responses, both incoming and outgoing, as well as -their …

-
-
spin_sdk.wit.imports.variables
-
-
-
-
spin_sdk.wit.imports.wasi_config_store
-
-
-
-
spin_sdk.wit.imports.wasi_keyvalue_store
-
-

A keyvalue interface that provides eventually consistent key-value operations …

-
-
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/key_value.html b/docs/v3/wit/imports/key_value.html deleted file mode 100644 index 6e641df..0000000 --- a/docs/v3/wit/imports/key_value.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - -spin_sdk.wit.imports.key_value API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.key_value

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
-
-
-
-
-

Classes

-
-
-class Error_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class Error_AccessDenied:
-    pass
-
-

Error_AccessDenied()

-
-
-class Error_NoSuchStore -
-
-
- -Expand source code - -
@dataclass
-class Error_NoSuchStore:
-    pass
-
-

Error_NoSuchStore()

-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_StoreTableFull -
-
-
- -Expand source code - -
@dataclass
-class Error_StoreTableFull:
-    pass
-
-

Error_StoreTableFull()

-
-
-class Store -
-
-
- -Expand source code - -
class Store:
-    """
-    An open key-value store
-    """
-    
-    @classmethod
-    def open(cls, label: str) -> Self:
-        """
-        Open the store with the specified label.
-        
-        `label` must refer to a store allowed in the spin.toml manifest.
-        
-        `error::no-such-store` will be raised if the `label` is not recognized.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value associated with the specified `key`
-        
-        Returns `ok(none)` if the key does not exist.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set the `value` associated with the specified `key` overwriting any existing value.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-    def delete(self, key: str) -> None:
-        """
-        Delete the tuple with the specified `key`
-        
-        No error is raised if a tuple did not previously exist for `key`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-    def exists(self, key: str) -> bool:
-        """
-        Return whether a tuple exists for the specified `key`
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-    def get_keys(self) -> List[str]:
-        """
-        Return a list of all the keys
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

An open key-value store

-

Static methods

-
-
-def open(label: str) ‑> Self -
-
-

Open the store with the specified label.

-

label must refer to a store allowed in the spin.toml manifest.

-

error::no-such-store will be raised if the label is not recognized.

-

Raises: Err(Error)

-
-
-

Methods

-
-
-def delete(self, key: str) ‑> None -
-
-
- -Expand source code - -
def delete(self, key: str) -> None:
-    """
-    Delete the tuple with the specified `key`
-    
-    No error is raised if a tuple did not previously exist for `key`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-

Delete the tuple with the specified key

-

No error is raised if a tuple did not previously exist for key.

-

Raises: Err(Error)

-
-
-def exists(self, key: str) ‑> bool -
-
-
- -Expand source code - -
def exists(self, key: str) -> bool:
-    """
-    Return whether a tuple exists for the specified `key`
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-

Return whether a tuple exists for the specified key

-

Raises: Err(Error)

-
-
-def get(self, key: str) ‑> bytes | None -
-
-
- -Expand source code - -
def get(self, key: str) -> Optional[bytes]:
-    """
-    Get the value associated with the specified `key`
-    
-    Returns `ok(none)` if the key does not exist.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-

Get the value associated with the specified key

-

Returns ok(none) if the key does not exist.

-

Raises: Err(Error)

-
-
-def get_keys(self) ‑> List[str] -
-
-
- -Expand source code - -
def get_keys(self) -> List[str]:
-    """
-    Return a list of all the keys
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-

Return a list of all the keys

-

Raises: Err(Error)

-
-
-def set(self, key: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
def set(self, key: str, value: bytes) -> None:
-    """
-    Set the `value` associated with the specified `key` overwriting any existing value.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-

Set the value associated with the specified key overwriting any existing value.

-

Raises: Err(Error)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/llm.html b/docs/v3/wit/imports/llm.html deleted file mode 100644 index d63d90b..0000000 --- a/docs/v3/wit/imports/llm.html +++ /dev/null @@ -1,409 +0,0 @@ - - - - - - -spin_sdk.wit.imports.llm API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.llm

-
-
-

A WASI interface dedicated to performing inferencing for Large Language Models.

-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
-
-
-

Functions

-
-
-def generate_embeddings(model: str, text: List[str]) ‑> EmbeddingsResult -
-
-
- -Expand source code - -
def generate_embeddings(model: str, text: List[str]) -> EmbeddingsResult:
-    """
-    Generate embeddings for the supplied list of text
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error)`
-    """
-    raise NotImplementedError
-
-

Generate embeddings for the supplied list of text

-

Raises: Err(Error)

-
-
-def infer(model: str,
prompt: str,
params: InferencingParams | None) ‑> InferencingResult
-
-
-
- -Expand source code - -
def infer(model: str, prompt: str, params: Optional[InferencingParams]) -> InferencingResult:
-    """
-    Perform inferencing using the provided model and prompt with the given optional params
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error)`
-    """
-    raise NotImplementedError
-
-

Perform inferencing using the provided model and prompt with the given optional params

-

Raises: Err(Error)

-
-
-
-
-

Classes

-
-
-class EmbeddingsResult -(embeddings: List[List[float]],
usage: EmbeddingsUsage)
-
-
-
- -Expand source code - -
@dataclass
-class EmbeddingsResult:
-    """
-    Result of generating embeddings
-    """
-    embeddings: List[List[float]]
-    usage: EmbeddingsUsage
-
-

Result of generating embeddings

-

Instance variables

-
-
var embeddings : List[List[float]]
-
-
-
-
var usageEmbeddingsUsage
-
-
-
-
-
-
-class EmbeddingsUsage -(prompt_token_count: int) -
-
-
- -Expand source code - -
@dataclass
-class EmbeddingsUsage:
-    """
-    Usage related to an embeddings generation request
-    """
-    prompt_token_count: int
-
-

Usage related to an embeddings generation request

-

Instance variables

-
-
var prompt_token_count : int
-
-
-
-
-
-
-class Error_InvalidInput -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidInput:
-    value: str
-
-

Error_InvalidInput(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ModelNotSupported -
-
-
- -Expand source code - -
@dataclass
-class Error_ModelNotSupported:
-    pass
-
-

Error_ModelNotSupported()

-
-
-class Error_RuntimeError -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_RuntimeError:
-    value: str
-
-

Error_RuntimeError(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class InferencingParams -(max_tokens: int,
repeat_penalty: float,
repeat_penalty_last_n_token_count: int,
temperature: float,
top_k: int,
top_p: float)
-
-
-
- -Expand source code - -
@dataclass
-class InferencingParams:
-    """
-    Inference request parameters
-    """
-    max_tokens: int
-    repeat_penalty: float
-    repeat_penalty_last_n_token_count: int
-    temperature: float
-    top_k: int
-    top_p: float
-
-

Inference request parameters

-

Instance variables

-
-
var max_tokens : int
-
-
-
-
var repeat_penalty : float
-
-
-
-
var repeat_penalty_last_n_token_count : int
-
-
-
-
var temperature : float
-
-
-
-
var top_k : int
-
-
-
-
var top_p : float
-
-
-
-
-
-
-class InferencingResult -(text: str,
usage: InferencingUsage)
-
-
-
- -Expand source code - -
@dataclass
-class InferencingResult:
-    """
-    An inferencing result
-    """
-    text: str
-    usage: InferencingUsage
-
-

An inferencing result

-

Instance variables

-
-
var text : str
-
-
-
-
var usageInferencingUsage
-
-
-
-
-
-
-class InferencingUsage -(prompt_token_count: int, generated_token_count: int) -
-
-
- -Expand source code - -
@dataclass
-class InferencingUsage:
-    """
-    Usage information related to the inferencing result
-    """
-    prompt_token_count: int
-    generated_token_count: int
-
-

Usage information related to the inferencing result

-

Instance variables

-
-
var generated_token_count : int
-
-
-
-
var prompt_token_count : int
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/monotonic_clock.html b/docs/v3/wit/imports/monotonic_clock.html deleted file mode 100644 index 0f9a49a..0000000 --- a/docs/v3/wit/imports/monotonic_clock.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - -spin_sdk.wit.imports.monotonic_clock API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.monotonic_clock

-
-
-

WASI Monotonic Clock is a clock API intended to let users measure elapsed -time.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-

A monotonic clock is a clock which has an unspecified initial value, and -successive reads of the clock will produce non-decreasing values.

-

It is intended for measuring elapsed time.

-
-
-
-
-
-
-

Functions

-
-
-def now() ‑> int -
-
-
- -Expand source code - -
def now() -> int:
-    """
-    Read the current value of the clock.
-    
-    The clock is monotonic, therefore calling this function repeatedly will
-    produce a sequence of non-decreasing values.
-    """
-    raise NotImplementedError
-
-

Read the current value of the clock.

-

The clock is monotonic, therefore calling this function repeatedly will -produce a sequence of non-decreasing values.

-
-
-def resolution() ‑> int -
-
-
- -Expand source code - -
def resolution() -> int:
-    """
-    Query the resolution of the clock. Returns the duration of time
-    corresponding to a clock tick.
-    """
-    raise NotImplementedError
-
-

Query the resolution of the clock. Returns the duration of time -corresponding to a clock tick.

-
-
-def subscribe_duration(when: int) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe_duration(when: int) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the given duration has
-    elapsed, starting at the time at which this function was called.
-    occured.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the given duration has -elapsed, starting at the time at which this function was called. -occured.

-
-
-def subscribe_instant(when: int) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe_instant(when: int) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the specified instant
-    occured.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the specified instant -occured.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/mqtt.html b/docs/v3/wit/imports/mqtt.html deleted file mode 100644 index a9539ee..0000000 --- a/docs/v3/wit/imports/mqtt.html +++ /dev/null @@ -1,297 +0,0 @@ - - - - - - -spin_sdk.wit.imports.mqtt API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.mqtt

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

Errors related to interacting with Mqtt

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    
-    @classmethod
-    def open(cls, address: str, username: str, password: str, keep_alive_interval_in_secs: int) -> Self:
-        """
-        Open a connection to the Mqtt instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.mqtt.Error)`
-        """
-        raise NotImplementedError
-    def publish(self, topic: str, payload: bytes, qos: Qos) -> None:
-        """
-        Publish an Mqtt message to the specified `topic`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.mqtt.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Static methods

-
-
-def open(address: str, username: str, password: str, keep_alive_interval_in_secs: int) ‑> Self -
-
-

Open a connection to the Mqtt instance at address.

-

Raises: Err(Error)

-
-
-

Methods

-
-
-def publish(self,
topic: str,
payload: bytes,
qos: Qos) ‑> None
-
-
-
- -Expand source code - -
def publish(self, topic: str, payload: bytes, qos: Qos) -> None:
-    """
-    Publish an Mqtt message to the specified `topic`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.mqtt.Error)`
-    """
-    raise NotImplementedError
-
-

Publish an Mqtt message to the specified topic.

-

Raises: Err(Error)

-
-
-
-
-class Error_ConnectionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ConnectionFailed:
-    value: str
-
-

Error_ConnectionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_InvalidAddress -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidAddress:
-    pass
-
-

Error_InvalidAddress()

-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_TooManyConnections -
-
-
- -Expand source code - -
@dataclass
-class Error_TooManyConnections:
-    pass
-
-

Error_TooManyConnections()

-
-
-class Qos -(*args, **kwds) -
-
-
- -Expand source code - -
class Qos(Enum):
-    """
-    QoS for publishing Mqtt messages
-    """
-    AT_MOST_ONCE = 0
-    AT_LEAST_ONCE = 1
-    EXACTLY_ONCE = 2
-
-

QoS for publishing Mqtt messages

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var AT_LEAST_ONCE
-
-
-
-
var AT_MOST_ONCE
-
-
-
-
var EXACTLY_ONCE
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/mysql.html b/docs/v3/wit/imports/mysql.html deleted file mode 100644 index 8958faa..0000000 --- a/docs/v3/wit/imports/mysql.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - -spin_sdk.wit.imports.mysql API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.mysql

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    """
-    A connection to a MySQL database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the MySQL instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-    def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-        """
-        query the database: select
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> None:
-        """
-        execute command to the database: insert, update, delete
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A connection to a MySQL database.

-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the MySQL instance at address.

-

Raises: Err(Error)

-
-
-

Methods

-
-
-def execute(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> None
-
-
-
- -Expand source code - -
def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> None:
-    """
-    execute command to the database: insert, update, delete
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-

execute command to the database: insert, update, delete

-

Raises: Err(Error)

-
-
-def query(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> RowSet
-
-
-
- -Expand source code - -
def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-    """
-    query the database: select
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-

query the database: select

-

Raises: Err(Error)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/outgoing_handler.html b/docs/v3/wit/imports/outgoing_handler.html deleted file mode 100644 index 189a86b..0000000 --- a/docs/v3/wit/imports/outgoing_handler.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - -spin_sdk.wit.imports.outgoing_handler API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.outgoing_handler

-
-
-

This interface defines a handler of outgoing HTTP Requests. It should be -imported by components which wish to make HTTP Requests.

-
-
-
-
-
-
-

Functions

-
-
-def handle(request: OutgoingRequest,
options: RequestOptions | None) ‑> FutureIncomingResponse
-
-
-
- -Expand source code - -
def handle(request: types.OutgoingRequest, options: Optional[types.RequestOptions]) -> types.FutureIncomingResponse:
-    """
-    This function is invoked with an outgoing HTTP Request, and it returns
-    a resource `future-incoming-response` which represents an HTTP Response
-    which may arrive in the future.
-    
-    The `options` argument accepts optional parameters for the HTTP
-    protocol's transport layer.
-    
-    This function may return an error if the `outgoing-request` is invalid
-    or not allowed to be made. Otherwise, protocol errors are reported
-    through the `future-incoming-response`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

This function is invoked with an outgoing HTTP Request, and it returns -a resource future-incoming-response which represents an HTTP Response -which may arrive in the future.

-

The options argument accepts optional parameters for the HTTP -protocol's transport layer.

-

This function may return an error if the outgoing-request is invalid -or not allowed to be made. Otherwise, protocol errors are reported -through the future-incoming-response.

-

Raises: Err(ErrorCode)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/poll.html b/docs/v3/wit/imports/poll.html deleted file mode 100644 index 4894d11..0000000 --- a/docs/v3/wit/imports/poll.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - -spin_sdk.wit.imports.poll API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.poll

-
-
-

A poll API intended to let users wait for I/O events on multiple handles -at once.

-
-
-
-
-
-
-

Functions

-
-
-def poll(in_: List[Pollable]) ‑> List[int] -
-
-
- -Expand source code - -
def poll(in_: List[Pollable]) -> List[int]:
-    """
-    Poll for completion on a set of pollables.
-    
-    This function takes a list of pollables, which identify I/O sources of
-    interest, and waits until one or more of the events is ready for I/O.
-    
-    The result `list<u32>` contains one or more indices of handles in the
-    argument list that is ready for I/O.
-    
-    If the list contains more elements than can be indexed with a `u32`
-    value, this function traps.
-    
-    A timeout can be implemented by adding a pollable from the
-    wasi-clocks API to the list.
-    
-    This function does not return a `result`; polling in itself does not
-    do any I/O so it doesn't fail. If any of the I/O sources identified by
-    the pollables has an error, it is indicated by marking the source as
-    being reaedy for I/O.
-    """
-    raise NotImplementedError
-
-

Poll for completion on a set of pollables.

-

This function takes a list of pollables, which identify I/O sources of -interest, and waits until one or more of the events is ready for I/O.

-

The result list<u32> contains one or more indices of handles in the -argument list that is ready for I/O.

-

If the list contains more elements than can be indexed with a u32 -value, this function traps.

-

A timeout can be implemented by adding a pollable from the -wasi-clocks API to the list.

-

This function does not return a result; polling in itself does not -do any I/O so it doesn't fail. If any of the I/O sources identified by -the pollables has an error, it is indicated by marking the source as -being reaedy for I/O.

-
-
-
-
-

Classes

-
-
-class Pollable -
-
-
- -Expand source code - -
class Pollable:
-    """
-    `pollable` represents a single I/O event which may be ready, or not.
-    """
-    
-    def ready(self) -> bool:
-        """
-        Return the readiness of a pollable. This function never blocks.
-        
-        Returns `true` when the pollable is ready, and `false` otherwise.
-        """
-        raise NotImplementedError
-    def block(self) -> None:
-        """
-        `block` returns immediately if the pollable is ready, and otherwise
-        blocks until ready.
-        
-        This function is equivalent to calling `poll.poll` on a list
-        containing only this pollable.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

pollable represents a single I/O event which may be ready, or not.

-

Methods

-
-
-def block(self) ‑> None -
-
-
- -Expand source code - -
def block(self) -> None:
-    """
-    `block` returns immediately if the pollable is ready, and otherwise
-    blocks until ready.
-    
-    This function is equivalent to calling `poll.poll` on a list
-    containing only this pollable.
-    """
-    raise NotImplementedError
-
-

block returns immediately if the pollable is ready, and otherwise -blocks until ready.

-

This function is equivalent to calling poll.poll on a list -containing only this pollable.

-
-
-def ready(self) ‑> bool -
-
-
- -Expand source code - -
def ready(self) -> bool:
-    """
-    Return the readiness of a pollable. This function never blocks.
-    
-    Returns `true` when the pollable is ready, and `false` otherwise.
-    """
-    raise NotImplementedError
-
-

Return the readiness of a pollable. This function never blocks.

-

Returns true when the pollable is ready, and false otherwise.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/postgres.html b/docs/v3/wit/imports/postgres.html deleted file mode 100644 index d501164..0000000 --- a/docs/v3/wit/imports/postgres.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - -spin_sdk.wit.imports.postgres API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.postgres

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    """
-    A connection to a postgres database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Postgres instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-    def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-        """
-        Query the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> int:
-        """
-        Execute command to the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A connection to a postgres database.

-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the Postgres instance at address.

-

Raises: Err(Error)

-
-
-

Methods

-
-
-def execute(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> int
-
-
-
- -Expand source code - -
def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> int:
-    """
-    Execute command to the database.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-

Execute command to the database.

-

Raises: Err(Error)

-
-
-def query(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> RowSet
-
-
-
- -Expand source code - -
def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-    """
-    Query the database.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-

Query the database.

-

Raises: Err(Error)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/rdbms_types.html b/docs/v3/wit/imports/rdbms_types.html deleted file mode 100644 index 60eee77..0000000 --- a/docs/v3/wit/imports/rdbms_types.html +++ /dev/null @@ -1,1200 +0,0 @@ - - - - - - -spin_sdk.wit.imports.rdbms_types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.rdbms_types

-
-
-
-
-
-
-

Global variables

-
-
var DbValue
-
-

Database values

-
-
var Error
-
-

Errors related to interacting with a database.

-
-
var ParameterValue
-
-

Values used in parameterized queries

-
-
-
-
-
-
-

Classes

-
-
-class Column -(name: str,
data_type: DbDataType)
-
-
-
- -Expand source code - -
@dataclass
-class Column:
-    """
-    A database column
-    """
-    name: str
-    data_type: DbDataType
-
-

A database column

-

Instance variables

-
-
var data_typeDbDataType
-
-
-
-
var name : str
-
-
-
-
-
-
-class DbDataType -(*args, **kwds) -
-
-
- -Expand source code - -
class DbDataType(Enum):
-    """
-    Data types for a database column
-    """
-    BOOLEAN = 0
-    INT8 = 1
-    INT16 = 2
-    INT32 = 3
-    INT64 = 4
-    UINT8 = 5
-    UINT16 = 6
-    UINT32 = 7
-    UINT64 = 8
-    FLOATING32 = 9
-    FLOATING64 = 10
-    STR = 11
-    BINARY = 12
-    OTHER = 13
-
-

Data types for a database column

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var BINARY
-
-
-
-
var BOOLEAN
-
-
-
-
var FLOATING32
-
-
-
-
var FLOATING64
-
-
-
-
var INT16
-
-
-
-
var INT32
-
-
-
-
var INT64
-
-
-
-
var INT8
-
-
-
-
var OTHER
-
-
-
-
var STR
-
-
-
-
var UINT16
-
-
-
-
var UINT32
-
-
-
-
var UINT64
-
-
-
-
var UINT8
-
-
-
-
-
-
-class DbValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Binary:
-    value: bytes
-
-

DbValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Boolean:
-    value: bool
-
-

DbValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class DbValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class DbValue_DbNull:
-    pass
-
-

DbValue_DbNull()

-
-
-class DbValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating32:
-    value: float
-
-

DbValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating64:
-    value: float
-
-

DbValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int16:
-    value: int
-
-

DbValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int32:
-    value: int
-
-

DbValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int64:
-    value: int
-
-

DbValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int8:
-    value: int
-
-

DbValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Str:
-    value: str
-
-

DbValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class DbValue_Uint16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uint16:
-    value: int
-
-

DbValue_Uint16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Uint32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uint32:
-    value: int
-
-

DbValue_Uint32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Uint64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uint64:
-    value: int
-
-

DbValue_Uint64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Uint8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uint8:
-    value: int
-
-

DbValue_Uint8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Unsupported -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Unsupported:
-    pass
-
-

DbValue_Unsupported()

-
-
-class Error_BadParameter -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_BadParameter:
-    value: str
-
-

Error_BadParameter(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ConnectionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ConnectionFailed:
-    value: str
-
-

Error_ConnectionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_QueryFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_QueryFailed:
-    value: str
-
-

Error_QueryFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ValueConversionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ValueConversionFailed:
-    value: str
-
-

Error_ValueConversionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Binary:
-    value: bytes
-
-

ParameterValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class ParameterValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Boolean:
-    value: bool
-
-

ParameterValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class ParameterValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_DbNull:
-    pass
-
-

ParameterValue_DbNull()

-
-
-class ParameterValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating32:
-    value: float
-
-

ParameterValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating64:
-    value: float
-
-

ParameterValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int16:
-    value: int
-
-

ParameterValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int32:
-    value: int
-
-

ParameterValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int64:
-    value: int
-
-

ParameterValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int8:
-    value: int
-
-

ParameterValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Str:
-    value: str
-
-

ParameterValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Uint16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uint16:
-    value: int
-
-

ParameterValue_Uint16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Uint32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uint32:
-    value: int
-
-

ParameterValue_Uint32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Uint64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uint64:
-    value: int
-
-

ParameterValue_Uint64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Uint8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uint8:
-    value: int
-
-

ParameterValue_Uint8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RowSet -(columns: List[Column],
rows: List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Uint8 | DbValue_Uint16 | DbValue_Uint32 | DbValue_Uint64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_DbNull | DbValue_Unsupported]])
-
-
-
- -Expand source code - -
@dataclass
-class RowSet:
-    """
-    A set of database rows
-    """
-    columns: List[Column]
-    rows: List[List[DbValue]]
-
-

A set of database rows

-

Instance variables

-
-
var columns : List[Column]
-
-
-
-
var rows : List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Uint8 | DbValue_Uint16 | DbValue_Uint32 | DbValue_Uint64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_DbNull | DbValue_Unsupported]]
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/redis.html b/docs/v3/wit/imports/redis.html deleted file mode 100644 index 737a241..0000000 --- a/docs/v3/wit/imports/redis.html +++ /dev/null @@ -1,644 +0,0 @@ - - - - - - -spin_sdk.wit.imports.redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.redis

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

Errors related to interacting with Redis

-
-
var RedisParameter
-
-

A parameter type for the general-purpose execute function.

-
-
var RedisResult
-
-

A return type for the general-purpose execute function.

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Redis instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-    def publish(self, channel: str, payload: bytes) -> None:
-        """
-        Publish a Redis message to the specified channel.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value of a key.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set key to value.
-        
-        If key already holds a value, it is overwritten.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-    def incr(self, key: str) -> int:
-        """
-        Increments the number stored at key by one.
-        
-        If the key does not exist, it is set to 0 before performing the operation.
-        An `error::type-error` is returned if the key contains a value of the wrong type
-        or contains a string that can not be represented as integer.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-    def del_(self, keys: List[str]) -> int:
-        """
-        Removes the specified keys.
-        
-        A key is ignored if it does not exist. Returns the number of keys deleted.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-    def sadd(self, key: str, values: List[str]) -> int:
-        """
-        Add the specified `values` to the set named `key`, returning the number of newly-added values.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-    def smembers(self, key: str) -> List[str]:
-        """
-        Retrieve the contents of the set named `key`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-    def srem(self, key: str, values: List[str]) -> int:
-        """
-        Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
-        """
-        Execute an arbitrary Redis command and receive the result.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the Redis instance at address.

-

Raises: Err(Error)

-
-
-

Methods

-
-
-def del_(self, keys: List[str]) ‑> int -
-
-
- -Expand source code - -
def del_(self, keys: List[str]) -> int:
-    """
-    Removes the specified keys.
-    
-    A key is ignored if it does not exist. Returns the number of keys deleted.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-

Removes the specified keys.

-

A key is ignored if it does not exist. Returns the number of keys deleted.

-

Raises: Err(Error)

-
-
-def execute(self,
command: str,
arguments: List[RedisParameter_Int64 | RedisParameter_Binary]) ‑> List[RedisResult_Nil | RedisResult_Status | RedisResult_Int64 | RedisResult_Binary]
-
-
-
- -Expand source code - -
def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
-    """
-    Execute an arbitrary Redis command and receive the result.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-

Execute an arbitrary Redis command and receive the result.

-

Raises: Err(Error)

-
-
-def get(self, key: str) ‑> bytes | None -
-
-
- -Expand source code - -
def get(self, key: str) -> Optional[bytes]:
-    """
-    Get the value of a key.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-

Get the value of a key.

-

Raises: Err(Error)

-
-
-def incr(self, key: str) ‑> int -
-
-
- -Expand source code - -
def incr(self, key: str) -> int:
-    """
-    Increments the number stored at key by one.
-    
-    If the key does not exist, it is set to 0 before performing the operation.
-    An `error::type-error` is returned if the key contains a value of the wrong type
-    or contains a string that can not be represented as integer.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-

Increments the number stored at key by one.

-

If the key does not exist, it is set to 0 before performing the operation. -An error::type-error is returned if the key contains a value of the wrong type -or contains a string that can not be represented as integer.

-

Raises: Err(Error)

-
-
-def publish(self, channel: str, payload: bytes) ‑> None -
-
-
- -Expand source code - -
def publish(self, channel: str, payload: bytes) -> None:
-    """
-    Publish a Redis message to the specified channel.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-

Publish a Redis message to the specified channel.

-

Raises: Err(Error)

-
-
-def sadd(self, key: str, values: List[str]) ‑> int -
-
-
- -Expand source code - -
def sadd(self, key: str, values: List[str]) -> int:
-    """
-    Add the specified `values` to the set named `key`, returning the number of newly-added values.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-

Add the specified values to the set named key, returning the number of newly-added values.

-

Raises: Err(Error)

-
-
-def set(self, key: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
def set(self, key: str, value: bytes) -> None:
-    """
-    Set key to value.
-    
-    If key already holds a value, it is overwritten.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-

Set key to value.

-

If key already holds a value, it is overwritten.

-

Raises: Err(Error)

-
-
-def smembers(self, key: str) ‑> List[str] -
-
-
- -Expand source code - -
def smembers(self, key: str) -> List[str]:
-    """
-    Retrieve the contents of the set named `key`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-

Retrieve the contents of the set named key.

-

Raises: Err(Error)

-
-
-def srem(self, key: str, values: List[str]) ‑> int -
-
-
- -Expand source code - -
def srem(self, key: str, values: List[str]) -> int:
-    """
-    Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-

Remove the specified values from the set named key, returning the number of newly-removed values.

-

Raises: Err(Error)

-
-
-
-
-class Error_InvalidAddress -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidAddress:
-    pass
-
-

Error_InvalidAddress()

-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_TooManyConnections -
-
-
- -Expand source code - -
@dataclass
-class Error_TooManyConnections:
-    pass
-
-

Error_TooManyConnections()

-
-
-class Error_TypeError -
-
-
- -Expand source code - -
@dataclass
-class Error_TypeError:
-    pass
-
-

Error_TypeError()

-
-
-class RedisParameter_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class RedisParameter_Binary:
-    value: bytes
-
-

RedisParameter_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisParameter_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class RedisParameter_Int64:
-    value: int
-
-

RedisParameter_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResult_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Binary:
-    value: bytes
-
-

RedisResult_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisResult_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Int64:
-    value: int
-
-

RedisResult_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResult_Nil -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Nil:
-    pass
-
-

RedisResult_Nil()

-
-
-class RedisResult_Status -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Status:
-    value: str
-
-

RedisResult_Status(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/redis_types.html b/docs/v3/wit/imports/redis_types.html deleted file mode 100644 index 53ab98a..0000000 --- a/docs/v3/wit/imports/redis_types.html +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - -spin_sdk.wit.imports.redis_types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.redis_types

-
-
-
-
-
-
-

Global variables

-
-
var RedisParameter
-
-

A parameter type for the general-purpose execute function.

-
-
var RedisResult
-
-

A return type for the general-purpose execute function.

-
-
-
-
-
-
-

Classes

-
-
-class Error -(*args, **kwds) -
-
-
- -Expand source code - -
class Error(Enum):
-    """
-    General purpose error.
-    """
-    SUCCESS = 0
-    ERROR = 1
-
-

General purpose error.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var ERROR
-
-
-
-
var SUCCESS
-
-
-
-
-
-
-class RedisParameter_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class RedisParameter_Binary:
-    value: bytes
-
-

RedisParameter_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisParameter_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class RedisParameter_Int64:
-    value: int
-
-

RedisParameter_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResult_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Binary:
-    value: bytes
-
-

RedisResult_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisResult_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Int64:
-    value: int
-
-

RedisResult_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResult_Nil -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Nil:
-    pass
-
-

RedisResult_Nil()

-
-
-class RedisResult_Status -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Status:
-    value: str
-
-

RedisResult_Status(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/spin_postgres_postgres.html b/docs/v3/wit/imports/spin_postgres_postgres.html deleted file mode 100644 index 01bed49..0000000 --- a/docs/v3/wit/imports/spin_postgres_postgres.html +++ /dev/null @@ -1,1306 +0,0 @@ - - - - - - -spin_sdk.wit.imports.spin_postgres_postgres API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.spin_postgres_postgres

-
-
-
-
-
-
-

Global variables

-
-
var DbValue
-
-

Database values

-
-
var Error
-
-

Errors related to interacting with a database.

-
-
var ParameterValue
-
-

Values used in parameterized queries

-
-
-
-
-
-
-

Classes

-
-
-class Column -(name: str,
data_type: DbDataType)
-
-
-
- -Expand source code - -
@dataclass
-class Column:
-    """
-    A database column
-    """
-    name: str
-    data_type: DbDataType
-
-

A database column

-

Instance variables

-
-
var data_typeDbDataType
-
-
-
-
var name : str
-
-
-
-
-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    """
-    A connection to a postgres database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Postgres instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres.Error)`
-        """
-        raise NotImplementedError
-    def query(self, statement: str, params: List[ParameterValue]) -> RowSet:
-        """
-        Query the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, statement: str, params: List[ParameterValue]) -> int:
-        """
-        Execute command to the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A connection to a postgres database.

-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the Postgres instance at address.

-

Raises: Err(Error)

-
-
-

Methods

-
-
-def execute(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_DbNull]) ‑> int
-
-
-
- -Expand source code - -
def execute(self, statement: str, params: List[ParameterValue]) -> int:
-    """
-    Execute command to the database.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres.Error)`
-    """
-    raise NotImplementedError
-
-

Execute command to the database.

-

Raises: Err(Error)

-
-
-def query(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_DbNull]) ‑> RowSet
-
-
-
- -Expand source code - -
def query(self, statement: str, params: List[ParameterValue]) -> RowSet:
-    """
-    Query the database.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres.Error)`
-    """
-    raise NotImplementedError
-
-

Query the database.

-

Raises: Err(Error)

-
-
-
-
-class DbDataType -(*args, **kwds) -
-
-
- -Expand source code - -
class DbDataType(Enum):
-    """
-    Data types for a database column
-    """
-    BOOLEAN = 0
-    INT8 = 1
-    INT16 = 2
-    INT32 = 3
-    INT64 = 4
-    FLOATING32 = 5
-    FLOATING64 = 6
-    STR = 7
-    BINARY = 8
-    DATE = 9
-    TIME = 10
-    DATETIME = 11
-    TIMESTAMP = 12
-    OTHER = 13
-
-

Data types for a database column

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var BINARY
-
-
-
-
var BOOLEAN
-
-
-
-
var DATE
-
-
-
-
var DATETIME
-
-
-
-
var FLOATING32
-
-
-
-
var FLOATING64
-
-
-
-
var INT16
-
-
-
-
var INT32
-
-
-
-
var INT64
-
-
-
-
var INT8
-
-
-
-
var OTHER
-
-
-
-
var STR
-
-
-
-
var TIME
-
-
-
-
var TIMESTAMP
-
-
-
-
-
-
-class DbValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Binary:
-    value: bytes
-
-

DbValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Boolean:
-    value: bool
-
-

DbValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class DbValue_Date -(value: Tuple[int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Date:
-    value: Tuple[int, int, int]
-
-

DbValue_Date(value: Tuple[int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int]
-
-
-
-
-
-
-class DbValue_Datetime -(value: Tuple[int, int, int, int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Datetime:
-    value: Tuple[int, int, int, int, int, int, int]
-
-

DbValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int, int, int, int]
-
-
-
-
-
-
-class DbValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class DbValue_DbNull:
-    pass
-
-

DbValue_DbNull()

-
-
-class DbValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating32:
-    value: float
-
-

DbValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating64:
-    value: float
-
-

DbValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int16:
-    value: int
-
-

DbValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int32:
-    value: int
-
-

DbValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int64:
-    value: int
-
-

DbValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int8:
-    value: int
-
-

DbValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Str:
-    value: str
-
-

DbValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class DbValue_Time -(value: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Time:
-    value: Tuple[int, int, int, int]
-
-

DbValue_Time(value: Tuple[int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int]
-
-
-
-
-
-
-class DbValue_Timestamp -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Timestamp:
-    value: int
-
-

DbValue_Timestamp(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Unsupported -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Unsupported:
-    pass
-
-

DbValue_Unsupported()

-
-
-class Error_BadParameter -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_BadParameter:
-    value: str
-
-

Error_BadParameter(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ConnectionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ConnectionFailed:
-    value: str
-
-

Error_ConnectionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_QueryFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_QueryFailed:
-    value: str
-
-

Error_QueryFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ValueConversionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ValueConversionFailed:
-    value: str
-
-

Error_ValueConversionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Binary:
-    value: bytes
-
-

ParameterValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class ParameterValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Boolean:
-    value: bool
-
-

ParameterValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class ParameterValue_Date -(value: Tuple[int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Date:
-    value: Tuple[int, int, int]
-
-

ParameterValue_Date(value: Tuple[int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int]
-
-
-
-
-
-
-class ParameterValue_Datetime -(value: Tuple[int, int, int, int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Datetime:
-    value: Tuple[int, int, int, int, int, int, int]
-
-

ParameterValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int, int, int, int]
-
-
-
-
-
-
-class ParameterValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_DbNull:
-    pass
-
-

ParameterValue_DbNull()

-
-
-class ParameterValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating32:
-    value: float
-
-

ParameterValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating64:
-    value: float
-
-

ParameterValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int16:
-    value: int
-
-

ParameterValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int32:
-    value: int
-
-

ParameterValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int64:
-    value: int
-
-

ParameterValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int8:
-    value: int
-
-

ParameterValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Str:
-    value: str
-
-

ParameterValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Time -(value: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Time:
-    value: Tuple[int, int, int, int]
-
-

ParameterValue_Time(value: Tuple[int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int]
-
-
-
-
-
-
-class ParameterValue_Timestamp -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Timestamp:
-    value: int
-
-

ParameterValue_Timestamp(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RowSet -(columns: List[Column],
rows: List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_DbNull | DbValue_Unsupported]])
-
-
-
- -Expand source code - -
@dataclass
-class RowSet:
-    """
-    A set of database rows
-    """
-    columns: List[Column]
-    rows: List[List[DbValue]]
-
-

A set of database rows

-

Instance variables

-
-
var columns : List[Column]
-
-
-
-
var rows : List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_DbNull | DbValue_Unsupported]]
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/spin_postgres_postgres_4_0_0.html b/docs/v3/wit/imports/spin_postgres_postgres_4_0_0.html deleted file mode 100644 index a950e01..0000000 --- a/docs/v3/wit/imports/spin_postgres_postgres_4_0_0.html +++ /dev/null @@ -1,2456 +0,0 @@ - - - - - - -spin_sdk.wit.imports.spin_postgres_postgres_4_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.spin_postgres_postgres_4_0_0

-
-
-
-
-
-
-

Global variables

-
-
var DbDataType
-
-

Data types for a database column

-
-
var DbValue
-
-

Database values

-
-
var Error
-
-

Errors related to interacting with a database.

-
-
var ParameterValue
-
-

Values used in parameterized queries

-
-
-
-
-
-
-

Classes

-
-
-class Column -(name: str,
data_type: DbDataType_Boolean | DbDataType_Int8 | DbDataType_Int16 | DbDataType_Int32 | DbDataType_Int64 | DbDataType_Floating32 | DbDataType_Floating64 | DbDataType_Str | DbDataType_Binary | DbDataType_Date | DbDataType_Time | DbDataType_Datetime | DbDataType_Timestamp | DbDataType_Uuid | DbDataType_Jsonb | DbDataType_Decimal | DbDataType_RangeInt32 | DbDataType_RangeInt64 | DbDataType_RangeDecimal | DbDataType_ArrayInt32 | DbDataType_ArrayInt64 | DbDataType_ArrayDecimal | DbDataType_ArrayStr | DbDataType_Interval | DbDataType_Other)
-
-
-
- -Expand source code - -
@dataclass
-class Column:
-    """
-    A database column
-    """
-    name: str
-    data_type: DbDataType
-
-

A database column

-

Instance variables

-
-
var data_typeDbDataType_Boolean | DbDataType_Int8 | DbDataType_Int16 | DbDataType_Int32 | DbDataType_Int64 | DbDataType_Floating32 | DbDataType_Floating64 | DbDataType_Str | DbDataType_Binary | DbDataType_Date | DbDataType_Time | DbDataType_Datetime | DbDataType_Timestamp | DbDataType_Uuid | DbDataType_Jsonb | DbDataType_Decimal | DbDataType_RangeInt32 | DbDataType_RangeInt64 | DbDataType_RangeDecimal | DbDataType_ArrayInt32 | DbDataType_ArrayInt64 | DbDataType_ArrayDecimal | DbDataType_ArrayStr | DbDataType_Interval | DbDataType_Other
-
-
-
-
var name : str
-
-
-
-
-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    """
-    A connection to a postgres database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Postgres instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)`
-        """
-        raise NotImplementedError
-    def query(self, statement: str, params: List[ParameterValue]) -> RowSet:
-        """
-        Query the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, statement: str, params: List[ParameterValue]) -> int:
-        """
-        Execute command to the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A connection to a postgres database.

-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the Postgres instance at address.

-

Raises: Err(Error)

-
-
-

Methods

-
-
-def execute(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_Uuid | ParameterValue_Jsonb | ParameterValue_Decimal | ParameterValue_RangeInt32 | ParameterValue_RangeInt64 | ParameterValue_RangeDecimal | ParameterValue_ArrayInt32 | ParameterValue_ArrayInt64 | ParameterValue_ArrayDecimal | ParameterValue_ArrayStr | ParameterValue_Interval | ParameterValue_DbNull]) ‑> int
-
-
-
- -Expand source code - -
def execute(self, statement: str, params: List[ParameterValue]) -> int:
-    """
-    Execute command to the database.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Execute command to the database.

-

Raises: Err(Error)

-
-
-def query(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_Uuid | ParameterValue_Jsonb | ParameterValue_Decimal | ParameterValue_RangeInt32 | ParameterValue_RangeInt64 | ParameterValue_RangeDecimal | ParameterValue_ArrayInt32 | ParameterValue_ArrayInt64 | ParameterValue_ArrayDecimal | ParameterValue_ArrayStr | ParameterValue_Interval | ParameterValue_DbNull]) ‑> RowSet
-
-
-
- -Expand source code - -
def query(self, statement: str, params: List[ParameterValue]) -> RowSet:
-    """
-    Query the database.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Query the database.

-

Raises: Err(Error)

-
-
-
-
-class DbDataType_ArrayDecimal -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_ArrayDecimal:
-    pass
-
-

DbDataType_ArrayDecimal()

-
-
-class DbDataType_ArrayInt32 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_ArrayInt32:
-    pass
-
-

DbDataType_ArrayInt32()

-
-
-class DbDataType_ArrayInt64 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_ArrayInt64:
-    pass
-
-

DbDataType_ArrayInt64()

-
-
-class DbDataType_ArrayStr -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_ArrayStr:
-    pass
-
-

DbDataType_ArrayStr()

-
-
-class DbDataType_Binary -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Binary:
-    pass
-
-

DbDataType_Binary()

-
-
-class DbDataType_Boolean -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Boolean:
-    pass
-
-

DbDataType_Boolean()

-
-
-class DbDataType_Date -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Date:
-    pass
-
-

DbDataType_Date()

-
-
-class DbDataType_Datetime -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Datetime:
-    pass
-
-

DbDataType_Datetime()

-
-
-class DbDataType_Decimal -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Decimal:
-    pass
-
-

DbDataType_Decimal()

-
-
-class DbDataType_Floating32 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Floating32:
-    pass
-
-

DbDataType_Floating32()

-
-
-class DbDataType_Floating64 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Floating64:
-    pass
-
-

DbDataType_Floating64()

-
-
-class DbDataType_Int16 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Int16:
-    pass
-
-

DbDataType_Int16()

-
-
-class DbDataType_Int32 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Int32:
-    pass
-
-

DbDataType_Int32()

-
-
-class DbDataType_Int64 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Int64:
-    pass
-
-

DbDataType_Int64()

-
-
-class DbDataType_Int8 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Int8:
-    pass
-
-

DbDataType_Int8()

-
-
-class DbDataType_Interval -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Interval:
-    pass
-
-

DbDataType_Interval()

-
-
-class DbDataType_Jsonb -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Jsonb:
-    pass
-
-

DbDataType_Jsonb()

-
-
-class DbDataType_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Other:
-    value: str
-
-

DbDataType_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class DbDataType_RangeDecimal -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_RangeDecimal:
-    pass
-
-

DbDataType_RangeDecimal()

-
-
-class DbDataType_RangeInt32 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_RangeInt32:
-    pass
-
-

DbDataType_RangeInt32()

-
-
-class DbDataType_RangeInt64 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_RangeInt64:
-    pass
-
-

DbDataType_RangeInt64()

-
-
-class DbDataType_Str -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Str:
-    pass
-
-

DbDataType_Str()

-
-
-class DbDataType_Time -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Time:
-    pass
-
-

DbDataType_Time()

-
-
-class DbDataType_Timestamp -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Timestamp:
-    pass
-
-

DbDataType_Timestamp()

-
-
-class DbDataType_Uuid -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Uuid:
-    pass
-
-

DbDataType_Uuid()

-
-
-class DbError -(as_text: str,
severity: str,
code: str,
message: str,
detail: str | None,
extras: List[Tuple[str, str]])
-
-
-
- -Expand source code - -
@dataclass
-class DbError:
-    as_text: str
-    severity: str
-    code: str
-    message: str
-    detail: Optional[str]
-    extras: List[Tuple[str, str]]
-
-

DbError(as_text: str, severity: str, code: str, message: str, detail: Optional[str], extras: List[Tuple[str, str]])

-

Instance variables

-
-
var as_text : str
-
-
-
-
var code : str
-
-
-
-
var detail : str | None
-
-
-
-
var extras : List[Tuple[str, str]]
-
-
-
-
var message : str
-
-
-
-
var severity : str
-
-
-
-
-
-
-class DbValue_ArrayDecimal -(value: List[str | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_ArrayDecimal:
-    value: List[Optional[str]]
-
-

DbValue_ArrayDecimal(value: List[Optional[str]])

-

Instance variables

-
-
var value : List[str | None]
-
-
-
-
-
-
-class DbValue_ArrayInt32 -(value: List[int | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_ArrayInt32:
-    value: List[Optional[int]]
-
-

DbValue_ArrayInt32(value: List[Optional[int]])

-

Instance variables

-
-
var value : List[int | None]
-
-
-
-
-
-
-class DbValue_ArrayInt64 -(value: List[int | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_ArrayInt64:
-    value: List[Optional[int]]
-
-

DbValue_ArrayInt64(value: List[Optional[int]])

-

Instance variables

-
-
var value : List[int | None]
-
-
-
-
-
-
-class DbValue_ArrayStr -(value: List[str | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_ArrayStr:
-    value: List[Optional[str]]
-
-

DbValue_ArrayStr(value: List[Optional[str]])

-

Instance variables

-
-
var value : List[str | None]
-
-
-
-
-
-
-class DbValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Binary:
-    value: bytes
-
-

DbValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Boolean:
-    value: bool
-
-

DbValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class DbValue_Date -(value: Tuple[int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Date:
-    value: Tuple[int, int, int]
-
-

DbValue_Date(value: Tuple[int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int]
-
-
-
-
-
-
-class DbValue_Datetime -(value: Tuple[int, int, int, int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Datetime:
-    value: Tuple[int, int, int, int, int, int, int]
-
-

DbValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int, int, int, int]
-
-
-
-
-
-
-class DbValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class DbValue_DbNull:
-    pass
-
-

DbValue_DbNull()

-
-
-class DbValue_Decimal -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Decimal:
-    value: str
-
-

DbValue_Decimal(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class DbValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating32:
-    value: float
-
-

DbValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating64:
-    value: float
-
-

DbValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int16:
-    value: int
-
-

DbValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int32:
-    value: int
-
-

DbValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int64:
-    value: int
-
-

DbValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int8:
-    value: int
-
-

DbValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Interval -(value: Interval) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Interval:
-    value: Interval
-
-

DbValue_Interval(value: spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Interval)

-

Instance variables

-
-
var valueInterval
-
-
-
-
-
-
-class DbValue_Jsonb -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Jsonb:
-    value: bytes
-
-

DbValue_Jsonb(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValue_RangeDecimal -(value: Tuple[Tuple[str, RangeBoundKind] | None, Tuple[str, RangeBoundKind] | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_RangeDecimal:
-    value: Tuple[Optional[Tuple[str, RangeBoundKind]], Optional[Tuple[str, RangeBoundKind]]]
-
-

DbValue_RangeDecimal(value: Tuple[Optional[Tuple[str, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]], Optional[Tuple[str, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]]])

-

Instance variables

-
-
var value : Tuple[Tuple[str, RangeBoundKind] | None, Tuple[str, RangeBoundKind] | None]
-
-
-
-
-
-
-class DbValue_RangeInt32 -(value: Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_RangeInt32:
-    value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]]
-
-

DbValue_RangeInt32(value: Tuple[Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]], Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]]])

-

Instance variables

-
-
var value : Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]
-
-
-
-
-
-
-class DbValue_RangeInt64 -(value: Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_RangeInt64:
-    value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]]
-
-

DbValue_RangeInt64(value: Tuple[Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]], Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]]])

-

Instance variables

-
-
var value : Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]
-
-
-
-
-
-
-class DbValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Str:
-    value: str
-
-

DbValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class DbValue_Time -(value: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Time:
-    value: Tuple[int, int, int, int]
-
-

DbValue_Time(value: Tuple[int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int]
-
-
-
-
-
-
-class DbValue_Timestamp -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Timestamp:
-    value: int
-
-

DbValue_Timestamp(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Unsupported -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Unsupported:
-    value: bytes
-
-

DbValue_Unsupported(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValue_Uuid -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uuid:
-    value: str
-
-

DbValue_Uuid(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_BadParameter -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_BadParameter:
-    value: str
-
-

Error_BadParameter(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ConnectionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ConnectionFailed:
-    value: str
-
-

Error_ConnectionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_QueryFailed -(value: QueryError_Text | QueryError_DbError) -
-
-
- -Expand source code - -
@dataclass
-class Error_QueryFailed:
-    value: QueryError
-
-

Error_QueryFailed(value: Union[spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.QueryError_Text, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.QueryError_DbError])

-

Instance variables

-
-
var valueQueryError_Text | QueryError_DbError
-
-
-
-
-
-
-class Error_ValueConversionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ValueConversionFailed:
-    value: str
-
-

Error_ValueConversionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Interval -(micros: int, days: int, months: int) -
-
-
- -Expand source code - -
@dataclass
-class Interval:
-    micros: int
-    days: int
-    months: int
-
-

Interval(micros: int, days: int, months: int)

-

Instance variables

-
-
var days : int
-
-
-
-
var micros : int
-
-
-
-
var months : int
-
-
-
-
-
-
-class ParameterValue_ArrayDecimal -(value: List[str | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_ArrayDecimal:
-    value: List[Optional[str]]
-
-

ParameterValue_ArrayDecimal(value: List[Optional[str]])

-

Instance variables

-
-
var value : List[str | None]
-
-
-
-
-
-
-class ParameterValue_ArrayInt32 -(value: List[int | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_ArrayInt32:
-    value: List[Optional[int]]
-
-

ParameterValue_ArrayInt32(value: List[Optional[int]])

-

Instance variables

-
-
var value : List[int | None]
-
-
-
-
-
-
-class ParameterValue_ArrayInt64 -(value: List[int | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_ArrayInt64:
-    value: List[Optional[int]]
-
-

ParameterValue_ArrayInt64(value: List[Optional[int]])

-

Instance variables

-
-
var value : List[int | None]
-
-
-
-
-
-
-class ParameterValue_ArrayStr -(value: List[str | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_ArrayStr:
-    value: List[Optional[str]]
-
-

ParameterValue_ArrayStr(value: List[Optional[str]])

-

Instance variables

-
-
var value : List[str | None]
-
-
-
-
-
-
-class ParameterValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Binary:
-    value: bytes
-
-

ParameterValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class ParameterValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Boolean:
-    value: bool
-
-

ParameterValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class ParameterValue_Date -(value: Tuple[int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Date:
-    value: Tuple[int, int, int]
-
-

ParameterValue_Date(value: Tuple[int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int]
-
-
-
-
-
-
-class ParameterValue_Datetime -(value: Tuple[int, int, int, int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Datetime:
-    value: Tuple[int, int, int, int, int, int, int]
-
-

ParameterValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int, int, int, int]
-
-
-
-
-
-
-class ParameterValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_DbNull:
-    pass
-
-

ParameterValue_DbNull()

-
-
-class ParameterValue_Decimal -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Decimal:
-    value: str
-
-

ParameterValue_Decimal(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating32:
-    value: float
-
-

ParameterValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating64:
-    value: float
-
-

ParameterValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int16:
-    value: int
-
-

ParameterValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int32:
-    value: int
-
-

ParameterValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int64:
-    value: int
-
-

ParameterValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int8:
-    value: int
-
-

ParameterValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Interval -(value: Interval) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Interval:
-    value: Interval
-
-

ParameterValue_Interval(value: spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Interval)

-

Instance variables

-
-
var valueInterval
-
-
-
-
-
-
-class ParameterValue_Jsonb -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Jsonb:
-    value: bytes
-
-

ParameterValue_Jsonb(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class ParameterValue_RangeDecimal -(value: Tuple[Tuple[str, RangeBoundKind] | None, Tuple[str, RangeBoundKind] | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_RangeDecimal:
-    value: Tuple[Optional[Tuple[str, RangeBoundKind]], Optional[Tuple[str, RangeBoundKind]]]
-
-

ParameterValue_RangeDecimal(value: Tuple[Optional[Tuple[str, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]], Optional[Tuple[str, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]]])

-

Instance variables

-
-
var value : Tuple[Tuple[str, RangeBoundKind] | None, Tuple[str, RangeBoundKind] | None]
-
-
-
-
-
-
-class ParameterValue_RangeInt32 -(value: Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_RangeInt32:
-    value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]]
-
-

ParameterValue_RangeInt32(value: Tuple[Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]], Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]]])

-

Instance variables

-
-
var value : Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]
-
-
-
-
-
-
-class ParameterValue_RangeInt64 -(value: Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_RangeInt64:
-    value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]]
-
-

ParameterValue_RangeInt64(value: Tuple[Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]], Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]]])

-

Instance variables

-
-
var value : Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]
-
-
-
-
-
-
-class ParameterValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Str:
-    value: str
-
-

ParameterValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Time -(value: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Time:
-    value: Tuple[int, int, int, int]
-
-

ParameterValue_Time(value: Tuple[int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int]
-
-
-
-
-
-
-class ParameterValue_Timestamp -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Timestamp:
-    value: int
-
-

ParameterValue_Timestamp(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Uuid -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uuid:
-    value: str
-
-

ParameterValue_Uuid(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class QueryError_DbError -(value: DbError) -
-
-
- -Expand source code - -
@dataclass
-class QueryError_DbError:
-    value: DbError
-
-

QueryError_DbError(value: spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.DbError)

-

Instance variables

-
-
var valueDbError
-
-
-
-
-
-
-class QueryError_Text -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class QueryError_Text:
-    value: str
-
-

QueryError_Text(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class RangeBoundKind -(*args, **kwds) -
-
-
- -Expand source code - -
class RangeBoundKind(Enum):
-    """
-    For range types, indicates if each bound is inclusive or exclusive
-    """
-    INCLUSIVE = 0
-    EXCLUSIVE = 1
-
-

For range types, indicates if each bound is inclusive or exclusive

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var EXCLUSIVE
-
-
-
-
var INCLUSIVE
-
-
-
-
-
-
-class RowSet -(columns: List[Column],
rows: List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_Uuid | DbValue_Jsonb | DbValue_Decimal | DbValue_RangeInt32 | DbValue_RangeInt64 | DbValue_RangeDecimal | DbValue_ArrayInt32 | DbValue_ArrayInt64 | DbValue_ArrayDecimal | DbValue_ArrayStr | DbValue_Interval | DbValue_DbNull | DbValue_Unsupported]])
-
-
-
- -Expand source code - -
@dataclass
-class RowSet:
-    """
-    A set of database rows
-    """
-    columns: List[Column]
-    rows: List[List[DbValue]]
-
-

A set of database rows

-

Instance variables

-
-
var columns : List[Column]
-
-
-
-
var rows : List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_Uuid | DbValue_Jsonb | DbValue_Decimal | DbValue_RangeInt32 | DbValue_RangeInt64 | DbValue_RangeDecimal | DbValue_ArrayInt32 | DbValue_ArrayInt64 | DbValue_ArrayDecimal | DbValue_ArrayStr | DbValue_Interval | DbValue_DbNull | DbValue_Unsupported]]
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/spin_sqlite_sqlite.html b/docs/v3/wit/imports/spin_sqlite_sqlite.html deleted file mode 100644 index 9dcfab9..0000000 --- a/docs/v3/wit/imports/spin_sqlite_sqlite.html +++ /dev/null @@ -1,518 +0,0 @@ - - - - - - -spin_sdk.wit.imports.spin_sqlite_sqlite API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.spin_sqlite_sqlite

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
var Value
-
-

A single column's result from a database query

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    """
-    A handle to an open sqlite instance
-    """
-    
-    @classmethod
-    def open(cls, database: str) -> Self:
-        """
-        Open a connection to a named database instance.
-        
-        If `database` is "default", the default instance is opened.
-        
-        `error::no-such-database` will be raised if the `name` is not recognized.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-        """
-        Execute a statement returning back data if there is any
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite.Error)`
-        """
-        raise NotImplementedError
-    def last_insert_rowid(self) -> int:
-        """
-        The SQLite rowid of the most recent successful INSERT on the connection, or 0 if
-        there has not yet been an INSERT on the connection.
-        """
-        raise NotImplementedError
-    def changes(self) -> int:
-        """
-        The number of rows modified, inserted or deleted by the most recently completed
-        INSERT, UPDATE or DELETE statement on the connection.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A handle to an open sqlite instance

-

Static methods

-
-
-def open(database: str) ‑> Self -
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

error::no-such-database will be raised if the name is not recognized.

-

Raises: Err(Error)

-
-
-

Methods

-
-
-def changes(self) ‑> int -
-
-
- -Expand source code - -
def changes(self) -> int:
-    """
-    The number of rows modified, inserted or deleted by the most recently completed
-    INSERT, UPDATE or DELETE statement on the connection.
-    """
-    raise NotImplementedError
-
-

The number of rows modified, inserted or deleted by the most recently completed -INSERT, UPDATE or DELETE statement on the connection.

-
-
-def execute(self,
statement: str,
parameters: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) ‑> QueryResult
-
-
-
- -Expand source code - -
def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-    """
-    Execute a statement returning back data if there is any
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite.Error)`
-    """
-    raise NotImplementedError
-
-

Execute a statement returning back data if there is any

-

Raises: Err(Error)

-
-
-def last_insert_rowid(self) ‑> int -
-
-
- -Expand source code - -
def last_insert_rowid(self) -> int:
-    """
-    The SQLite rowid of the most recent successful INSERT on the connection, or 0 if
-    there has not yet been an INSERT on the connection.
-    """
-    raise NotImplementedError
-
-

The SQLite rowid of the most recent successful INSERT on the connection, or 0 if -there has not yet been an INSERT on the connection.

-
-
-
-
-class Error_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class Error_AccessDenied:
-    pass
-
-

Error_AccessDenied()

-
-
-class Error_DatabaseFull -
-
-
- -Expand source code - -
@dataclass
-class Error_DatabaseFull:
-    pass
-
-

Error_DatabaseFull()

-
-
-class Error_InvalidConnection -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidConnection:
-    pass
-
-

Error_InvalidConnection()

-
-
-class Error_Io -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Io:
-    value: str
-
-

Error_Io(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_NoSuchDatabase -
-
-
- -Expand source code - -
@dataclass
-class Error_NoSuchDatabase:
-    pass
-
-

Error_NoSuchDatabase()

-
-
-class QueryResult -(columns: List[str],
rows: List[RowResult])
-
-
-
- -Expand source code - -
@dataclass
-class QueryResult:
-    """
-    A result of a query
-    """
-    columns: List[str]
-    rows: List[RowResult]
-
-

A result of a query

-

Instance variables

-
-
var columns : List[str]
-
-
-
-
var rows : List[RowResult]
-
-
-
-
-
-
-class RowResult -(values: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) -
-
-
- -Expand source code - -
@dataclass
-class RowResult:
-    """
-    A set of values for each of the columns in a query-result
-    """
-    values: List[Value]
-
-

A set of values for each of the columns in a query-result

-

Instance variables

-
-
var values : List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]
-
-
-
-
-
-
-class Value_Blob -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class Value_Blob:
-    value: bytes
-
-

Value_Blob(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class Value_Integer -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class Value_Integer:
-    value: int
-
-

Value_Integer(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class Value_Null -
-
-
- -Expand source code - -
@dataclass
-class Value_Null:
-    pass
-
-

Value_Null()

-
-
-class Value_Real -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class Value_Real:
-    value: float
-
-

Value_Real(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class Value_Text -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Value_Text:
-    value: str
-
-

Value_Text(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/sqlite.html b/docs/v3/wit/imports/sqlite.html deleted file mode 100644 index 0d8ca29..0000000 --- a/docs/v3/wit/imports/sqlite.html +++ /dev/null @@ -1,468 +0,0 @@ - - - - - - -spin_sdk.wit.imports.sqlite API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.sqlite

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
var Value
-
-

A single column's result from a database query

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    """
-    A handle to an open sqlite instance
-    """
-    
-    @classmethod
-    def open(cls, database: str) -> Self:
-        """
-        Open a connection to a named database instance.
-        
-        If `database` is "default", the default instance is opened.
-        
-        `error::no-such-database` will be raised if the `name` is not recognized.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-        """
-        Execute a statement returning back data if there is any
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A handle to an open sqlite instance

-

Static methods

-
-
-def open(database: str) ‑> Self -
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

error::no-such-database will be raised if the name is not recognized.

-

Raises: Err(Error)

-
-
-

Methods

-
-
-def execute(self,
statement: str,
parameters: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) ‑> QueryResult
-
-
-
- -Expand source code - -
def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-    """
-    Execute a statement returning back data if there is any
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-    """
-    raise NotImplementedError
-
-

Execute a statement returning back data if there is any

-

Raises: Err(Error)

-
-
-
-
-class Error_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class Error_AccessDenied:
-    pass
-
-

Error_AccessDenied()

-
-
-class Error_DatabaseFull -
-
-
- -Expand source code - -
@dataclass
-class Error_DatabaseFull:
-    pass
-
-

Error_DatabaseFull()

-
-
-class Error_InvalidConnection -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidConnection:
-    pass
-
-

Error_InvalidConnection()

-
-
-class Error_Io -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Io:
-    value: str
-
-

Error_Io(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_NoSuchDatabase -
-
-
- -Expand source code - -
@dataclass
-class Error_NoSuchDatabase:
-    pass
-
-

Error_NoSuchDatabase()

-
-
-class QueryResult -(columns: List[str],
rows: List[RowResult])
-
-
-
- -Expand source code - -
@dataclass
-class QueryResult:
-    """
-    A result of a query
-    """
-    columns: List[str]
-    rows: List[RowResult]
-
-

A result of a query

-

Instance variables

-
-
var columns : List[str]
-
-
-
-
var rows : List[RowResult]
-
-
-
-
-
-
-class RowResult -(values: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) -
-
-
- -Expand source code - -
@dataclass
-class RowResult:
-    """
-    A set of values for each of the columns in a query-result
-    """
-    values: List[Value]
-
-

A set of values for each of the columns in a query-result

-

Instance variables

-
-
var values : List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]
-
-
-
-
-
-
-class Value_Blob -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class Value_Blob:
-    value: bytes
-
-

Value_Blob(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class Value_Integer -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class Value_Integer:
-    value: int
-
-

Value_Integer(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class Value_Null -
-
-
- -Expand source code - -
@dataclass
-class Value_Null:
-    pass
-
-

Value_Null()

-
-
-class Value_Real -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class Value_Real:
-    value: float
-
-

Value_Real(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class Value_Text -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Value_Text:
-    value: str
-
-

Value_Text(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/streams.html b/docs/v3/wit/imports/streams.html deleted file mode 100644 index 248d4a4..0000000 --- a/docs/v3/wit/imports/streams.html +++ /dev/null @@ -1,1019 +0,0 @@ - - - - - - -spin_sdk.wit.imports.streams API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.streams

-
-
-

WASI I/O is an I/O abstraction API which is currently focused on providing -stream types.

-

In the future, the component model is expected to add built-in stream types; -when it does, they are expected to subsume this API.

-
-
-
-
-

Global variables

-
-
var StreamError
-
-

An error for input-stream and output-stream operations.

-
-
-
-
-
-
-

Classes

-
-
-class InputStream -
-
-
- -Expand source code - -
class InputStream:
-    """
-    An input bytestream.
-    
-    `input-stream`s are *non-blocking* to the extent practical on underlying
-    platforms. I/O operations always return promptly; if fewer bytes are
-    promptly available than requested, they return the number of bytes promptly
-    available, which could even be zero. To wait for data to be available,
-    use the `subscribe` function to obtain a `pollable` which can be polled
-    for using `wasi:io/poll`.
-    """
-    
-    def read(self, len: int) -> bytes:
-        """
-        Perform a non-blocking read from the stream.
-        
-        When the source of a `read` is binary data, the bytes from the source
-        are returned verbatim. When the source of a `read` is known to the
-        implementation to be text, bytes containing the UTF-8 encoding of the
-        text are returned.
-        
-        This function returns a list of bytes containing the read data,
-        when successful. The returned list will contain up to `len` bytes;
-        it may return fewer than requested, but not more. The list is
-        empty when no bytes are available for reading at this time. The
-        pollable given by `subscribe` will be ready when more bytes are
-        available.
-        
-        This function fails with a `stream-error` when the operation
-        encounters an error, giving `last-operation-failed`, or when the
-        stream is closed, giving `closed`.
-        
-        When the caller gives a `len` of 0, it represents a request to
-        read 0 bytes. If the stream is still open, this call should
-        succeed and return an empty list, or otherwise fail with `closed`.
-        
-        The `len` parameter is a `u64`, which could represent a list of u8 which
-        is not possible to allocate in wasm32, or not desirable to allocate as
-        as a return value by the callee. The callee may return a list of bytes
-        less than `len` in size while more bytes are available for reading.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_read(self, len: int) -> bytes:
-        """
-        Read bytes from a stream, after blocking until at least one byte can
-        be read. Except for blocking, behavior is identical to `read`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream. Returns number of bytes skipped.
-        
-        Behaves identical to `read`, except instead of returning a list
-        of bytes, returns the number of bytes consumed from the stream.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream, after blocking until at least one byte
-        can be skipped. Except for blocking behavior, identical to `skip`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> poll.Pollable:
-        """
-        Create a `pollable` which will resolve once either the specified stream
-        has bytes available to read or the other end of the stream has been
-        closed.
-        The created `pollable` is a child resource of the `input-stream`.
-        Implementations may trap if the `input-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

An input bytestream.

-

input-streams are non-blocking to the extent practical on underlying -platforms. I/O operations always return promptly; if fewer bytes are -promptly available than requested, they return the number of bytes promptly -available, which could even be zero. To wait for data to be available, -use the subscribe function to obtain a pollable which can be polled -for using wasi:io/poll.

-

Methods

-
-
-def blocking_read(self, len: int) ‑> bytes -
-
-
- -Expand source code - -
def blocking_read(self, len: int) -> bytes:
-    """
-    Read bytes from a stream, after blocking until at least one byte can
-    be read. Except for blocking, behavior is identical to `read`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Read bytes from a stream, after blocking until at least one byte can -be read. Except for blocking, behavior is identical to read.

-

Raises: Err(StreamError)

-
-
-def blocking_skip(self, len: int) ‑> int -
-
-
- -Expand source code - -
def blocking_skip(self, len: int) -> int:
-    """
-    Skip bytes from a stream, after blocking until at least one byte
-    can be skipped. Except for blocking behavior, identical to `skip`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Skip bytes from a stream, after blocking until at least one byte -can be skipped. Except for blocking behavior, identical to skip.

-

Raises: Err(StreamError)

-
-
-def read(self, len: int) ‑> bytes -
-
-
- -Expand source code - -
def read(self, len: int) -> bytes:
-    """
-    Perform a non-blocking read from the stream.
-    
-    When the source of a `read` is binary data, the bytes from the source
-    are returned verbatim. When the source of a `read` is known to the
-    implementation to be text, bytes containing the UTF-8 encoding of the
-    text are returned.
-    
-    This function returns a list of bytes containing the read data,
-    when successful. The returned list will contain up to `len` bytes;
-    it may return fewer than requested, but not more. The list is
-    empty when no bytes are available for reading at this time. The
-    pollable given by `subscribe` will be ready when more bytes are
-    available.
-    
-    This function fails with a `stream-error` when the operation
-    encounters an error, giving `last-operation-failed`, or when the
-    stream is closed, giving `closed`.
-    
-    When the caller gives a `len` of 0, it represents a request to
-    read 0 bytes. If the stream is still open, this call should
-    succeed and return an empty list, or otherwise fail with `closed`.
-    
-    The `len` parameter is a `u64`, which could represent a list of u8 which
-    is not possible to allocate in wasm32, or not desirable to allocate as
-    as a return value by the callee. The callee may return a list of bytes
-    less than `len` in size while more bytes are available for reading.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Perform a non-blocking read from the stream.

-

When the source of a read is binary data, the bytes from the source -are returned verbatim. When the source of a read is known to the -implementation to be text, bytes containing the UTF-8 encoding of the -text are returned.

-

This function returns a list of bytes containing the read data, -when successful. The returned list will contain up to len bytes; -it may return fewer than requested, but not more. The list is -empty when no bytes are available for reading at this time. The -pollable given by subscribe will be ready when more bytes are -available.

-

This function fails with a stream-error when the operation -encounters an error, giving last-operation-failed, or when the -stream is closed, giving closed.

-

When the caller gives a len of 0, it represents a request to -read 0 bytes. If the stream is still open, this call should -succeed and return an empty list, or otherwise fail with closed.

-

The len parameter is a u64, which could represent a list of u8 which -is not possible to allocate in wasm32, or not desirable to allocate as -as a return value by the callee. The callee may return a list of bytes -less than len in size while more bytes are available for reading.

-

Raises: Err(StreamError)

-
-
-def skip(self, len: int) ‑> int -
-
-
- -Expand source code - -
def skip(self, len: int) -> int:
-    """
-    Skip bytes from a stream. Returns number of bytes skipped.
-    
-    Behaves identical to `read`, except instead of returning a list
-    of bytes, returns the number of bytes consumed from the stream.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Skip bytes from a stream. Returns number of bytes skipped.

-

Behaves identical to read, except instead of returning a list -of bytes, returns the number of bytes consumed from the stream.

-

Raises: Err(StreamError)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once either the specified stream
-    has bytes available to read or the other end of the stream has been
-    closed.
-    The created `pollable` is a child resource of the `input-stream`.
-    Implementations may trap if the `input-stream` is dropped before
-    all derived `pollable`s created with this function are dropped.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once either the specified stream -has bytes available to read or the other end of the stream has been -closed. -The created pollable is a child resource of the input-stream. -Implementations may trap if the input-stream is dropped before -all derived pollables created with this function are dropped.

-
-
-
-
-class OutputStream -
-
-
- -Expand source code - -
class OutputStream:
-    """
-    An output bytestream.
-    
-    `output-stream`s are *non-blocking* to the extent practical on
-    underlying platforms. Except where specified otherwise, I/O operations also
-    always return promptly, after the number of bytes that can be written
-    promptly, which could even be zero. To wait for the stream to be ready to
-    accept data, the `subscribe` function to obtain a `pollable` which can be
-    polled for using `wasi:io/poll`.
-    """
-    
-    def check_write(self) -> int:
-        """
-        Check readiness for writing. This function never blocks.
-        
-        Returns the number of bytes permitted for the next call to `write`,
-        or an error. Calling `write` with more bytes than this function has
-        permitted will trap.
-        
-        When this function returns 0 bytes, the `subscribe` pollable will
-        become ready when this function will report at least 1 byte, or an
-        error.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def write(self, contents: bytes) -> None:
-        """
-        Perform a write. This function never blocks.
-        
-        When the destination of a `write` is binary data, the bytes from
-        `contents` are written verbatim. When the destination of a `write` is
-        known to the implementation to be text, the bytes of `contents` are
-        transcoded from UTF-8 into the encoding of the destination and then
-        written.
-        
-        Precondition: check-write gave permit of Ok(n) and contents has a
-        length of less than or equal to n. Otherwise, this function will trap.
-        
-        returns Err(closed) without writing if the stream has closed since
-        the last call to check-write provided a permit.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_write_and_flush(self, contents: bytes) -> None:
-        """
-        Perform a write of up to 4096 bytes, and then flush the stream. Block
-        until all of these operations are complete, or an error occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write`, and `flush`, and is implemented with the
-        following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while !contents.is_empty() {
-            // Wait for the stream to become writable
-            pollable.block();
-            let Ok(n) = this.check-write(); // eliding error handling
-            let len = min(n, contents.len());
-            let (chunk, rest) = contents.split_at(len);
-            this.write(chunk  );            // eliding error handling
-            contents = rest;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def flush(self) -> None:
-        """
-        Request to flush buffered output. This function never blocks.
-        
-        This tells the output-stream that the caller intends any buffered
-        output to be flushed. the output which is expected to be flushed
-        is all that has been passed to `write` prior to this call.
-        
-        Upon calling this function, the `output-stream` will not accept any
-        writes (`check-write` will return `ok(0)`) until the flush has
-        completed. The `subscribe` pollable will become ready when the
-        flush has completed and the stream can accept more writes.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_flush(self) -> None:
-        """
-        Request to flush buffered output, and block until flush completes
-        and stream is ready for writing again.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> poll.Pollable:
-        """
-        Create a `pollable` which will resolve once the output-stream
-        is ready for more writing, or an error has occured. When this
-        pollable is ready, `check-write` will return `ok(n)` with n>0, or an
-        error.
-        
-        If the stream is closed, this pollable is always ready immediately.
-        
-        The created `pollable` is a child resource of the `output-stream`.
-        Implementations may trap if the `output-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-    def write_zeroes(self, len: int) -> None:
-        """
-        Write zeroes to a stream.
-        
-        This should be used precisely like `write` with the exact same
-        preconditions (must use check-write first), but instead of
-        passing a list of bytes, you simply pass the number of zero-bytes
-        that should be written.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_write_zeroes_and_flush(self, len: int) -> None:
-        """
-        Perform a write of up to 4096 zeroes, and then flush the stream.
-        Block until all of these operations are complete, or an error
-        occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write-zeroes`, and `flush`, and is implemented with
-        the following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while num_zeroes != 0 {
-            // Wait for the stream to become writable
-            pollable.block();
-            let Ok(n) = this.check-write(); // eliding error handling
-            let len = min(n, num_zeroes);
-            this.write-zeroes(len);         // eliding error handling
-            num_zeroes -= len;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another.
-        
-        The behavior of splice is equivelant to:
-        1. calling `check-write` on the `output-stream`
-        2. calling `read` on the `input-stream` with the smaller of the
-        `check-write` permitted length and the `len` provided to `splice`
-        3. calling `write` on the `output-stream` with that read data.
-        
-        Any error reported by the call to `check-write`, `read`, or
-        `write` ends the splice and reports that error.
-        
-        This function returns the number of bytes transferred; it may be less
-        than `len`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another, with blocking.
-        
-        This is similar to `splice`, except that it blocks until the
-        `output-stream` is ready for writing, and the `input-stream`
-        is ready for reading, before performing the `splice`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

An output bytestream.

-

output-streams are non-blocking to the extent practical on -underlying platforms. Except where specified otherwise, I/O operations also -always return promptly, after the number of bytes that can be written -promptly, which could even be zero. To wait for the stream to be ready to -accept data, the subscribe function to obtain a pollable which can be -polled for using wasi:io/poll.

-

Methods

-
-
-def blocking_flush(self) ‑> None -
-
-
- -Expand source code - -
def blocking_flush(self) -> None:
-    """
-    Request to flush buffered output, and block until flush completes
-    and stream is ready for writing again.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Request to flush buffered output, and block until flush completes -and stream is ready for writing again.

-

Raises: Err(StreamError)

-
-
-def blocking_splice(self,
src: InputStream,
len: int) ‑> int
-
-
-
- -Expand source code - -
def blocking_splice(self, src: InputStream, len: int) -> int:
-    """
-    Read from one stream and write to another, with blocking.
-    
-    This is similar to `splice`, except that it blocks until the
-    `output-stream` is ready for writing, and the `input-stream`
-    is ready for reading, before performing the `splice`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Read from one stream and write to another, with blocking.

-

This is similar to splice, except that it blocks until the -output-stream is ready for writing, and the input-stream -is ready for reading, before performing the splice.

-

Raises: Err(StreamError)

-
-
-def blocking_write_and_flush(self, contents: bytes) ‑> None -
-
-
- -Expand source code - -
def blocking_write_and_flush(self, contents: bytes) -> None:
-    """
-    Perform a write of up to 4096 bytes, and then flush the stream. Block
-    until all of these operations are complete, or an error occurs.
-    
-    This is a convenience wrapper around the use of `check-write`,
-    `subscribe`, `write`, and `flush`, and is implemented with the
-    following pseudo-code:
-    
-    ```text
-    let pollable = this.subscribe();
-    while !contents.is_empty() {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, contents.len());
-        let (chunk, rest) = contents.split_at(len);
-        this.write(chunk  );            // eliding error handling
-        contents = rest;
-    }
-    this.flush();
-    // Wait for completion of `flush`
-    pollable.block();
-    // Check for any errors that arose during `flush`
-    let _ = this.check-write();         // eliding error handling
-    ```
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Perform a write of up to 4096 bytes, and then flush the stream. Block -until all of these operations are complete, or an error occurs.

-

This is a convenience wrapper around the use of check-write, -subscribe, write, and flush, and is implemented with the -following pseudo-code:

-
let pollable = this.subscribe();
-while !contents.is_empty() {
-    // Wait for the stream to become writable
-    pollable.block();
-    let Ok(n) = this.check-write(); // eliding error handling
-    let len = min(n, contents.len());
-    let (chunk, rest) = contents.split_at(len);
-    this.write(chunk  );            // eliding error handling
-    contents = rest;
-}
-this.flush();
-// Wait for completion of `flush`
-pollable.block();
-// Check for any errors that arose during `flush`
-let _ = this.check-write();         // eliding error handling
-
-

Raises: Err(StreamError)

-
-
-def blocking_write_zeroes_and_flush(self, len: int) ‑> None -
-
-
- -Expand source code - -
def blocking_write_zeroes_and_flush(self, len: int) -> None:
-    """
-    Perform a write of up to 4096 zeroes, and then flush the stream.
-    Block until all of these operations are complete, or an error
-    occurs.
-    
-    This is a convenience wrapper around the use of `check-write`,
-    `subscribe`, `write-zeroes`, and `flush`, and is implemented with
-    the following pseudo-code:
-    
-    ```text
-    let pollable = this.subscribe();
-    while num_zeroes != 0 {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, num_zeroes);
-        this.write-zeroes(len);         // eliding error handling
-        num_zeroes -= len;
-    }
-    this.flush();
-    // Wait for completion of `flush`
-    pollable.block();
-    // Check for any errors that arose during `flush`
-    let _ = this.check-write();         // eliding error handling
-    ```
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Perform a write of up to 4096 zeroes, and then flush the stream. -Block until all of these operations are complete, or an error -occurs.

-

This is a convenience wrapper around the use of check-write, -subscribe, write-zeroes, and flush, and is implemented with -the following pseudo-code:

-
let pollable = this.subscribe();
-while num_zeroes != 0 {
-    // Wait for the stream to become writable
-    pollable.block();
-    let Ok(n) = this.check-write(); // eliding error handling
-    let len = min(n, num_zeroes);
-    this.write-zeroes(len);         // eliding error handling
-    num_zeroes -= len;
-}
-this.flush();
-// Wait for completion of `flush`
-pollable.block();
-// Check for any errors that arose during `flush`
-let _ = this.check-write();         // eliding error handling
-
-

Raises: Err(StreamError)

-
-
-def check_write(self) ‑> int -
-
-
- -Expand source code - -
def check_write(self) -> int:
-    """
-    Check readiness for writing. This function never blocks.
-    
-    Returns the number of bytes permitted for the next call to `write`,
-    or an error. Calling `write` with more bytes than this function has
-    permitted will trap.
-    
-    When this function returns 0 bytes, the `subscribe` pollable will
-    become ready when this function will report at least 1 byte, or an
-    error.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Check readiness for writing. This function never blocks.

-

Returns the number of bytes permitted for the next call to write, -or an error. Calling write with more bytes than this function has -permitted will trap.

-

When this function returns 0 bytes, the subscribe pollable will -become ready when this function will report at least 1 byte, or an -error.

-

Raises: Err(StreamError)

-
-
-def flush(self) ‑> None -
-
-
- -Expand source code - -
def flush(self) -> None:
-    """
-    Request to flush buffered output. This function never blocks.
-    
-    This tells the output-stream that the caller intends any buffered
-    output to be flushed. the output which is expected to be flushed
-    is all that has been passed to `write` prior to this call.
-    
-    Upon calling this function, the `output-stream` will not accept any
-    writes (`check-write` will return `ok(0)`) until the flush has
-    completed. The `subscribe` pollable will become ready when the
-    flush has completed and the stream can accept more writes.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Request to flush buffered output. This function never blocks.

-

This tells the output-stream that the caller intends any buffered -output to be flushed. the output which is expected to be flushed -is all that has been passed to write prior to this call.

-

Upon calling this function, the output-stream will not accept any -writes (check-write will return ok(0)) until the flush has -completed. The subscribe pollable will become ready when the -flush has completed and the stream can accept more writes.

-

Raises: Err(StreamError)

-
-
-def splice(self,
src: InputStream,
len: int) ‑> int
-
-
-
- -Expand source code - -
def splice(self, src: InputStream, len: int) -> int:
-    """
-    Read from one stream and write to another.
-    
-    The behavior of splice is equivelant to:
-    1. calling `check-write` on the `output-stream`
-    2. calling `read` on the `input-stream` with the smaller of the
-    `check-write` permitted length and the `len` provided to `splice`
-    3. calling `write` on the `output-stream` with that read data.
-    
-    Any error reported by the call to `check-write`, `read`, or
-    `write` ends the splice and reports that error.
-    
-    This function returns the number of bytes transferred; it may be less
-    than `len`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Read from one stream and write to another.

-

The behavior of splice is equivelant to: -1. calling check-write on the output-stream -2. calling read on the input-stream with the smaller of the -check-write permitted length and the len provided to splice -3. calling write on the output-stream with that read data.

-

Any error reported by the call to check-write, read, or -write ends the splice and reports that error.

-

This function returns the number of bytes transferred; it may be less -than len.

-

Raises: Err(StreamError)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the output-stream
-    is ready for more writing, or an error has occured. When this
-    pollable is ready, `check-write` will return `ok(n)` with n>0, or an
-    error.
-    
-    If the stream is closed, this pollable is always ready immediately.
-    
-    The created `pollable` is a child resource of the `output-stream`.
-    Implementations may trap if the `output-stream` is dropped before
-    all derived `pollable`s created with this function are dropped.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the output-stream -is ready for more writing, or an error has occured. When this -pollable is ready, check-write will return ok(n) with n>0, or an -error.

-

If the stream is closed, this pollable is always ready immediately.

-

The created pollable is a child resource of the output-stream. -Implementations may trap if the output-stream is dropped before -all derived pollables created with this function are dropped.

-
-
-def write(self, contents: bytes) ‑> None -
-
-
- -Expand source code - -
def write(self, contents: bytes) -> None:
-    """
-    Perform a write. This function never blocks.
-    
-    When the destination of a `write` is binary data, the bytes from
-    `contents` are written verbatim. When the destination of a `write` is
-    known to the implementation to be text, the bytes of `contents` are
-    transcoded from UTF-8 into the encoding of the destination and then
-    written.
-    
-    Precondition: check-write gave permit of Ok(n) and contents has a
-    length of less than or equal to n. Otherwise, this function will trap.
-    
-    returns Err(closed) without writing if the stream has closed since
-    the last call to check-write provided a permit.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Perform a write. This function never blocks.

-

When the destination of a write is binary data, the bytes from -contents are written verbatim. When the destination of a write is -known to the implementation to be text, the bytes of contents are -transcoded from UTF-8 into the encoding of the destination and then -written.

-

Precondition: check-write gave permit of Ok(n) and contents has a -length of less than or equal to n. Otherwise, this function will trap.

-

returns Err(closed) without writing if the stream has closed since -the last call to check-write provided a permit.

-

Raises: Err(StreamError)

-
-
-def write_zeroes(self, len: int) ‑> None -
-
-
- -Expand source code - -
def write_zeroes(self, len: int) -> None:
-    """
-    Write zeroes to a stream.
-    
-    This should be used precisely like `write` with the exact same
-    preconditions (must use check-write first), but instead of
-    passing a list of bytes, you simply pass the number of zero-bytes
-    that should be written.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-

Write zeroes to a stream.

-

This should be used precisely like write with the exact same -preconditions (must use check-write first), but instead of -passing a list of bytes, you simply pass the number of zero-bytes -that should be written.

-

Raises: Err(StreamError)

-
-
-
-
-class StreamError_Closed -
-
-
- -Expand source code - -
@dataclass
-class StreamError_Closed:
-    pass
-
-

StreamError_Closed()

-
-
-class StreamError_LastOperationFailed -(value: Error) -
-
-
- -Expand source code - -
@dataclass
-class StreamError_LastOperationFailed:
-    value: error.Error
-
-

StreamError_LastOperationFailed(value: spin_sdk.wit.imports.error.Error)

-

Instance variables

-
-
var valueError
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/types.html b/docs/v3/wit/imports/types.html deleted file mode 100644 index 498c3aa..0000000 --- a/docs/v3/wit/imports/types.html +++ /dev/null @@ -1,3397 +0,0 @@ - - - - - - -spin_sdk.wit.imports.types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.types

-
-
-

This interface defines all of the types and methods for implementing -HTTP Requests and Responses, both incoming and outgoing, as well as -their headers, trailers, and bodies.

-
-
-
-
-

Global variables

-
-
var ErrorCode
-
- -
-
var HeaderError
-
-

This type enumerates the different kinds of errors that may occur when -setting or appending to a fields resource.

-
-
var Method
-
-

This type corresponds to HTTP standard Methods.

-
-
var Scheme
-
-

This type corresponds to HTTP standard Related Schemes.

-
-
-
-
-

Functions

-
-
-def http_error_code(err: Error) ‑> ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError | None -
-
-
- -Expand source code - -
def http_error_code(err: error.Error) -> Optional[ErrorCode]:
-    """
-    Attempts to extract a http-related `error` from the wasi:io `error`
-    provided.
-    
-    Stream operations which return
-    `wasi:io/stream/stream-error::last-operation-failed` have a payload of
-    type `wasi:io/error/error` with more information about the operation
-    that failed. This payload can be passed through to this function to see
-    if there's http-related information about the error to return.
-    
-    Note that this function is fallible because not all io-errors are
-    http-related errors.
-    """
-    raise NotImplementedError
-
-

Attempts to extract a http-related error from the wasi:io error -provided.

-

Stream operations which return -wasi:io/stream/stream-error::last-operation-failed have a payload of -type wasi:io/error/error with more information about the operation -that failed. This payload can be passed through to this function to see -if there's http-related information about the error to return.

-

Note that this function is fallible because not all io-errors are -http-related errors.

-
-
-
-
-

Classes

-
-
-class DnsErrorPayload -(rcode: str | None, info_code: int | None) -
-
-
- -Expand source code - -
@dataclass
-class DnsErrorPayload:
-    """
-    Defines the case payload type for `DNS-error` above:
-    """
-    rcode: Optional[str]
-    info_code: Optional[int]
-
-

Defines the case payload type for DNS-error above:

-

Instance variables

-
-
var info_code : int | None
-
-
-
-
var rcode : str | None
-
-
-
-
-
-
-class ErrorCode_ConfigurationError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConfigurationError:
-    pass
-
-

ErrorCode_ConfigurationError()

-
-
-class ErrorCode_ConnectionLimitReached -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionLimitReached:
-    pass
-
-

ErrorCode_ConnectionLimitReached()

-
-
-class ErrorCode_ConnectionReadTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionReadTimeout:
-    pass
-
-

ErrorCode_ConnectionReadTimeout()

-
-
-class ErrorCode_ConnectionRefused -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionRefused:
-    pass
-
-

ErrorCode_ConnectionRefused()

-
-
-class ErrorCode_ConnectionTerminated -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionTerminated:
-    pass
-
-

ErrorCode_ConnectionTerminated()

-
-
-class ErrorCode_ConnectionTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionTimeout:
-    pass
-
-

ErrorCode_ConnectionTimeout()

-
-
-class ErrorCode_ConnectionWriteTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionWriteTimeout:
-    pass
-
-

ErrorCode_ConnectionWriteTimeout()

-
-
-class ErrorCode_DestinationIpProhibited -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationIpProhibited:
-    pass
-
-

ErrorCode_DestinationIpProhibited()

-
-
-class ErrorCode_DestinationIpUnroutable -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationIpUnroutable:
-    pass
-
-

ErrorCode_DestinationIpUnroutable()

-
-
-class ErrorCode_DestinationNotFound -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationNotFound:
-    pass
-
-

ErrorCode_DestinationNotFound()

-
-
-class ErrorCode_DestinationUnavailable -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationUnavailable:
-    pass
-
-

ErrorCode_DestinationUnavailable()

-
-
-class ErrorCode_DnsError -(value: DnsErrorPayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DnsError:
-    value: DnsErrorPayload
-
-

ErrorCode_DnsError(value: spin_sdk.wit.imports.types.DnsErrorPayload)

-

Instance variables

-
-
var valueDnsErrorPayload
-
-
-
-
-
-
-class ErrorCode_DnsTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DnsTimeout:
-    pass
-
-

ErrorCode_DnsTimeout()

-
-
-class ErrorCode_HttpProtocolError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpProtocolError:
-    pass
-
-

ErrorCode_HttpProtocolError()

-
-
-class ErrorCode_HttpRequestBodySize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestBodySize:
-    value: Optional[int]
-
-

ErrorCode_HttpRequestBodySize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestDenied -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestDenied:
-    pass
-
-

ErrorCode_HttpRequestDenied()

-
-
-class ErrorCode_HttpRequestHeaderSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestHeaderSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpRequestHeaderSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestHeaderSize -(value: FieldSizePayload | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestHeaderSize:
-    value: Optional[FieldSizePayload]
-
-

ErrorCode_HttpRequestHeaderSize(value: Optional[spin_sdk.wit.imports.types.FieldSizePayload])

-

Instance variables

-
-
var valueFieldSizePayload | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestLengthRequired -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestLengthRequired:
-    pass
-
-

ErrorCode_HttpRequestLengthRequired()

-
-
-class ErrorCode_HttpRequestMethodInvalid -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestMethodInvalid:
-    pass
-
-

ErrorCode_HttpRequestMethodInvalid()

-
-
-class ErrorCode_HttpRequestTrailerSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestTrailerSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpRequestTrailerSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestTrailerSize -(value: FieldSizePayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestTrailerSize:
-    value: FieldSizePayload
-
-

ErrorCode_HttpRequestTrailerSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

-

Instance variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCode_HttpRequestUriInvalid -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestUriInvalid:
-    pass
-
-

ErrorCode_HttpRequestUriInvalid()

-
-
-class ErrorCode_HttpRequestUriTooLong -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestUriTooLong:
-    pass
-
-

ErrorCode_HttpRequestUriTooLong()

-
-
-class ErrorCode_HttpResponseBodySize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseBodySize:
-    value: Optional[int]
-
-

ErrorCode_HttpResponseBodySize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseContentCoding -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseContentCoding:
-    value: Optional[str]
-
-

ErrorCode_HttpResponseContentCoding(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseHeaderSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseHeaderSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpResponseHeaderSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseHeaderSize -(value: FieldSizePayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseHeaderSize:
-    value: FieldSizePayload
-
-

ErrorCode_HttpResponseHeaderSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

-

Instance variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCode_HttpResponseIncomplete -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseIncomplete:
-    pass
-
-

ErrorCode_HttpResponseIncomplete()

-
-
-class ErrorCode_HttpResponseTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTimeout:
-    pass
-
-

ErrorCode_HttpResponseTimeout()

-
-
-class ErrorCode_HttpResponseTrailerSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTrailerSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpResponseTrailerSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseTrailerSize -(value: FieldSizePayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTrailerSize:
-    value: FieldSizePayload
-
-

ErrorCode_HttpResponseTrailerSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

-

Instance variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCode_HttpResponseTransferCoding -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTransferCoding:
-    value: Optional[str]
-
-

ErrorCode_HttpResponseTransferCoding(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_HttpUpgradeFailed -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpUpgradeFailed:
-    pass
-
-

ErrorCode_HttpUpgradeFailed()

-
-
-class ErrorCode_InternalError -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_InternalError:
-    value: Optional[str]
-
-

ErrorCode_InternalError(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_LoopDetected -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_LoopDetected:
-    pass
-
-

ErrorCode_LoopDetected()

-
-
-class ErrorCode_TlsAlertReceived -(value: TlsAlertReceivedPayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TlsAlertReceived:
-    value: TlsAlertReceivedPayload
-
-

ErrorCode_TlsAlertReceived(value: spin_sdk.wit.imports.types.TlsAlertReceivedPayload)

-

Instance variables

-
-
var valueTlsAlertReceivedPayload
-
-
-
-
-
-
-class ErrorCode_TlsCertificateError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TlsCertificateError:
-    pass
-
-

ErrorCode_TlsCertificateError()

-
-
-class ErrorCode_TlsProtocolError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TlsProtocolError:
-    pass
-
-

ErrorCode_TlsProtocolError()

-
-
-class FieldSizePayload -(field_name: str | None, field_size: int | None) -
-
-
- -Expand source code - -
@dataclass
-class FieldSizePayload:
-    """
-    Defines the case payload type for `HTTP-response-{header,trailer}-size` above:
-    """
-    field_name: Optional[str]
-    field_size: Optional[int]
-
-

Defines the case payload type for HTTP-response-{header,trailer}-size above:

-

Instance variables

-
-
var field_name : str | None
-
-
-
-
var field_size : int | None
-
-
-
-
-
-
-class Fields -
-
-
- -Expand source code - -
class Fields:
-    """
-    This following block defines the `fields` resource which corresponds to
-    HTTP standard Fields. Fields are a common representation used for both
-    Headers and Trailers.
-    
-    A `fields` may be mutable or immutable. A `fields` created using the
-    constructor, `from-list`, or `clone` will be mutable, but a `fields`
-    resource given by other means (including, but not limited to,
-    `incoming-request.headers`, `outgoing-request.headers`) might be be
-    immutable. In an immutable fields, the `set`, `append`, and `delete`
-    operations will fail with `header-error.immutable`.
-    """
-    
-    def __init__(self) -> None:
-        """
-        Construct an empty HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def from_list(cls, entries: List[Tuple[str, bytes]]) -> Self:
-        """
-        Construct an HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        
-        The list represents each key-value pair in the Fields. Keys
-        which have multiple values are represented by multiple entries in this
-        list with the same key.
-        
-        The tuple is a pair of the field key, represented as a string, and
-        Value, represented as a list of bytes. In a valid Fields, all keys
-        and values are valid UTF-8 strings. However, values are not always
-        well-formed, so they are represented as a raw list of bytes.
-        
-        An error result will be returned if any header or value was
-        syntactically invalid, or if a header was forbidden.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-    def get(self, name: str) -> List[bytes]:
-        """
-        Get all of the values corresponding to a key. If the key is not present
-        in this `fields`, an empty list is returned. However, if the key is
-        present but empty, this is represented by a list with one or more
-        empty field-values present.
-        """
-        raise NotImplementedError
-    def has(self, name: str) -> bool:
-        """
-        Returns `true` when the key is present in this `fields`. If the key is
-        syntactically invalid, `false` is returned.
-        """
-        raise NotImplementedError
-    def set(self, name: str, value: List[bytes]) -> None:
-        """
-        Set all of the values for a key. Clears any existing values for that
-        key, if they have been set.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-    def delete(self, name: str) -> None:
-        """
-        Delete all values for a key. Does nothing if no values for the key
-        exist.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-    def append(self, name: str, value: bytes) -> None:
-        """
-        Append a value for a key. Does not change or delete any existing
-        values for that key.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-    def entries(self) -> List[Tuple[str, bytes]]:
-        """
-        Retrieve the full set of keys and values in the Fields. Like the
-        constructor, the list represents each key-value pair.
-        
-        The outer list represents each key-value pair in the Fields. Keys
-        which have multiple values are represented by multiple entries in this
-        list with the same key.
-        """
-        raise NotImplementedError
-    def clone(self) -> Self:
-        """
-        Make a deep copy of the Fields. Equivelant in behavior to calling the
-        `fields` constructor on the return value of `entries`. The resulting
-        `fields` is mutable.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

This following block defines the fields resource which corresponds to -HTTP standard Fields. Fields are a common representation used for both -Headers and Trailers.

-

A fields may be mutable or immutable. A fields created using the -constructor, from-list, or clone will be mutable, but a fields -resource given by other means (including, but not limited to, -incoming-request.headers, outgoing-request.headers) might be be -immutable. In an immutable fields, the set, append, and delete -operations will fail with header-error.immutable.

-

Construct an empty HTTP Fields.

-

The resulting fields is mutable.

-

Static methods

-
-
-def from_list(entries: List[Tuple[str, bytes]]) ‑> Self -
-
-

Construct an HTTP Fields.

-

The resulting fields is mutable.

-

The list represents each key-value pair in the Fields. Keys -which have multiple values are represented by multiple entries in this -list with the same key.

-

The tuple is a pair of the field key, represented as a string, and -Value, represented as a list of bytes. In a valid Fields, all keys -and values are valid UTF-8 strings. However, values are not always -well-formed, so they are represented as a raw list of bytes.

-

An error result will be returned if any header or value was -syntactically invalid, or if a header was forbidden.

-

Raises: Err(HeaderError)

-
-
-

Methods

-
-
-def append(self, name: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
def append(self, name: str, value: bytes) -> None:
-    """
-    Append a value for a key. Does not change or delete any existing
-    values for that key.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Append a value for a key. Does not change or delete any existing -values for that key.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: Err(HeaderError)

-
-
-def clone(self) ‑> Self -
-
-
- -Expand source code - -
def clone(self) -> Self:
-    """
-    Make a deep copy of the Fields. Equivelant in behavior to calling the
-    `fields` constructor on the return value of `entries`. The resulting
-    `fields` is mutable.
-    """
-    raise NotImplementedError
-
-

Make a deep copy of the Fields. Equivelant in behavior to calling the -fields constructor on the return value of entries. The resulting -fields is mutable.

-
-
-def delete(self, name: str) ‑> None -
-
-
- -Expand source code - -
def delete(self, name: str) -> None:
-    """
-    Delete all values for a key. Does nothing if no values for the key
-    exist.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Delete all values for a key. Does nothing if no values for the key -exist.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: Err(HeaderError)

-
-
-def entries(self) ‑> List[Tuple[str, bytes]] -
-
-
- -Expand source code - -
def entries(self) -> List[Tuple[str, bytes]]:
-    """
-    Retrieve the full set of keys and values in the Fields. Like the
-    constructor, the list represents each key-value pair.
-    
-    The outer list represents each key-value pair in the Fields. Keys
-    which have multiple values are represented by multiple entries in this
-    list with the same key.
-    """
-    raise NotImplementedError
-
-

Retrieve the full set of keys and values in the Fields. Like the -constructor, the list represents each key-value pair.

-

The outer list represents each key-value pair in the Fields. Keys -which have multiple values are represented by multiple entries in this -list with the same key.

-
-
-def get(self, name: str) ‑> List[bytes] -
-
-
- -Expand source code - -
def get(self, name: str) -> List[bytes]:
-    """
-    Get all of the values corresponding to a key. If the key is not present
-    in this `fields`, an empty list is returned. However, if the key is
-    present but empty, this is represented by a list with one or more
-    empty field-values present.
-    """
-    raise NotImplementedError
-
-

Get all of the values corresponding to a key. If the key is not present -in this fields, an empty list is returned. However, if the key is -present but empty, this is represented by a list with one or more -empty field-values present.

-
-
-def has(self, name: str) ‑> bool -
-
-
- -Expand source code - -
def has(self, name: str) -> bool:
-    """
-    Returns `true` when the key is present in this `fields`. If the key is
-    syntactically invalid, `false` is returned.
-    """
-    raise NotImplementedError
-
-

Returns true when the key is present in this fields. If the key is -syntactically invalid, false is returned.

-
-
-def set(self, name: str, value: List[bytes]) ‑> None -
-
-
- -Expand source code - -
def set(self, name: str, value: List[bytes]) -> None:
-    """
-    Set all of the values for a key. Clears any existing values for that
-    key, if they have been set.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Set all of the values for a key. Clears any existing values for that -key, if they have been set.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: Err(HeaderError)

-
-
-
-
-class FutureIncomingResponse -
-
-
- -Expand source code - -
class FutureIncomingResponse:
-    """
-    Represents a future which may eventaully return an incoming HTTP
-    Response, or an error.
-    
-    This resource is returned by the `wasi:http/outgoing-handler` interface to
-    provide the HTTP Response corresponding to the sent Request.
-    """
-    
-    def subscribe(self) -> poll.Pollable:
-        """
-        Returns a pollable which becomes ready when either the Response has
-        been received, or an error has occured. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-    def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
-        """
-        Returns the incoming HTTP Response, or an error, once one is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the response or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the incoming HTTP Response
-        status and headers have recieved successfully, or that an error
-        occured. Errors may also occur while consuming the response body,
-        but those will be reported by the `incoming-body` and its
-        `output-stream` child.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents a future which may eventaully return an incoming HTTP -Response, or an error.

-

This resource is returned by the wasi:http/outgoing-handler interface to -provide the HTTP Response corresponding to the sent Request.

-

Methods

-
-
-def get(self) ‑> Ok[Ok[IncomingResponse] | Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]] | Err[None] | None -
-
-
- -Expand source code - -
def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
-    """
-    Returns the incoming HTTP Response, or an error, once one is ready.
-    
-    The outer `option` represents future readiness. Users can wait on this
-    `option` to become `some` using the `subscribe` method.
-    
-    The outer `result` is used to retrieve the response or error at most
-    once. It will be success on the first call in which the outer option
-    is `some`, and error on subsequent calls.
-    
-    The inner `result` represents that either the incoming HTTP Response
-    status and headers have recieved successfully, or that an error
-    occured. Errors may also occur while consuming the response body,
-    but those will be reported by the `incoming-body` and its
-    `output-stream` child.
-    """
-    raise NotImplementedError
-
-

Returns the incoming HTTP Response, or an error, once one is ready.

-

The outer option represents future readiness. Users can wait on this -option to become some using the subscribe method.

-

The outer result is used to retrieve the response or error at most -once. It will be success on the first call in which the outer option -is some, and error on subsequent calls.

-

The inner result represents that either the incoming HTTP Response -status and headers have recieved successfully, or that an error -occured. Errors may also occur while consuming the response body, -but those will be reported by the incoming-body and its -output-stream child.

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> poll.Pollable:
-    """
-    Returns a pollable which becomes ready when either the Response has
-    been received, or an error has occured. When this pollable is ready,
-    the `get` method will return `some`.
-    """
-    raise NotImplementedError
-
-

Returns a pollable which becomes ready when either the Response has -been received, or an error has occured. When this pollable is ready, -the get method will return some.

-
-
-
-
-class FutureTrailers -
-
-
- -Expand source code - -
class FutureTrailers:
-    """
-    Represents a future which may eventaully return trailers, or an error.
-    
-    In the case that the incoming HTTP Request or Response did not have any
-    trailers, this future will resolve to the empty set of trailers once the
-    complete Request or Response body has been received.
-    """
-    
-    def subscribe(self) -> poll.Pollable:
-        """
-        Returns a pollable which becomes ready when either the trailers have
-        been received, or an error has occured. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-    def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
-        """
-        Returns the contents of the trailers, or an error which occured,
-        once the future is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the trailers or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the HTTP Request or Response
-        body, as well as any trailers, were received successfully, or that an
-        error occured receiving them. The optional `trailers` indicates whether
-        or not trailers were present in the body.
-        
-        When some `trailers` are returned by this method, the `trailers`
-        resource is immutable, and a child. Use of the `set`, `append`, or
-        `delete` methods will return an error, and the resource must be
-        dropped before the parent `future-trailers` is dropped.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents a future which may eventaully return trailers, or an error.

-

In the case that the incoming HTTP Request or Response did not have any -trailers, this future will resolve to the empty set of trailers once the -complete Request or Response body has been received.

-

Methods

-
-
-def get(self) ‑> Ok[Ok[Fields | None] | Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]] | Err[None] | None -
-
-
- -Expand source code - -
def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
-    """
-    Returns the contents of the trailers, or an error which occured,
-    once the future is ready.
-    
-    The outer `option` represents future readiness. Users can wait on this
-    `option` to become `some` using the `subscribe` method.
-    
-    The outer `result` is used to retrieve the trailers or error at most
-    once. It will be success on the first call in which the outer option
-    is `some`, and error on subsequent calls.
-    
-    The inner `result` represents that either the HTTP Request or Response
-    body, as well as any trailers, were received successfully, or that an
-    error occured receiving them. The optional `trailers` indicates whether
-    or not trailers were present in the body.
-    
-    When some `trailers` are returned by this method, the `trailers`
-    resource is immutable, and a child. Use of the `set`, `append`, or
-    `delete` methods will return an error, and the resource must be
-    dropped before the parent `future-trailers` is dropped.
-    """
-    raise NotImplementedError
-
-

Returns the contents of the trailers, or an error which occured, -once the future is ready.

-

The outer option represents future readiness. Users can wait on this -option to become some using the subscribe method.

-

The outer result is used to retrieve the trailers or error at most -once. It will be success on the first call in which the outer option -is some, and error on subsequent calls.

-

The inner result represents that either the HTTP Request or Response -body, as well as any trailers, were received successfully, or that an -error occured receiving them. The optional trailers indicates whether -or not trailers were present in the body.

-

When some trailers are returned by this method, the trailers -resource is immutable, and a child. Use of the set, append, or -delete methods will return an error, and the resource must be -dropped before the parent future-trailers is dropped.

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> poll.Pollable:
-    """
-    Returns a pollable which becomes ready when either the trailers have
-    been received, or an error has occured. When this pollable is ready,
-    the `get` method will return `some`.
-    """
-    raise NotImplementedError
-
-

Returns a pollable which becomes ready when either the trailers have -been received, or an error has occured. When this pollable is ready, -the get method will return some.

-
-
-
-
-class HeaderError_Forbidden -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_Forbidden:
-    pass
-
-

HeaderError_Forbidden()

-
-
-class HeaderError_Immutable -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_Immutable:
-    pass
-
-

HeaderError_Immutable()

-
-
-class HeaderError_InvalidSyntax -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_InvalidSyntax:
-    pass
-
-

HeaderError_InvalidSyntax()

-
-
-class IncomingBody -
-
-
- -Expand source code - -
class IncomingBody:
-    """
-    Represents an incoming HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, indicating that the full contents of the
-    body have been received. This resource represents the contents as
-    an `input-stream` and the delivery of trailers as a `future-trailers`,
-    and ensures that the user of this interface may only be consuming either
-    the body contents or waiting on trailers at any given time.
-    """
-    
-    def stream(self) -> streams.InputStream:
-        """
-        Returns the contents of the body, as a stream of bytes.
-        
-        Returns success on first call: the stream representing the contents
-        can be retrieved at most once. Subsequent calls will return error.
-        
-        The returned `input-stream` resource is a child: it must be dropped
-        before the parent `incoming-body` is dropped, or consumed by
-        `incoming-body.finish`.
-        
-        This invariant ensures that the implementation can determine whether
-        the user is consuming the contents of the body, waiting on the
-        `future-trailers` to be ready, or neither. This allows for network
-        backpressure is to be applied when the user is consuming the body,
-        and for that backpressure to not inhibit delivery of the trailers if
-        the user does not read the entire body.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    @classmethod
-    def finish(cls, this: Self) -> FutureTrailers:
-        """
-        Takes ownership of `incoming-body`, and returns a `future-trailers`.
-        This function will trap if the `input-stream` child is still alive.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an incoming HTTP Request or Response's Body.

-

A body has both its contents - a stream of bytes - and a (possibly -empty) set of trailers, indicating that the full contents of the -body have been received. This resource represents the contents as -an input-stream and the delivery of trailers as a future-trailers, -and ensures that the user of this interface may only be consuming either -the body contents or waiting on trailers at any given time.

-

Static methods

-
-
-def finish(this: Self) ‑> FutureTrailers -
-
-

Takes ownership of incoming-body, and returns a future-trailers. -This function will trap if the input-stream child is still alive.

-
-
-

Methods

-
-
-def stream(self) ‑> InputStream -
-
-
- -Expand source code - -
def stream(self) -> streams.InputStream:
-    """
-    Returns the contents of the body, as a stream of bytes.
-    
-    Returns success on first call: the stream representing the contents
-    can be retrieved at most once. Subsequent calls will return error.
-    
-    The returned `input-stream` resource is a child: it must be dropped
-    before the parent `incoming-body` is dropped, or consumed by
-    `incoming-body.finish`.
-    
-    This invariant ensures that the implementation can determine whether
-    the user is consuming the contents of the body, waiting on the
-    `future-trailers` to be ready, or neither. This allows for network
-    backpressure is to be applied when the user is consuming the body,
-    and for that backpressure to not inhibit delivery of the trailers if
-    the user does not read the entire body.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns the contents of the body, as a stream of bytes.

-

Returns success on first call: the stream representing the contents -can be retrieved at most once. Subsequent calls will return error.

-

The returned input-stream resource is a child: it must be dropped -before the parent incoming-body is dropped, or consumed by -incoming-body.finish.

-

This invariant ensures that the implementation can determine whether -the user is consuming the contents of the body, waiting on the -future-trailers to be ready, or neither. This allows for network -backpressure is to be applied when the user is consuming the body, -and for that backpressure to not inhibit delivery of the trailers if -the user does not read the entire body.

-

Raises: Err(None)

-
-
-
-
-class IncomingRequest -
-
-
- -Expand source code - -
class IncomingRequest:
-    """
-    Represents an incoming HTTP Request.
-    """
-    
-    def method(self) -> Method:
-        """
-        Returns the method of the incoming request.
-        """
-        raise NotImplementedError
-    def path_with_query(self) -> Optional[str]:
-        """
-        Returns the path with query parameters from the request, as a string.
-        """
-        raise NotImplementedError
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Returns the protocol scheme from the request.
-        """
-        raise NotImplementedError
-    def authority(self) -> Optional[str]:
-        """
-        Returns the authority from the request, if it was present.
-        """
-        raise NotImplementedError
-    def headers(self) -> Fields:
-        """
-        Get the `headers` associated with the request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        The `headers` returned are a child resource: it must be dropped before
-        the parent `incoming-request` is dropped. Dropping this
-        `incoming-request` before all children are dropped will trap.
-        """
-        raise NotImplementedError
-    def consume(self) -> IncomingBody:
-        """
-        Gives the `incoming-body` associated with this request. Will only
-        return success at most once, and subsequent calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an incoming HTTP Request.

-

Methods

-
-
-def authority(self) ‑> str | None -
-
-
- -Expand source code - -
def authority(self) -> Optional[str]:
-    """
-    Returns the authority from the request, if it was present.
-    """
-    raise NotImplementedError
-
-

Returns the authority from the request, if it was present.

-
-
-def consume(self) ‑> IncomingBody -
-
-
- -Expand source code - -
def consume(self) -> IncomingBody:
-    """
-    Gives the `incoming-body` associated with this request. Will only
-    return success at most once, and subsequent calls will return error.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Gives the incoming-body associated with this request. Will only -return success at most once, and subsequent calls will return error.

-

Raises: Err(None)

-
-
-def headers(self) ‑> Fields -
-
-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the `headers` associated with the request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    The `headers` returned are a child resource: it must be dropped before
-    the parent `incoming-request` is dropped. Dropping this
-    `incoming-request` before all children are dropped will trap.
-    """
-    raise NotImplementedError
-
-

Get the headers associated with the request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

The headers returned are a child resource: it must be dropped before -the parent incoming-request is dropped. Dropping this -incoming-request before all children are dropped will trap.

-
-
-def method(self) ‑> Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other -
-
-
- -Expand source code - -
def method(self) -> Method:
-    """
-    Returns the method of the incoming request.
-    """
-    raise NotImplementedError
-
-

Returns the method of the incoming request.

-
-
-def path_with_query(self) ‑> str | None -
-
-
- -Expand source code - -
def path_with_query(self) -> Optional[str]:
-    """
-    Returns the path with query parameters from the request, as a string.
-    """
-    raise NotImplementedError
-
-

Returns the path with query parameters from the request, as a string.

-
-
-def scheme(self) ‑> Scheme_Http | Scheme_Https | Scheme_Other | None -
-
-
- -Expand source code - -
def scheme(self) -> Optional[Scheme]:
-    """
-    Returns the protocol scheme from the request.
-    """
-    raise NotImplementedError
-
-

Returns the protocol scheme from the request.

-
-
-
-
-class IncomingResponse -
-
-
- -Expand source code - -
class IncomingResponse:
-    """
-    Represents an incoming HTTP Response.
-    """
-    
-    def status(self) -> int:
-        """
-        Returns the status code from the incoming response.
-        """
-        raise NotImplementedError
-    def headers(self) -> Fields:
-        """
-        Returns the headers from the incoming response.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `incoming-response` is dropped.
-        """
-        raise NotImplementedError
-    def consume(self) -> IncomingBody:
-        """
-        Returns the incoming body. May be called at most once. Returns error
-        if called additional times.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an incoming HTTP Response.

-

Methods

-
-
-def consume(self) ‑> IncomingBody -
-
-
- -Expand source code - -
def consume(self) -> IncomingBody:
-    """
-    Returns the incoming body. May be called at most once. Returns error
-    if called additional times.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns the incoming body. May be called at most once. Returns error -if called additional times.

-

Raises: Err(None)

-
-
-def headers(self) ‑> Fields -
-
-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Returns the headers from the incoming response.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `incoming-response` is dropped.
-    """
-    raise NotImplementedError
-
-

Returns the headers from the incoming response.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -incoming-response is dropped.

-
-
-def status(self) ‑> int -
-
-
- -Expand source code - -
def status(self) -> int:
-    """
-    Returns the status code from the incoming response.
-    """
-    raise NotImplementedError
-
-

Returns the status code from the incoming response.

-
-
-
-
-class Method_Connect -
-
-
- -Expand source code - -
@dataclass
-class Method_Connect:
-    pass
-
-

Method_Connect()

-
-
-class Method_Delete -
-
-
- -Expand source code - -
@dataclass
-class Method_Delete:
-    pass
-
-

Method_Delete()

-
-
-class Method_Get -
-
-
- -Expand source code - -
@dataclass
-class Method_Get:
-    pass
-
-

Method_Get()

-
-
-class Method_Head -
-
-
- -Expand source code - -
@dataclass
-class Method_Head:
-    pass
-
-

Method_Head()

-
-
-class Method_Options -
-
-
- -Expand source code - -
@dataclass
-class Method_Options:
-    pass
-
-

Method_Options()

-
-
-class Method_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Method_Other:
-    value: str
-
-

Method_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Method_Patch -
-
-
- -Expand source code - -
@dataclass
-class Method_Patch:
-    pass
-
-

Method_Patch()

-
-
-class Method_Post -
-
-
- -Expand source code - -
@dataclass
-class Method_Post:
-    pass
-
-

Method_Post()

-
-
-class Method_Put -
-
-
- -Expand source code - -
@dataclass
-class Method_Put:
-    pass
-
-

Method_Put()

-
-
-class Method_Trace -
-
-
- -Expand source code - -
@dataclass
-class Method_Trace:
-    pass
-
-

Method_Trace()

-
-
-class OutgoingBody -
-
-
- -Expand source code - -
class OutgoingBody:
-    """
-    Represents an outgoing HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, inducating the full contents of the body
-    have been sent. This resource represents the contents as an
-    `output-stream` child resource, and the completion of the body (with
-    optional trailers) with a static function that consumes the
-    `outgoing-body` resource, and ensures that the user of this interface
-    may not write to the body contents after the body has been finished.
-    
-    If the user code drops this resource, as opposed to calling the static
-    method `finish`, the implementation should treat the body as incomplete,
-    and that an error has occured. The implementation should propogate this
-    error to the HTTP protocol by whatever means it has available,
-    including: corrupting the body on the wire, aborting the associated
-    Request, or sending a late status code for the Response.
-    """
-    
-    def write(self) -> streams.OutputStream:
-        """
-        Returns a stream for writing the body contents.
-        
-        The returned `output-stream` is a child resource: it must be dropped
-        before the parent `outgoing-body` resource is dropped (or finished),
-        otherwise the `outgoing-body` drop or `finish` will trap.
-        
-        Returns success on the first call: the `output-stream` resource for
-        this `outgoing-body` may be retrieved at most once. Subsequent calls
-        will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    @classmethod
-    def finish(cls, this: Self, trailers: Optional[Fields]) -> None:
-        """
-        Finalize an outgoing body, optionally providing trailers. This must be
-        called to signal that the response is complete. If the `outgoing-body`
-        is dropped without calling `outgoing-body.finalize`, the implementation
-        should treat the body as corrupted.
-        
-        Fails if the body's `outgoing-request` or `outgoing-response` was
-        constructed with a Content-Length header, and the contents written
-        to the body (via `write`) does not match the value given in the
-        Content-Length.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an outgoing HTTP Request or Response's Body.

-

A body has both its contents - a stream of bytes - and a (possibly -empty) set of trailers, inducating the full contents of the body -have been sent. This resource represents the contents as an -output-stream child resource, and the completion of the body (with -optional trailers) with a static function that consumes the -outgoing-body resource, and ensures that the user of this interface -may not write to the body contents after the body has been finished.

-

If the user code drops this resource, as opposed to calling the static -method finish, the implementation should treat the body as incomplete, -and that an error has occured. The implementation should propogate this -error to the HTTP protocol by whatever means it has available, -including: corrupting the body on the wire, aborting the associated -Request, or sending a late status code for the Response.

-

Static methods

-
-
-def finish(this: Self,
trailers: Fields | None) ‑> None
-
-
-

Finalize an outgoing body, optionally providing trailers. This must be -called to signal that the response is complete. If the outgoing-body -is dropped without calling outgoing-body.finalize, the implementation -should treat the body as corrupted.

-

Fails if the body's outgoing-request or outgoing-response was -constructed with a Content-Length header, and the contents written -to the body (via write) does not match the value given in the -Content-Length.

-

Raises: Err(ErrorCode)

-
-
-

Methods

-
-
-def write(self) ‑> OutputStream -
-
-
- -Expand source code - -
def write(self) -> streams.OutputStream:
-    """
-    Returns a stream for writing the body contents.
-    
-    The returned `output-stream` is a child resource: it must be dropped
-    before the parent `outgoing-body` resource is dropped (or finished),
-    otherwise the `outgoing-body` drop or `finish` will trap.
-    
-    Returns success on the first call: the `output-stream` resource for
-    this `outgoing-body` may be retrieved at most once. Subsequent calls
-    will return error.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns a stream for writing the body contents.

-

The returned output-stream is a child resource: it must be dropped -before the parent outgoing-body resource is dropped (or finished), -otherwise the outgoing-body drop or finish will trap.

-

Returns success on the first call: the output-stream resource for -this outgoing-body may be retrieved at most once. Subsequent calls -will return error.

-

Raises: Err(None)

-
-
-
-
-class OutgoingRequest -(headers: Fields) -
-
-
- -Expand source code - -
class OutgoingRequest:
-    """
-    Represents an outgoing HTTP Request.
-    """
-    
-    def __init__(self, headers: Fields) -> None:
-        """
-        Construct a new `outgoing-request` with a default `method` of `GET`, and
-        `none` values for `path-with-query`, `scheme`, and `authority`.
-        
-        * `headers` is the HTTP Headers for the Request.
-        
-        It is possible to construct, or manipulate with the accessor functions
-        below, an `outgoing-request` with an invalid combination of `scheme`
-        and `authority`, or `headers` which are not permitted to be sent.
-        It is the obligation of the `outgoing-handler.handle` implementation
-        to reject invalid constructions of `outgoing-request`.
-        """
-        raise NotImplementedError
-
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this
-        Request.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-request` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    def method(self) -> Method:
-        """
-        Get the Method for the Request.
-        """
-        raise NotImplementedError
-    def set_method(self, method: Method) -> None:
-        """
-        Set the Method for the Request. Fails if the string present in a
-        `method.other` argument is not a syntactically valid method.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    def path_with_query(self) -> Optional[str]:
-        """
-        Get the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query.
-        """
-        raise NotImplementedError
-    def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-        """
-        Set the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query. Fails is the
-        string given is not a syntactically valid path and query uri component.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Get the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme.
-        """
-        raise NotImplementedError
-    def set_scheme(self, scheme: Optional[Scheme]) -> None:
-        """
-        Set the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme. Fails if the
-        string given is not a syntactically valid uri scheme.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    def authority(self) -> Optional[str]:
-        """
-        Get the HTTP Authority for the Request. A value of `none` may be used
-        with Related Schemes which do not require an Authority. The HTTP and
-        HTTPS schemes always require an authority.
-        """
-        raise NotImplementedError
-    def set_authority(self, authority: Optional[str]) -> None:
-        """
-        Set the HTTP Authority for the Request. A value of `none` may be used
-        with Related Schemes which do not require an Authority. The HTTP and
-        HTTPS schemes always require an authority. Fails if the string given is
-        not a syntactically valid uri authority.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transfered to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an outgoing HTTP Request.

-

Construct a new outgoing-request with a default method of GET, and -none values for path-with-query, scheme, and authority.

-
    -
  • headers is the HTTP Headers for the Request.
  • -
-

It is possible to construct, or manipulate with the accessor functions -below, an outgoing-request with an invalid combination of scheme -and authority, or headers which are not permitted to be sent. -It is the obligation of the outgoing-handler.handle implementation -to reject invalid constructions of outgoing-request.

-

Methods

-
-
-def authority(self) ‑> str | None -
-
-
- -Expand source code - -
def authority(self) -> Optional[str]:
-    """
-    Get the HTTP Authority for the Request. A value of `none` may be used
-    with Related Schemes which do not require an Authority. The HTTP and
-    HTTPS schemes always require an authority.
-    """
-    raise NotImplementedError
-
-

Get the HTTP Authority for the Request. A value of none may be used -with Related Schemes which do not require an Authority. The HTTP and -HTTPS schemes always require an authority.

-
-
-def body(self) ‑> OutgoingBody -
-
-
- -Expand source code - -
def body(self) -> OutgoingBody:
-    """
-    Returns the resource corresponding to the outgoing Body for this
-    Request.
-    
-    Returns success on the first call: the `outgoing-body` resource for
-    this `outgoing-request` can be retrieved at most once. Subsequent
-    calls will return error.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns the resource corresponding to the outgoing Body for this -Request.

-

Returns success on the first call: the outgoing-body resource for -this outgoing-request can be retrieved at most once. Subsequent -calls will return error.

-

Raises: Err(None)

-
-
-def headers(self) ‑> Fields -
-
-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the headers associated with the Request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `outgoing-request` is dropped, or its ownership is transfered to
-    another component by e.g. `outgoing-handler.handle`.
-    """
-    raise NotImplementedError
-
-

Get the headers associated with the Request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -outgoing-request is dropped, or its ownership is transfered to -another component by e.g. outgoing-handler.handle.

-
-
-def method(self) ‑> Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other -
-
-
- -Expand source code - -
def method(self) -> Method:
-    """
-    Get the Method for the Request.
-    """
-    raise NotImplementedError
-
-

Get the Method for the Request.

-
-
-def path_with_query(self) ‑> str | None -
-
-
- -Expand source code - -
def path_with_query(self) -> Optional[str]:
-    """
-    Get the combination of the HTTP Path and Query for the Request.
-    When `none`, this represents an empty Path and empty Query.
-    """
-    raise NotImplementedError
-
-

Get the combination of the HTTP Path and Query for the Request. -When none, this represents an empty Path and empty Query.

-
-
-def scheme(self) ‑> Scheme_Http | Scheme_Https | Scheme_Other | None -
-
-
- -Expand source code - -
def scheme(self) -> Optional[Scheme]:
-    """
-    Get the HTTP Related Scheme for the Request. When `none`, the
-    implementation may choose an appropriate default scheme.
-    """
-    raise NotImplementedError
-
-

Get the HTTP Related Scheme for the Request. When none, the -implementation may choose an appropriate default scheme.

-
-
-def set_authority(self, authority: str | None) ‑> None -
-
-
- -Expand source code - -
def set_authority(self, authority: Optional[str]) -> None:
-    """
-    Set the HTTP Authority for the Request. A value of `none` may be used
-    with Related Schemes which do not require an Authority. The HTTP and
-    HTTPS schemes always require an authority. Fails if the string given is
-    not a syntactically valid uri authority.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the HTTP Authority for the Request. A value of none may be used -with Related Schemes which do not require an Authority. The HTTP and -HTTPS schemes always require an authority. Fails if the string given is -not a syntactically valid uri authority.

-

Raises: Err(None)

-
-
-def set_method(self,
method: Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other) ‑> None
-
-
-
- -Expand source code - -
def set_method(self, method: Method) -> None:
-    """
-    Set the Method for the Request. Fails if the string present in a
-    `method.other` argument is not a syntactically valid method.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the Method for the Request. Fails if the string present in a -method.other argument is not a syntactically valid method.

-

Raises: Err(None)

-
-
-def set_path_with_query(self, path_with_query: str | None) ‑> None -
-
-
- -Expand source code - -
def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-    """
-    Set the combination of the HTTP Path and Query for the Request.
-    When `none`, this represents an empty Path and empty Query. Fails is the
-    string given is not a syntactically valid path and query uri component.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the combination of the HTTP Path and Query for the Request. -When none, this represents an empty Path and empty Query. Fails is the -string given is not a syntactically valid path and query uri component.

-

Raises: Err(None)

-
-
-def set_scheme(self,
scheme: Scheme_Http | Scheme_Https | Scheme_Other | None) ‑> None
-
-
-
- -Expand source code - -
def set_scheme(self, scheme: Optional[Scheme]) -> None:
-    """
-    Set the HTTP Related Scheme for the Request. When `none`, the
-    implementation may choose an appropriate default scheme. Fails if the
-    string given is not a syntactically valid uri scheme.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the HTTP Related Scheme for the Request. When none, the -implementation may choose an appropriate default scheme. Fails if the -string given is not a syntactically valid uri scheme.

-

Raises: Err(None)

-
-
-
-
-class OutgoingResponse -(headers: Fields) -
-
-
- -Expand source code - -
class OutgoingResponse:
-    """
-    Represents an outgoing HTTP Response.
-    """
-    
-    def __init__(self, headers: Fields) -> None:
-        """
-        Construct an `outgoing-response`, with a default `status-code` of `200`.
-        If a different `status-code` is needed, it must be set via the
-        `set-status-code` method.
-        
-        * `headers` is the HTTP Headers for the Response.
-        """
-        raise NotImplementedError
-
-    def status_code(self) -> int:
-        """
-        Get the HTTP Status Code for the Response.
-        """
-        raise NotImplementedError
-    def set_status_code(self, status_code: int) -> None:
-        """
-        Set the HTTP Status Code for the Response. Fails if the status-code
-        given is not a valid http status code.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transfered to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this Response.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-response` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an outgoing HTTP Response.

-

Construct an outgoing-response, with a default status-code of 200. -If a different status-code is needed, it must be set via the -set-status-code method.

-
    -
  • headers is the HTTP Headers for the Response.
  • -
-

Methods

-
-
-def body(self) ‑> OutgoingBody -
-
-
- -Expand source code - -
def body(self) -> OutgoingBody:
-    """
-    Returns the resource corresponding to the outgoing Body for this Response.
-    
-    Returns success on the first call: the `outgoing-body` resource for
-    this `outgoing-response` can be retrieved at most once. Subsequent
-    calls will return error.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns the resource corresponding to the outgoing Body for this Response.

-

Returns success on the first call: the outgoing-body resource for -this outgoing-response can be retrieved at most once. Subsequent -calls will return error.

-

Raises: Err(None)

-
-
-def headers(self) ‑> Fields -
-
-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the headers associated with the Request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `outgoing-request` is dropped, or its ownership is transfered to
-    another component by e.g. `outgoing-handler.handle`.
-    """
-    raise NotImplementedError
-
-

Get the headers associated with the Request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -outgoing-request is dropped, or its ownership is transfered to -another component by e.g. outgoing-handler.handle.

-
-
-def set_status_code(self, status_code: int) ‑> None -
-
-
- -Expand source code - -
def set_status_code(self, status_code: int) -> None:
-    """
-    Set the HTTP Status Code for the Response. Fails if the status-code
-    given is not a valid http status code.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the HTTP Status Code for the Response. Fails if the status-code -given is not a valid http status code.

-

Raises: Err(None)

-
-
-def status_code(self) ‑> int -
-
-
- -Expand source code - -
def status_code(self) -> int:
-    """
-    Get the HTTP Status Code for the Response.
-    """
-    raise NotImplementedError
-
-

Get the HTTP Status Code for the Response.

-
-
-
-
-class RequestOptions -
-
-
- -Expand source code - -
class RequestOptions:
-    """
-    Parameters for making an HTTP Request. Each of these parameters is
-    currently an optional timeout applicable to the transport layer of the
-    HTTP protocol.
-    
-    These timeouts are separate from any the user may use to bound a
-    blocking call to `wasi:io/poll.poll`.
-    """
-    
-    def __init__(self) -> None:
-        """
-        Construct a default `request-options` value.
-        """
-        raise NotImplementedError
-
-    def connect_timeout(self) -> Optional[int]:
-        """
-        The timeout for the initial connect to the HTTP Server.
-        """
-        raise NotImplementedError
-    def set_connect_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for the initial connect to the HTTP Server. An error
-        return value indicates that this timeout is not supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    def first_byte_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving the first byte of the Response body.
-        """
-        raise NotImplementedError
-    def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving the first byte of the Response body. An
-        error return value indicates that this timeout is not supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    def between_bytes_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving subsequent chunks of bytes in the Response
-        body stream.
-        """
-        raise NotImplementedError
-    def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving subsequent chunks of bytes in the Response
-        body stream. An error return value indicates that this timeout is not
-        supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Parameters for making an HTTP Request. Each of these parameters is -currently an optional timeout applicable to the transport layer of the -HTTP protocol.

-

These timeouts are separate from any the user may use to bound a -blocking call to wasi:io/poll.poll.

-

Construct a default request-options value.

-

Methods

-
-
-def between_bytes_timeout(self) ‑> int | None -
-
-
- -Expand source code - -
def between_bytes_timeout(self) -> Optional[int]:
-    """
-    The timeout for receiving subsequent chunks of bytes in the Response
-    body stream.
-    """
-    raise NotImplementedError
-
-

The timeout for receiving subsequent chunks of bytes in the Response -body stream.

-
-
-def connect_timeout(self) ‑> int | None -
-
-
- -Expand source code - -
def connect_timeout(self) -> Optional[int]:
-    """
-    The timeout for the initial connect to the HTTP Server.
-    """
-    raise NotImplementedError
-
-

The timeout for the initial connect to the HTTP Server.

-
-
-def first_byte_timeout(self) ‑> int | None -
-
-
- -Expand source code - -
def first_byte_timeout(self) -> Optional[int]:
-    """
-    The timeout for receiving the first byte of the Response body.
-    """
-    raise NotImplementedError
-
-

The timeout for receiving the first byte of the Response body.

-
-
-def set_between_bytes_timeout(self, duration: int | None) ‑> None -
-
-
- -Expand source code - -
def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for receiving subsequent chunks of bytes in the Response
-    body stream. An error return value indicates that this timeout is not
-    supported.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the timeout for receiving subsequent chunks of bytes in the Response -body stream. An error return value indicates that this timeout is not -supported.

-

Raises: Err(None)

-
-
-def set_connect_timeout(self, duration: int | None) ‑> None -
-
-
- -Expand source code - -
def set_connect_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for the initial connect to the HTTP Server. An error
-    return value indicates that this timeout is not supported.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the timeout for the initial connect to the HTTP Server. An error -return value indicates that this timeout is not supported.

-

Raises: Err(None)

-
-
-def set_first_byte_timeout(self, duration: int | None) ‑> None -
-
-
- -Expand source code - -
def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for receiving the first byte of the Response body. An
-    error return value indicates that this timeout is not supported.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the timeout for receiving the first byte of the Response body. An -error return value indicates that this timeout is not supported.

-

Raises: Err(None)

-
-
-
-
-class ResponseOutparam -
-
-
- -Expand source code - -
class ResponseOutparam:
-    """
-    Represents the ability to send an HTTP Response.
-    
-    This resource is used by the `wasi:http/incoming-handler` interface to
-    allow a Response to be sent corresponding to the Request provided as the
-    other argument to `incoming-handler.handle`.
-    """
-    
-    @classmethod
-    def set(cls, param: Self, response: Result[OutgoingResponse, ErrorCode]) -> None:
-        """
-        Set the value of the `response-outparam` to either send a response,
-        or indicate an error.
-        
-        This method consumes the `response-outparam` to ensure that it is
-        called at most once. If it is never called, the implementation
-        will respond with an error.
-        
-        The user may provide an `error` to `response` to allow the
-        implementation determine how to respond with an HTTP error response.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents the ability to send an HTTP Response.

-

This resource is used by the wasi:http/incoming-handler interface to -allow a Response to be sent corresponding to the Request provided as the -other argument to incoming-handler.handle.

-

Static methods

-
-
-def set(param: Self,
response: Ok[OutgoingResponse] | Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]) ‑> None
-
-
-

Set the value of the response-outparam to either send a response, -or indicate an error.

-

This method consumes the response-outparam to ensure that it is -called at most once. If it is never called, the implementation -will respond with an error.

-

The user may provide an error to response to allow the -implementation determine how to respond with an HTTP error response.

-
-
-
-
-class Scheme_Http -
-
-
- -Expand source code - -
@dataclass
-class Scheme_Http:
-    pass
-
-

Scheme_Http()

-
-
-class Scheme_Https -
-
-
- -Expand source code - -
@dataclass
-class Scheme_Https:
-    pass
-
-

Scheme_Https()

-
-
-class Scheme_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Scheme_Other:
-    value: str
-
-

Scheme_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class TlsAlertReceivedPayload -(alert_id: int | None, alert_message: str | None) -
-
-
- -Expand source code - -
@dataclass
-class TlsAlertReceivedPayload:
-    """
-    Defines the case payload type for `TLS-alert-received` above:
-    """
-    alert_id: Optional[int]
-    alert_message: Optional[str]
-
-

Defines the case payload type for TLS-alert-received above:

-

Instance variables

-
-
var alert_id : int | None
-
-
-
-
var alert_message : str | None
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/variables.html b/docs/v3/wit/imports/variables.html deleted file mode 100644 index 48d2175..0000000 --- a/docs/v3/wit/imports/variables.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - -spin_sdk.wit.imports.variables API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.variables

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface.

-
-
-
-
-

Functions

-
-
-def get(name: str) ‑> str -
-
-
- -Expand source code - -
def get(name: str) -> str:
-    """
-    Get an application variable value for the current component.
-    
-    The name must match one defined in in the component manifest.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.variables.Error)`
-    """
-    raise NotImplementedError
-
-

Get an application variable value for the current component.

-

The name must match one defined in in the component manifest.

-

Raises: Err(Error)

-
-
-
-
-

Classes

-
-
-class Error_InvalidName -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidName:
-    value: str
-
-

Error_InvalidName(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Provider -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Provider:
-    value: str
-
-

Error_Provider(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Undefined -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Undefined:
-    value: str
-
-

Error_Undefined(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/wasi_config_store.html b/docs/v3/wit/imports/wasi_config_store.html deleted file mode 100644 index 77f405a..0000000 --- a/docs/v3/wit/imports/wasi_config_store.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_config_store API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_config_store

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

An error type that encapsulates the different errors that can occur fetching configuration values.

-
-
-
-
-

Functions

-
-
-def get(key: str) ‑> str | None -
-
-
- -Expand source code - -
def get(key: str) -> Optional[str]:
-    """
-    Gets a configuration value of type `string` associated with the `key`.
-    
-    The value is returned as an `option<string>`. If the key is not found,
-    `Ok(none)` is returned. If an error occurs, an `Err(error)` is returned.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_config_store.Error)`
-    """
-    raise NotImplementedError
-
-

Gets a configuration value of type string associated with the key.

-

The value is returned as an option<string>. If the key is not found, -Ok(none) is returned. If an error occurs, an Err(error) is returned.

-

Raises: Err(Error)

-
-
-def get_all() ‑> List[Tuple[str, str]] -
-
-
- -Expand source code - -
def get_all() -> List[Tuple[str, str]]:
-    """
-    Gets a list of configuration key-value pairs of type `string`.
-    
-    If an error occurs, an `Err(error)` is returned.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_config_store.Error)`
-    """
-    raise NotImplementedError
-
-

Gets a list of configuration key-value pairs of type string.

-

If an error occurs, an Err(error) is returned.

-

Raises: Err(Error)

-
-
-
-
-

Classes

-
-
-class Error_Io -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Io:
-    value: str
-
-

Error_Io(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Upstream -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Upstream:
-    value: str
-
-

Error_Upstream(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/imports/wasi_keyvalue_store.html b/docs/v3/wit/imports/wasi_keyvalue_store.html deleted file mode 100644 index bfe6999..0000000 --- a/docs/v3/wit/imports/wasi_keyvalue_store.html +++ /dev/null @@ -1,526 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_keyvalue_store API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_keyvalue_store

-
-
-

A keyvalue interface that provides eventually consistent key-value operations.

-

Each of these operations acts on a single key-value pair.

-

The value in the key-value pair is defined as a u8 byte array and the intention is that it is -the common denominator for all data types defined by different key-value stores to handle data, -ensuring compatibility between different key-value stores. Note: the clients will be expecting -serialization/deserialization overhead to be handled by the key-value store. The value could be -a serialized object from JSON, HTML or vendor-specific data types like AWS S3 objects.

-

Data consistency in a key value store refers to the guarantee that once a write operation -completes, all subsequent read operations will return the value that was written.

-

Any implementation of this interface must have enough consistency to guarantee "reading your -writes." In particular, this means that the client should never get a value that is older than -the one it wrote, but it MAY get a newer value if one was written around the same time. These -guarantees only apply to the same client (which will likely be provided by the host or an -external capability of some kind). In this context a "client" is referring to the caller or -guest that is consuming this interface. Once a write request is committed by a specific client, -all subsequent read requests by the same client will reflect that write or any subsequent -writes. Another client running in a different context may or may not immediately see the result -due to the replication lag. As an example of all of this, if a value at a given key is A, and -the client writes B, then immediately reads, it should get B. If something else writes C in -quick succession, then the client may get C. However, a client running in a separate context may -still see A or B

-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this package

-
-
-
-
-

Functions

-
-
-def open(identifier: str) ‑> Bucket -
-
-
- -Expand source code - -
def open(identifier: str) -> Bucket:
-    """
-    Get the bucket with the specified identifier.
-    
-    `identifier` must refer to a bucket provided by the host.
-    
-    `error::no-such-store` will be raised if the `identifier` is not recognized.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-    """
-    raise NotImplementedError
-
-

Get the bucket with the specified identifier.

-

identifier must refer to a bucket provided by the host.

-

error::no-such-store will be raised if the identifier is not recognized.

-

Raises: Err(Error)

-
-
-
-
-

Classes

-
-
-class Bucket -
-
-
- -Expand source code - -
class Bucket:
-    """
-    A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the
-    bucket, and the bucket itself acts as a collection of all these entries.
-    
-    It is worth noting that the exact terminology for bucket in key-value stores can very
-    depending on the specific implementation. For example:
-    
-    1. Amazon DynamoDB calls a collection of key-value pairs a table
-    2. Redis has hashes, sets, and sorted sets as different types of collections
-    3. Cassandra calls a collection of key-value pairs a column family
-    4. MongoDB calls a collection of key-value pairs a collection
-    5. Riak calls a collection of key-value pairs a bucket
-    6. Memcached calls a collection of key-value pairs a slab
-    7. Azure Cosmos DB calls a collection of key-value pairs a container
-    
-    In this interface, we use the term `bucket` to refer to a collection of key-value pairs
-    """
-    
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value associated with the specified `key`
-        
-        The value is returned as an option. If the key-value pair exists in the
-        store, it returns `Ok(value)`. If the key does not exist in the
-        store, it returns `Ok(none)`.
-        
-        If any other error occurs, it returns an `Err(error)`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-        """
-        raise NotImplementedError
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set the value associated with the key in the store. If the key already
-        exists in the store, it overwrites the value.
-        
-        If the key does not exist in the store, it creates a new key-value pair.
-        
-        If any other error occurs, it returns an `Err(error)`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-        """
-        raise NotImplementedError
-    def delete(self, key: str) -> None:
-        """
-        Delete the key-value pair associated with the key in the store.
-        
-        If the key does not exist in the store, it does nothing.
-        
-        If any other error occurs, it returns an `Err(error)`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-        """
-        raise NotImplementedError
-    def exists(self, key: str) -> bool:
-        """
-        Check if the key exists in the store.
-        
-        If the key exists in the store, it returns `Ok(true)`. If the key does
-        not exist in the store, it returns `Ok(false)`.
-        
-        If any other error occurs, it returns an `Err(error)`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-        """
-        raise NotImplementedError
-    def list_keys(self, cursor: Optional[str]) -> KeyResponse:
-        """
-        Get all the keys in the store with an optional cursor (for use in pagination). It
-        returns a list of keys. Please note that for most KeyValue implementations, this is a
-        can be a very expensive operation and so it should be used judiciously. Implementations
-        can return any number of keys in a single response, but they should never attempt to
-        send more data than is reasonable (i.e. on a small edge device, this may only be a few
-        KB, while on a large machine this could be several MB). Any response should also return
-        a cursor that can be used to fetch the next page of keys. See the `key-response` record
-        for more information.
-        
-        Note that the keys are not guaranteed to be returned in any particular order.
-        
-        If the store is empty, it returns an empty list.
-        
-        MAY show an out-of-date list of keys if there are concurrent writes to the store.
-        
-        If any error occurs, it returns an `Err(error)`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the -bucket, and the bucket itself acts as a collection of all these entries.

-

It is worth noting that the exact terminology for bucket in key-value stores can very -depending on the specific implementation. For example:

-
    -
  1. Amazon DynamoDB calls a collection of key-value pairs a table
  2. -
  3. Redis has hashes, sets, and sorted sets as different types of collections
  4. -
  5. Cassandra calls a collection of key-value pairs a column family
  6. -
  7. MongoDB calls a collection of key-value pairs a collection
  8. -
  9. Riak calls a collection of key-value pairs a bucket
  10. -
  11. Memcached calls a collection of key-value pairs a slab
  12. -
  13. Azure Cosmos DB calls a collection of key-value pairs a container
  14. -
-

In this interface, we use the term bucket to refer to a collection of key-value pairs

-

Methods

-
-
-def delete(self, key: str) ‑> None -
-
-
- -Expand source code - -
def delete(self, key: str) -> None:
-    """
-    Delete the key-value pair associated with the key in the store.
-    
-    If the key does not exist in the store, it does nothing.
-    
-    If any other error occurs, it returns an `Err(error)`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-    """
-    raise NotImplementedError
-
-

Delete the key-value pair associated with the key in the store.

-

If the key does not exist in the store, it does nothing.

-

If any other error occurs, it returns an Err(error).

-

Raises: Err(Error)

-
-
-def exists(self, key: str) ‑> bool -
-
-
- -Expand source code - -
def exists(self, key: str) -> bool:
-    """
-    Check if the key exists in the store.
-    
-    If the key exists in the store, it returns `Ok(true)`. If the key does
-    not exist in the store, it returns `Ok(false)`.
-    
-    If any other error occurs, it returns an `Err(error)`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-    """
-    raise NotImplementedError
-
-

Check if the key exists in the store.

-

If the key exists in the store, it returns Ok(true). If the key does -not exist in the store, it returns Ok(false).

-

If any other error occurs, it returns an Err(error).

-

Raises: Err(Error)

-
-
-def get(self, key: str) ‑> bytes | None -
-
-
- -Expand source code - -
def get(self, key: str) -> Optional[bytes]:
-    """
-    Get the value associated with the specified `key`
-    
-    The value is returned as an option. If the key-value pair exists in the
-    store, it returns `Ok(value)`. If the key does not exist in the
-    store, it returns `Ok(none)`.
-    
-    If any other error occurs, it returns an `Err(error)`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-    """
-    raise NotImplementedError
-
-

Get the value associated with the specified key

-

The value is returned as an option. If the key-value pair exists in the -store, it returns Ok(value). If the key does not exist in the -store, it returns Ok(none).

-

If any other error occurs, it returns an Err(error).

-

Raises: Err(Error)

-
-
-def list_keys(self, cursor: str | None) ‑> KeyResponse -
-
-
- -Expand source code - -
def list_keys(self, cursor: Optional[str]) -> KeyResponse:
-    """
-    Get all the keys in the store with an optional cursor (for use in pagination). It
-    returns a list of keys. Please note that for most KeyValue implementations, this is a
-    can be a very expensive operation and so it should be used judiciously. Implementations
-    can return any number of keys in a single response, but they should never attempt to
-    send more data than is reasonable (i.e. on a small edge device, this may only be a few
-    KB, while on a large machine this could be several MB). Any response should also return
-    a cursor that can be used to fetch the next page of keys. See the `key-response` record
-    for more information.
-    
-    Note that the keys are not guaranteed to be returned in any particular order.
-    
-    If the store is empty, it returns an empty list.
-    
-    MAY show an out-of-date list of keys if there are concurrent writes to the store.
-    
-    If any error occurs, it returns an `Err(error)`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-    """
-    raise NotImplementedError
-
-

Get all the keys in the store with an optional cursor (for use in pagination). It -returns a list of keys. Please note that for most KeyValue implementations, this is a -can be a very expensive operation and so it should be used judiciously. Implementations -can return any number of keys in a single response, but they should never attempt to -send more data than is reasonable (i.e. on a small edge device, this may only be a few -KB, while on a large machine this could be several MB). Any response should also return -a cursor that can be used to fetch the next page of keys. See the key-response record -for more information.

-

Note that the keys are not guaranteed to be returned in any particular order.

-

If the store is empty, it returns an empty list.

-

MAY show an out-of-date list of keys if there are concurrent writes to the store.

-

If any error occurs, it returns an Err(error).

-

Raises: Err(Error)

-
-
-def set(self, key: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
def set(self, key: str, value: bytes) -> None:
-    """
-    Set the value associated with the key in the store. If the key already
-    exists in the store, it overwrites the value.
-    
-    If the key does not exist in the store, it creates a new key-value pair.
-    
-    If any other error occurs, it returns an `Err(error)`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
-    """
-    raise NotImplementedError
-
-

Set the value associated with the key in the store. If the key already -exists in the store, it overwrites the value.

-

If the key does not exist in the store, it creates a new key-value pair.

-

If any other error occurs, it returns an Err(error).

-

Raises: Err(Error)

-
-
-
-
-class Error_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class Error_AccessDenied:
-    pass
-
-

Error_AccessDenied()

-
-
-class Error_NoSuchStore -
-
-
- -Expand source code - -
@dataclass
-class Error_NoSuchStore:
-    pass
-
-

Error_NoSuchStore()

-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class KeyResponse -(keys: List[str], cursor: str | None) -
-
-
- -Expand source code - -
@dataclass
-class KeyResponse:
-    """
-    A response to a `list-keys` operation.
-    """
-    keys: List[str]
-    cursor: Optional[str]
-
-

A response to a list-keys operation.

-

Instance variables

-
-
var cursor : str | None
-
-
-
-
var keys : List[str]
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/index.html b/docs/v3/wit/index.html deleted file mode 100644 index f374d59..0000000 --- a/docs/v3/wit/index.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - -spin_sdk.wit API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit

-
-
-

Module with the bindings generated from the wit by componentize-py

-
-
-

Sub-modules

-
-
spin_sdk.wit.exports
-
-
-
-
spin_sdk.wit.imports
-
-
-
-
spin_sdk.wit.types
-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class SpinSdkWit -(*args, **kwargs) -
-
-
- -Expand source code - -
class SpinSdkWit(Protocol):
-    pass
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto[T](Protocol):
-    def meth(self) -> T:
-        ...
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-
-
-
-
- -
- - - diff --git a/docs/v3/wit/types.html b/docs/v3/wit/types.html deleted file mode 100644 index be2f196..0000000 --- a/docs/v3/wit/types.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - -spin_sdk.wit.types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.types

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Err -(value: ~E) -
-
-
- -Expand source code - -
@dataclass(frozen=True)
-class Err(Generic[E], Exception):
-    value: E
-
-

Err(value: ~E)

-

Ancestors

-
    -
  • typing.Generic
  • -
  • builtins.Exception
  • -
  • builtins.BaseException
  • -
-

Instance variables

-
-
var value : ~E
-
-
-
-
-
-
-class Ok -(value: ~T) -
-
-
- -Expand source code - -
@dataclass
-class Ok(Generic[T]):
-    value: T
-
-

Ok(value: ~T)

-

Ancestors

-
    -
  • typing.Generic
  • -
-

Instance variables

-
-
var value : ~T
-
-
-
-
-
-
-class Some -(value: ~S) -
-
-
- -Expand source code - -
@dataclass
-class Some(Generic[S]):
-    value: S
-
-

Some(value: ~S)

-

Ancestors

-
    -
  • typing.Generic
  • -
-

Instance variables

-
-
var value : ~S
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/http/index.html b/docs/v4/http/index.html deleted file mode 100644 index 00d2b70..0000000 --- a/docs/v4/http/index.html +++ /dev/null @@ -1,426 +0,0 @@ - - - - - - -spin_sdk.http API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.http

-
-
-

Module with helpers for wasi http

-
-
-
-
-
-
-

Functions

-
-
-async def send(request: Request) ‑> Response -
-
-
- -Expand source code - -
async def send(request: Request) -> Response:
-    """Send an HTTP request and return a response or raise an error"""
-    match request.method:
-        case "GET":
-            method: Method = Method_Get()
-        case "HEAD":
-            method = Method_Head()
-        case "POST":
-            method = Method_Post()
-        case "PUT":
-            method = Method_Put()
-        case "DELETE":
-            method = Method_Delete()
-        case "CONNECT":
-            method = Method_Connect()
-        case "OPTIONS":
-            method = Method_Options()
-        case "TRACE":
-            method = Method_Trace()
-        case "PATCH":
-            method = Method_Patch()
-        case _:
-            method = Method_Other(request.method)
-    
-    url_parsed = parse.urlparse(request.uri)
-
-    match url_parsed.scheme:
-        case "http":
-            scheme: Scheme = Scheme_Http()
-        case "https":
-            scheme = Scheme_Https()
-        case "":
-            scheme = Scheme_Http()
-        case _:
-            scheme = Scheme_Other(url_parsed.scheme)
-
-    headers_dict = request.headers
-
-    # Add a `content-length` header if the caller didn't include one, but did
-    # specify a body:
-    if headers_dict.get('content-length') is None:
-        content_length = len(request.body) if request.body is not None else 0
-        # Make a copy rather than mutate in place, since the caller might not
-        # expect us to mutate it:
-        headers_dict = dict(headers_dict)
-        headers_dict['content-length'] = str(content_length)
-
-    headers = list(map(
-        lambda pair: (pair[0], bytes(pair[1], "utf-8")),
-        headers_dict.items()
-    ))
-
-    tx, rx = wit.byte_stream()
-    componentize_py_async_support.spawn(_copy(request.body, tx))
-    outgoing_request = WasiRequest.new(Fields.from_list(headers), rx, _trailers_future(), None)[0]
-    outgoing_request.set_method(method)
-    outgoing_request.set_scheme(scheme)
-    if url_parsed.netloc == '':
-        if isinstance(scheme, Scheme_Http):
-            authority = ":80"
-        else:
-            authority = ":443"
-    else:
-        authority = url_parsed.netloc
-
-    outgoing_request.set_authority(authority)
-
-    path_and_query = url_parsed.path
-    if url_parsed.query:
-        path_and_query += '?' + url_parsed.query
-    outgoing_request.set_path_with_query(path_and_query)
-
-    incoming_response = await client.send(outgoing_request)
-
-    status = incoming_response.get_status_code()
-    headers = incoming_response.get_headers().copy_all()
-    rx, trailers = WasiResponse.consume_body(incoming_response, _unit_future())
-    body = bytearray()
-    with rx:
-        while not rx.writer_dropped:
-            body += await rx.read(16 * 1024)
-
-    return Response(
-        status,
-        dict(map(
-            lambda pair: (pair[0], str(pair[1], "utf-8")),
-            headers
-        )),
-        bytes(body)
-    )
-
-

Send an HTTP request and return a response or raise an error

-
-
-def strip_forbidden_headers(headers: MutableMapping[str, str]) ‑> MutableMapping[str, str] -
-
-
- -Expand source code - -
def strip_forbidden_headers(headers:MutableMapping[str, str]) -> MutableMapping[str, str]:
-    """
-    Strips forbidden headers for requests and responses originating from guest apps, per wasmtime/Spin
-    """
-    # See https://github.com/bytecodealliance/wasmtime/blob/e9e1665c5ef150d618bd8c21fb355c063596d6f7/crates/wasi-http/src/lib.rs#L42-L52
-    for header in [
-        "connection",
-        "keep-alive",
-        "proxy-authenticate",
-        "proxy-authorization",
-        "proxy-connection",
-        "transfer-encoding",
-        "upgrade",
-        "host",
-        "http2-settings"
-    ]:
-        try:
-            del headers[header]
-        except KeyError:
-            pass
-    return headers
-
-

Strips forbidden headers for requests and responses originating from guest apps, per wasmtime/Spin

-
-
-
-
-

Classes

-
-
-class Handler -(*args, **kwargs) -
-
-
- -Expand source code - -
class Handler(Base):
-    """Simplified handler for incoming HTTP requests using blocking, buffered I/O."""
-
-    async def handle_request(self, request: Request) -> Response:
-        """Handle an incoming HTTP request and return a response or raise an error"""
-        raise NotImplementedError
-
-    async def handle(self, request: WasiRequest) -> WasiResponse:
-        method = request.get_method()
-
-        if isinstance(method, Method_Get):
-            method_str = "GET"
-        elif isinstance(method, Method_Head):
-            method_str = "HEAD"
-        elif isinstance(method, Method_Post):
-            method_str = "POST"
-        elif isinstance(method, Method_Put):
-            method_str = "PUT"
-        elif isinstance(method, Method_Delete):
-            method_str = "DELETE"
-        elif isinstance(method, Method_Connect):
-            method_str = "CONNECT"
-        elif isinstance(method, Method_Options):
-            method_str = "OPTIONS"
-        elif isinstance(method, Method_Trace):
-            method_str = "TRACE"
-        elif isinstance(method, Method_Patch):
-            method_str = "PATCH"
-        elif isinstance(method, Method_Other):
-            method_str = method.value
-        else:
-            raise AssertionError
-
-        headers = request.get_headers().copy_all()
-        request_uri = request.get_path_with_query()
-        rx, trailers = WasiRequest.consume_body(request, _unit_future())
-        body = bytearray()
-        with rx:
-            while not rx.writer_dropped:
-                body += await rx.read(16 * 1024)
-
-        if request_uri is None:
-            uri = "/"
-        else:
-            uri = request_uri
-
-        try:
-            simple_response = await self.handle_request(Request(
-                method_str,
-                uri,
-                dict(map(lambda pair: (pair[0], str(pair[1], "utf-8")), headers)),
-                bytes(body)
-            ))
-        except:
-            traceback.print_exc()
-
-            response = WasiResponse.new(Fields(), None, _trailers_future())[0]
-            response.set_status_code(500)
-            return response
-
-        if simple_response.headers.get('content-length') is None:
-            content_length = len(simple_response.body) if simple_response.body is not None else 0
-            simple_response.headers['content-length'] = str(content_length)
-
-        tx, rx = wit.byte_stream()
-        componentize_py_async_support.spawn(_copy(simple_response.body, tx))
-        response = WasiResponse.new(Fields.from_list(list(map(
-            lambda pair: (pair[0], bytes(pair[1], "utf-8")),
-            simple_response.headers.items()
-        ))), rx, _trailers_future())[0]
-
-        response.set_status_code(simple_response.status)
-        return response
-
-

Simplified handler for incoming HTTP requests using blocking, buffered I/O.

-

Ancestors

- -

Methods

-
-
-async def handle_request(self,
request: Request) ‑> Response
-
-
-
- -Expand source code - -
async def handle_request(self, request: Request) -> Response:
-    """Handle an incoming HTTP request and return a response or raise an error"""
-    raise NotImplementedError
-
-

Handle an incoming HTTP request and return a response or raise an error

-
-
-

Inherited members

- -
-
-class Request -(method: str, uri: str, headers: MutableMapping[str, str], body: bytes | None) -
-
-
- -Expand source code - -
@dataclass
-class Request:
-    """An HTTP request"""
-    method: str
-    uri: str
-    headers: MutableMapping[str, str]
-    body: Optional[bytes]
-
-

An HTTP request

-

Instance variables

-
-
var body : bytes | None
-
-
-
-
var headers : MutableMapping[str, str]
-
-
-
-
var method : str
-
-
-
-
var uri : str
-
-
-
-
-
-
-class Response -(status: int, headers: MutableMapping[str, str], body: bytes | None) -
-
-
- -Expand source code - -
@dataclass
-class Response:
-    """An HTTP response"""
-    status: int
-    headers: MutableMapping[str, str]
-    body: Optional[bytes]
-
-

An HTTP response

-

Instance variables

-
-
var body : bytes | None
-
-
-
-
var headers : MutableMapping[str, str]
-
-
-
-
var status : int
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/index.html b/docs/v4/index.html deleted file mode 100644 index 6c05f6d..0000000 --- a/docs/v4/index.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -spin_sdk API documentation - - - - - - - - - - - -
-
-
-

Package spin_sdk

-
-
-

Spin Python SDK

-

This is an SDK for creating Spin apps using Python.

-

Note that this SDK supercedes an earlier, experimental version, the documentation for which may be found here.

-
-
-

Sub-modules

-
-
spin_sdk.http
-
-

Module with helpers for wasi http

-
-
spin_sdk.key_value
-
-

Module for accessing Spin key-value stores

-
-
spin_sdk.llm
-
-

Module for working with the Spin large language model API

-
-
spin_sdk.mqtt
-
-

Module for utilizing Spin Outbound MQTT

-
-
spin_sdk.mysql
-
-

Module for interacting with a MySQL database

-
-
spin_sdk.postgres
-
-

Module for interacting with a Postgres database

-
-
spin_sdk.redis
-
-

Module for interacting with a Redis database

-
-
spin_sdk.sqlite
-
-

Module for interacting with an SQLite database

-
-
spin_sdk.util
-
-

Module for general-purpose utility functions

-
-
spin_sdk.variables
-
-

Module for interacting with Spin Variables

-
-
spin_sdk.wit
-
-

Module with the bindings generated from the wit by componentize-py

-
-
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/key_value.html b/docs/v4/key_value.html deleted file mode 100644 index b284c20..0000000 --- a/docs/v4/key_value.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - -spin_sdk.key_value API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.key_value

-
-
-

Module for accessing Spin key-value stores

-
-
-
-
-
-
-

Functions

-
-
-async def open(name: str) ‑> Store -
-
-
- -Expand source code - -
async def open(name: str) -> Store:
-    """
-    Open the store with the specified name.
-  
-    If `name` is "default", the default store is opened.  Otherwise, `name` must
-    refer to a store defined and configured in a runtime configuration file
-    supplied with the application.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error_NoSuchStore)` will be raised if the `name` is not recognized.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error_AccessDenied)` will be raised if the requesting component does not have
-    access to the specified store.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error_StoreTableFull)` will be raised if too many stores have been opened simultaneously.
-    Closing one or more previously opened stores might address this using the `__exit__` method.
-    
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error_Other(str))` will be raised if some implementation specific error has occured (e.g I/O)
-    """
-    return await Store.open(name)
-
-

Open the store with the specified name.

-

If name is "default", the default store is opened. -Otherwise, name must -refer to a store defined and configured in a runtime configuration file -supplied with the application.

-

A componentize_py_types.Err(Error_NoSuchStore) will be raised if the name is not recognized.

-

A componentize_py_types.Err(Error_AccessDenied) will be raised if the requesting component does not have -access to the specified store.

-

A componentize_py_types.Err(Error_StoreTableFull) will be raised if too many stores have been opened simultaneously. -Closing one or more previously opened stores might address this using the __exit__ method.

-

A componentize_py_types.Err(Error_Other(str)) will be raised if some implementation specific error has occured (e.g I/O)

-
-
-async def open_default() ‑> Store -
-
-
- -Expand source code - -
async def open_default() -> Store:
-    """
-    Open the default store.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error_AccessDenied)`
-    will be raised if the requesting component does not have access to the
-    default store.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error_StoreTableFull)` will be raised if too many stores have been opened simultaneously.
-    Closing one or more previously opened stores might address this using the `__exit__` method.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error_Other(str))` will be raised if some implementation specific error has occured (e.g I/O)
-    """
-    return await Store.open("default")
-
-

Open the default store.

-

A componentize_py_types.Err(Error_AccessDenied) -will be raised if the requesting component does not have access to the -default store.

-

A componentize_py_types.Err(Error_StoreTableFull) will be raised if too many stores have been opened simultaneously. -Closing one or more previously opened stores might address this using the __exit__ method.

-

A componentize_py_types.Err(Error_Other(str)) will be raised if some implementation specific error has occured (e.g I/O)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/llm.html b/docs/v4/llm.html deleted file mode 100644 index 61356ac..0000000 --- a/docs/v4/llm.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - -spin_sdk.llm API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.llm

-
-
-

Module for working with the Spin large language model API

-
-
-
-
-
-
-

Functions

-
-
-def generate_embeddings(model: str, text: List[str]) ‑> EmbeddingsResult -
-
-
- -Expand source code - -
def generate_embeddings(model: str, text: List[str]) -> spin_llm.EmbeddingsResult:
-    """
-    A `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error_ModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error_RuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error_InvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    return spin_llm.generate_embeddings(model, text)
-
-

A componentize_py_types.Err(Error_ModelNotSupported) will be raised if the component does not have access to the specified model.

-

A componentize_py_types.Err(Error_RuntimeError(str)) will be raised if there are any runtime errors.

-

A componentize_py_types.Err(Error_InvalidInput(str)) will be raised if an invalid input is provided.

-
-
-def infer(model: str, prompt: str) ‑> InferencingResult -
-
-
- -Expand source code - -
def infer(model: str, prompt: str) -> spin_llm.InferencingResult:
-    """
-    A `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error_ModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error_RuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error_InvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    return infer_with_options(model, prompt, None)
-
-

A componentize_py_types.Err(Error_ModelNotSupported) will be raised if the component does not have access to the specified model.

-

A componentize_py_types.Err(Error_RuntimeError(str)) will be raised if there are any runtime errors.

-

A componentize_py_types.Err(Error_InvalidInput(str)) will be raised if an invalid input is provided.

-
-
-def infer_with_options(model: str,
prompt: str,
options: InferencingParams | None) ‑> InferencingResult
-
-
-
- -Expand source code - -
def infer_with_options(model: str, prompt: str, options: Optional[InferencingParams]) -> spin_llm.InferencingResult:
-    """
-    A `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error_ModelNotSupported)` will be raised if the component does not have access to the specified model.
-    
-    A `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error_RuntimeError(str))` will be raised if there are any runtime errors.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error_InvalidInput(str))` will be raised if an invalid input is provided.
-    """
-    some_options = options or InferencingParams()
-    my_options = spin_llm.InferencingParams(
-        some_options.max_tokens,
-        some_options.repeat_penalty,
-        some_options.repeat_penalty_last_n_token_count,
-        some_options.temperature,
-        some_options.top_k,
-        some_options.top_p,        
-    )
-    return spin_llm.infer(model, prompt, my_options)
-
-

A componentize_py_types.Err(Error_ModelNotSupported) will be raised if the component does not have access to the specified model.

-

A componentize_py_types.Err(Error_RuntimeError(str)) will be raised if there are any runtime errors.

-

A componentize_py_types.Err(Error_InvalidInput(str)) will be raised if an invalid input is provided.

-
-
-
-
-

Classes

-
-
-class InferencingParams -(max_tokens: int = 100,
repeat_penalty: float = 1.1,
repeat_penalty_last_n_token_count: int = 64,
temperature: float = 0.8,
top_k: int = 40,
top_p: float = 0.9)
-
-
-
- -Expand source code - -
@dataclass
-class InferencingParams:
-    max_tokens: int = 100
-    repeat_penalty: float = 1.1
-    repeat_penalty_last_n_token_count: int = 64
-    temperature: float = 0.8
-    top_k: int = 40
-    top_p: float = 0.9
-
-

InferencingParams(max_tokens: int = 100, repeat_penalty: float = 1.1, repeat_penalty_last_n_token_count: int = 64, temperature: float = 0.8, top_k: int = 40, top_p: float = 0.9)

-

Instance variables

-
-
var max_tokens : int
-
-
-
-
var repeat_penalty : float
-
-
-
-
var repeat_penalty_last_n_token_count : int
-
-
-
-
var temperature : float
-
-
-
-
var top_k : int
-
-
-
-
var top_p : float
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/mqtt.html b/docs/v4/mqtt.html deleted file mode 100644 index cf1c8c2..0000000 --- a/docs/v4/mqtt.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -spin_sdk.mqtt API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.mqtt

-
-
-

Module for utilizing Spin Outbound MQTT

-
-
-
-
-
-
-

Functions

-
-
-async def open(address: str, username: str, password: str, keep_alive_interval_in_secs: int) ‑> Connection -
-
-
- -Expand source code - -
async def open(address: str, username: str, password: str, keep_alive_interval_in_secs: int) -> Connection:
-    """
-    Open a connection to the Mqtt instance at `address`.
-    
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_mqtt_mqtt_3_0_0.Error_InvalidAddress)` will be raised if the connection string is invalid.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_mqtt_mqtt_3_0_0.Error_TooManyConnections)` will be raised if there are too many open connections. Closing one or more previously opened connection using the `__exit__` method might help.
-    
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_mqtt_mqtt_3_0_0.Error_ConnectionFailed)` will be raised if the connection failed.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_mqtt_mqtt_3_0_0.Error_Other(str))` when some other error occurs.
-    """
-    return await Connection.open(address, username, password, keep_alive_interval_in_secs)
-
-

Open a connection to the Mqtt instance at address.

-

A componentize_py_types.Err(Error_InvalidAddress) will be raised if the connection string is invalid.

-

A componentize_py_types.Err(Error_TooManyConnections) will be raised if there are too many open connections. Closing one or more previously opened connection using the __exit__ method might help.

-

A componentize_py_types.Err(Error_ConnectionFailed) will be raised if the connection failed.

-

A componentize_py_types.Err(Error_Other(str)) when some other error occurs.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/mysql.html b/docs/v4/mysql.html deleted file mode 100644 index d0d7edb..0000000 --- a/docs/v4/mysql.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - -spin_sdk.mysql API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.mysql

-
-
-

Module for interacting with a MySQL database

-
-
-
-
-
-
-

Functions

-
-
-def open(connection_string: str) ‑> Connection -
-
-
- -Expand source code - -
def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a MySQL database.
-    
-    The connection_string is the MySQL URL connection string.
-
-    A `componentize_py_types.Err(Error_ConnectionFailed(str))` when a connection fails.
-    
-    A `componentize_py_types.Err(Error_Other(str))` when some other error occurs.
-    """
-    return Connection.open(connection_string)
-
-

Open a connection with a MySQL database.

-

The connection_string is the MySQL URL connection string.

-

A componentize_py_types.Err(Error_ConnectionFailed(str)) when a connection fails.

-

A componentize_py_types.Err(Error_Other(str)) when some other error occurs.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/postgres.html b/docs/v4/postgres.html deleted file mode 100644 index 9fe84e2..0000000 --- a/docs/v4/postgres.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - -spin_sdk.postgres API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.postgres

-
-
-

Module for interacting with a Postgres database

-
-
-
-
-
-
-
-
-

Classes

-
-
-class Connection -(connection: Connection) -
-
-
- -Expand source code - -
class Connection:
-    def __init__(self, connection: pg.Connection) -> None:
-        self.connection = connection
-
-    def __enter__(self) -> Self:
-        return self
-
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        return self.connection.__exit__(exc_type, exc_value, traceback)
-
-    @classmethod
-    async def open(cls, connection_string: str) -> Self:
-        """
-        Open a connection with a Postgres database.
-
-        The connection_string is the Postgres URL or connection string.
-
-        A `componentize_py_types.Err(Error_ConnectionFailed(str))` when a connection fails.
-
-        A `componentize_py_types.Err(Error_Other(str))` when some other error occurs.
-        """
-        return cls(await pg.Connection.open_async(connection_string))
-
-    async def query(self, statement: str, params: List[ParameterValue]) -> Tuple[List[Column], StreamReader[List[DbValue]], FutureReader[Result[None, Error]]]:
-        """
-        Query the Postgres database.
-
-        Returns a Tuple containing a List of Columns, a List of DbValues encapsulated in an asynchronous iterator (`componentize_py_async_support.streams.StreamReader`),
-        and a future (`componentize_py_async_support.futures.FutureReader`) containing the result of the operation.
-
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-        """
-        return await self.connection.query_async(statement, params)
-
-    async def execute(self, statement: str, params: List[ParameterValue]) -> int:
-        """
-        Execute command to the database.
-
-        Returns the number of affected rows as an int.
-
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-        """
-        return await self.connection.execute_async(statement, params)
-
-
-

Static methods

-
-
-async def open(connection_string: str) ‑> Self -
-
-

Open a connection with a Postgres database.

-

The connection_string is the Postgres URL or connection string.

-

A componentize_py_types.Err(Error_ConnectionFailed(str)) when a connection fails.

-

A componentize_py_types.Err(Error_Other(str)) when some other error occurs.

-
-
-

Methods

-
-
-async def execute(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_Uuid | ParameterValue_Jsonb | ParameterValue_Decimal | ParameterValue_RangeInt32 | ParameterValue_RangeInt64 | ParameterValue_RangeDecimal | ParameterValue_ArrayInt32 | ParameterValue_ArrayInt64 | ParameterValue_ArrayDecimal | ParameterValue_ArrayStr | ParameterValue_Interval | ParameterValue_DbNull]) ‑> int
-
-
-
- -Expand source code - -
async def execute(self, statement: str, params: List[ParameterValue]) -> int:
-    """
-    Execute command to the database.
-
-    Returns the number of affected rows as an int.
-
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-    """
-    return await self.connection.execute_async(statement, params)
-
-

Execute command to the database.

-

Returns the number of affected rows as an int.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def query(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_Uuid | ParameterValue_Jsonb | ParameterValue_Decimal | ParameterValue_RangeInt32 | ParameterValue_RangeInt64 | ParameterValue_RangeDecimal | ParameterValue_ArrayInt32 | ParameterValue_ArrayInt64 | ParameterValue_ArrayDecimal | ParameterValue_ArrayStr | ParameterValue_Interval | ParameterValue_DbNull]) ‑> Tuple[List[Column], componentize_py_async_support.streams.StreamReader[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_Uuid | DbValue_Jsonb | DbValue_Decimal | DbValue_RangeInt32 | DbValue_RangeInt64 | DbValue_RangeDecimal | DbValue_ArrayInt32 | DbValue_ArrayInt64 | DbValue_ArrayDecimal | DbValue_ArrayStr | DbValue_Interval | DbValue_DbNull | DbValue_Unsupported]], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[Error_ConnectionFailed | Error_BadParameter | Error_QueryFailed | Error_ValueConversionFailed | Error_Other]]]
-
-
-
- -Expand source code - -
async def query(self, statement: str, params: List[ParameterValue]) -> Tuple[List[Column], StreamReader[List[DbValue]], FutureReader[Result[None, Error]]]:
-    """
-    Query the Postgres database.
-
-    Returns a Tuple containing a List of Columns, a List of DbValues encapsulated in an asynchronous iterator (`componentize_py_async_support.streams.StreamReader`),
-    and a future (`componentize_py_async_support.futures.FutureReader`) containing the result of the operation.
-
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-    """
-    return await self.connection.query_async(statement, params)
-
-

Query the Postgres database.

-

Returns a Tuple containing a List of Columns, a List of DbValues encapsulated in an asynchronous iterator (componentize_py_async_support.streams.StreamReader), -and a future (componentize_py_async_support.futures.FutureReader) containing the result of the operation.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/redis.html b/docs/v4/redis.html deleted file mode 100644 index 06288c6..0000000 --- a/docs/v4/redis.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -spin_sdk.redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.redis

-
-
-

Module for interacting with a Redis database

-
-
-
-
-
-
-

Functions

-
-
-async def open(connection_string: str) ‑> Connection -
-
-
- -Expand source code - -
async def open(connection_string: str) -> Connection:
-    """
-    Open a connection with a Redis database.
-    
-    The connection_string is the Redis URL to connect to.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error_InvalidAddress)` will be raised if the connection string is invalid.
-
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error_TooManyConnections)` will be raised if there are too many open connections. Closing one or more previously opened connection using the `__exit__` method might help.
-    
-    A `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error_Other(str))` when some other error occurs.
-    """
-    return await Connection.open(connection_string)
-
-

Open a connection with a Redis database.

-

The connection_string is the Redis URL to connect to.

-

A componentize_py_types.Err(Error_InvalidAddress) will be raised if the connection string is invalid.

-

A componentize_py_types.Err(Error_TooManyConnections) will be raised if there are too many open connections. Closing one or more previously opened connection using the __exit__ method might help.

-

A componentize_py_types.Err(Error_Other(str)) when some other error occurs.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/sqlite.html b/docs/v4/sqlite.html deleted file mode 100644 index a81af48..0000000 --- a/docs/v4/sqlite.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - -spin_sdk.sqlite API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.sqlite

-
-
-

Module for interacting with an SQLite database

-
-
-
-
-
-
-
-
-

Classes

-
-
-class Connection -(connection: Connection) -
-
-
- -Expand source code - -
class Connection:
-    def __init__(self, connection: sqlite.Connection) -> None:
-        self.connection = connection
-
-    def __enter__(self) -> Self:
-        return self
-
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        return self.connection.__exit__(exc_type, exc_value, traceback)
-
-    @classmethod
-    async def open(cls, name: str) -> Self:
-        """Open a connection to a named database instance.
-
-        If `database` is "default", the default instance is opened.
-
-        A `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error_AccessDenied)` will be raised when the component does not have access to the specified database.
-
-        A `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error_NoSuchDatabase)` will be raised when the host does not recognize the database name requested.
-
-        A `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error_InvalidConnection)` will be raised when the provided connection string is not valid.
-
-        A `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error_Io(str))` will be raised when implementation-specific error occured (e.g. I/O)
-        """
-        return cls(await sqlite.Connection.open_async(name))
-
-    @classmethod
-    async def open_default(cls) -> Self:
-        """Open the default store.
-
-        A `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error_AccessDenied)` will be raised when the component does not have access to the default database.
-
-        A `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error_Io(str))` will be raised when implementation-specific error occured (e.g. I/O)
-        """
-        return cls(await sqlite.Connection.open_async("default"))
-
-    async def execute(self, statement: str, params: List[Value]) -> Tuple[List[str], StreamReader[RowResult], FutureReader[Result[None, Error]]]:
-        """
-        Execute a command to the database.
-
-        Returns a Tuple containing a List of columns, a List of RowResults encapsulated in an asynchronous iterator (`componentize_py_async_support.streams.StreamReader`),
-        and a future (`componentize_py_async_support.futures.FutureReader`) containing the result of the operation.
-
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error)`
-        """
-        return await self.connection.execute_async(statement, params)
-
-    async def last_insert_rowid(self) -> int:
-        """
-        The SQLite rowid of the most recent successful INSERT on the connection, or 0 if
-        there has not yet been an INSERT on the connection.
-        """
-        return await self.connection.last_insert_rowid_async()
-
-    async def changes(self) -> int:
-        """
-        The number of rows modified, inserted or deleted by the most recently completed
-        INSERT, UPDATE or DELETE statement on the connection.
-        """
-        return await self.connection.changes_async()
-
-
-

Static methods

-
-
-async def open(name: str) ‑> Self -
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

A componentize_py_types.Err(Error_AccessDenied) will be raised when the component does not have access to the specified database.

-

A componentize_py_types.Err(Error_NoSuchDatabase) will be raised when the host does not recognize the database name requested.

-

A componentize_py_types.Err(Error_InvalidConnection) will be raised when the provided connection string is not valid.

-

A componentize_py_types.Err(Error_Io(str)) will be raised when implementation-specific error occured (e.g. I/O)

-
-
-async def open_default() ‑> Self -
-
-

Open the default store.

-

A componentize_py_types.Err(Error_AccessDenied) will be raised when the component does not have access to the default database.

-

A componentize_py_types.Err(Error_Io(str)) will be raised when implementation-specific error occured (e.g. I/O)

-
-
-

Methods

-
-
-async def changes(self) ‑> int -
-
-
- -Expand source code - -
async def changes(self) -> int:
-    """
-    The number of rows modified, inserted or deleted by the most recently completed
-    INSERT, UPDATE or DELETE statement on the connection.
-    """
-    return await self.connection.changes_async()
-
-

The number of rows modified, inserted or deleted by the most recently completed -INSERT, UPDATE or DELETE statement on the connection.

-
-
-async def execute(self,
statement: str,
params: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) ‑> Tuple[List[str], componentize_py_async_support.streams.StreamReader[RowResult], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[Error_NoSuchDatabase | Error_AccessDenied | Error_InvalidConnection | Error_DatabaseFull | Error_Io]]]
-
-
-
- -Expand source code - -
async def execute(self, statement: str, params: List[Value]) -> Tuple[List[str], StreamReader[RowResult], FutureReader[Result[None, Error]]]:
-    """
-    Execute a command to the database.
-
-    Returns a Tuple containing a List of columns, a List of RowResults encapsulated in an asynchronous iterator (`componentize_py_async_support.streams.StreamReader`),
-    and a future (`componentize_py_async_support.futures.FutureReader`) containing the result of the operation.
-
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error)`
-    """
-    return await self.connection.execute_async(statement, params)
-
-

Execute a command to the database.

-

Returns a Tuple containing a List of columns, a List of RowResults encapsulated in an asynchronous iterator (componentize_py_async_support.streams.StreamReader), -and a future (componentize_py_async_support.futures.FutureReader) containing the result of the operation.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def last_insert_rowid(self) ‑> int -
-
-
- -Expand source code - -
async def last_insert_rowid(self) -> int:
-    """
-    The SQLite rowid of the most recent successful INSERT on the connection, or 0 if
-    there has not yet been an INSERT on the connection.
-    """
-    return await self.connection.last_insert_rowid_async()
-
-

The SQLite rowid of the most recent successful INSERT on the connection, or 0 if -there has not yet been an INSERT on the connection.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/util.html b/docs/v4/util.html deleted file mode 100644 index 3b2b8bc..0000000 --- a/docs/v4/util.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -spin_sdk.util API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.util

-
-
-

Module for general-purpose utility functions

-
-
-
-
-
-
-

Functions

-
-
-async def collect(tuple: Tuple[componentize_py_async_support.streams.StreamReader[~T], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[~E]]]) ‑> List[~T] -
-
-
- -Expand source code - -
async def collect(tuple: Tuple[StreamReader[T], FutureReader[Result[None, E]]]) -> List[T]:
-    """
-    Collect all items from the StreamReader portion of the provided Tuple and return them in a List,
-    verifying the FutureReader result upon stream completion and, if it is error, raising it as an exception.
-    """
-    stream = tuple[0]
-    future = tuple[1]
-    collected = []
-    with stream, future:
-        while not stream.writer_dropped:
-            collected += await stream.read(128)
-        result = await future.read()
-        if isinstance(result, Err):
-            raise result
-        else:
-            return collected
-
-

Collect all items from the StreamReader portion of the provided Tuple and return them in a List, -verifying the FutureReader result upon stream completion and, if it is error, raising it as an exception.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/variables.html b/docs/v4/variables.html deleted file mode 100644 index 44686a4..0000000 --- a/docs/v4/variables.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - -spin_sdk.variables API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.variables

-
-
-

Module for interacting with Spin Variables

-
-
-
-
-
-
-

Functions

-
-
-async def get(key: str) ‑> str -
-
-
- -Expand source code - -
async def get(key: str) -> str:
-    """
-    Gets the value of the given key
-    """
-    return await variables.get(key)
-
-

Gets the value of the given key

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/exports/fermyon_spin_inbound_redis.html b/docs/v4/wit/exports/fermyon_spin_inbound_redis.html deleted file mode 100644 index 51f8f6a..0000000 --- a/docs/v4/wit/exports/fermyon_spin_inbound_redis.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - -spin_sdk.wit.exports.fermyon_spin_inbound_redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports.fermyon_spin_inbound_redis

-
-
-
-
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/exports/http_handler.html b/docs/v4/wit/exports/http_handler.html deleted file mode 100644 index e8b9b55..0000000 --- a/docs/v4/wit/exports/http_handler.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - -spin_sdk.wit.exports.http_handler API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports.http_handler

-
-
-

This interface defines a handler of HTTP Requests.

-

In a wasi:http/service this interface is exported to respond to an -incoming HTTP Request with a Response.

-

In wasi:http/middleware this interface is both exported and imported as -the "downstream" and "upstream" directions of the middleware chain.

-
-
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/exports/index.html b/docs/v4/wit/exports/index.html deleted file mode 100644 index a8f2e5c..0000000 --- a/docs/v4/wit/exports/index.html +++ /dev/null @@ -1,453 +0,0 @@ - - - - - - -spin_sdk.wit.exports API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports

-
-
-
-
-

Sub-modules

-
-
spin_sdk.wit.exports.fermyon_spin_inbound_redis
-
-
-
-
spin_sdk.wit.exports.http_handler
-
-

This interface defines a handler of HTTP Requests …

-
-
spin_sdk.wit.exports.redis_handler
-
-
-
-
spin_sdk.wit.exports.wasi_http_incoming_handler_0_2_0
-
-

This interface defines a handler of incoming HTTP Requests. It should -be exported by components which can respond to HTTP Requests.

-
-
-
-
-
-
-
-
-

Classes

-
-
-class FermyonSpinInboundRedis -(*args, **kwargs) -
-
-
- -Expand source code - -
class FermyonSpinInboundRedis(Protocol):
-
-    @abstractmethod
-    def handle_message(self, message: bytes) -> None:
-        """
-        The entrypoint for a Redis handler.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
-        """
-        raise NotImplementedError
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto[T](Protocol):
-    def meth(self) -> T:
-        ...
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-

Methods

-
-
-def handle_message(self, message: bytes) ‑> None -
-
-
- -Expand source code - -
@abstractmethod
-def handle_message(self, message: bytes) -> None:
-    """
-    The entrypoint for a Redis handler.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
-    """
-    raise NotImplementedError
-
-

The entrypoint for a Redis handler.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-class HttpHandler -(*args, **kwargs) -
-
-
- -Expand source code - -
class HttpHandler(Protocol):
-
-    @abstractmethod
-    async def handle(self, request: wasi_http_types_0_3_0_rc_2026_03_15.Request) -> wasi_http_types_0_3_0_rc_2026_03_15.Response:
-        """
-        This function may be called with either an incoming request read from the
-        network or a request synthesized or forwarded by another component.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto[T](Protocol):
-    def meth(self) -> T:
-        ...
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-

Subclasses

- -

Methods

-
-
-async def handle(self,
request: Request) ‑> Response
-
-
-
- -Expand source code - -
@abstractmethod
-async def handle(self, request: wasi_http_types_0_3_0_rc_2026_03_15.Request) -> wasi_http_types_0_3_0_rc_2026_03_15.Response:
-    """
-    This function may be called with either an incoming request read from the
-    network or a request synthesized or forwarded by another component.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

This function may be called with either an incoming request read from the -network or a request synthesized or forwarded by another component.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-class RedisHandler -(*args, **kwargs) -
-
-
- -Expand source code - -
class RedisHandler(Protocol):
-
-    @abstractmethod
-    async def handle_message(self, message: bytes) -> None:
-        """
-        The entrypoint for a Redis handler.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-        """
-        raise NotImplementedError
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto[T](Protocol):
-    def meth(self) -> T:
-        ...
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-

Methods

-
-
-async def handle_message(self, message: bytes) ‑> None -
-
-
- -Expand source code - -
@abstractmethod
-async def handle_message(self, message: bytes) -> None:
-    """
-    The entrypoint for a Redis handler.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

The entrypoint for a Redis handler.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-class WasiHttpIncomingHandler020 -(*args, **kwargs) -
-
-
- -Expand source code - -
class WasiHttpIncomingHandler020(Protocol):
-
-    @abstractmethod
-    def handle(self, request: wasi_http_types_0_2_0.IncomingRequest, response_out: wasi_http_types_0_2_0.ResponseOutparam) -> None:
-        """
-        This function is invoked with an incoming HTTP Request, and a resource
-        `response-outparam` which provides the capability to reply with an HTTP
-        Response. The response is sent by calling the `response-outparam.set`
-        method, which allows execution to continue after the response has been
-        sent. This enables both streaming to the response body, and performing other
-        work.
-        
-        The implementor of this function must write a response to the
-        `response-outparam` before returning, or else the caller will respond
-        with an error on its behalf.
-        """
-        raise NotImplementedError
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto[T](Protocol):
-    def meth(self) -> T:
-        ...
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-

Methods

-
-
-def handle(self,
request: IncomingRequest,
response_out: ResponseOutparam) ‑> None
-
-
-
- -Expand source code - -
@abstractmethod
-def handle(self, request: wasi_http_types_0_2_0.IncomingRequest, response_out: wasi_http_types_0_2_0.ResponseOutparam) -> None:
-    """
-    This function is invoked with an incoming HTTP Request, and a resource
-    `response-outparam` which provides the capability to reply with an HTTP
-    Response. The response is sent by calling the `response-outparam.set`
-    method, which allows execution to continue after the response has been
-    sent. This enables both streaming to the response body, and performing other
-    work.
-    
-    The implementor of this function must write a response to the
-    `response-outparam` before returning, or else the caller will respond
-    with an error on its behalf.
-    """
-    raise NotImplementedError
-
-

This function is invoked with an incoming HTTP Request, and a resource -response-outparam which provides the capability to reply with an HTTP -Response. The response is sent by calling the response-outparam.set -method, which allows execution to continue after the response has been -sent. This enables both streaming to the response body, and performing other -work.

-

The implementor of this function must write a response to the -response-outparam before returning, or else the caller will respond -with an error on its behalf.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/exports/redis_handler.html b/docs/v4/wit/exports/redis_handler.html deleted file mode 100644 index 75dadf7..0000000 --- a/docs/v4/wit/exports/redis_handler.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - -spin_sdk.wit.exports.redis_handler API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports.redis_handler

-
-
-
-
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/exports/wasi_http_incoming_handler_0_2_0.html b/docs/v4/wit/exports/wasi_http_incoming_handler_0_2_0.html deleted file mode 100644 index b1fac0e..0000000 --- a/docs/v4/wit/exports/wasi_http_incoming_handler_0_2_0.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - -spin_sdk.wit.exports.wasi_http_incoming_handler_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports.wasi_http_incoming_handler_0_2_0

-
-
-

This interface defines a handler of incoming HTTP Requests. It should -be exported by components which can respond to HTTP Requests.

-
-
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_config.html b/docs/v4/wit/imports/fermyon_spin_config.html deleted file mode 100644 index df65718..0000000 --- a/docs/v4/wit/imports/fermyon_spin_config.html +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_config API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_config

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_config(key: str) ‑> str -
-
-
- -Expand source code - -
def get_config(key: str) -> str:
-    """
-    Get a configuration value for the current component.
-    The config key must match one defined in in the component manifest.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_config.Error)`
-    """
-    raise NotImplementedError
-
-

Get a configuration value for the current component. -The config key must match one defined in in the component manifest.

-

Raises: componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_config.Error)

-
-
-
-
-

Classes

-
-
-class Error_InvalidKey -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidKey:
-    value: str
-
-

Error_InvalidKey(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_InvalidSchema -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidSchema:
-    value: str
-
-

Error_InvalidSchema(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Provider -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Provider:
-    value: str
-
-

Error_Provider(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_http.html b/docs/v4/wit/imports/fermyon_spin_http.html deleted file mode 100644 index 8aaffc4..0000000 --- a/docs/v4/wit/imports/fermyon_spin_http.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_http API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_http

-
-
-
-
-
-
-
-
-

Functions

-
-
-def send_request(req: Request) ‑> Response -
-
-
- -Expand source code - -
def send_request(req: fermyon_spin_http_types.Request) -> fermyon_spin_http_types.Response:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_http_types.HttpError)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(HttpError)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_http_types.html b/docs/v4/wit/imports/fermyon_spin_http_types.html deleted file mode 100644 index f26523c..0000000 --- a/docs/v4/wit/imports/fermyon_spin_http_types.html +++ /dev/null @@ -1,391 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_http_types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_http_types

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class HttpError -(*args, **kwds) -
-
-
- -Expand source code - -
class HttpError(Enum):
-    SUCCESS = 0
-    DESTINATION_NOT_ALLOWED = 1
-    INVALID_URL = 2
-    REQUEST_ERROR = 3
-    RUNTIME_ERROR = 4
-    TOO_MANY_REQUESTS = 5
-
-

Create a collection of name/value pairs.

-

Example enumeration:

-
>>> class Color(Enum):
-...     RED = 1
-...     BLUE = 2
-...     GREEN = 3
-
-

Access them by:

-
    -
  • attribute access:
  • -
-
-
-
-

Color.RED -

-
-
-
-
    -
  • value lookup:
  • -
-
-
-
-

Color(1) -

-
-
-
-
    -
  • name lookup:
  • -
-
-
-
-

Color['RED'] -

-
-
-
-

Enumerations can be iterated over, and know how many members they have:

-
>>> len(Color)
-3
-
-
>>> list(Color)
-[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
-
-

Methods can be added to enumerations, and members can have their own -attributes – see the documentation for details.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var DESTINATION_NOT_ALLOWED
-
-
-
-
var INVALID_URL
-
-
-
-
var REQUEST_ERROR
-
-
-
-
var RUNTIME_ERROR
-
-
-
-
var SUCCESS
-
-
-
-
var TOO_MANY_REQUESTS
-
-
-
-
-
-
-class Method -(*args, **kwds) -
-
-
- -Expand source code - -
class Method(Enum):
-    GET = 0
-    POST = 1
-    PUT = 2
-    DELETE = 3
-    PATCH = 4
-    HEAD = 5
-    OPTIONS = 6
-
-

Create a collection of name/value pairs.

-

Example enumeration:

-
>>> class Color(Enum):
-...     RED = 1
-...     BLUE = 2
-...     GREEN = 3
-
-

Access them by:

-
    -
  • attribute access:
  • -
-
-
-
-

Color.RED -

-
-
-
-
    -
  • value lookup:
  • -
-
-
-
-

Color(1) -

-
-
-
-
    -
  • name lookup:
  • -
-
-
-
-

Color['RED'] -

-
-
-
-

Enumerations can be iterated over, and know how many members they have:

-
>>> len(Color)
-3
-
-
>>> list(Color)
-[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
-
-

Methods can be added to enumerations, and members can have their own -attributes – see the documentation for details.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var DELETE
-
-
-
-
var GET
-
-
-
-
var HEAD
-
-
-
-
var OPTIONS
-
-
-
-
var PATCH
-
-
-
-
var POST
-
-
-
-
var PUT
-
-
-
-
-
-
-class Request -(method: Method,
uri: str,
headers: List[Tuple[str, str]],
params: List[Tuple[str, str]],
body: bytes | None)
-
-
-
- -Expand source code - -
@dataclass
-class Request:
-    method: Method
-    uri: str
-    headers: List[Tuple[str, str]]
-    params: List[Tuple[str, str]]
-    body: Optional[bytes]
-
-

Request(method: spin_sdk.wit.imports.fermyon_spin_http_types.Method, uri: str, headers: List[Tuple[str, str]], params: List[Tuple[str, str]], body: Optional[bytes])

-

Instance variables

-
-
var body : bytes | None
-
-
-
-
var headers : List[Tuple[str, str]]
-
-
-
-
var methodMethod
-
-
-
-
var params : List[Tuple[str, str]]
-
-
-
-
var uri : str
-
-
-
-
-
-
-class Response -(status: int, headers: List[Tuple[str, str]] | None, body: bytes | None) -
-
-
- -Expand source code - -
@dataclass
-class Response:
-    status: int
-    headers: Optional[List[Tuple[str, str]]]
-    body: Optional[bytes]
-
-

Response(status: int, headers: Optional[List[Tuple[str, str]]], body: Optional[bytes])

-

Instance variables

-
-
var body : bytes | None
-
-
-
-
var headers : List[Tuple[str, str]] | None
-
-
-
-
var status : int
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_key_value.html b/docs/v4/wit/imports/fermyon_spin_key_value.html deleted file mode 100644 index 1bf746a..0000000 --- a/docs/v4/wit/imports/fermyon_spin_key_value.html +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_key_value API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_key_value

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
-
-
-

Functions

-
-
-def close(store: int) ‑> None -
-
-
- -Expand source code - -
def close(store: int) -> None:
-    """
-    Close the specified `store`.
-    
-    This has no effect if `store` is not a valid handle to an open store.
-    """
-    raise NotImplementedError
-
-

Close the specified store.

-

This has no effect if store is not a valid handle to an open store.

-
-
-def delete(store: int, key: str) ‑> None -
-
-
- -Expand source code - -
def delete(store: int, key: str) -> None:
-    """
-    Delete the tuple with the specified `key` from the specified `store`.
-    
-    `error::invalid-store` will be raised if `store` is not a valid handle
-    to an open store.  No error is raised if a tuple did not previously
-    exist for `key`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value.Error)`
-    """
-    raise NotImplementedError
-
-

Delete the tuple with the specified key from the specified store.

-

error::invalid-store will be raised if store is not a valid handle -to an open store. -No error is raised if a tuple did not previously -exist for key.

-

Raises: componentize_py_types.Err(Error)

-
-
-def exists(store: int, key: str) ‑> bool -
-
-
- -Expand source code - -
def exists(store: int, key: str) -> bool:
-    """
-    Return whether a tuple exists for the specified `key` in the specified
-    `store`.
-    
-    `error::invalid-store` will be raised if `store` is not a valid handle
-    to an open store.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value.Error)`
-    """
-    raise NotImplementedError
-
-

Return whether a tuple exists for the specified key in the specified -store.

-

error::invalid-store will be raised if store is not a valid handle -to an open store.

-

Raises: componentize_py_types.Err(Error)

-
-
-def get(store: int, key: str) ‑> bytes -
-
-
- -Expand source code - -
def get(store: int, key: str) -> bytes:
-    """
-    Get the value associated with the specified `key` from the specified
-    `store`.
-    
-    `error::invalid-store` will be raised if `store` is not a valid handle
-    to an open store, and `error::no-such-key` will be raised if there is no
-    tuple for `key` in `store`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value.Error)`
-    """
-    raise NotImplementedError
-
-

Get the value associated with the specified key from the specified -store.

-

error::invalid-store will be raised if store is not a valid handle -to an open store, and error::no-such-key will be raised if there is no -tuple for key in store.

-

Raises: componentize_py_types.Err(Error)

-
-
-def get_keys(store: int) ‑> List[str] -
-
-
- -Expand source code - -
def get_keys(store: int) -> List[str]:
-    """
-    Return a list of all the keys in the specified `store`.
-    
-    `error::invalid-store` will be raised if `store` is not a valid handle
-    to an open store.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value.Error)`
-    """
-    raise NotImplementedError
-
-

Return a list of all the keys in the specified store.

-

error::invalid-store will be raised if store is not a valid handle -to an open store.

-

Raises: componentize_py_types.Err(Error)

-
-
-def open(name: str) ‑> int -
-
-
- -Expand source code - -
def open(name: str) -> int:
-    """
-    Open the store with the specified name.
-    
-    If `name` is "default", the default store is opened.  Otherwise,
-    `name` must refer to a store defined and configured in a runtime
-    configuration file supplied with the application.
-    
-    `error::no-such-store` will be raised if the `name` is not recognized.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value.Error)`
-    """
-    raise NotImplementedError
-
-

Open the store with the specified name.

-

If name is "default", the default store is opened. -Otherwise, -name must refer to a store defined and configured in a runtime -configuration file supplied with the application.

-

error::no-such-store will be raised if the name is not recognized.

-

Raises: componentize_py_types.Err(Error)

-
-
-def set(store: int, key: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
def set(store: int, key: str, value: bytes) -> None:
-    """
-    Set the `value` associated with the specified `key` in the specified
-    `store`, overwriting any existing value.
-    
-    `error::invalid-store` will be raised if `store` is not a valid handle
-    to an open store.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value.Error)`
-    """
-    raise NotImplementedError
-
-

Set the value associated with the specified key in the specified -store, overwriting any existing value.

-

error::invalid-store will be raised if store is not a valid handle -to an open store.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-

Classes

-
-
-class Error_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class Error_AccessDenied:
-    pass
-
-

Error_AccessDenied()

-
-
-class Error_InvalidStore -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidStore:
-    pass
-
-

Error_InvalidStore()

-
-
-class Error_Io -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Io:
-    value: str
-
-

Error_Io(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_NoSuchKey -
-
-
- -Expand source code - -
@dataclass
-class Error_NoSuchKey:
-    pass
-
-

Error_NoSuchKey()

-
-
-class Error_NoSuchStore -
-
-
- -Expand source code - -
@dataclass
-class Error_NoSuchStore:
-    pass
-
-

Error_NoSuchStore()

-
-
-class Error_StoreTableFull -
-
-
- -Expand source code - -
@dataclass
-class Error_StoreTableFull:
-    pass
-
-

Error_StoreTableFull()

-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_key_value_2_0_0.html b/docs/v4/wit/imports/fermyon_spin_key_value_2_0_0.html deleted file mode 100644 index c83b156..0000000 --- a/docs/v4/wit/imports/fermyon_spin_key_value_2_0_0.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
-
-
-
-
-

Classes

-
-
-class Error_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class Error_AccessDenied:
-    pass
-
-

Error_AccessDenied()

-
-
-class Error_NoSuchStore -
-
-
- -Expand source code - -
@dataclass
-class Error_NoSuchStore:
-    pass
-
-

Error_NoSuchStore()

-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_StoreTableFull -
-
-
- -Expand source code - -
@dataclass
-class Error_StoreTableFull:
-    pass
-
-

Error_StoreTableFull()

-
-
-class Store -
-
-
- -Expand source code - -
class Store:
-    """
-    An open key-value store
-    """
-    
-    @classmethod
-    def open(cls, label: str) -> Self:
-        """
-        Open the store with the specified label.
-        
-        `label` must refer to a store allowed in the spin.toml manifest.
-        
-        `error::no-such-store` will be raised if the `label` is not recognized.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value associated with the specified `key`
-        
-        Returns `ok(none)` if the key does not exist.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set the `value` associated with the specified `key` overwriting any existing value.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def delete(self, key: str) -> None:
-        """
-        Delete the tuple with the specified `key`
-        
-        No error is raised if a tuple did not previously exist for `key`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def exists(self, key: str) -> bool:
-        """
-        Return whether a tuple exists for the specified `key`
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def get_keys(self) -> List[str]:
-        """
-        Return a list of all the keys
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

An open key-value store

-

Static methods

-
-
-def open(label: str) ‑> Self -
-
-

Open the store with the specified label.

-

label must refer to a store allowed in the spin.toml manifest.

-

error::no-such-store will be raised if the label is not recognized.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-def delete(self, key: str) ‑> None -
-
-
- -Expand source code - -
def delete(self, key: str) -> None:
-    """
-    Delete the tuple with the specified `key`
-    
-    No error is raised if a tuple did not previously exist for `key`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Delete the tuple with the specified key

-

No error is raised if a tuple did not previously exist for key.

-

Raises: componentize_py_types.Err(Error)

-
-
-def exists(self, key: str) ‑> bool -
-
-
- -Expand source code - -
def exists(self, key: str) -> bool:
-    """
-    Return whether a tuple exists for the specified `key`
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Return whether a tuple exists for the specified key

-

Raises: componentize_py_types.Err(Error)

-
-
-def get(self, key: str) ‑> bytes | None -
-
-
- -Expand source code - -
def get(self, key: str) -> Optional[bytes]:
-    """
-    Get the value associated with the specified `key`
-    
-    Returns `ok(none)` if the key does not exist.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Get the value associated with the specified key

-

Returns ok(none) if the key does not exist.

-

Raises: componentize_py_types.Err(Error)

-
-
-def get_keys(self) ‑> List[str] -
-
-
- -Expand source code - -
def get_keys(self) -> List[str]:
-    """
-    Return a list of all the keys
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Return a list of all the keys

-

Raises: componentize_py_types.Err(Error)

-
-
-def set(self, key: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
def set(self, key: str, value: bytes) -> None:
-    """
-    Set the `value` associated with the specified `key` overwriting any existing value.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Set the value associated with the specified key overwriting any existing value.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_llm.html b/docs/v4/wit/imports/fermyon_spin_llm.html deleted file mode 100644 index 155a26e..0000000 --- a/docs/v4/wit/imports/fermyon_spin_llm.html +++ /dev/null @@ -1,409 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_llm API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_llm

-
-
-

A WASI interface dedicated to performing inferencing for Large Language Models.

-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
-
-
-

Functions

-
-
-def generate_embeddings(model: str, text: List[str]) ‑> EmbeddingsResult -
-
-
- -Expand source code - -
def generate_embeddings(model: str, text: List[str]) -> EmbeddingsResult:
-    """
-    Generate embeddings for the supplied list of text
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm.Error)`
-    """
-    raise NotImplementedError
-
-

Generate embeddings for the supplied list of text

-

Raises: componentize_py_types.Err(Error)

-
-
-def infer(model: str,
prompt: str,
params: InferencingParams | None) ‑> InferencingResult
-
-
-
- -Expand source code - -
def infer(model: str, prompt: str, params: Optional[InferencingParams]) -> InferencingResult:
-    """
-    Perform inferencing using the provided model and prompt with the given optional params
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm.Error)`
-    """
-    raise NotImplementedError
-
-

Perform inferencing using the provided model and prompt with the given optional params

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-

Classes

-
-
-class EmbeddingsResult -(embeddings: List[List[float]],
usage: EmbeddingsUsage)
-
-
-
- -Expand source code - -
@dataclass
-class EmbeddingsResult:
-    """
-    Result of generating embeddings
-    """
-    embeddings: List[List[float]]
-    usage: EmbeddingsUsage
-
-

Result of generating embeddings

-

Instance variables

-
-
var embeddings : List[List[float]]
-
-
-
-
var usageEmbeddingsUsage
-
-
-
-
-
-
-class EmbeddingsUsage -(prompt_token_count: int) -
-
-
- -Expand source code - -
@dataclass
-class EmbeddingsUsage:
-    """
-    Usage related to an embeddings generation request
-    """
-    prompt_token_count: int
-
-

Usage related to an embeddings generation request

-

Instance variables

-
-
var prompt_token_count : int
-
-
-
-
-
-
-class Error_InvalidInput -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidInput:
-    value: str
-
-

Error_InvalidInput(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ModelNotSupported -
-
-
- -Expand source code - -
@dataclass
-class Error_ModelNotSupported:
-    pass
-
-

Error_ModelNotSupported()

-
-
-class Error_RuntimeError -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_RuntimeError:
-    value: str
-
-

Error_RuntimeError(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class InferencingParams -(max_tokens: int,
repeat_penalty: float,
repeat_penalty_last_n_token_count: int,
temperature: float,
top_k: int,
top_p: float)
-
-
-
- -Expand source code - -
@dataclass
-class InferencingParams:
-    """
-    Inference request parameters
-    """
-    max_tokens: int
-    repeat_penalty: float
-    repeat_penalty_last_n_token_count: int
-    temperature: float
-    top_k: int
-    top_p: float
-
-

Inference request parameters

-

Instance variables

-
-
var max_tokens : int
-
-
-
-
var repeat_penalty : float
-
-
-
-
var repeat_penalty_last_n_token_count : int
-
-
-
-
var temperature : float
-
-
-
-
var top_k : int
-
-
-
-
var top_p : float
-
-
-
-
-
-
-class InferencingResult -(text: str,
usage: InferencingUsage)
-
-
-
- -Expand source code - -
@dataclass
-class InferencingResult:
-    """
-    An inferencing result
-    """
-    text: str
-    usage: InferencingUsage
-
-

An inferencing result

-

Instance variables

-
-
var text : str
-
-
-
-
var usageInferencingUsage
-
-
-
-
-
-
-class InferencingUsage -(prompt_token_count: int, generated_token_count: int) -
-
-
- -Expand source code - -
@dataclass
-class InferencingUsage:
-    """
-    Usage information related to the inferencing result
-    """
-    prompt_token_count: int
-    generated_token_count: int
-
-

Usage information related to the inferencing result

-

Instance variables

-
-
var generated_token_count : int
-
-
-
-
var prompt_token_count : int
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_llm_2_0_0.html b/docs/v4/wit/imports/fermyon_spin_llm_2_0_0.html deleted file mode 100644 index 72b889c..0000000 --- a/docs/v4/wit/imports/fermyon_spin_llm_2_0_0.html +++ /dev/null @@ -1,409 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_llm_2_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_llm_2_0_0

-
-
-

A WASI interface dedicated to performing inferencing for Large Language Models.

-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
-
-
-

Functions

-
-
-def generate_embeddings(model: str, text: List[str]) ‑> EmbeddingsResult -
-
-
- -Expand source code - -
def generate_embeddings(model: str, text: List[str]) -> EmbeddingsResult:
-    """
-    Generate embeddings for the supplied list of text
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Generate embeddings for the supplied list of text

-

Raises: componentize_py_types.Err(Error)

-
-
-def infer(model: str,
prompt: str,
params: InferencingParams | None) ‑> InferencingResult
-
-
-
- -Expand source code - -
def infer(model: str, prompt: str, params: Optional[InferencingParams]) -> InferencingResult:
-    """
-    Perform inferencing using the provided model and prompt with the given optional params
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Perform inferencing using the provided model and prompt with the given optional params

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-

Classes

-
-
-class EmbeddingsResult -(embeddings: List[List[float]],
usage: EmbeddingsUsage)
-
-
-
- -Expand source code - -
@dataclass
-class EmbeddingsResult:
-    """
-    Result of generating embeddings
-    """
-    embeddings: List[List[float]]
-    usage: EmbeddingsUsage
-
-

Result of generating embeddings

-

Instance variables

-
-
var embeddings : List[List[float]]
-
-
-
-
var usageEmbeddingsUsage
-
-
-
-
-
-
-class EmbeddingsUsage -(prompt_token_count: int) -
-
-
- -Expand source code - -
@dataclass
-class EmbeddingsUsage:
-    """
-    Usage related to an embeddings generation request
-    """
-    prompt_token_count: int
-
-

Usage related to an embeddings generation request

-

Instance variables

-
-
var prompt_token_count : int
-
-
-
-
-
-
-class Error_InvalidInput -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidInput:
-    value: str
-
-

Error_InvalidInput(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ModelNotSupported -
-
-
- -Expand source code - -
@dataclass
-class Error_ModelNotSupported:
-    pass
-
-

Error_ModelNotSupported()

-
-
-class Error_RuntimeError -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_RuntimeError:
-    value: str
-
-

Error_RuntimeError(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class InferencingParams -(max_tokens: int,
repeat_penalty: float,
repeat_penalty_last_n_token_count: int,
temperature: float,
top_k: int,
top_p: float)
-
-
-
- -Expand source code - -
@dataclass
-class InferencingParams:
-    """
-    Inference request parameters
-    """
-    max_tokens: int
-    repeat_penalty: float
-    repeat_penalty_last_n_token_count: int
-    temperature: float
-    top_k: int
-    top_p: float
-
-

Inference request parameters

-

Instance variables

-
-
var max_tokens : int
-
-
-
-
var repeat_penalty : float
-
-
-
-
var repeat_penalty_last_n_token_count : int
-
-
-
-
var temperature : float
-
-
-
-
var top_k : int
-
-
-
-
var top_p : float
-
-
-
-
-
-
-class InferencingResult -(text: str,
usage: InferencingUsage)
-
-
-
- -Expand source code - -
@dataclass
-class InferencingResult:
-    """
-    An inferencing result
-    """
-    text: str
-    usage: InferencingUsage
-
-

An inferencing result

-

Instance variables

-
-
var text : str
-
-
-
-
var usageInferencingUsage
-
-
-
-
-
-
-class InferencingUsage -(prompt_token_count: int, generated_token_count: int) -
-
-
- -Expand source code - -
@dataclass
-class InferencingUsage:
-    """
-    Usage information related to the inferencing result
-    """
-    prompt_token_count: int
-    generated_token_count: int
-
-

Usage information related to the inferencing result

-

Instance variables

-
-
var generated_token_count : int
-
-
-
-
var prompt_token_count : int
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_mqtt_2_0_0.html b/docs/v4/wit/imports/fermyon_spin_mqtt_2_0_0.html deleted file mode 100644 index 4b1f452..0000000 --- a/docs/v4/wit/imports/fermyon_spin_mqtt_2_0_0.html +++ /dev/null @@ -1,297 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_mqtt_2_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_mqtt_2_0_0

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

Errors related to interacting with Mqtt

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    
-    @classmethod
-    def open(cls, address: str, username: str, password: str, keep_alive_interval_in_secs: int) -> Self:
-        """
-        Open a connection to the Mqtt instance at `address`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_mqtt_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def publish(self, topic: str, payload: bytes, qos: Qos) -> None:
-        """
-        Publish an Mqtt message to the specified `topic`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_mqtt_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Static methods

-
-
-def open(address: str, username: str, password: str, keep_alive_interval_in_secs: int) ‑> Self -
-
-

Open a connection to the Mqtt instance at address.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-def publish(self,
topic: str,
payload: bytes,
qos: Qos) ‑> None
-
-
-
- -Expand source code - -
def publish(self, topic: str, payload: bytes, qos: Qos) -> None:
-    """
-    Publish an Mqtt message to the specified `topic`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_mqtt_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Publish an Mqtt message to the specified topic.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-class Error_ConnectionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ConnectionFailed:
-    value: str
-
-

Error_ConnectionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_InvalidAddress -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidAddress:
-    pass
-
-

Error_InvalidAddress()

-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_TooManyConnections -
-
-
- -Expand source code - -
@dataclass
-class Error_TooManyConnections:
-    pass
-
-

Error_TooManyConnections()

-
-
-class Qos -(*args, **kwds) -
-
-
- -Expand source code - -
class Qos(Enum):
-    """
-    QoS for publishing Mqtt messages
-    """
-    AT_MOST_ONCE = 0
-    AT_LEAST_ONCE = 1
-    EXACTLY_ONCE = 2
-
-

QoS for publishing Mqtt messages

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var AT_LEAST_ONCE
-
-
-
-
var AT_MOST_ONCE
-
-
-
-
var EXACTLY_ONCE
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_mysql.html b/docs/v4/wit/imports/fermyon_spin_mysql.html deleted file mode 100644 index a11454a..0000000 --- a/docs/v4/wit/imports/fermyon_spin_mysql.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_mysql API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_mysql

-
-
-
-
-
-
-

Global variables

-
-
var MysqlError
-
-

General purpose error.

-
-
-
-
-

Functions

-
-
-def execute(address: str,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> None
-
-
-
- -Expand source code - -
def execute(address: str, statement: str, params: List[fermyon_spin_rdbms_types.ParameterValue]) -> None:
-    """
-    execute command to the database: insert, update, delete
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_mysql.MysqlError)`
-    """
-    raise NotImplementedError
-
-

execute command to the database: insert, update, delete

-

Raises: componentize_py_types.Err(MysqlError)

-
-
-def query(address: str,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> RowSet
-
-
-
- -Expand source code - -
def query(address: str, statement: str, params: List[fermyon_spin_rdbms_types.ParameterValue]) -> fermyon_spin_rdbms_types.RowSet:
-    """
-    query the database: select
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_mysql.MysqlError)`
-    """
-    raise NotImplementedError
-
-

query the database: select

-

Raises: componentize_py_types.Err(MysqlError)

-
-
-
-
-

Classes

-
-
-class MysqlError_BadParameter -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class MysqlError_BadParameter:
-    value: str
-
-

MysqlError_BadParameter(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class MysqlError_ConnectionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class MysqlError_ConnectionFailed:
-    value: str
-
-

MysqlError_ConnectionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class MysqlError_OtherError -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class MysqlError_OtherError:
-    value: str
-
-

MysqlError_OtherError(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class MysqlError_QueryFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class MysqlError_QueryFailed:
-    value: str
-
-

MysqlError_QueryFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class MysqlError_Success -
-
-
- -Expand source code - -
@dataclass
-class MysqlError_Success:
-    pass
-
-

MysqlError_Success()

-
-
-class MysqlError_ValueConversionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class MysqlError_ValueConversionFailed:
-    value: str
-
-

MysqlError_ValueConversionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_mysql_2_0_0.html b/docs/v4/wit/imports/fermyon_spin_mysql_2_0_0.html deleted file mode 100644 index 1b13bef..0000000 --- a/docs/v4/wit/imports/fermyon_spin_mysql_2_0_0.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_mysql_2_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_mysql_2_0_0

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    """
-    A connection to a MySQL database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the MySQL instance at `address`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def query(self, statement: str, params: List[fermyon_spin_rdbms_types_2_0_0.ParameterValue]) -> fermyon_spin_rdbms_types_2_0_0.RowSet:
-        """
-        query the database: select
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, statement: str, params: List[fermyon_spin_rdbms_types_2_0_0.ParameterValue]) -> None:
-        """
-        execute command to the database: insert, update, delete
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A connection to a MySQL database.

-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the MySQL instance at address.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-def execute(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> None
-
-
-
- -Expand source code - -
def execute(self, statement: str, params: List[fermyon_spin_rdbms_types_2_0_0.ParameterValue]) -> None:
-    """
-    execute command to the database: insert, update, delete
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

execute command to the database: insert, update, delete

-

Raises: componentize_py_types.Err(Error)

-
-
-def query(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> RowSet
-
-
-
- -Expand source code - -
def query(self, statement: str, params: List[fermyon_spin_rdbms_types_2_0_0.ParameterValue]) -> fermyon_spin_rdbms_types_2_0_0.RowSet:
-    """
-    query the database: select
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

query the database: select

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_postgres.html b/docs/v4/wit/imports/fermyon_spin_postgres.html deleted file mode 100644 index 0d12292..0000000 --- a/docs/v4/wit/imports/fermyon_spin_postgres.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_postgres API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_postgres

-
-
-
-
-
-
-

Global variables

-
-
var PgError
-
-

General purpose error.

-
-
-
-
-

Functions

-
-
-def execute(address: str,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> int
-
-
-
- -Expand source code - -
def execute(address: str, statement: str, params: List[fermyon_spin_rdbms_types.ParameterValue]) -> int:
-    """
-    execute command to the database: insert, update, delete
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_postgres.PgError)`
-    """
-    raise NotImplementedError
-
-

execute command to the database: insert, update, delete

-

Raises: componentize_py_types.Err(PgError)

-
-
-def query(address: str,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> RowSet
-
-
-
- -Expand source code - -
def query(address: str, statement: str, params: List[fermyon_spin_rdbms_types.ParameterValue]) -> fermyon_spin_rdbms_types.RowSet:
-    """
-    query the database: select
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_postgres.PgError)`
-    """
-    raise NotImplementedError
-
-

query the database: select

-

Raises: componentize_py_types.Err(PgError)

-
-
-
-
-

Classes

-
-
-class PgError_BadParameter -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class PgError_BadParameter:
-    value: str
-
-

PgError_BadParameter(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class PgError_ConnectionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class PgError_ConnectionFailed:
-    value: str
-
-

PgError_ConnectionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class PgError_OtherError -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class PgError_OtherError:
-    value: str
-
-

PgError_OtherError(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class PgError_QueryFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class PgError_QueryFailed:
-    value: str
-
-

PgError_QueryFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class PgError_Success -
-
-
- -Expand source code - -
@dataclass
-class PgError_Success:
-    pass
-
-

PgError_Success()

-
-
-class PgError_ValueConversionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class PgError_ValueConversionFailed:
-    value: str
-
-

PgError_ValueConversionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_postgres_2_0_0.html b/docs/v4/wit/imports/fermyon_spin_postgres_2_0_0.html deleted file mode 100644 index 32df729..0000000 --- a/docs/v4/wit/imports/fermyon_spin_postgres_2_0_0.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_postgres_2_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_postgres_2_0_0

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    """
-    A connection to a postgres database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Postgres instance at `address`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def query(self, statement: str, params: List[fermyon_spin_rdbms_types_2_0_0.ParameterValue]) -> fermyon_spin_rdbms_types_2_0_0.RowSet:
-        """
-        Query the database.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, statement: str, params: List[fermyon_spin_rdbms_types_2_0_0.ParameterValue]) -> int:
-        """
-        Execute command to the database.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A connection to a postgres database.

-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the Postgres instance at address.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-def execute(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> int
-
-
-
- -Expand source code - -
def execute(self, statement: str, params: List[fermyon_spin_rdbms_types_2_0_0.ParameterValue]) -> int:
-    """
-    Execute command to the database.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Execute command to the database.

-

Raises: componentize_py_types.Err(Error)

-
-
-def query(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> RowSet
-
-
-
- -Expand source code - -
def query(self, statement: str, params: List[fermyon_spin_rdbms_types_2_0_0.ParameterValue]) -> fermyon_spin_rdbms_types_2_0_0.RowSet:
-    """
-    Query the database.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Query the database.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_rdbms_types.html b/docs/v4/wit/imports/fermyon_spin_rdbms_types.html deleted file mode 100644 index 0213347..0000000 --- a/docs/v4/wit/imports/fermyon_spin_rdbms_types.html +++ /dev/null @@ -1,1078 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_rdbms_types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_rdbms_types

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Column -(name: str,
data_type: DbDataType)
-
-
-
- -Expand source code - -
@dataclass
-class Column:
-    name: str
-    data_type: DbDataType
-
-

Column(name: str, data_type: spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbDataType)

-

Instance variables

-
-
var data_typeDbDataType
-
-
-
-
var name : str
-
-
-
-
-
-
-class DbDataType -(*args, **kwds) -
-
-
- -Expand source code - -
class DbDataType(Enum):
-    BOOLEAN = 0
-    INT8 = 1
-    INT16 = 2
-    INT32 = 3
-    INT64 = 4
-    UINT8 = 5
-    UINT16 = 6
-    UINT32 = 7
-    UINT64 = 8
-    FLOATING32 = 9
-    FLOATING64 = 10
-    STR = 11
-    BINARY = 12
-    OTHER = 13
-
-

Create a collection of name/value pairs.

-

Example enumeration:

-
>>> class Color(Enum):
-...     RED = 1
-...     BLUE = 2
-...     GREEN = 3
-
-

Access them by:

-
    -
  • attribute access:
  • -
-
-
-
-

Color.RED -

-
-
-
-
    -
  • value lookup:
  • -
-
-
-
-

Color(1) -

-
-
-
-
    -
  • name lookup:
  • -
-
-
-
-

Color['RED'] -

-
-
-
-

Enumerations can be iterated over, and know how many members they have:

-
>>> len(Color)
-3
-
-
>>> list(Color)
-[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
-
-

Methods can be added to enumerations, and members can have their own -attributes – see the documentation for details.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var BINARY
-
-
-
-
var BOOLEAN
-
-
-
-
var FLOATING32
-
-
-
-
var FLOATING64
-
-
-
-
var INT16
-
-
-
-
var INT32
-
-
-
-
var INT64
-
-
-
-
var INT8
-
-
-
-
var OTHER
-
-
-
-
var STR
-
-
-
-
var UINT16
-
-
-
-
var UINT32
-
-
-
-
var UINT64
-
-
-
-
var UINT8
-
-
-
-
-
-
-class DbValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Binary:
-    value: bytes
-
-

DbValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Boolean:
-    value: bool
-
-

DbValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class DbValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class DbValue_DbNull:
-    pass
-
-

DbValue_DbNull()

-
-
-class DbValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating32:
-    value: float
-
-

DbValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating64:
-    value: float
-
-

DbValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int16:
-    value: int
-
-

DbValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int32:
-    value: int
-
-

DbValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int64:
-    value: int
-
-

DbValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int8:
-    value: int
-
-

DbValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Str:
-    value: str
-
-

DbValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class DbValue_Uint16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uint16:
-    value: int
-
-

DbValue_Uint16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Uint32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uint32:
-    value: int
-
-

DbValue_Uint32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Uint64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uint64:
-    value: int
-
-

DbValue_Uint64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Uint8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uint8:
-    value: int
-
-

DbValue_Uint8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Unsupported -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Unsupported:
-    pass
-
-

DbValue_Unsupported()

-
-
-class ParameterValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Binary:
-    value: bytes
-
-

ParameterValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class ParameterValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Boolean:
-    value: bool
-
-

ParameterValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class ParameterValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_DbNull:
-    pass
-
-

ParameterValue_DbNull()

-
-
-class ParameterValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating32:
-    value: float
-
-

ParameterValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating64:
-    value: float
-
-

ParameterValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int16:
-    value: int
-
-

ParameterValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int32:
-    value: int
-
-

ParameterValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int64:
-    value: int
-
-

ParameterValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int8:
-    value: int
-
-

ParameterValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Str:
-    value: str
-
-

ParameterValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Uint16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uint16:
-    value: int
-
-

ParameterValue_Uint16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Uint32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uint32:
-    value: int
-
-

ParameterValue_Uint32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Uint64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uint64:
-    value: int
-
-

ParameterValue_Uint64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Uint8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uint8:
-    value: int
-
-

ParameterValue_Uint8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RowSet -(columns: List[Column],
rows: List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Uint8 | DbValue_Uint16 | DbValue_Uint32 | DbValue_Uint64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_DbNull | DbValue_Unsupported]])
-
-
-
- -Expand source code - -
@dataclass
-class RowSet:
-    columns: List[Column]
-    rows: List[List[DbValue]]
-
-

RowSet(columns: List[spin_sdk.wit.imports.fermyon_spin_rdbms_types.Column], rows: List[List[Union[spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Boolean, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Int8, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Int16, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Int32, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Int64, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Uint8, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Uint16, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Uint32, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Uint64, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Floating32, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Floating64, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Str, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Binary, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_DbNull, spin_sdk.wit.imports.fermyon_spin_rdbms_types.DbValue_Unsupported]]])

-

Instance variables

-
-
var columns : List[Column]
-
-
-
-
var rows : List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Uint8 | DbValue_Uint16 | DbValue_Uint32 | DbValue_Uint64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_DbNull | DbValue_Unsupported]]
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_rdbms_types_2_0_0.html b/docs/v4/wit/imports/fermyon_spin_rdbms_types_2_0_0.html deleted file mode 100644 index a5020a5..0000000 --- a/docs/v4/wit/imports/fermyon_spin_rdbms_types_2_0_0.html +++ /dev/null @@ -1,1200 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0

-
-
-
-
-
-
-

Global variables

-
-
var DbValue
-
-

Database values

-
-
var Error
-
-

Errors related to interacting with a database.

-
-
var ParameterValue
-
-

Values used in parameterized queries

-
-
-
-
-
-
-

Classes

-
-
-class Column -(name: str,
data_type: DbDataType)
-
-
-
- -Expand source code - -
@dataclass
-class Column:
-    """
-    A database column
-    """
-    name: str
-    data_type: DbDataType
-
-

A database column

-

Instance variables

-
-
var data_typeDbDataType
-
-
-
-
var name : str
-
-
-
-
-
-
-class DbDataType -(*args, **kwds) -
-
-
- -Expand source code - -
class DbDataType(Enum):
-    """
-    Data types for a database column
-    """
-    BOOLEAN = 0
-    INT8 = 1
-    INT16 = 2
-    INT32 = 3
-    INT64 = 4
-    UINT8 = 5
-    UINT16 = 6
-    UINT32 = 7
-    UINT64 = 8
-    FLOATING32 = 9
-    FLOATING64 = 10
-    STR = 11
-    BINARY = 12
-    OTHER = 13
-
-

Data types for a database column

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var BINARY
-
-
-
-
var BOOLEAN
-
-
-
-
var FLOATING32
-
-
-
-
var FLOATING64
-
-
-
-
var INT16
-
-
-
-
var INT32
-
-
-
-
var INT64
-
-
-
-
var INT8
-
-
-
-
var OTHER
-
-
-
-
var STR
-
-
-
-
var UINT16
-
-
-
-
var UINT32
-
-
-
-
var UINT64
-
-
-
-
var UINT8
-
-
-
-
-
-
-class DbValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Binary:
-    value: bytes
-
-

DbValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Boolean:
-    value: bool
-
-

DbValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class DbValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class DbValue_DbNull:
-    pass
-
-

DbValue_DbNull()

-
-
-class DbValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating32:
-    value: float
-
-

DbValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating64:
-    value: float
-
-

DbValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int16:
-    value: int
-
-

DbValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int32:
-    value: int
-
-

DbValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int64:
-    value: int
-
-

DbValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int8:
-    value: int
-
-

DbValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Str:
-    value: str
-
-

DbValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class DbValue_Uint16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uint16:
-    value: int
-
-

DbValue_Uint16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Uint32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uint32:
-    value: int
-
-

DbValue_Uint32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Uint64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uint64:
-    value: int
-
-

DbValue_Uint64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Uint8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uint8:
-    value: int
-
-

DbValue_Uint8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Unsupported -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Unsupported:
-    pass
-
-

DbValue_Unsupported()

-
-
-class Error_BadParameter -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_BadParameter:
-    value: str
-
-

Error_BadParameter(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ConnectionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ConnectionFailed:
-    value: str
-
-

Error_ConnectionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_QueryFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_QueryFailed:
-    value: str
-
-

Error_QueryFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ValueConversionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ValueConversionFailed:
-    value: str
-
-

Error_ValueConversionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Binary:
-    value: bytes
-
-

ParameterValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class ParameterValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Boolean:
-    value: bool
-
-

ParameterValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class ParameterValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_DbNull:
-    pass
-
-

ParameterValue_DbNull()

-
-
-class ParameterValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating32:
-    value: float
-
-

ParameterValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating64:
-    value: float
-
-

ParameterValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int16:
-    value: int
-
-

ParameterValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int32:
-    value: int
-
-

ParameterValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int64:
-    value: int
-
-

ParameterValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int8:
-    value: int
-
-

ParameterValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Str:
-    value: str
-
-

ParameterValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Uint16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uint16:
-    value: int
-
-

ParameterValue_Uint16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Uint32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uint32:
-    value: int
-
-

ParameterValue_Uint32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Uint64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uint64:
-    value: int
-
-

ParameterValue_Uint64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Uint8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uint8:
-    value: int
-
-

ParameterValue_Uint8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RowSet -(columns: List[Column],
rows: List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Uint8 | DbValue_Uint16 | DbValue_Uint32 | DbValue_Uint64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_DbNull | DbValue_Unsupported]])
-
-
-
- -Expand source code - -
@dataclass
-class RowSet:
-    """
-    A set of database rows
-    """
-    columns: List[Column]
-    rows: List[List[DbValue]]
-
-

A set of database rows

-

Instance variables

-
-
var columns : List[Column]
-
-
-
-
var rows : List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Uint8 | DbValue_Uint16 | DbValue_Uint32 | DbValue_Uint64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_DbNull | DbValue_Unsupported]]
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_redis.html b/docs/v4/wit/imports/fermyon_spin_redis.html deleted file mode 100644 index 1b68a76..0000000 --- a/docs/v4/wit/imports/fermyon_spin_redis.html +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_redis

-
-
-
-
-
-
-
-
-

Functions

-
-
-def del_(address: str, keys: List[str]) ‑> int -
-
-
- -Expand source code - -
def del_(address: str, keys: List[str]) -> int:
-    """
-    Removes the specified keys. A key is ignored if it does not exist.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
-    """
-    raise NotImplementedError
-
-

Removes the specified keys. A key is ignored if it does not exist.

-

Raises: componentize_py_types.Err(Error)

-
-
-def execute(address: str,
command: str,
arguments: List[RedisParameter_Int64 | RedisParameter_Binary]) ‑> List[RedisResult_Nil | RedisResult_Status | RedisResult_Int64 | RedisResult_Binary]
-
-
-
- -Expand source code - -
def execute(address: str, command: str, arguments: List[fermyon_spin_redis_types.RedisParameter]) -> List[fermyon_spin_redis_types.RedisResult]:
-    """
-    Execute an arbitrary Redis command and receive the result.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
-    """
-    raise NotImplementedError
-
-

Execute an arbitrary Redis command and receive the result.

-

Raises: componentize_py_types.Err(Error)

-
-
-def get(address: str, key: str) ‑> bytes -
-
-
- -Expand source code - -
def get(address: str, key: str) -> bytes:
-    """
-    Get the value of a key.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
-    """
-    raise NotImplementedError
-
-

Get the value of a key.

-

Raises: componentize_py_types.Err(Error)

-
-
-def incr(address: str, key: str) ‑> int -
-
-
- -Expand source code - -
def incr(address: str, key: str) -> int:
-    """
-    Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation.
-    An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
-    """
-    raise NotImplementedError
-
-

Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation. -An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer.

-

Raises: componentize_py_types.Err(Error)

-
-
-def publish(address: str, channel: str, payload: bytes) ‑> None -
-
-
- -Expand source code - -
def publish(address: str, channel: str, payload: bytes) -> None:
-    """
-    Publish a Redis message to the specificed channel and return an error, if any.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
-    """
-    raise NotImplementedError
-
-

Publish a Redis message to the specificed channel and return an error, if any.

-

Raises: componentize_py_types.Err(Error)

-
-
-def sadd(address: str, key: str, values: List[str]) ‑> int -
-
-
- -Expand source code - -
def sadd(address: str, key: str, values: List[str]) -> int:
-    """
-    Add the specified `values` to the set named `key`, returning the number of newly-added values.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
-    """
-    raise NotImplementedError
-
-

Add the specified values to the set named key, returning the number of newly-added values.

-

Raises: componentize_py_types.Err(Error)

-
-
-def set(address: str, key: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
def set(address: str, key: str, value: bytes) -> None:
-    """
-    Set key to value. If key alreads holds a value, it is overwritten.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
-    """
-    raise NotImplementedError
-
-

Set key to value. If key alreads holds a value, it is overwritten.

-

Raises: componentize_py_types.Err(Error)

-
-
-def smembers(address: str, key: str) ‑> List[str] -
-
-
- -Expand source code - -
def smembers(address: str, key: str) -> List[str]:
-    """
-    Retrieve the contents of the set named `key`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
-    """
-    raise NotImplementedError
-
-

Retrieve the contents of the set named key.

-

Raises: componentize_py_types.Err(Error)

-
-
-def srem(address: str, key: str, values: List[str]) ‑> int -
-
-
- -Expand source code - -
def srem(address: str, key: str, values: List[str]) -> int:
-    """
-    Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
-    """
-    raise NotImplementedError
-
-

Remove the specified values from the set named key, returning the number of newly-removed values.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_redis_2_0_0.html b/docs/v4/wit/imports/fermyon_spin_redis_2_0_0.html deleted file mode 100644 index 2610b4b..0000000 --- a/docs/v4/wit/imports/fermyon_spin_redis_2_0_0.html +++ /dev/null @@ -1,644 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_redis_2_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_redis_2_0_0

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

Errors related to interacting with Redis

-
-
var RedisParameter
-
-

A parameter type for the general-purpose execute function.

-
-
var RedisResult
-
-

A return type for the general-purpose execute function.

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Redis instance at `address`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def publish(self, channel: str, payload: bytes) -> None:
-        """
-        Publish a Redis message to the specified channel.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value of a key.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set key to value.
-        
-        If key already holds a value, it is overwritten.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def incr(self, key: str) -> int:
-        """
-        Increments the number stored at key by one.
-        
-        If the key does not exist, it is set to 0 before performing the operation.
-        An `error::type-error` is returned if the key contains a value of the wrong type
-        or contains a string that can not be represented as integer.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def del_(self, keys: List[str]) -> int:
-        """
-        Removes the specified keys.
-        
-        A key is ignored if it does not exist. Returns the number of keys deleted.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def sadd(self, key: str, values: List[str]) -> int:
-        """
-        Add the specified `values` to the set named `key`, returning the number of newly-added values.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def smembers(self, key: str) -> List[str]:
-        """
-        Retrieve the contents of the set named `key`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def srem(self, key: str, values: List[str]) -> int:
-        """
-        Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
-        """
-        Execute an arbitrary Redis command and receive the result.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the Redis instance at address.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-def del_(self, keys: List[str]) ‑> int -
-
-
- -Expand source code - -
def del_(self, keys: List[str]) -> int:
-    """
-    Removes the specified keys.
-    
-    A key is ignored if it does not exist. Returns the number of keys deleted.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Removes the specified keys.

-

A key is ignored if it does not exist. Returns the number of keys deleted.

-

Raises: componentize_py_types.Err(Error)

-
-
-def execute(self,
command: str,
arguments: List[RedisParameter_Int64 | RedisParameter_Binary]) ‑> List[RedisResult_Nil | RedisResult_Status | RedisResult_Int64 | RedisResult_Binary]
-
-
-
- -Expand source code - -
def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
-    """
-    Execute an arbitrary Redis command and receive the result.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Execute an arbitrary Redis command and receive the result.

-

Raises: componentize_py_types.Err(Error)

-
-
-def get(self, key: str) ‑> bytes | None -
-
-
- -Expand source code - -
def get(self, key: str) -> Optional[bytes]:
-    """
-    Get the value of a key.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Get the value of a key.

-

Raises: componentize_py_types.Err(Error)

-
-
-def incr(self, key: str) ‑> int -
-
-
- -Expand source code - -
def incr(self, key: str) -> int:
-    """
-    Increments the number stored at key by one.
-    
-    If the key does not exist, it is set to 0 before performing the operation.
-    An `error::type-error` is returned if the key contains a value of the wrong type
-    or contains a string that can not be represented as integer.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Increments the number stored at key by one.

-

If the key does not exist, it is set to 0 before performing the operation. -An error::type-error is returned if the key contains a value of the wrong type -or contains a string that can not be represented as integer.

-

Raises: componentize_py_types.Err(Error)

-
-
-def publish(self, channel: str, payload: bytes) ‑> None -
-
-
- -Expand source code - -
def publish(self, channel: str, payload: bytes) -> None:
-    """
-    Publish a Redis message to the specified channel.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Publish a Redis message to the specified channel.

-

Raises: componentize_py_types.Err(Error)

-
-
-def sadd(self, key: str, values: List[str]) ‑> int -
-
-
- -Expand source code - -
def sadd(self, key: str, values: List[str]) -> int:
-    """
-    Add the specified `values` to the set named `key`, returning the number of newly-added values.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Add the specified values to the set named key, returning the number of newly-added values.

-

Raises: componentize_py_types.Err(Error)

-
-
-def set(self, key: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
def set(self, key: str, value: bytes) -> None:
-    """
-    Set key to value.
-    
-    If key already holds a value, it is overwritten.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Set key to value.

-

If key already holds a value, it is overwritten.

-

Raises: componentize_py_types.Err(Error)

-
-
-def smembers(self, key: str) ‑> List[str] -
-
-
- -Expand source code - -
def smembers(self, key: str) -> List[str]:
-    """
-    Retrieve the contents of the set named `key`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Retrieve the contents of the set named key.

-

Raises: componentize_py_types.Err(Error)

-
-
-def srem(self, key: str, values: List[str]) ‑> int -
-
-
- -Expand source code - -
def srem(self, key: str, values: List[str]) -> int:
-    """
-    Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Remove the specified values from the set named key, returning the number of newly-removed values.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-class Error_InvalidAddress -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidAddress:
-    pass
-
-

Error_InvalidAddress()

-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_TooManyConnections -
-
-
- -Expand source code - -
@dataclass
-class Error_TooManyConnections:
-    pass
-
-

Error_TooManyConnections()

-
-
-class Error_TypeError -
-
-
- -Expand source code - -
@dataclass
-class Error_TypeError:
-    pass
-
-

Error_TypeError()

-
-
-class RedisParameter_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class RedisParameter_Binary:
-    value: bytes
-
-

RedisParameter_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisParameter_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class RedisParameter_Int64:
-    value: int
-
-

RedisParameter_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResult_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Binary:
-    value: bytes
-
-

RedisResult_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisResult_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Int64:
-    value: int
-
-

RedisResult_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResult_Nil -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Nil:
-    pass
-
-

RedisResult_Nil()

-
-
-class RedisResult_Status -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Status:
-    value: str
-
-

RedisResult_Status(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_redis_types.html b/docs/v4/wit/imports/fermyon_spin_redis_types.html deleted file mode 100644 index 71f6e5d..0000000 --- a/docs/v4/wit/imports/fermyon_spin_redis_types.html +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_redis_types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_redis_types

-
-
-
-
-
-
-

Global variables

-
-
var RedisParameter
-
-

A parameter type for the general-purpose execute function.

-
-
var RedisResult
-
-

A return type for the general-purpose execute function.

-
-
-
-
-
-
-

Classes

-
-
-class Error -(*args, **kwds) -
-
-
- -Expand source code - -
class Error(Enum):
-    """
-    General purpose error.
-    """
-    SUCCESS = 0
-    ERROR = 1
-
-

General purpose error.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var ERROR
-
-
-
-
var SUCCESS
-
-
-
-
-
-
-class RedisParameter_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class RedisParameter_Binary:
-    value: bytes
-
-

RedisParameter_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisParameter_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class RedisParameter_Int64:
-    value: int
-
-

RedisParameter_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResult_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Binary:
-    value: bytes
-
-

RedisResult_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisResult_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Int64:
-    value: int
-
-

RedisResult_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResult_Nil -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Nil:
-    pass
-
-

RedisResult_Nil()

-
-
-class RedisResult_Status -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Status:
-    value: str
-
-

RedisResult_Status(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_sqlite.html b/docs/v4/wit/imports/fermyon_spin_sqlite.html deleted file mode 100644 index 81d5a5a..0000000 --- a/docs/v4/wit/imports/fermyon_spin_sqlite.html +++ /dev/null @@ -1,448 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_sqlite API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_sqlite

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
-
-
-

Functions

-
-
-def close(conn: int) ‑> None -
-
-
- -Expand source code - -
def close(conn: int) -> None:
-    """
-    Close the specified `connection`.
-    """
-    raise NotImplementedError
-
-

Close the specified connection.

-
-
-def execute(conn: int,
statement: str,
parameters: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) ‑> QueryResult
-
-
-
- -Expand source code - -
def execute(conn: int, statement: str, parameters: List[Value]) -> QueryResult:
-    """
-    Execute a statement returning back data if there is any
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_sqlite.Error)`
-    """
-    raise NotImplementedError
-
-

Execute a statement returning back data if there is any

-

Raises: componentize_py_types.Err(Error)

-
-
-def open(database: str) ‑> int -
-
-
- -Expand source code - -
def open(database: str) -> int:
-    """
-    Open a connection to a named database instance.
-    
-    If `database` is "default", the default instance is opened.
-    
-    `error::no-such-database` will be raised if the `name` is not recognized.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_sqlite.Error)`
-    """
-    raise NotImplementedError
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

error::no-such-database will be raised if the name is not recognized.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-

Classes

-
-
-class Error_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class Error_AccessDenied:
-    pass
-
-

Error_AccessDenied()

-
-
-class Error_DatabaseFull -
-
-
- -Expand source code - -
@dataclass
-class Error_DatabaseFull:
-    pass
-
-

Error_DatabaseFull()

-
-
-class Error_InvalidConnection -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidConnection:
-    pass
-
-

Error_InvalidConnection()

-
-
-class Error_Io -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Io:
-    value: str
-
-

Error_Io(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_NoSuchDatabase -
-
-
- -Expand source code - -
@dataclass
-class Error_NoSuchDatabase:
-    pass
-
-

Error_NoSuchDatabase()

-
-
-class QueryResult -(columns: List[str],
rows: List[RowResult])
-
-
-
- -Expand source code - -
@dataclass
-class QueryResult:
-    """
-    A result of a query
-    """
-    columns: List[str]
-    rows: List[RowResult]
-
-

A result of a query

-

Instance variables

-
-
var columns : List[str]
-
-
-
-
var rows : List[RowResult]
-
-
-
-
-
-
-class RowResult -(values: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) -
-
-
- -Expand source code - -
@dataclass
-class RowResult:
-    """
-    A set of values for each of the columns in a query-result
-    """
-    values: List[Value]
-
-

A set of values for each of the columns in a query-result

-

Instance variables

-
-
var values : List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]
-
-
-
-
-
-
-class Value_Blob -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class Value_Blob:
-    value: bytes
-
-

Value_Blob(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class Value_Integer -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class Value_Integer:
-    value: int
-
-

Value_Integer(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class Value_Null -
-
-
- -Expand source code - -
@dataclass
-class Value_Null:
-    pass
-
-

Value_Null()

-
-
-class Value_Real -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class Value_Real:
-    value: float
-
-

Value_Real(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class Value_Text -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Value_Text:
-    value: str
-
-

Value_Text(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_sqlite_2_0_0.html b/docs/v4/wit/imports/fermyon_spin_sqlite_2_0_0.html deleted file mode 100644 index 6e4e61f..0000000 --- a/docs/v4/wit/imports/fermyon_spin_sqlite_2_0_0.html +++ /dev/null @@ -1,468 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_sqlite_2_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_sqlite_2_0_0

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
var Value
-
-

A single column's result from a database query

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    """
-    A handle to an open sqlite instance
-    """
-    
-    @classmethod
-    def open(cls, database: str) -> Self:
-        """
-        Open a connection to a named database instance.
-        
-        If `database` is "default", the default instance is opened.
-        
-        `error::no-such-database` will be raised if the `name` is not recognized.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_sqlite_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-        """
-        Execute a statement returning back data if there is any
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_sqlite_2_0_0.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A handle to an open sqlite instance

-

Static methods

-
-
-def open(database: str) ‑> Self -
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

error::no-such-database will be raised if the name is not recognized.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-def execute(self,
statement: str,
parameters: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) ‑> QueryResult
-
-
-
- -Expand source code - -
def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-    """
-    Execute a statement returning back data if there is any
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_sqlite_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Execute a statement returning back data if there is any

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-class Error_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class Error_AccessDenied:
-    pass
-
-

Error_AccessDenied()

-
-
-class Error_DatabaseFull -
-
-
- -Expand source code - -
@dataclass
-class Error_DatabaseFull:
-    pass
-
-

Error_DatabaseFull()

-
-
-class Error_InvalidConnection -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidConnection:
-    pass
-
-

Error_InvalidConnection()

-
-
-class Error_Io -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Io:
-    value: str
-
-

Error_Io(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_NoSuchDatabase -
-
-
- -Expand source code - -
@dataclass
-class Error_NoSuchDatabase:
-    pass
-
-

Error_NoSuchDatabase()

-
-
-class QueryResult -(columns: List[str],
rows: List[RowResult])
-
-
-
- -Expand source code - -
@dataclass
-class QueryResult:
-    """
-    A result of a query
-    """
-    columns: List[str]
-    rows: List[RowResult]
-
-

A result of a query

-

Instance variables

-
-
var columns : List[str]
-
-
-
-
var rows : List[RowResult]
-
-
-
-
-
-
-class RowResult -(values: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) -
-
-
- -Expand source code - -
@dataclass
-class RowResult:
-    """
-    A set of values for each of the columns in a query-result
-    """
-    values: List[Value]
-
-

A set of values for each of the columns in a query-result

-

Instance variables

-
-
var values : List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]
-
-
-
-
-
-
-class Value_Blob -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class Value_Blob:
-    value: bytes
-
-

Value_Blob(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class Value_Integer -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class Value_Integer:
-    value: int
-
-

Value_Integer(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class Value_Null -
-
-
- -Expand source code - -
@dataclass
-class Value_Null:
-    pass
-
-

Value_Null()

-
-
-class Value_Real -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class Value_Real:
-    value: float
-
-

Value_Real(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class Value_Text -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Value_Text:
-    value: str
-
-

Value_Text(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/fermyon_spin_variables_2_0_0.html b/docs/v4/wit/imports/fermyon_spin_variables_2_0_0.html deleted file mode 100644 index c7e0e48..0000000 --- a/docs/v4/wit/imports/fermyon_spin_variables_2_0_0.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - -spin_sdk.wit.imports.fermyon_spin_variables_2_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.fermyon_spin_variables_2_0_0

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface.

-
-
-
-
-

Functions

-
-
-def get(name: str) ‑> str -
-
-
- -Expand source code - -
def get(name: str) -> str:
-    """
-    Get an application variable value for the current component.
-    
-    The name must match one defined in in the component manifest.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_variables_2_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Get an application variable value for the current component.

-

The name must match one defined in in the component manifest.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-

Classes

-
-
-class Error_InvalidName -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidName:
-    value: str
-
-

Error_InvalidName(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Provider -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Provider:
-    value: str
-
-

Error_Provider(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Undefined -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Undefined:
-    value: str
-
-

Error_Undefined(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/index.html b/docs/v4/wit/imports/index.html deleted file mode 100644 index 7640573..0000000 --- a/docs/v4/wit/imports/index.html +++ /dev/null @@ -1,662 +0,0 @@ - - - - - - -spin_sdk.wit.imports API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports

-
-
-
-
-

Sub-modules

-
-
spin_sdk.wit.imports.fermyon_spin_config
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_http
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_http_types
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_key_value
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_key_value_2_0_0
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_llm
-
-

A WASI interface dedicated to performing inferencing for Large Language Models.

-
-
spin_sdk.wit.imports.fermyon_spin_llm_2_0_0
-
-

A WASI interface dedicated to performing inferencing for Large Language Models.

-
-
spin_sdk.wit.imports.fermyon_spin_mqtt_2_0_0
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_mysql
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_mysql_2_0_0
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_postgres
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_postgres_2_0_0
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_rdbms_types
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_rdbms_types_2_0_0
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_redis
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_redis_2_0_0
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_redis_types
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_sqlite
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_sqlite_2_0_0
-
-
-
-
spin_sdk.wit.imports.fermyon_spin_variables_2_0_0
-
-
-
-
spin_sdk.wit.imports.spin_key_value_key_value_3_0_0
-
-
-
-
spin_sdk.wit.imports.spin_mqtt_mqtt_3_0_0
-
-
-
-
spin_sdk.wit.imports.spin_postgres_postgres_3_0_0
-
-
-
-
spin_sdk.wit.imports.spin_postgres_postgres_4_2_0
-
-
-
-
spin_sdk.wit.imports.spin_redis_redis_3_0_0
-
-
-
-
spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0
-
-
-
-
spin_sdk.wit.imports.spin_variables_variables_3_0_0
-
-
-
-
spin_sdk.wit.imports.wasi_cli_environment_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_cli_environment_0_2_6
-
-
-
-
spin_sdk.wit.imports.wasi_cli_environment_0_3_0_rc_2026_03_15
-
-
-
-
spin_sdk.wit.imports.wasi_cli_exit_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_cli_exit_0_2_6
-
-
-
-
spin_sdk.wit.imports.wasi_cli_exit_0_3_0_rc_2026_03_15
-
-
-
-
spin_sdk.wit.imports.wasi_cli_stderr_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_cli_stderr_0_2_6
-
-
-
-
spin_sdk.wit.imports.wasi_cli_stderr_0_3_0_rc_2026_03_15
-
-
-
-
spin_sdk.wit.imports.wasi_cli_stdin_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_cli_stdin_0_2_6
-
-
-
-
spin_sdk.wit.imports.wasi_cli_stdin_0_3_0_rc_2026_03_15
-
-
-
-
spin_sdk.wit.imports.wasi_cli_stdout_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_cli_stdout_0_2_6
-
-
-
-
spin_sdk.wit.imports.wasi_cli_stdout_0_3_0_rc_2026_03_15
-
-
-
-
spin_sdk.wit.imports.wasi_cli_terminal_input_0_2_0
-
-

Terminal input …

-
-
spin_sdk.wit.imports.wasi_cli_terminal_input_0_2_6
-
-

Terminal input …

-
-
spin_sdk.wit.imports.wasi_cli_terminal_input_0_3_0_rc_2026_03_15
-
-

Terminal input …

-
-
spin_sdk.wit.imports.wasi_cli_terminal_output_0_2_0
-
-

Terminal output …

-
-
spin_sdk.wit.imports.wasi_cli_terminal_output_0_2_6
-
-

Terminal output …

-
-
spin_sdk.wit.imports.wasi_cli_terminal_output_0_3_0_rc_2026_03_15
-
-

Terminal output …

-
-
spin_sdk.wit.imports.wasi_cli_terminal_stderr_0_2_0
-
-

An interface providing an optional terminal-output for stderr as a -link-time authority.

-
-
spin_sdk.wit.imports.wasi_cli_terminal_stderr_0_2_6
-
-

An interface providing an optional terminal-output for stderr as a -link-time authority.

-
-
spin_sdk.wit.imports.wasi_cli_terminal_stderr_0_3_0_rc_2026_03_15
-
-

An interface providing an optional terminal-output for stderr as a -link-time authority.

-
-
spin_sdk.wit.imports.wasi_cli_terminal_stdin_0_2_0
-
-

An interface providing an optional terminal-input for stdin as a -link-time authority.

-
-
spin_sdk.wit.imports.wasi_cli_terminal_stdin_0_2_6
-
-

An interface providing an optional terminal-input for stdin as a -link-time authority.

-
-
spin_sdk.wit.imports.wasi_cli_terminal_stdin_0_3_0_rc_2026_03_15
-
-

An interface providing an optional terminal-input for stdin as a -link-time authority.

-
-
spin_sdk.wit.imports.wasi_cli_terminal_stdout_0_2_0
-
-

An interface providing an optional terminal-output for stdout as a -link-time authority.

-
-
spin_sdk.wit.imports.wasi_cli_terminal_stdout_0_2_6
-
-

An interface providing an optional terminal-output for stdout as a -link-time authority.

-
-
spin_sdk.wit.imports.wasi_cli_terminal_stdout_0_3_0_rc_2026_03_15
-
-

An interface providing an optional terminal-output for stdout as a -link-time authority.

-
-
spin_sdk.wit.imports.wasi_cli_types_0_3_0_rc_2026_03_15
-
-
-
-
spin_sdk.wit.imports.wasi_clocks_monotonic_clock_0_2_0
-
-

WASI Monotonic Clock is a clock API intended to let users measure elapsed -time …

-
-
spin_sdk.wit.imports.wasi_clocks_monotonic_clock_0_2_6
-
-

WASI Monotonic Clock is a clock API intended to let users measure elapsed -time …

-
-
spin_sdk.wit.imports.wasi_clocks_monotonic_clock_0_3_0_rc_2026_03_15
-
-

WASI Monotonic Clock is a clock API intended to let users measure elapsed -time …

-
-
spin_sdk.wit.imports.wasi_clocks_system_clock_0_3_0_rc_2026_03_15
-
-

WASI System Clock is a clock API intended to let users query the current -time. The clock is not necessarily monotonic as it may be reset …

-
-
spin_sdk.wit.imports.wasi_clocks_wall_clock_0_2_0
-
-

WASI Wall Clock is a clock API intended to let users query the current -time. The name "wall" makes an analogy to a "clock on the wall", which -is not …

-
-
spin_sdk.wit.imports.wasi_clocks_wall_clock_0_2_6
-
-

WASI Wall Clock is a clock API intended to let users query the current -time. The name "wall" makes an analogy to a "clock on the wall", which -is not …

-
-
spin_sdk.wit.imports.wasi_config_store_0_2_0_draft_2024_09_27
-
-
-
-
spin_sdk.wit.imports.wasi_filesystem_preopens_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_filesystem_preopens_0_2_6
-
-
-
-
spin_sdk.wit.imports.wasi_filesystem_preopens_0_3_0_rc_2026_03_15
-
-
-
-
spin_sdk.wit.imports.wasi_filesystem_types_0_2_0
-
-

WASI filesystem is a filesystem API primarily intended to let users run WASI -programs that access their files on their existing filesystems, without -…

-
-
spin_sdk.wit.imports.wasi_filesystem_types_0_2_6
-
-

WASI filesystem is a filesystem API primarily intended to let users run WASI -programs that access their files on their existing filesystems, without -…

-
-
spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15
-
-

WASI filesystem is a filesystem API primarily intended to let users run WASI -programs that access their files on their existing filesystems, without -…

-
-
spin_sdk.wit.imports.wasi_http_client_0_3_0_rc_2026_03_15
-
-

This interface defines an HTTP client for sending "outgoing" requests …

-
-
spin_sdk.wit.imports.wasi_http_outgoing_handler_0_2_0
-
-

This interface defines a handler of outgoing HTTP Requests. It should be -imported by components which wish to make HTTP Requests.

-
-
spin_sdk.wit.imports.wasi_http_outgoing_handler_0_2_6
-
-

This interface defines a handler of outgoing HTTP Requests. It should be -imported by components which wish to make HTTP Requests.

-
-
spin_sdk.wit.imports.wasi_http_types_0_2_0
-
-

This interface defines all of the types and methods for implementing -HTTP Requests and Responses, both incoming and outgoing, as well as -their …

-
-
spin_sdk.wit.imports.wasi_http_types_0_2_6
-
-

This interface defines all of the types and methods for implementing -HTTP Requests and Responses, both incoming and outgoing, as well as -their …

-
-
spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15
-
-

This interface defines all of the types and methods for implementing HTTP -Requests and Responses, as well as their headers, trailers, and bodies.

-
-
spin_sdk.wit.imports.wasi_io_error_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_io_error_0_2_6
-
-
-
-
spin_sdk.wit.imports.wasi_io_poll_0_2_0
-
-

A poll API intended to let users wait for I/O events on multiple handles -at once.

-
-
spin_sdk.wit.imports.wasi_io_poll_0_2_6
-
-

A poll API intended to let users wait for I/O events on multiple handles -at once.

-
-
spin_sdk.wit.imports.wasi_io_streams_0_2_0
-
-

WASI I/O is an I/O abstraction API which is currently focused on providing -stream types …

-
-
spin_sdk.wit.imports.wasi_io_streams_0_2_6
-
-

WASI I/O is an I/O abstraction API which is currently focused on providing -stream types …

-
-
spin_sdk.wit.imports.wasi_keyvalue_atomics_0_2_0_draft2
-
-

A keyvalue interface that provides atomic operations …

-
-
spin_sdk.wit.imports.wasi_keyvalue_batch_0_2_0_draft2
-
-

A keyvalue interface that provides batch operations …

-
-
spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2
-
-

A keyvalue interface that provides eventually consistent key-value operations …

-
-
spin_sdk.wit.imports.wasi_random_insecure_0_2_0
-
-

The insecure interface for insecure pseudo-random numbers …

-
-
spin_sdk.wit.imports.wasi_random_insecure_0_2_6
-
-

The insecure interface for insecure pseudo-random numbers …

-
-
spin_sdk.wit.imports.wasi_random_insecure_0_3_0_rc_2026_03_15
-
-

The insecure interface for insecure pseudo-random numbers …

-
-
spin_sdk.wit.imports.wasi_random_insecure_seed_0_2_0
-
-

The insecure-seed interface for seeding hash-map DoS resistance …

-
-
spin_sdk.wit.imports.wasi_random_insecure_seed_0_2_6
-
-

The insecure-seed interface for seeding hash-map DoS resistance …

-
-
spin_sdk.wit.imports.wasi_random_insecure_seed_0_3_0_rc_2026_03_15
-
-

The insecure-seed interface for seeding hash-map DoS resistance …

-
-
spin_sdk.wit.imports.wasi_random_random_0_2_0
-
-

WASI Random is a random data API …

-
-
spin_sdk.wit.imports.wasi_random_random_0_2_6
-
-

WASI Random is a random data API …

-
-
spin_sdk.wit.imports.wasi_random_random_0_3_0_rc_2026_03_15
-
-

WASI Random is a random data API …

-
-
spin_sdk.wit.imports.wasi_sockets_instance_network_0_2_0
-
-

This interface provides a value-export of the default network handle..

-
-
spin_sdk.wit.imports.wasi_sockets_instance_network_0_2_6
-
-

This interface provides a value-export of the default network handle..

-
-
spin_sdk.wit.imports.wasi_sockets_ip_name_lookup_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_ip_name_lookup_0_2_6
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_ip_name_lookup_0_3_0_rc_2026_03_15
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_network_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_network_0_2_6
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_tcp_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_tcp_0_2_6
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_tcp_create_socket_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_tcp_create_socket_0_2_6
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_udp_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_udp_0_2_6
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_udp_create_socket_0_2_0
-
-
-
-
spin_sdk.wit.imports.wasi_sockets_udp_create_socket_0_2_6
-
-
-
-
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/spin_key_value_key_value_3_0_0.html b/docs/v4/wit/imports/spin_key_value_key_value_3_0_0.html deleted file mode 100644 index 50a73bd..0000000 --- a/docs/v4/wit/imports/spin_key_value_key_value_3_0_0.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - -spin_sdk.wit.imports.spin_key_value_key_value_3_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.spin_key_value_key_value_3_0_0

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
-
-
-
-
-

Classes

-
-
-class Error_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class Error_AccessDenied:
-    pass
-
-

Error_AccessDenied()

-
-
-class Error_NoSuchStore -
-
-
- -Expand source code - -
@dataclass
-class Error_NoSuchStore:
-    pass
-
-

Error_NoSuchStore()

-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_StoreTableFull -
-
-
- -Expand source code - -
@dataclass
-class Error_StoreTableFull:
-    pass
-
-

Error_StoreTableFull()

-
-
-class Store -
-
-
- -Expand source code - -
class Store:
-    """
-    An open key-value store
-    """
-    
-    @classmethod
-    async def open(cls, label: str) -> Self:
-        """
-        Open the store with the specified label.
-        
-        `label` must refer to a store allowed in the spin.toml manifest.
-        
-        `error::no-such-store` will be raised if the `label` is not recognized.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value associated with the specified `key`
-        
-        Returns `ok(none)` if the key does not exist.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def set(self, key: str, value: bytes) -> None:
-        """
-        Set the `value` associated with the specified `key` overwriting any existing value.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def delete(self, key: str) -> None:
-        """
-        Delete the tuple with the specified `key`
-        
-        No error is raised if a tuple did not previously exist for `key`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def exists(self, key: str) -> bool:
-        """
-        Return whether a tuple exists for the specified `key`
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def get_keys(self) -> Tuple[StreamReader[str], FutureReader[Result[None, Error]]]:
-        """
-        Return a list of all the keys
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

An open key-value store

-

Static methods

-
-
-async def open(label: str) ‑> Self -
-
-

Open the store with the specified label.

-

label must refer to a store allowed in the spin.toml manifest.

-

error::no-such-store will be raised if the label is not recognized.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-async def delete(self, key: str) ‑> None -
-
-
- -Expand source code - -
async def delete(self, key: str) -> None:
-    """
-    Delete the tuple with the specified `key`
-    
-    No error is raised if a tuple did not previously exist for `key`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Delete the tuple with the specified key

-

No error is raised if a tuple did not previously exist for key.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def exists(self, key: str) ‑> bool -
-
-
- -Expand source code - -
async def exists(self, key: str) -> bool:
-    """
-    Return whether a tuple exists for the specified `key`
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Return whether a tuple exists for the specified key

-

Raises: componentize_py_types.Err(Error)

-
-
-async def get(self, key: str) ‑> bytes | None -
-
-
- -Expand source code - -
async def get(self, key: str) -> Optional[bytes]:
-    """
-    Get the value associated with the specified `key`
-    
-    Returns `ok(none)` if the key does not exist.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Get the value associated with the specified key

-

Returns ok(none) if the key does not exist.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def get_keys(self) ‑> Tuple[componentize_py_async_support.streams.StreamReader[str], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[Error_StoreTableFull | Error_NoSuchStore | Error_AccessDenied | Error_Other]]] -
-
-
- -Expand source code - -
async def get_keys(self) -> Tuple[StreamReader[str], FutureReader[Result[None, Error]]]:
-    """
-    Return a list of all the keys
-    """
-    raise NotImplementedError
-
-

Return a list of all the keys

-
-
-async def set(self, key: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
async def set(self, key: str, value: bytes) -> None:
-    """
-    Set the `value` associated with the specified `key` overwriting any existing value.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Set the value associated with the specified key overwriting any existing value.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/spin_mqtt_mqtt_3_0_0.html b/docs/v4/wit/imports/spin_mqtt_mqtt_3_0_0.html deleted file mode 100644 index 1cff829..0000000 --- a/docs/v4/wit/imports/spin_mqtt_mqtt_3_0_0.html +++ /dev/null @@ -1,297 +0,0 @@ - - - - - - -spin_sdk.wit.imports.spin_mqtt_mqtt_3_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.spin_mqtt_mqtt_3_0_0

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

Errors related to interacting with Mqtt

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    
-    @classmethod
-    async def open(cls, address: str, username: str, password: str, keep_alive_interval_in_secs: int) -> Self:
-        """
-        Open a connection to the Mqtt instance at `address`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_mqtt_mqtt_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def publish(self, topic: str, payload: bytes, qos: Qos) -> None:
-        """
-        Publish an Mqtt message to the specified `topic`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_mqtt_mqtt_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Static methods

-
-
-async def open(address: str, username: str, password: str, keep_alive_interval_in_secs: int) ‑> Self -
-
-

Open a connection to the Mqtt instance at address.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-async def publish(self,
topic: str,
payload: bytes,
qos: Qos) ‑> None
-
-
-
- -Expand source code - -
async def publish(self, topic: str, payload: bytes, qos: Qos) -> None:
-    """
-    Publish an Mqtt message to the specified `topic`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_mqtt_mqtt_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Publish an Mqtt message to the specified topic.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-class Error_ConnectionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ConnectionFailed:
-    value: str
-
-

Error_ConnectionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_InvalidAddress -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidAddress:
-    pass
-
-

Error_InvalidAddress()

-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_TooManyConnections -
-
-
- -Expand source code - -
@dataclass
-class Error_TooManyConnections:
-    pass
-
-

Error_TooManyConnections()

-
-
-class Qos -(*args, **kwds) -
-
-
- -Expand source code - -
class Qos(Enum):
-    """
-    QoS for publishing Mqtt messages
-    """
-    AT_MOST_ONCE = 0
-    AT_LEAST_ONCE = 1
-    EXACTLY_ONCE = 2
-
-

QoS for publishing Mqtt messages

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var AT_LEAST_ONCE
-
-
-
-
var AT_MOST_ONCE
-
-
-
-
var EXACTLY_ONCE
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/spin_postgres_postgres_3_0_0.html b/docs/v4/wit/imports/spin_postgres_postgres_3_0_0.html deleted file mode 100644 index 1f8d9b1..0000000 --- a/docs/v4/wit/imports/spin_postgres_postgres_3_0_0.html +++ /dev/null @@ -1,1306 +0,0 @@ - - - - - - -spin_sdk.wit.imports.spin_postgres_postgres_3_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.spin_postgres_postgres_3_0_0

-
-
-
-
-
-
-

Global variables

-
-
var DbValue
-
-

Database values

-
-
var Error
-
-

Errors related to interacting with a database.

-
-
var ParameterValue
-
-

Values used in parameterized queries

-
-
-
-
-
-
-

Classes

-
-
-class Column -(name: str,
data_type: DbDataType)
-
-
-
- -Expand source code - -
@dataclass
-class Column:
-    """
-    A database column
-    """
-    name: str
-    data_type: DbDataType
-
-

A database column

-

Instance variables

-
-
var data_typeDbDataType
-
-
-
-
var name : str
-
-
-
-
-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    """
-    A connection to a postgres database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Postgres instance at `address`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    def query(self, statement: str, params: List[ParameterValue]) -> RowSet:
-        """
-        Query the database.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, statement: str, params: List[ParameterValue]) -> int:
-        """
-        Execute command to the database.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A connection to a postgres database.

-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the Postgres instance at address.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-def execute(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_DbNull]) ‑> int
-
-
-
- -Expand source code - -
def execute(self, statement: str, params: List[ParameterValue]) -> int:
-    """
-    Execute command to the database.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Execute command to the database.

-

Raises: componentize_py_types.Err(Error)

-
-
-def query(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_DbNull]) ‑> RowSet
-
-
-
- -Expand source code - -
def query(self, statement: str, params: List[ParameterValue]) -> RowSet:
-    """
-    Query the database.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Query the database.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-class DbDataType -(*args, **kwds) -
-
-
- -Expand source code - -
class DbDataType(Enum):
-    """
-    Data types for a database column
-    """
-    BOOLEAN = 0
-    INT8 = 1
-    INT16 = 2
-    INT32 = 3
-    INT64 = 4
-    FLOATING32 = 5
-    FLOATING64 = 6
-    STR = 7
-    BINARY = 8
-    DATE = 9
-    TIME = 10
-    DATETIME = 11
-    TIMESTAMP = 12
-    OTHER = 13
-
-

Data types for a database column

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var BINARY
-
-
-
-
var BOOLEAN
-
-
-
-
var DATE
-
-
-
-
var DATETIME
-
-
-
-
var FLOATING32
-
-
-
-
var FLOATING64
-
-
-
-
var INT16
-
-
-
-
var INT32
-
-
-
-
var INT64
-
-
-
-
var INT8
-
-
-
-
var OTHER
-
-
-
-
var STR
-
-
-
-
var TIME
-
-
-
-
var TIMESTAMP
-
-
-
-
-
-
-class DbValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Binary:
-    value: bytes
-
-

DbValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Boolean:
-    value: bool
-
-

DbValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class DbValue_Date -(value: Tuple[int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Date:
-    value: Tuple[int, int, int]
-
-

DbValue_Date(value: Tuple[int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int]
-
-
-
-
-
-
-class DbValue_Datetime -(value: Tuple[int, int, int, int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Datetime:
-    value: Tuple[int, int, int, int, int, int, int]
-
-

DbValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int, int, int, int]
-
-
-
-
-
-
-class DbValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class DbValue_DbNull:
-    pass
-
-

DbValue_DbNull()

-
-
-class DbValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating32:
-    value: float
-
-

DbValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating64:
-    value: float
-
-

DbValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int16:
-    value: int
-
-

DbValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int32:
-    value: int
-
-

DbValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int64:
-    value: int
-
-

DbValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int8:
-    value: int
-
-

DbValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Str:
-    value: str
-
-

DbValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class DbValue_Time -(value: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Time:
-    value: Tuple[int, int, int, int]
-
-

DbValue_Time(value: Tuple[int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int]
-
-
-
-
-
-
-class DbValue_Timestamp -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Timestamp:
-    value: int
-
-

DbValue_Timestamp(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Unsupported -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Unsupported:
-    pass
-
-

DbValue_Unsupported()

-
-
-class Error_BadParameter -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_BadParameter:
-    value: str
-
-

Error_BadParameter(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ConnectionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ConnectionFailed:
-    value: str
-
-

Error_ConnectionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_QueryFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_QueryFailed:
-    value: str
-
-

Error_QueryFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ValueConversionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ValueConversionFailed:
-    value: str
-
-

Error_ValueConversionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Binary:
-    value: bytes
-
-

ParameterValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class ParameterValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Boolean:
-    value: bool
-
-

ParameterValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class ParameterValue_Date -(value: Tuple[int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Date:
-    value: Tuple[int, int, int]
-
-

ParameterValue_Date(value: Tuple[int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int]
-
-
-
-
-
-
-class ParameterValue_Datetime -(value: Tuple[int, int, int, int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Datetime:
-    value: Tuple[int, int, int, int, int, int, int]
-
-

ParameterValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int, int, int, int]
-
-
-
-
-
-
-class ParameterValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_DbNull:
-    pass
-
-

ParameterValue_DbNull()

-
-
-class ParameterValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating32:
-    value: float
-
-

ParameterValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating64:
-    value: float
-
-

ParameterValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int16:
-    value: int
-
-

ParameterValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int32:
-    value: int
-
-

ParameterValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int64:
-    value: int
-
-

ParameterValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int8:
-    value: int
-
-

ParameterValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Str:
-    value: str
-
-

ParameterValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Time -(value: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Time:
-    value: Tuple[int, int, int, int]
-
-

ParameterValue_Time(value: Tuple[int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int]
-
-
-
-
-
-
-class ParameterValue_Timestamp -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Timestamp:
-    value: int
-
-

ParameterValue_Timestamp(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RowSet -(columns: List[Column],
rows: List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_DbNull | DbValue_Unsupported]])
-
-
-
- -Expand source code - -
@dataclass
-class RowSet:
-    """
-    A set of database rows
-    """
-    columns: List[Column]
-    rows: List[List[DbValue]]
-
-

A set of database rows

-

Instance variables

-
-
var columns : List[Column]
-
-
-
-
var rows : List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_DbNull | DbValue_Unsupported]]
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/spin_postgres_postgres_4_2_0.html b/docs/v4/wit/imports/spin_postgres_postgres_4_2_0.html deleted file mode 100644 index a4b72b9..0000000 --- a/docs/v4/wit/imports/spin_postgres_postgres_4_2_0.html +++ /dev/null @@ -1,2626 +0,0 @@ - - - - - - -spin_sdk.wit.imports.spin_postgres_postgres_4_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.spin_postgres_postgres_4_2_0

-
-
-
-
-
-
-

Global variables

-
-
var DbDataType
-
-

Data types for a database column

-
-
var DbValue
-
-

Database values

-
-
var Error
-
-

Errors related to interacting with a database.

-
-
var ParameterValue
-
-

Values used in parameterized queries

-
-
-
-
-
-
-

Classes

-
-
-class Column -(name: str,
data_type: DbDataType_Boolean | DbDataType_Int8 | DbDataType_Int16 | DbDataType_Int32 | DbDataType_Int64 | DbDataType_Floating32 | DbDataType_Floating64 | DbDataType_Str | DbDataType_Binary | DbDataType_Date | DbDataType_Time | DbDataType_Datetime | DbDataType_Timestamp | DbDataType_Uuid | DbDataType_Jsonb | DbDataType_Decimal | DbDataType_RangeInt32 | DbDataType_RangeInt64 | DbDataType_RangeDecimal | DbDataType_ArrayInt32 | DbDataType_ArrayInt64 | DbDataType_ArrayDecimal | DbDataType_ArrayStr | DbDataType_Interval | DbDataType_Other)
-
-
-
- -Expand source code - -
@dataclass
-class Column:
-    """
-    A database column
-    """
-    name: str
-    data_type: DbDataType
-
-

A database column

-

Instance variables

-
-
var data_typeDbDataType_Boolean | DbDataType_Int8 | DbDataType_Int16 | DbDataType_Int32 | DbDataType_Int64 | DbDataType_Floating32 | DbDataType_Floating64 | DbDataType_Str | DbDataType_Binary | DbDataType_Date | DbDataType_Time | DbDataType_Datetime | DbDataType_Timestamp | DbDataType_Uuid | DbDataType_Jsonb | DbDataType_Decimal | DbDataType_RangeInt32 | DbDataType_RangeInt64 | DbDataType_RangeDecimal | DbDataType_ArrayInt32 | DbDataType_ArrayInt64 | DbDataType_ArrayDecimal | DbDataType_ArrayStr | DbDataType_Interval | DbDataType_Other
-
-
-
-
var name : str
-
-
-
-
-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    """
-    A connection to a postgres database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Postgres instance at `address`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-        """
-        raise NotImplementedError
-    @classmethod
-    async def open_async(cls, address: str) -> Self:
-        """
-        Open a connection to the Postgres instance at `address`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-        """
-        raise NotImplementedError
-    def query(self, statement: str, params: List[ParameterValue]) -> RowSet:
-        """
-        Query the database.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-        """
-        raise NotImplementedError
-    async def query_async(self, statement: str, params: List[ParameterValue]) -> Tuple[List[Column], StreamReader[List[DbValue]], FutureReader[Result[None, Error]]]:
-        """
-        Query the database.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, statement: str, params: List[ParameterValue]) -> int:
-        """
-        Execute command to the database.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-        """
-        raise NotImplementedError
-    async def execute_async(self, statement: str, params: List[ParameterValue]) -> int:
-        """
-        Execute command to the database.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A connection to a postgres database.

-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the Postgres instance at address.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def open_async(address: str) ‑> Self -
-
-

Open a connection to the Postgres instance at address.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-def execute(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_Uuid | ParameterValue_Jsonb | ParameterValue_Decimal | ParameterValue_RangeInt32 | ParameterValue_RangeInt64 | ParameterValue_RangeDecimal | ParameterValue_ArrayInt32 | ParameterValue_ArrayInt64 | ParameterValue_ArrayDecimal | ParameterValue_ArrayStr | ParameterValue_Interval | ParameterValue_DbNull]) ‑> int
-
-
-
- -Expand source code - -
def execute(self, statement: str, params: List[ParameterValue]) -> int:
-    """
-    Execute command to the database.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-    """
-    raise NotImplementedError
-
-

Execute command to the database.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def execute_async(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_Uuid | ParameterValue_Jsonb | ParameterValue_Decimal | ParameterValue_RangeInt32 | ParameterValue_RangeInt64 | ParameterValue_RangeDecimal | ParameterValue_ArrayInt32 | ParameterValue_ArrayInt64 | ParameterValue_ArrayDecimal | ParameterValue_ArrayStr | ParameterValue_Interval | ParameterValue_DbNull]) ‑> int
-
-
-
- -Expand source code - -
async def execute_async(self, statement: str, params: List[ParameterValue]) -> int:
-    """
-    Execute command to the database.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-    """
-    raise NotImplementedError
-
-

Execute command to the database.

-

Raises: componentize_py_types.Err(Error)

-
-
-def query(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_Uuid | ParameterValue_Jsonb | ParameterValue_Decimal | ParameterValue_RangeInt32 | ParameterValue_RangeInt64 | ParameterValue_RangeDecimal | ParameterValue_ArrayInt32 | ParameterValue_ArrayInt64 | ParameterValue_ArrayDecimal | ParameterValue_ArrayStr | ParameterValue_Interval | ParameterValue_DbNull]) ‑> RowSet
-
-
-
- -Expand source code - -
def query(self, statement: str, params: List[ParameterValue]) -> RowSet:
-    """
-    Query the database.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-    """
-    raise NotImplementedError
-
-

Query the database.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def query_async(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_Uuid | ParameterValue_Jsonb | ParameterValue_Decimal | ParameterValue_RangeInt32 | ParameterValue_RangeInt64 | ParameterValue_RangeDecimal | ParameterValue_ArrayInt32 | ParameterValue_ArrayInt64 | ParameterValue_ArrayDecimal | ParameterValue_ArrayStr | ParameterValue_Interval | ParameterValue_DbNull]) ‑> Tuple[List[Column], componentize_py_async_support.streams.StreamReader[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_Uuid | DbValue_Jsonb | DbValue_Decimal | DbValue_RangeInt32 | DbValue_RangeInt64 | DbValue_RangeDecimal | DbValue_ArrayInt32 | DbValue_ArrayInt64 | DbValue_ArrayDecimal | DbValue_ArrayStr | DbValue_Interval | DbValue_DbNull | DbValue_Unsupported]], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[Error_ConnectionFailed | Error_BadParameter | Error_QueryFailed | Error_ValueConversionFailed | Error_Other]]]
-
-
-
- -Expand source code - -
async def query_async(self, statement: str, params: List[ParameterValue]) -> Tuple[List[Column], StreamReader[List[DbValue]], FutureReader[Result[None, Error]]]:
-    """
-    Query the database.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-    """
-    raise NotImplementedError
-
-

Query the database.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-class ConnectionBuilder -(address: str) -
-
-
- -Expand source code - -
class ConnectionBuilder:
-    
-    def __init__(self, address: str) -> None:
-        raise NotImplementedError
-
-    def set_ca_root(self, certificate: str) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-        """
-        raise NotImplementedError
-    def build(self) -> Connection:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-        """
-        raise NotImplementedError
-    async def build_async(self) -> Connection:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Methods

-
-
-def build(self) ‑> Connection -
-
-
- -Expand source code - -
def build(self) -> Connection:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(Error)

-
-
-async def build_async(self) ‑> Connection -
-
-
- -Expand source code - -
async def build_async(self) -> Connection:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(Error)

-
-
-def set_ca_root(self, certificate: str) ‑> None -
-
-
- -Expand source code - -
def set_ca_root(self, certificate: str) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Error)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-class DbDataType_ArrayDecimal -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_ArrayDecimal:
-    pass
-
-

DbDataType_ArrayDecimal()

-
-
-class DbDataType_ArrayInt32 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_ArrayInt32:
-    pass
-
-

DbDataType_ArrayInt32()

-
-
-class DbDataType_ArrayInt64 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_ArrayInt64:
-    pass
-
-

DbDataType_ArrayInt64()

-
-
-class DbDataType_ArrayStr -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_ArrayStr:
-    pass
-
-

DbDataType_ArrayStr()

-
-
-class DbDataType_Binary -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Binary:
-    pass
-
-

DbDataType_Binary()

-
-
-class DbDataType_Boolean -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Boolean:
-    pass
-
-

DbDataType_Boolean()

-
-
-class DbDataType_Date -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Date:
-    pass
-
-

DbDataType_Date()

-
-
-class DbDataType_Datetime -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Datetime:
-    pass
-
-

DbDataType_Datetime()

-
-
-class DbDataType_Decimal -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Decimal:
-    pass
-
-

DbDataType_Decimal()

-
-
-class DbDataType_Floating32 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Floating32:
-    pass
-
-

DbDataType_Floating32()

-
-
-class DbDataType_Floating64 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Floating64:
-    pass
-
-

DbDataType_Floating64()

-
-
-class DbDataType_Int16 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Int16:
-    pass
-
-

DbDataType_Int16()

-
-
-class DbDataType_Int32 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Int32:
-    pass
-
-

DbDataType_Int32()

-
-
-class DbDataType_Int64 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Int64:
-    pass
-
-

DbDataType_Int64()

-
-
-class DbDataType_Int8 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Int8:
-    pass
-
-

DbDataType_Int8()

-
-
-class DbDataType_Interval -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Interval:
-    pass
-
-

DbDataType_Interval()

-
-
-class DbDataType_Jsonb -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Jsonb:
-    pass
-
-

DbDataType_Jsonb()

-
-
-class DbDataType_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Other:
-    value: str
-
-

DbDataType_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class DbDataType_RangeDecimal -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_RangeDecimal:
-    pass
-
-

DbDataType_RangeDecimal()

-
-
-class DbDataType_RangeInt32 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_RangeInt32:
-    pass
-
-

DbDataType_RangeInt32()

-
-
-class DbDataType_RangeInt64 -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_RangeInt64:
-    pass
-
-

DbDataType_RangeInt64()

-
-
-class DbDataType_Str -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Str:
-    pass
-
-

DbDataType_Str()

-
-
-class DbDataType_Time -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Time:
-    pass
-
-

DbDataType_Time()

-
-
-class DbDataType_Timestamp -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Timestamp:
-    pass
-
-

DbDataType_Timestamp()

-
-
-class DbDataType_Uuid -
-
-
- -Expand source code - -
@dataclass
-class DbDataType_Uuid:
-    pass
-
-

DbDataType_Uuid()

-
-
-class DbError -(as_text: str,
severity: str,
code: str,
message: str,
detail: str | None,
extras: List[Tuple[str, str]])
-
-
-
- -Expand source code - -
@dataclass
-class DbError:
-    as_text: str
-    severity: str
-    code: str
-    message: str
-    detail: Optional[str]
-    extras: List[Tuple[str, str]]
-
-

DbError(as_text: str, severity: str, code: str, message: str, detail: Optional[str], extras: List[Tuple[str, str]])

-

Instance variables

-
-
var as_text : str
-
-
-
-
var code : str
-
-
-
-
var detail : str | None
-
-
-
-
var extras : List[Tuple[str, str]]
-
-
-
-
var message : str
-
-
-
-
var severity : str
-
-
-
-
-
-
-class DbValue_ArrayDecimal -(value: List[str | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_ArrayDecimal:
-    value: List[Optional[str]]
-
-

DbValue_ArrayDecimal(value: List[Optional[str]])

-

Instance variables

-
-
var value : List[str | None]
-
-
-
-
-
-
-class DbValue_ArrayInt32 -(value: List[int | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_ArrayInt32:
-    value: List[Optional[int]]
-
-

DbValue_ArrayInt32(value: List[Optional[int]])

-

Instance variables

-
-
var value : List[int | None]
-
-
-
-
-
-
-class DbValue_ArrayInt64 -(value: List[int | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_ArrayInt64:
-    value: List[Optional[int]]
-
-

DbValue_ArrayInt64(value: List[Optional[int]])

-

Instance variables

-
-
var value : List[int | None]
-
-
-
-
-
-
-class DbValue_ArrayStr -(value: List[str | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_ArrayStr:
-    value: List[Optional[str]]
-
-

DbValue_ArrayStr(value: List[Optional[str]])

-

Instance variables

-
-
var value : List[str | None]
-
-
-
-
-
-
-class DbValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Binary:
-    value: bytes
-
-

DbValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Boolean:
-    value: bool
-
-

DbValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class DbValue_Date -(value: Tuple[int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Date:
-    value: Tuple[int, int, int]
-
-

DbValue_Date(value: Tuple[int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int]
-
-
-
-
-
-
-class DbValue_Datetime -(value: Tuple[int, int, int, int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Datetime:
-    value: Tuple[int, int, int, int, int, int, int]
-
-

DbValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int, int, int, int]
-
-
-
-
-
-
-class DbValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class DbValue_DbNull:
-    pass
-
-

DbValue_DbNull()

-
-
-class DbValue_Decimal -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Decimal:
-    value: str
-
-

DbValue_Decimal(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class DbValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating32:
-    value: float
-
-

DbValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Floating64:
-    value: float
-
-

DbValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class DbValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int16:
-    value: int
-
-

DbValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int32:
-    value: int
-
-

DbValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int64:
-    value: int
-
-

DbValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Int8:
-    value: int
-
-

DbValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Interval -(value: Interval) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Interval:
-    value: Interval
-
-

DbValue_Interval(value: spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Interval)

-

Instance variables

-
-
var valueInterval
-
-
-
-
-
-
-class DbValue_Jsonb -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Jsonb:
-    value: bytes
-
-

DbValue_Jsonb(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValue_RangeDecimal -(value: Tuple[Tuple[str, RangeBoundKind] | None, Tuple[str, RangeBoundKind] | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_RangeDecimal:
-    value: Tuple[Optional[Tuple[str, RangeBoundKind]], Optional[Tuple[str, RangeBoundKind]]]
-
-

DbValue_RangeDecimal(value: Tuple[Optional[Tuple[str, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.RangeBoundKind]], Optional[Tuple[str, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.RangeBoundKind]]])

-

Instance variables

-
-
var value : Tuple[Tuple[str, RangeBoundKind] | None, Tuple[str, RangeBoundKind] | None]
-
-
-
-
-
-
-class DbValue_RangeInt32 -(value: Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_RangeInt32:
-    value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]]
-
-

DbValue_RangeInt32(value: Tuple[Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.RangeBoundKind]], Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.RangeBoundKind]]])

-

Instance variables

-
-
var value : Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]
-
-
-
-
-
-
-class DbValue_RangeInt64 -(value: Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_RangeInt64:
-    value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]]
-
-

DbValue_RangeInt64(value: Tuple[Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.RangeBoundKind]], Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.RangeBoundKind]]])

-

Instance variables

-
-
var value : Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]
-
-
-
-
-
-
-class DbValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Str:
-    value: str
-
-

DbValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class DbValue_Time -(value: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Time:
-    value: Tuple[int, int, int, int]
-
-

DbValue_Time(value: Tuple[int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int]
-
-
-
-
-
-
-class DbValue_Timestamp -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Timestamp:
-    value: int
-
-

DbValue_Timestamp(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class DbValue_Unsupported -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Unsupported:
-    value: bytes
-
-

DbValue_Unsupported(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValue_Uuid -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class DbValue_Uuid:
-    value: str
-
-

DbValue_Uuid(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_BadParameter -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_BadParameter:
-    value: str
-
-

Error_BadParameter(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_ConnectionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ConnectionFailed:
-    value: str
-
-

Error_ConnectionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_QueryFailed -(value: QueryError_Text | QueryError_DbError) -
-
-
- -Expand source code - -
@dataclass
-class Error_QueryFailed:
-    value: QueryError
-
-

Error_QueryFailed(value: Union[spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.QueryError_Text, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.QueryError_DbError])

-

Instance variables

-
-
var valueQueryError_Text | QueryError_DbError
-
-
-
-
-
-
-class Error_ValueConversionFailed -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_ValueConversionFailed:
-    value: str
-
-

Error_ValueConversionFailed(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Interval -(micros: int, days: int, months: int) -
-
-
- -Expand source code - -
@dataclass
-class Interval:
-    micros: int
-    days: int
-    months: int
-
-

Interval(micros: int, days: int, months: int)

-

Instance variables

-
-
var days : int
-
-
-
-
var micros : int
-
-
-
-
var months : int
-
-
-
-
-
-
-class ParameterValue_ArrayDecimal -(value: List[str | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_ArrayDecimal:
-    value: List[Optional[str]]
-
-

ParameterValue_ArrayDecimal(value: List[Optional[str]])

-

Instance variables

-
-
var value : List[str | None]
-
-
-
-
-
-
-class ParameterValue_ArrayInt32 -(value: List[int | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_ArrayInt32:
-    value: List[Optional[int]]
-
-

ParameterValue_ArrayInt32(value: List[Optional[int]])

-

Instance variables

-
-
var value : List[int | None]
-
-
-
-
-
-
-class ParameterValue_ArrayInt64 -(value: List[int | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_ArrayInt64:
-    value: List[Optional[int]]
-
-

ParameterValue_ArrayInt64(value: List[Optional[int]])

-

Instance variables

-
-
var value : List[int | None]
-
-
-
-
-
-
-class ParameterValue_ArrayStr -(value: List[str | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_ArrayStr:
-    value: List[Optional[str]]
-
-

ParameterValue_ArrayStr(value: List[Optional[str]])

-

Instance variables

-
-
var value : List[str | None]
-
-
-
-
-
-
-class ParameterValue_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Binary:
-    value: bytes
-
-

ParameterValue_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class ParameterValue_Boolean -(value: bool) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Boolean:
-    value: bool
-
-

ParameterValue_Boolean(value: bool)

-

Instance variables

-
-
var value : bool
-
-
-
-
-
-
-class ParameterValue_Date -(value: Tuple[int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Date:
-    value: Tuple[int, int, int]
-
-

ParameterValue_Date(value: Tuple[int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int]
-
-
-
-
-
-
-class ParameterValue_Datetime -(value: Tuple[int, int, int, int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Datetime:
-    value: Tuple[int, int, int, int, int, int, int]
-
-

ParameterValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int, int, int, int]
-
-
-
-
-
-
-class ParameterValue_DbNull -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_DbNull:
-    pass
-
-

ParameterValue_DbNull()

-
-
-class ParameterValue_Decimal -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Decimal:
-    value: str
-
-

ParameterValue_Decimal(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Floating32 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating32:
-    value: float
-
-

ParameterValue_Floating32(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Floating64 -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Floating64:
-    value: float
-
-

ParameterValue_Floating64(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValue_Int16 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int16:
-    value: int
-
-

ParameterValue_Int16(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int32 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int32:
-    value: int
-
-

ParameterValue_Int32(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int64:
-    value: int
-
-

ParameterValue_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Int8 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Int8:
-    value: int
-
-

ParameterValue_Int8(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Interval -(value: Interval) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Interval:
-    value: Interval
-
-

ParameterValue_Interval(value: spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.Interval)

-

Instance variables

-
-
var valueInterval
-
-
-
-
-
-
-class ParameterValue_Jsonb -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Jsonb:
-    value: bytes
-
-

ParameterValue_Jsonb(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class ParameterValue_RangeDecimal -(value: Tuple[Tuple[str, RangeBoundKind] | None, Tuple[str, RangeBoundKind] | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_RangeDecimal:
-    value: Tuple[Optional[Tuple[str, RangeBoundKind]], Optional[Tuple[str, RangeBoundKind]]]
-
-

ParameterValue_RangeDecimal(value: Tuple[Optional[Tuple[str, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.RangeBoundKind]], Optional[Tuple[str, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.RangeBoundKind]]])

-

Instance variables

-
-
var value : Tuple[Tuple[str, RangeBoundKind] | None, Tuple[str, RangeBoundKind] | None]
-
-
-
-
-
-
-class ParameterValue_RangeInt32 -(value: Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_RangeInt32:
-    value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]]
-
-

ParameterValue_RangeInt32(value: Tuple[Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.RangeBoundKind]], Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.RangeBoundKind]]])

-

Instance variables

-
-
var value : Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]
-
-
-
-
-
-
-class ParameterValue_RangeInt64 -(value: Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_RangeInt64:
-    value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]]
-
-

ParameterValue_RangeInt64(value: Tuple[Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.RangeBoundKind]], Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.RangeBoundKind]]])

-

Instance variables

-
-
var value : Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]
-
-
-
-
-
-
-class ParameterValue_Str -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Str:
-    value: str
-
-

ParameterValue_Str(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValue_Time -(value: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Time:
-    value: Tuple[int, int, int, int]
-
-

ParameterValue_Time(value: Tuple[int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int]
-
-
-
-
-
-
-class ParameterValue_Timestamp -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Timestamp:
-    value: int
-
-

ParameterValue_Timestamp(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValue_Uuid -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class ParameterValue_Uuid:
-    value: str
-
-

ParameterValue_Uuid(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class QueryError_DbError -(value: DbError) -
-
-
- -Expand source code - -
@dataclass
-class QueryError_DbError:
-    value: DbError
-
-

QueryError_DbError(value: spin_sdk.wit.imports.spin_postgres_postgres_4_2_0.DbError)

-

Instance variables

-
-
var valueDbError
-
-
-
-
-
-
-class QueryError_Text -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class QueryError_Text:
-    value: str
-
-

QueryError_Text(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class RangeBoundKind -(*args, **kwds) -
-
-
- -Expand source code - -
class RangeBoundKind(Enum):
-    """
-    For range types, indicates if each bound is inclusive or exclusive
-    """
-    INCLUSIVE = 0
-    EXCLUSIVE = 1
-
-

For range types, indicates if each bound is inclusive or exclusive

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var EXCLUSIVE
-
-
-
-
var INCLUSIVE
-
-
-
-
-
-
-class RowSet -(columns: List[Column],
rows: List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_Uuid | DbValue_Jsonb | DbValue_Decimal | DbValue_RangeInt32 | DbValue_RangeInt64 | DbValue_RangeDecimal | DbValue_ArrayInt32 | DbValue_ArrayInt64 | DbValue_ArrayDecimal | DbValue_ArrayStr | DbValue_Interval | DbValue_DbNull | DbValue_Unsupported]])
-
-
-
- -Expand source code - -
@dataclass
-class RowSet:
-    """
-    A set of database rows
-    """
-    columns: List[Column]
-    rows: List[List[DbValue]]
-
-

A set of database rows

-

Instance variables

-
-
var columns : List[Column]
-
-
-
-
var rows : List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_Uuid | DbValue_Jsonb | DbValue_Decimal | DbValue_RangeInt32 | DbValue_RangeInt64 | DbValue_RangeDecimal | DbValue_ArrayInt32 | DbValue_ArrayInt64 | DbValue_ArrayDecimal | DbValue_ArrayStr | DbValue_Interval | DbValue_DbNull | DbValue_Unsupported]]
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/spin_redis_redis_3_0_0.html b/docs/v4/wit/imports/spin_redis_redis_3_0_0.html deleted file mode 100644 index 3e92fa5..0000000 --- a/docs/v4/wit/imports/spin_redis_redis_3_0_0.html +++ /dev/null @@ -1,644 +0,0 @@ - - - - - - -spin_sdk.wit.imports.spin_redis_redis_3_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.spin_redis_redis_3_0_0

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

Errors related to interacting with Redis

-
-
var RedisParameter
-
-

A parameter type for the general-purpose execute function.

-
-
var RedisResult
-
-

A return type for the general-purpose execute function.

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    
-    @classmethod
-    async def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Redis instance at `address`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def publish(self, channel: str, payload: bytes) -> None:
-        """
-        Publish a Redis message to the specified channel.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value of a key.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def set(self, key: str, value: bytes) -> None:
-        """
-        Set key to value.
-        
-        If key already holds a value, it is overwritten.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def incr(self, key: str) -> int:
-        """
-        Increments the number stored at key by one.
-        
-        If the key does not exist, it is set to 0 before performing the operation.
-        An `error::type-error` is returned if the key contains a value of the wrong type
-        or contains a string that can not be represented as integer.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def del_(self, keys: List[str]) -> int:
-        """
-        Removes the specified keys.
-        
-        A key is ignored if it does not exist. Returns the number of keys deleted.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def sadd(self, key: str, values: List[str]) -> int:
-        """
-        Add the specified `values` to the set named `key`, returning the number of newly-added values.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def smembers(self, key: str) -> List[str]:
-        """
-        Retrieve the contents of the set named `key`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def srem(self, key: str, values: List[str]) -> int:
-        """
-        Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    async def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
-        """
-        Execute an arbitrary Redis command and receive the result.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Static methods

-
-
-async def open(address: str) ‑> Self -
-
-

Open a connection to the Redis instance at address.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-async def del_(self, keys: List[str]) ‑> int -
-
-
- -Expand source code - -
async def del_(self, keys: List[str]) -> int:
-    """
-    Removes the specified keys.
-    
-    A key is ignored if it does not exist. Returns the number of keys deleted.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Removes the specified keys.

-

A key is ignored if it does not exist. Returns the number of keys deleted.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def execute(self,
command: str,
arguments: List[RedisParameter_Int64 | RedisParameter_Binary]) ‑> List[RedisResult_Nil | RedisResult_Status | RedisResult_Int64 | RedisResult_Binary]
-
-
-
- -Expand source code - -
async def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
-    """
-    Execute an arbitrary Redis command and receive the result.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Execute an arbitrary Redis command and receive the result.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def get(self, key: str) ‑> bytes | None -
-
-
- -Expand source code - -
async def get(self, key: str) -> Optional[bytes]:
-    """
-    Get the value of a key.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Get the value of a key.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def incr(self, key: str) ‑> int -
-
-
- -Expand source code - -
async def incr(self, key: str) -> int:
-    """
-    Increments the number stored at key by one.
-    
-    If the key does not exist, it is set to 0 before performing the operation.
-    An `error::type-error` is returned if the key contains a value of the wrong type
-    or contains a string that can not be represented as integer.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Increments the number stored at key by one.

-

If the key does not exist, it is set to 0 before performing the operation. -An error::type-error is returned if the key contains a value of the wrong type -or contains a string that can not be represented as integer.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def publish(self, channel: str, payload: bytes) ‑> None -
-
-
- -Expand source code - -
async def publish(self, channel: str, payload: bytes) -> None:
-    """
-    Publish a Redis message to the specified channel.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Publish a Redis message to the specified channel.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def sadd(self, key: str, values: List[str]) ‑> int -
-
-
- -Expand source code - -
async def sadd(self, key: str, values: List[str]) -> int:
-    """
-    Add the specified `values` to the set named `key`, returning the number of newly-added values.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Add the specified values to the set named key, returning the number of newly-added values.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def set(self, key: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
async def set(self, key: str, value: bytes) -> None:
-    """
-    Set key to value.
-    
-    If key already holds a value, it is overwritten.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Set key to value.

-

If key already holds a value, it is overwritten.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def smembers(self, key: str) ‑> List[str] -
-
-
- -Expand source code - -
async def smembers(self, key: str) -> List[str]:
-    """
-    Retrieve the contents of the set named `key`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Retrieve the contents of the set named key.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def srem(self, key: str, values: List[str]) ‑> int -
-
-
- -Expand source code - -
async def srem(self, key: str, values: List[str]) -> int:
-    """
-    Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Remove the specified values from the set named key, returning the number of newly-removed values.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-class Error_InvalidAddress -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidAddress:
-    pass
-
-

Error_InvalidAddress()

-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_TooManyConnections -
-
-
- -Expand source code - -
@dataclass
-class Error_TooManyConnections:
-    pass
-
-

Error_TooManyConnections()

-
-
-class Error_TypeError -
-
-
- -Expand source code - -
@dataclass
-class Error_TypeError:
-    pass
-
-

Error_TypeError()

-
-
-class RedisParameter_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class RedisParameter_Binary:
-    value: bytes
-
-

RedisParameter_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisParameter_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class RedisParameter_Int64:
-    value: int
-
-

RedisParameter_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResult_Binary -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Binary:
-    value: bytes
-
-

RedisResult_Binary(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisResult_Int64 -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Int64:
-    value: int
-
-

RedisResult_Int64(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResult_Nil -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Nil:
-    pass
-
-

RedisResult_Nil()

-
-
-class RedisResult_Status -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class RedisResult_Status:
-    value: str
-
-

RedisResult_Status(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/spin_sqlite_sqlite_3_1_0.html b/docs/v4/wit/imports/spin_sqlite_sqlite_3_1_0.html deleted file mode 100644 index 2f6b51c..0000000 --- a/docs/v4/wit/imports/spin_sqlite_sqlite_3_1_0.html +++ /dev/null @@ -1,617 +0,0 @@ - - - - - - -spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
var Value
-
-

A single column's result from a database query

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
- -Expand source code - -
class Connection:
-    """
-    A handle to an open sqlite instance
-    """
-    
-    @classmethod
-    def open(cls, database: str) -> Self:
-        """
-        Open a connection to a named database instance.
-        
-        If `database` is "default", the default instance is opened.
-        
-        `error::no-such-database` will be raised if the `name` is not recognized.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error)`
-        """
-        raise NotImplementedError
-    @classmethod
-    async def open_async(cls, database: str) -> Self:
-        """
-        Open a connection to a named database instance.
-        
-        If `database` is "default", the default instance is opened.
-        
-        `error::no-such-database` will be raised if the `name` is not recognized.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error)`
-        """
-        raise NotImplementedError
-    def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-        """
-        Execute a statement returning back data if there is any
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error)`
-        """
-        raise NotImplementedError
-    async def execute_async(self, statement: str, parameters: List[Value]) -> Tuple[List[str], StreamReader[RowResult], FutureReader[Result[None, Error]]]:
-        """
-        Execute a statement returning back data if there is any
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error)`
-        """
-        raise NotImplementedError
-    def last_insert_rowid(self) -> int:
-        """
-        The SQLite rowid of the most recent successful INSERT on the connection, or 0 if
-        there has not yet been an INSERT on the connection.
-        """
-        raise NotImplementedError
-    async def last_insert_rowid_async(self) -> int:
-        """
-        The SQLite rowid of the most recent successful INSERT on the connection, or 0 if
-        there has not yet been an INSERT on the connection.
-        """
-        raise NotImplementedError
-    def changes(self) -> int:
-        """
-        The number of rows modified, inserted or deleted by the most recently completed
-        INSERT, UPDATE or DELETE statement on the connection.
-        """
-        raise NotImplementedError
-    async def changes_async(self) -> int:
-        """
-        The number of rows modified, inserted or deleted by the most recently completed
-        INSERT, UPDATE or DELETE statement on the connection.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A handle to an open sqlite instance

-

Static methods

-
-
-def open(database: str) ‑> Self -
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

error::no-such-database will be raised if the name is not recognized.

-

Raises: componentize_py_types.Err(Error)

-
-
-async def open_async(database: str) ‑> Self -
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

error::no-such-database will be raised if the name is not recognized.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-def changes(self) ‑> int -
-
-
- -Expand source code - -
def changes(self) -> int:
-    """
-    The number of rows modified, inserted or deleted by the most recently completed
-    INSERT, UPDATE or DELETE statement on the connection.
-    """
-    raise NotImplementedError
-
-

The number of rows modified, inserted or deleted by the most recently completed -INSERT, UPDATE or DELETE statement on the connection.

-
-
-async def changes_async(self) ‑> int -
-
-
- -Expand source code - -
async def changes_async(self) -> int:
-    """
-    The number of rows modified, inserted or deleted by the most recently completed
-    INSERT, UPDATE or DELETE statement on the connection.
-    """
-    raise NotImplementedError
-
-

The number of rows modified, inserted or deleted by the most recently completed -INSERT, UPDATE or DELETE statement on the connection.

-
-
-def execute(self,
statement: str,
parameters: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) ‑> QueryResult
-
-
-
- -Expand source code - -
def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-    """
-    Execute a statement returning back data if there is any
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error)`
-    """
-    raise NotImplementedError
-
-

Execute a statement returning back data if there is any

-

Raises: componentize_py_types.Err(Error)

-
-
-async def execute_async(self,
statement: str,
parameters: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) ‑> Tuple[List[str], componentize_py_async_support.streams.StreamReader[RowResult], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[Error_NoSuchDatabase | Error_AccessDenied | Error_InvalidConnection | Error_DatabaseFull | Error_Io]]]
-
-
-
- -Expand source code - -
async def execute_async(self, statement: str, parameters: List[Value]) -> Tuple[List[str], StreamReader[RowResult], FutureReader[Result[None, Error]]]:
-    """
-    Execute a statement returning back data if there is any
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite_3_1_0.Error)`
-    """
-    raise NotImplementedError
-
-

Execute a statement returning back data if there is any

-

Raises: componentize_py_types.Err(Error)

-
-
-def last_insert_rowid(self) ‑> int -
-
-
- -Expand source code - -
def last_insert_rowid(self) -> int:
-    """
-    The SQLite rowid of the most recent successful INSERT on the connection, or 0 if
-    there has not yet been an INSERT on the connection.
-    """
-    raise NotImplementedError
-
-

The SQLite rowid of the most recent successful INSERT on the connection, or 0 if -there has not yet been an INSERT on the connection.

-
-
-async def last_insert_rowid_async(self) ‑> int -
-
-
- -Expand source code - -
async def last_insert_rowid_async(self) -> int:
-    """
-    The SQLite rowid of the most recent successful INSERT on the connection, or 0 if
-    there has not yet been an INSERT on the connection.
-    """
-    raise NotImplementedError
-
-

The SQLite rowid of the most recent successful INSERT on the connection, or 0 if -there has not yet been an INSERT on the connection.

-
-
-
-
-class Error_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class Error_AccessDenied:
-    pass
-
-

Error_AccessDenied()

-
-
-class Error_DatabaseFull -
-
-
- -Expand source code - -
@dataclass
-class Error_DatabaseFull:
-    pass
-
-

Error_DatabaseFull()

-
-
-class Error_InvalidConnection -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidConnection:
-    pass
-
-

Error_InvalidConnection()

-
-
-class Error_Io -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Io:
-    value: str
-
-

Error_Io(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_NoSuchDatabase -
-
-
- -Expand source code - -
@dataclass
-class Error_NoSuchDatabase:
-    pass
-
-

Error_NoSuchDatabase()

-
-
-class QueryResult -(columns: List[str],
rows: List[RowResult])
-
-
-
- -Expand source code - -
@dataclass
-class QueryResult:
-    """
-    A result of a query
-    """
-    columns: List[str]
-    rows: List[RowResult]
-
-

A result of a query

-

Instance variables

-
-
var columns : List[str]
-
-
-
-
var rows : List[RowResult]
-
-
-
-
-
-
-class RowResult -(values: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) -
-
-
- -Expand source code - -
@dataclass
-class RowResult:
-    """
-    A set of values for each of the columns in a query-result
-    """
-    values: List[Value]
-
-

A set of values for each of the columns in a query-result

-

Instance variables

-
-
var values : List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]
-
-
-
-
-
-
-class Value_Blob -(value: bytes) -
-
-
- -Expand source code - -
@dataclass
-class Value_Blob:
-    value: bytes
-
-

Value_Blob(value: bytes)

-

Instance variables

-
-
var value : bytes
-
-
-
-
-
-
-class Value_Integer -(value: int) -
-
-
- -Expand source code - -
@dataclass
-class Value_Integer:
-    value: int
-
-

Value_Integer(value: int)

-

Instance variables

-
-
var value : int
-
-
-
-
-
-
-class Value_Null -
-
-
- -Expand source code - -
@dataclass
-class Value_Null:
-    pass
-
-

Value_Null()

-
-
-class Value_Real -(value: float) -
-
-
- -Expand source code - -
@dataclass
-class Value_Real:
-    value: float
-
-

Value_Real(value: float)

-

Instance variables

-
-
var value : float
-
-
-
-
-
-
-class Value_Text -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Value_Text:
-    value: str
-
-

Value_Text(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/spin_variables_variables_3_0_0.html b/docs/v4/wit/imports/spin_variables_variables_3_0_0.html deleted file mode 100644 index f7c57ca..0000000 --- a/docs/v4/wit/imports/spin_variables_variables_3_0_0.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - -spin_sdk.wit.imports.spin_variables_variables_3_0_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.spin_variables_variables_3_0_0

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface.

-
-
-
-
-

Functions

-
-
-async def get(name: str) ‑> str -
-
-
- -Expand source code - -
async def get(name: str) -> str:
-    """
-    Get an application variable value for the current component.
-    
-    The name must match one defined in in the component manifest.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_variables_variables_3_0_0.Error)`
-    """
-    raise NotImplementedError
-
-

Get an application variable value for the current component.

-

The name must match one defined in in the component manifest.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-

Classes

-
-
-class Error_InvalidName -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_InvalidName:
-    value: str
-
-

Error_InvalidName(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Provider -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Provider:
-    value: str
-
-

Error_Provider(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Undefined -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Undefined:
-    value: str
-
-

Error_Undefined(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_environment_0_2_0.html b/docs/v4/wit/imports/wasi_cli_environment_0_2_0.html deleted file mode 100644 index 86ee268..0000000 --- a/docs/v4/wit/imports/wasi_cli_environment_0_2_0.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_environment_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_environment_0_2_0

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_arguments() ‑> List[str] -
-
-
- -Expand source code - -
def get_arguments() -> List[str]:
-    """
-    Get the POSIX-style arguments to the program.
-    """
-    raise NotImplementedError
-
-

Get the POSIX-style arguments to the program.

-
-
-def get_environment() ‑> List[Tuple[str, str]] -
-
-
- -Expand source code - -
def get_environment() -> List[Tuple[str, str]]:
-    """
-    Get the POSIX-style environment variables.
-    
-    Each environment variable is provided as a pair of string variable names
-    and string value.
-    
-    Morally, these are a value import, but until value imports are available
-    in the component model, this import function should return the same
-    values each time it is called.
-    """
-    raise NotImplementedError
-
-

Get the POSIX-style environment variables.

-

Each environment variable is provided as a pair of string variable names -and string value.

-

Morally, these are a value import, but until value imports are available -in the component model, this import function should return the same -values each time it is called.

-
-
-def initial_cwd() ‑> str | None -
-
-
- -Expand source code - -
def initial_cwd() -> Optional[str]:
-    """
-    Return a path that programs should use as their initial current working
-    directory, interpreting `.` as shorthand for this.
-    """
-    raise NotImplementedError
-
-

Return a path that programs should use as their initial current working -directory, interpreting . as shorthand for this.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_environment_0_2_6.html b/docs/v4/wit/imports/wasi_cli_environment_0_2_6.html deleted file mode 100644 index 0ffc654..0000000 --- a/docs/v4/wit/imports/wasi_cli_environment_0_2_6.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_environment_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_environment_0_2_6

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_arguments() ‑> List[str] -
-
-
- -Expand source code - -
def get_arguments() -> List[str]:
-    """
-    Get the POSIX-style arguments to the program.
-    """
-    raise NotImplementedError
-
-

Get the POSIX-style arguments to the program.

-
-
-def get_environment() ‑> List[Tuple[str, str]] -
-
-
- -Expand source code - -
def get_environment() -> List[Tuple[str, str]]:
-    """
-    Get the POSIX-style environment variables.
-    
-    Each environment variable is provided as a pair of string variable names
-    and string value.
-    
-    Morally, these are a value import, but until value imports are available
-    in the component model, this import function should return the same
-    values each time it is called.
-    """
-    raise NotImplementedError
-
-

Get the POSIX-style environment variables.

-

Each environment variable is provided as a pair of string variable names -and string value.

-

Morally, these are a value import, but until value imports are available -in the component model, this import function should return the same -values each time it is called.

-
-
-def initial_cwd() ‑> str | None -
-
-
- -Expand source code - -
def initial_cwd() -> Optional[str]:
-    """
-    Return a path that programs should use as their initial current working
-    directory, interpreting `.` as shorthand for this.
-    """
-    raise NotImplementedError
-
-

Return a path that programs should use as their initial current working -directory, interpreting . as shorthand for this.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_environment_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_cli_environment_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 037ec7c..0000000 --- a/docs/v4/wit/imports/wasi_cli_environment_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_environment_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_environment_0_3_0_rc_2026_03_15

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_arguments() ‑> List[str] -
-
-
- -Expand source code - -
def get_arguments() -> List[str]:
-    """
-    Get the POSIX-style arguments to the program.
-    """
-    raise NotImplementedError
-
-

Get the POSIX-style arguments to the program.

-
-
-def get_environment() ‑> List[Tuple[str, str]] -
-
-
- -Expand source code - -
def get_environment() -> List[Tuple[str, str]]:
-    """
-    Get the POSIX-style environment variables.
-    
-    Each environment variable is provided as a pair of string variable names
-    and string value.
-    
-    Morally, these are a value import, but until value imports are available
-    in the component model, this import function should return the same
-    values each time it is called.
-    """
-    raise NotImplementedError
-
-

Get the POSIX-style environment variables.

-

Each environment variable is provided as a pair of string variable names -and string value.

-

Morally, these are a value import, but until value imports are available -in the component model, this import function should return the same -values each time it is called.

-
-
-def get_initial_cwd() ‑> str | None -
-
-
- -Expand source code - -
def get_initial_cwd() -> Optional[str]:
-    """
-    Return a path that programs should use as their initial current working
-    directory, interpreting `.` as shorthand for this.
-    """
-    raise NotImplementedError
-
-

Return a path that programs should use as their initial current working -directory, interpreting . as shorthand for this.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_exit_0_2_0.html b/docs/v4/wit/imports/wasi_cli_exit_0_2_0.html deleted file mode 100644 index 9f54488..0000000 --- a/docs/v4/wit/imports/wasi_cli_exit_0_2_0.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_exit_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_exit_0_2_0

-
-
-
-
-
-
-
-
-

Functions

-
-
-def exit(status: componentize_py_types.Ok[None] | componentize_py_types.Err[None]) ‑> None -
-
-
- -Expand source code - -
def exit(status: Result[None, None]) -> None:
-    """
-    Exit the current instance and any linked instances.
-    """
-    raise NotImplementedError
-
-

Exit the current instance and any linked instances.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_exit_0_2_6.html b/docs/v4/wit/imports/wasi_cli_exit_0_2_6.html deleted file mode 100644 index 0759d2d..0000000 --- a/docs/v4/wit/imports/wasi_cli_exit_0_2_6.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_exit_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_exit_0_2_6

-
-
-
-
-
-
-
-
-

Functions

-
-
-def exit(status: componentize_py_types.Ok[None] | componentize_py_types.Err[None]) ‑> None -
-
-
- -Expand source code - -
def exit(status: Result[None, None]) -> None:
-    """
-    Exit the current instance and any linked instances.
-    """
-    raise NotImplementedError
-
-

Exit the current instance and any linked instances.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_exit_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_cli_exit_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 8e29b8b..0000000 --- a/docs/v4/wit/imports/wasi_cli_exit_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_exit_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_exit_0_3_0_rc_2026_03_15

-
-
-
-
-
-
-
-
-

Functions

-
-
-def exit(status: componentize_py_types.Ok[None] | componentize_py_types.Err[None]) ‑> None -
-
-
- -Expand source code - -
def exit(status: Result[None, None]) -> None:
-    """
-    Exit the current instance and any linked instances.
-    """
-    raise NotImplementedError
-
-

Exit the current instance and any linked instances.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_stderr_0_2_0.html b/docs/v4/wit/imports/wasi_cli_stderr_0_2_0.html deleted file mode 100644 index 1f7b478..0000000 --- a/docs/v4/wit/imports/wasi_cli_stderr_0_2_0.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_stderr_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_stderr_0_2_0

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_stderr() ‑> OutputStream -
-
-
- -Expand source code - -
def get_stderr() -> wasi_io_streams_0_2_0.OutputStream:
-    raise NotImplementedError
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_stderr_0_2_6.html b/docs/v4/wit/imports/wasi_cli_stderr_0_2_6.html deleted file mode 100644 index 2995db3..0000000 --- a/docs/v4/wit/imports/wasi_cli_stderr_0_2_6.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_stderr_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_stderr_0_2_6

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_stderr() ‑> OutputStream -
-
-
- -Expand source code - -
def get_stderr() -> wasi_io_streams_0_2_6.OutputStream:
-    raise NotImplementedError
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_stderr_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_cli_stderr_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 7556d4a..0000000 --- a/docs/v4/wit/imports/wasi_cli_stderr_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_stderr_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_stderr_0_3_0_rc_2026_03_15

-
-
-
-
-
-
-
-
-

Functions

-
-
-def write_via_stream(data: componentize_py_async_support.streams.ByteStreamReader) ‑> componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode]] -
-
-
- -Expand source code - -
def write_via_stream(data: ByteStreamReader) -> FutureReader[Result[None, wasi_cli_types_0_3_0_rc_2026_03_15.ErrorCode]]:
-    """
-    Write the given stream to stderr.
-    
-    If the stream's writable end is dropped this function will either return
-    success once the entire contents of the stream have been written or an
-    error-code representing a failure.
-    
-    Otherwise if there is an error the readable end of the stream will be
-    dropped and this function will return an error-code.
-    """
-    raise NotImplementedError
-
-

Write the given stream to stderr.

-

If the stream's writable end is dropped this function will either return -success once the entire contents of the stream have been written or an -error-code representing a failure.

-

Otherwise if there is an error the readable end of the stream will be -dropped and this function will return an error-code.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_stdin_0_2_0.html b/docs/v4/wit/imports/wasi_cli_stdin_0_2_0.html deleted file mode 100644 index aa9925f..0000000 --- a/docs/v4/wit/imports/wasi_cli_stdin_0_2_0.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_stdin_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_stdin_0_2_0

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_stdin() ‑> InputStream -
-
-
- -Expand source code - -
def get_stdin() -> wasi_io_streams_0_2_0.InputStream:
-    raise NotImplementedError
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_stdin_0_2_6.html b/docs/v4/wit/imports/wasi_cli_stdin_0_2_6.html deleted file mode 100644 index c42a6e0..0000000 --- a/docs/v4/wit/imports/wasi_cli_stdin_0_2_6.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_stdin_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_stdin_0_2_6

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_stdin() ‑> InputStream -
-
-
- -Expand source code - -
def get_stdin() -> wasi_io_streams_0_2_6.InputStream:
-    raise NotImplementedError
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_stdin_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_cli_stdin_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 91f3aea..0000000 --- a/docs/v4/wit/imports/wasi_cli_stdin_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_stdin_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_stdin_0_3_0_rc_2026_03_15

-
-
-
-
-
-
-
-
-

Functions

-
-
-def read_via_stream() ‑> Tuple[componentize_py_async_support.streams.ByteStreamReader, componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode]]] -
-
-
- -Expand source code - -
def read_via_stream() -> Tuple[ByteStreamReader, FutureReader[Result[None, wasi_cli_types_0_3_0_rc_2026_03_15.ErrorCode]]]:
-    """
-    Return a stream for reading from stdin.
-    
-    This function returns a stream which provides data read from stdin,
-    and a future to signal read results.
-    
-    If the stream's readable end is dropped the future will resolve to success.
-    
-    If the stream's writable end is dropped the future will either resolve to
-    success if stdin was closed by the writer or to an error-code if reading
-    failed for some other reason.
-    
-    Multiple streams may be active at the same time. The behavior of concurrent
-    reads is implementation-specific.
-    """
-    raise NotImplementedError
-
-

Return a stream for reading from stdin.

-

This function returns a stream which provides data read from stdin, -and a future to signal read results.

-

If the stream's readable end is dropped the future will resolve to success.

-

If the stream's writable end is dropped the future will either resolve to -success if stdin was closed by the writer or to an error-code if reading -failed for some other reason.

-

Multiple streams may be active at the same time. The behavior of concurrent -reads is implementation-specific.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_stdout_0_2_0.html b/docs/v4/wit/imports/wasi_cli_stdout_0_2_0.html deleted file mode 100644 index 3bcfbb4..0000000 --- a/docs/v4/wit/imports/wasi_cli_stdout_0_2_0.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_stdout_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_stdout_0_2_0

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_stdout() ‑> OutputStream -
-
-
- -Expand source code - -
def get_stdout() -> wasi_io_streams_0_2_0.OutputStream:
-    raise NotImplementedError
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_stdout_0_2_6.html b/docs/v4/wit/imports/wasi_cli_stdout_0_2_6.html deleted file mode 100644 index 6c224a4..0000000 --- a/docs/v4/wit/imports/wasi_cli_stdout_0_2_6.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_stdout_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_stdout_0_2_6

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_stdout() ‑> OutputStream -
-
-
- -Expand source code - -
def get_stdout() -> wasi_io_streams_0_2_6.OutputStream:
-    raise NotImplementedError
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_stdout_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_cli_stdout_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 88c4946..0000000 --- a/docs/v4/wit/imports/wasi_cli_stdout_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_stdout_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_stdout_0_3_0_rc_2026_03_15

-
-
-
-
-
-
-
-
-

Functions

-
-
-def write_via_stream(data: componentize_py_async_support.streams.ByteStreamReader) ‑> componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode]] -
-
-
- -Expand source code - -
def write_via_stream(data: ByteStreamReader) -> FutureReader[Result[None, wasi_cli_types_0_3_0_rc_2026_03_15.ErrorCode]]:
-    """
-    Write the given stream to stdout.
-    
-    If the stream's writable end is dropped this function will either return
-    success once the entire contents of the stream have been written or an
-    error-code representing a failure.
-    
-    Otherwise if there is an error the readable end of the stream will be
-    dropped and this function will return an error-code.
-    """
-    raise NotImplementedError
-
-

Write the given stream to stdout.

-

If the stream's writable end is dropped this function will either return -success once the entire contents of the stream have been written or an -error-code representing a failure.

-

Otherwise if there is an error the readable end of the stream will be -dropped and this function will return an error-code.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_input_0_2_0.html b/docs/v4/wit/imports/wasi_cli_terminal_input_0_2_0.html deleted file mode 100644 index a59d463..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_input_0_2_0.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_input_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_input_0_2_0

-
-
-

Terminal input.

-

In the future, this may include functions for disabling echoing, -disabling input buffering so that keyboard events are sent through -immediately, querying supported features, and so on.

-
-
-
-
-
-
-
-
-

Classes

-
-
-class TerminalInput -
-
-
- -Expand source code - -
class TerminalInput:
-    """
-    The input side of a terminal.
-    """
-    
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

The input side of a terminal.

-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_input_0_2_6.html b/docs/v4/wit/imports/wasi_cli_terminal_input_0_2_6.html deleted file mode 100644 index 880ab2e..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_input_0_2_6.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_input_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_input_0_2_6

-
-
-

Terminal input.

-

In the future, this may include functions for disabling echoing, -disabling input buffering so that keyboard events are sent through -immediately, querying supported features, and so on.

-
-
-
-
-
-
-
-
-

Classes

-
-
-class TerminalInput -
-
-
- -Expand source code - -
class TerminalInput:
-    """
-    The input side of a terminal.
-    """
-    
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

The input side of a terminal.

-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_input_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_cli_terminal_input_0_3_0_rc_2026_03_15.html deleted file mode 100644 index c60c2a0..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_input_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_input_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_input_0_3_0_rc_2026_03_15

-
-
-

Terminal input.

-

In the future, this may include functions for disabling echoing, -disabling input buffering so that keyboard events are sent through -immediately, querying supported features, and so on.

-
-
-
-
-
-
-
-
-

Classes

-
-
-class TerminalInput -
-
-
- -Expand source code - -
class TerminalInput:
-    """
-    The input side of a terminal.
-    """
-    
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

The input side of a terminal.

-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_output_0_2_0.html b/docs/v4/wit/imports/wasi_cli_terminal_output_0_2_0.html deleted file mode 100644 index 6136bad..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_output_0_2_0.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_output_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_output_0_2_0

-
-
-

Terminal output.

-

In the future, this may include functions for querying the terminal -size, being notified of terminal size changes, querying supported -features, and so on.

-
-
-
-
-
-
-
-
-

Classes

-
-
-class TerminalOutput -
-
-
- -Expand source code - -
class TerminalOutput:
-    """
-    The output side of a terminal.
-    """
-    
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

The output side of a terminal.

-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_output_0_2_6.html b/docs/v4/wit/imports/wasi_cli_terminal_output_0_2_6.html deleted file mode 100644 index 0d6dc49..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_output_0_2_6.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_output_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_output_0_2_6

-
-
-

Terminal output.

-

In the future, this may include functions for querying the terminal -size, being notified of terminal size changes, querying supported -features, and so on.

-
-
-
-
-
-
-
-
-

Classes

-
-
-class TerminalOutput -
-
-
- -Expand source code - -
class TerminalOutput:
-    """
-    The output side of a terminal.
-    """
-    
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

The output side of a terminal.

-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_output_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_cli_terminal_output_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 29cb7bb..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_output_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_output_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_output_0_3_0_rc_2026_03_15

-
-
-

Terminal output.

-

In the future, this may include functions for querying the terminal -size, being notified of terminal size changes, querying supported -features, and so on.

-
-
-
-
-
-
-
-
-

Classes

-
-
-class TerminalOutput -
-
-
- -Expand source code - -
class TerminalOutput:
-    """
-    The output side of a terminal.
-    """
-    
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

The output side of a terminal.

-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_stderr_0_2_0.html b/docs/v4/wit/imports/wasi_cli_terminal_stderr_0_2_0.html deleted file mode 100644 index 9d076b7..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_stderr_0_2_0.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_stderr_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_stderr_0_2_0

-
-
-

An interface providing an optional terminal-output for stderr as a -link-time authority.

-
-
-
-
-
-
-

Functions

-
-
-def get_terminal_stderr() ‑> TerminalOutput | None -
-
-
- -Expand source code - -
def get_terminal_stderr() -> Optional[wasi_cli_terminal_output_0_2_0.TerminalOutput]:
-    """
-    If stderr is connected to a terminal, return a `terminal-output` handle
-    allowing further interaction with it.
-    """
-    raise NotImplementedError
-
-

If stderr is connected to a terminal, return a terminal-output handle -allowing further interaction with it.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_stderr_0_2_6.html b/docs/v4/wit/imports/wasi_cli_terminal_stderr_0_2_6.html deleted file mode 100644 index 6e15444..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_stderr_0_2_6.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_stderr_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_stderr_0_2_6

-
-
-

An interface providing an optional terminal-output for stderr as a -link-time authority.

-
-
-
-
-
-
-

Functions

-
-
-def get_terminal_stderr() ‑> TerminalOutput | None -
-
-
- -Expand source code - -
def get_terminal_stderr() -> Optional[wasi_cli_terminal_output_0_2_6.TerminalOutput]:
-    """
-    If stderr is connected to a terminal, return a `terminal-output` handle
-    allowing further interaction with it.
-    """
-    raise NotImplementedError
-
-

If stderr is connected to a terminal, return a terminal-output handle -allowing further interaction with it.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_stderr_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_cli_terminal_stderr_0_3_0_rc_2026_03_15.html deleted file mode 100644 index abc71d1..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_stderr_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_stderr_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_stderr_0_3_0_rc_2026_03_15

-
-
-

An interface providing an optional terminal-output for stderr as a -link-time authority.

-
-
-
-
-
-
-

Functions

-
-
-def get_terminal_stderr() ‑> TerminalOutput | None -
-
-
- -Expand source code - -
def get_terminal_stderr() -> Optional[wasi_cli_terminal_output_0_3_0_rc_2026_03_15.TerminalOutput]:
-    """
-    If stderr is connected to a terminal, return a `terminal-output` handle
-    allowing further interaction with it.
-    """
-    raise NotImplementedError
-
-

If stderr is connected to a terminal, return a terminal-output handle -allowing further interaction with it.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_stdin_0_2_0.html b/docs/v4/wit/imports/wasi_cli_terminal_stdin_0_2_0.html deleted file mode 100644 index c9c0c3f..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_stdin_0_2_0.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_stdin_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_stdin_0_2_0

-
-
-

An interface providing an optional terminal-input for stdin as a -link-time authority.

-
-
-
-
-
-
-

Functions

-
-
-def get_terminal_stdin() ‑> TerminalInput | None -
-
-
- -Expand source code - -
def get_terminal_stdin() -> Optional[wasi_cli_terminal_input_0_2_0.TerminalInput]:
-    """
-    If stdin is connected to a terminal, return a `terminal-input` handle
-    allowing further interaction with it.
-    """
-    raise NotImplementedError
-
-

If stdin is connected to a terminal, return a terminal-input handle -allowing further interaction with it.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_stdin_0_2_6.html b/docs/v4/wit/imports/wasi_cli_terminal_stdin_0_2_6.html deleted file mode 100644 index c880602..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_stdin_0_2_6.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_stdin_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_stdin_0_2_6

-
-
-

An interface providing an optional terminal-input for stdin as a -link-time authority.

-
-
-
-
-
-
-

Functions

-
-
-def get_terminal_stdin() ‑> TerminalInput | None -
-
-
- -Expand source code - -
def get_terminal_stdin() -> Optional[wasi_cli_terminal_input_0_2_6.TerminalInput]:
-    """
-    If stdin is connected to a terminal, return a `terminal-input` handle
-    allowing further interaction with it.
-    """
-    raise NotImplementedError
-
-

If stdin is connected to a terminal, return a terminal-input handle -allowing further interaction with it.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_stdin_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_cli_terminal_stdin_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 2d3e86a..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_stdin_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_stdin_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_stdin_0_3_0_rc_2026_03_15

-
-
-

An interface providing an optional terminal-input for stdin as a -link-time authority.

-
-
-
-
-
-
-

Functions

-
-
-def get_terminal_stdin() ‑> TerminalInput | None -
-
-
- -Expand source code - -
def get_terminal_stdin() -> Optional[wasi_cli_terminal_input_0_3_0_rc_2026_03_15.TerminalInput]:
-    """
-    If stdin is connected to a terminal, return a `terminal-input` handle
-    allowing further interaction with it.
-    """
-    raise NotImplementedError
-
-

If stdin is connected to a terminal, return a terminal-input handle -allowing further interaction with it.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_stdout_0_2_0.html b/docs/v4/wit/imports/wasi_cli_terminal_stdout_0_2_0.html deleted file mode 100644 index e3e0a4e..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_stdout_0_2_0.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_stdout_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_stdout_0_2_0

-
-
-

An interface providing an optional terminal-output for stdout as a -link-time authority.

-
-
-
-
-
-
-

Functions

-
-
-def get_terminal_stdout() ‑> TerminalOutput | None -
-
-
- -Expand source code - -
def get_terminal_stdout() -> Optional[wasi_cli_terminal_output_0_2_0.TerminalOutput]:
-    """
-    If stdout is connected to a terminal, return a `terminal-output` handle
-    allowing further interaction with it.
-    """
-    raise NotImplementedError
-
-

If stdout is connected to a terminal, return a terminal-output handle -allowing further interaction with it.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_stdout_0_2_6.html b/docs/v4/wit/imports/wasi_cli_terminal_stdout_0_2_6.html deleted file mode 100644 index dc73c68..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_stdout_0_2_6.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_stdout_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_stdout_0_2_6

-
-
-

An interface providing an optional terminal-output for stdout as a -link-time authority.

-
-
-
-
-
-
-

Functions

-
-
-def get_terminal_stdout() ‑> TerminalOutput | None -
-
-
- -Expand source code - -
def get_terminal_stdout() -> Optional[wasi_cli_terminal_output_0_2_6.TerminalOutput]:
-    """
-    If stdout is connected to a terminal, return a `terminal-output` handle
-    allowing further interaction with it.
-    """
-    raise NotImplementedError
-
-

If stdout is connected to a terminal, return a terminal-output handle -allowing further interaction with it.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_terminal_stdout_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_cli_terminal_stdout_0_3_0_rc_2026_03_15.html deleted file mode 100644 index c84858d..0000000 --- a/docs/v4/wit/imports/wasi_cli_terminal_stdout_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_terminal_stdout_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_terminal_stdout_0_3_0_rc_2026_03_15

-
-
-

An interface providing an optional terminal-output for stdout as a -link-time authority.

-
-
-
-
-
-
-

Functions

-
-
-def get_terminal_stdout() ‑> TerminalOutput | None -
-
-
- -Expand source code - -
def get_terminal_stdout() -> Optional[wasi_cli_terminal_output_0_3_0_rc_2026_03_15.TerminalOutput]:
-    """
-    If stdout is connected to a terminal, return a `terminal-output` handle
-    allowing further interaction with it.
-    """
-    raise NotImplementedError
-
-

If stdout is connected to a terminal, return a terminal-output handle -allowing further interaction with it.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_cli_types_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_cli_types_0_3_0_rc_2026_03_15.html deleted file mode 100644 index fe69018..0000000 --- a/docs/v4/wit/imports/wasi_cli_types_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_cli_types_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_cli_types_0_3_0_rc_2026_03_15

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class ErrorCode -(*args, **kwds) -
-
-
- -Expand source code - -
class ErrorCode(Enum):
-    IO = 0
-    ILLEGAL_BYTE_SEQUENCE = 1
-    PIPE = 2
-
-

Create a collection of name/value pairs.

-

Example enumeration:

-
>>> class Color(Enum):
-...     RED = 1
-...     BLUE = 2
-...     GREEN = 3
-
-

Access them by:

-
    -
  • attribute access:
  • -
-
-
-
-

Color.RED -

-
-
-
-
    -
  • value lookup:
  • -
-
-
-
-

Color(1) -

-
-
-
-
    -
  • name lookup:
  • -
-
-
-
-

Color['RED'] -

-
-
-
-

Enumerations can be iterated over, and know how many members they have:

-
>>> len(Color)
-3
-
-
>>> list(Color)
-[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
-
-

Methods can be added to enumerations, and members can have their own -attributes – see the documentation for details.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var ILLEGAL_BYTE_SEQUENCE
-
-
-
-
var IO
-
-
-
-
var PIPE
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_clocks_monotonic_clock_0_2_0.html b/docs/v4/wit/imports/wasi_clocks_monotonic_clock_0_2_0.html deleted file mode 100644 index ea51884..0000000 --- a/docs/v4/wit/imports/wasi_clocks_monotonic_clock_0_2_0.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_clocks_monotonic_clock_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_clocks_monotonic_clock_0_2_0

-
-
-

WASI Monotonic Clock is a clock API intended to let users measure elapsed -time.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-

A monotonic clock is a clock which has an unspecified initial value, and -successive reads of the clock will produce non-decreasing values.

-

It is intended for measuring elapsed time.

-
-
-
-
-
-
-

Functions

-
-
-def now() ‑> int -
-
-
- -Expand source code - -
def now() -> int:
-    """
-    Read the current value of the clock.
-    
-    The clock is monotonic, therefore calling this function repeatedly will
-    produce a sequence of non-decreasing values.
-    """
-    raise NotImplementedError
-
-

Read the current value of the clock.

-

The clock is monotonic, therefore calling this function repeatedly will -produce a sequence of non-decreasing values.

-
-
-def resolution() ‑> int -
-
-
- -Expand source code - -
def resolution() -> int:
-    """
-    Query the resolution of the clock. Returns the duration of time
-    corresponding to a clock tick.
-    """
-    raise NotImplementedError
-
-

Query the resolution of the clock. Returns the duration of time -corresponding to a clock tick.

-
-
-def subscribe_duration(when: int) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe_duration(when: int) -> wasi_io_poll_0_2_0.Pollable:
-    """
-    Create a `pollable` which will resolve once the given duration has
-    elapsed, starting at the time at which this function was called.
-    occured.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the given duration has -elapsed, starting at the time at which this function was called. -occured.

-
-
-def subscribe_instant(when: int) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe_instant(when: int) -> wasi_io_poll_0_2_0.Pollable:
-    """
-    Create a `pollable` which will resolve once the specified instant
-    occured.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the specified instant -occured.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_clocks_monotonic_clock_0_2_6.html b/docs/v4/wit/imports/wasi_clocks_monotonic_clock_0_2_6.html deleted file mode 100644 index 55d9992..0000000 --- a/docs/v4/wit/imports/wasi_clocks_monotonic_clock_0_2_6.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_clocks_monotonic_clock_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_clocks_monotonic_clock_0_2_6

-
-
-

WASI Monotonic Clock is a clock API intended to let users measure elapsed -time.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-

A monotonic clock is a clock which has an unspecified initial value, and -successive reads of the clock will produce non-decreasing values.

-
-
-
-
-
-
-

Functions

-
-
-def now() ‑> int -
-
-
- -Expand source code - -
def now() -> int:
-    """
-    Read the current value of the clock.
-    
-    The clock is monotonic, therefore calling this function repeatedly will
-    produce a sequence of non-decreasing values.
-    """
-    raise NotImplementedError
-
-

Read the current value of the clock.

-

The clock is monotonic, therefore calling this function repeatedly will -produce a sequence of non-decreasing values.

-
-
-def resolution() ‑> int -
-
-
- -Expand source code - -
def resolution() -> int:
-    """
-    Query the resolution of the clock. Returns the duration of time
-    corresponding to a clock tick.
-    """
-    raise NotImplementedError
-
-

Query the resolution of the clock. Returns the duration of time -corresponding to a clock tick.

-
-
-def subscribe_duration(when: int) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe_duration(when: int) -> wasi_io_poll_0_2_6.Pollable:
-    """
-    Create a `pollable` that will resolve after the specified duration has
-    elapsed from the time this function is invoked.
-    """
-    raise NotImplementedError
-
-

Create a pollable that will resolve after the specified duration has -elapsed from the time this function is invoked.

-
-
-def subscribe_instant(when: int) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe_instant(when: int) -> wasi_io_poll_0_2_6.Pollable:
-    """
-    Create a `pollable` which will resolve once the specified instant
-    has occurred.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the specified instant -has occurred.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_clocks_monotonic_clock_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_clocks_monotonic_clock_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 5b0bc15..0000000 --- a/docs/v4/wit/imports/wasi_clocks_monotonic_clock_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_clocks_monotonic_clock_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_clocks_monotonic_clock_0_3_0_rc_2026_03_15

-
-
-

WASI Monotonic Clock is a clock API intended to let users measure elapsed -time.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-

A monotonic clock is a clock which has an unspecified initial value, and -successive reads of the clock will produce non-decreasing values.

-
-
-
-
-
-
-

Functions

-
-
-def get_resolution() ‑> int -
-
-
- -Expand source code - -
def get_resolution() -> int:
-    """
-    Query the resolution of the clock. Returns the duration of time
-    corresponding to a clock tick.
-    """
-    raise NotImplementedError
-
-

Query the resolution of the clock. Returns the duration of time -corresponding to a clock tick.

-
-
-def now() ‑> int -
-
-
- -Expand source code - -
def now() -> int:
-    """
-    Read the current value of the clock.
-    
-    The clock is monotonic, therefore calling this function repeatedly will
-    produce a sequence of non-decreasing values.
-    
-    For completeness, this function traps if it's not possible to represent
-    the value of the clock in a `mark`. Consequently, implementations
-    should ensure that the starting time is low enough to avoid the
-    possibility of overflow in practice.
-    """
-    raise NotImplementedError
-
-

Read the current value of the clock.

-

The clock is monotonic, therefore calling this function repeatedly will -produce a sequence of non-decreasing values.

-

For completeness, this function traps if it's not possible to represent -the value of the clock in a mark. Consequently, implementations -should ensure that the starting time is low enough to avoid the -possibility of overflow in practice.

-
-
-async def wait_for(how_long: int) ‑> None -
-
-
- -Expand source code - -
async def wait_for(how_long: int) -> None:
-    """
-    Wait for the specified duration to elapse.
-    """
-    raise NotImplementedError
-
-

Wait for the specified duration to elapse.

-
-
-async def wait_until(when: int) ‑> None -
-
-
- -Expand source code - -
async def wait_until(when: int) -> None:
-    """
-    Wait until the specified mark has occurred.
-    """
-    raise NotImplementedError
-
-

Wait until the specified mark has occurred.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_clocks_system_clock_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_clocks_system_clock_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 6fe8f60..0000000 --- a/docs/v4/wit/imports/wasi_clocks_system_clock_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_clocks_system_clock_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_clocks_system_clock_0_3_0_rc_2026_03_15

-
-
-

WASI System Clock is a clock API intended to let users query the current -time. The clock is not necessarily monotonic as it may be reset.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-

External references may be reset, so this clock is not necessarily -monotonic, making it unsuitable for measuring elapsed time.

-

It is intended for reporting the current date and time for humans.

-
-
-
-
-
-
-

Functions

-
-
-def get_resolution() ‑> int -
-
-
- -Expand source code - -
def get_resolution() -> int:
-    """
-    Query the resolution of the clock. Returns the smallest duration of time
-    that the implementation permits distinguishing.
-    """
-    raise NotImplementedError
-
-

Query the resolution of the clock. Returns the smallest duration of time -that the implementation permits distinguishing.

-
-
-def now() ‑> Instant -
-
-
- -Expand source code - -
def now() -> Instant:
-    """
-    Read the current value of the clock.
-    
-    This clock is not monotonic, therefore calling this function repeatedly
-    will not necessarily produce a sequence of non-decreasing values.
-    
-    The nanoseconds field of the output is always less than 1000000000.
-    """
-    raise NotImplementedError
-
-

Read the current value of the clock.

-

This clock is not monotonic, therefore calling this function repeatedly -will not necessarily produce a sequence of non-decreasing values.

-

The nanoseconds field of the output is always less than 1000000000.

-
-
-
-
-

Classes

-
-
-class Instant -(seconds: int, nanoseconds: int) -
-
-
- -Expand source code - -
@dataclass
-class Instant:
-    """
-    An "instant", or "exact time", is a point in time without regard to any
-    time zone: just the time since a particular external reference point,
-    often called an "epoch".
-    
-    Here, the epoch is 1970-01-01T00:00:00Z, also known as
-    [POSIX's Seconds Since the Epoch], also known as [Unix Time].
-    
-    Note that even if the seconds field is negative, incrementing
-    nanoseconds always represents moving forwards in time.
-    For example, `{ -1 seconds, 999999999 nanoseconds }` represents the
-    instant one nanosecond before the epoch.
-    For more on various different ways to represent time, see
-    https://tc39.es/proposal-temporal/docs/timezone.html
-    
-    [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
-    [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
-    """
-    seconds: int
-    nanoseconds: int
-
-

An "instant", or "exact time", is a point in time without regard to any -time zone: just the time since a particular external reference point, -often called an "epoch".

-

Here, the epoch is 1970-01-01T00:00:00Z, also known as -POSIX's Seconds Since the Epoch, also known as Unix Time.

-

Note that even if the seconds field is negative, incrementing -nanoseconds always represents moving forwards in time. -For example, { -1 seconds, 999999999 nanoseconds } represents the -instant one nanosecond before the epoch. -For more on various different ways to represent time, see -https://tc39.es/proposal-temporal/docs/timezone.html

-

Instance variables

-
-
var nanoseconds : int
-
-
-
-
var seconds : int
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_clocks_wall_clock_0_2_0.html b/docs/v4/wit/imports/wasi_clocks_wall_clock_0_2_0.html deleted file mode 100644 index 123bb0e..0000000 --- a/docs/v4/wit/imports/wasi_clocks_wall_clock_0_2_0.html +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_clocks_wall_clock_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_clocks_wall_clock_0_2_0

-
-
-

WASI Wall Clock is a clock API intended to let users query the current -time. The name "wall" makes an analogy to a "clock on the wall", which -is not necessarily monotonic as it may be reset.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-

A wall clock is a clock which measures the date and time according to -some external reference.

-

External references may be reset, so this clock is not necessarily -monotonic, making it unsuitable for measuring elapsed time.

-

It is intended for reporting the current date and time for humans.

-
-
-
-
-
-
-

Functions

-
-
-def now() ‑> Datetime -
-
-
- -Expand source code - -
def now() -> Datetime:
-    """
-    Read the current value of the clock.
-    
-    This clock is not monotonic, therefore calling this function repeatedly
-    will not necessarily produce a sequence of non-decreasing values.
-    
-    The returned timestamps represent the number of seconds since
-    1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch],
-    also known as [Unix Time].
-    
-    The nanoseconds field of the output is always less than 1000000000.
-    
-    [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
-    [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
-    """
-    raise NotImplementedError
-
-

Read the current value of the clock.

-

This clock is not monotonic, therefore calling this function repeatedly -will not necessarily produce a sequence of non-decreasing values.

-

The returned timestamps represent the number of seconds since -1970-01-01T00:00:00Z, also known as POSIX's Seconds Since the Epoch, -also known as Unix Time.

-

The nanoseconds field of the output is always less than 1000000000.

-
-
-def resolution() ‑> Datetime -
-
-
- -Expand source code - -
def resolution() -> Datetime:
-    """
-    Query the resolution of the clock.
-    
-    The nanoseconds field of the output is always less than 1000000000.
-    """
-    raise NotImplementedError
-
-

Query the resolution of the clock.

-

The nanoseconds field of the output is always less than 1000000000.

-
-
-
-
-

Classes

-
-
-class Datetime -(seconds: int, nanoseconds: int) -
-
-
- -Expand source code - -
@dataclass
-class Datetime:
-    """
-    A time and date in seconds plus nanoseconds.
-    """
-    seconds: int
-    nanoseconds: int
-
-

A time and date in seconds plus nanoseconds.

-

Instance variables

-
-
var nanoseconds : int
-
-
-
-
var seconds : int
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_clocks_wall_clock_0_2_6.html b/docs/v4/wit/imports/wasi_clocks_wall_clock_0_2_6.html deleted file mode 100644 index d109b88..0000000 --- a/docs/v4/wit/imports/wasi_clocks_wall_clock_0_2_6.html +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_clocks_wall_clock_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_clocks_wall_clock_0_2_6

-
-
-

WASI Wall Clock is a clock API intended to let users query the current -time. The name "wall" makes an analogy to a "clock on the wall", which -is not necessarily monotonic as it may be reset.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-

A wall clock is a clock which measures the date and time according to -some external reference.

-

External references may be reset, so this clock is not necessarily -monotonic, making it unsuitable for measuring elapsed time.

-

It is intended for reporting the current date and time for humans.

-
-
-
-
-
-
-

Functions

-
-
-def now() ‑> Datetime -
-
-
- -Expand source code - -
def now() -> Datetime:
-    """
-    Read the current value of the clock.
-    
-    This clock is not monotonic, therefore calling this function repeatedly
-    will not necessarily produce a sequence of non-decreasing values.
-    
-    The returned timestamps represent the number of seconds since
-    1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch],
-    also known as [Unix Time].
-    
-    The nanoseconds field of the output is always less than 1000000000.
-    
-    [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
-    [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
-    """
-    raise NotImplementedError
-
-

Read the current value of the clock.

-

This clock is not monotonic, therefore calling this function repeatedly -will not necessarily produce a sequence of non-decreasing values.

-

The returned timestamps represent the number of seconds since -1970-01-01T00:00:00Z, also known as POSIX's Seconds Since the Epoch, -also known as Unix Time.

-

The nanoseconds field of the output is always less than 1000000000.

-
-
-def resolution() ‑> Datetime -
-
-
- -Expand source code - -
def resolution() -> Datetime:
-    """
-    Query the resolution of the clock.
-    
-    The nanoseconds field of the output is always less than 1000000000.
-    """
-    raise NotImplementedError
-
-

Query the resolution of the clock.

-

The nanoseconds field of the output is always less than 1000000000.

-
-
-
-
-

Classes

-
-
-class Datetime -(seconds: int, nanoseconds: int) -
-
-
- -Expand source code - -
@dataclass
-class Datetime:
-    """
-    A time and date in seconds plus nanoseconds.
-    """
-    seconds: int
-    nanoseconds: int
-
-

A time and date in seconds plus nanoseconds.

-

Instance variables

-
-
var nanoseconds : int
-
-
-
-
var seconds : int
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_config_store_0_2_0_draft_2024_09_27.html b/docs/v4/wit/imports/wasi_config_store_0_2_0_draft_2024_09_27.html deleted file mode 100644 index 4c9a487..0000000 --- a/docs/v4/wit/imports/wasi_config_store_0_2_0_draft_2024_09_27.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_config_store_0_2_0_draft_2024_09_27 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_config_store_0_2_0_draft_2024_09_27

-
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

An error type that encapsulates the different errors that can occur fetching configuration values.

-
-
-
-
-

Functions

-
-
-def get(key: str) ‑> str | None -
-
-
- -Expand source code - -
def get(key: str) -> Optional[str]:
-    """
-    Gets a configuration value of type `string` associated with the `key`.
-    
-    The value is returned as an `option<string>`. If the key is not found,
-    `Ok(none)` is returned. If an error occurs, an `Err(error)` is returned.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_config_store_0_2_0_draft_2024_09_27.Error)`
-    """
-    raise NotImplementedError
-
-

Gets a configuration value of type string associated with the key.

-

The value is returned as an option<string>. If the key is not found, -Ok(none) is returned. If an error occurs, an Err(error) is returned.

-

Raises: componentize_py_types.Err(Error)

-
-
-def get_all() ‑> List[Tuple[str, str]] -
-
-
- -Expand source code - -
def get_all() -> List[Tuple[str, str]]:
-    """
-    Gets a list of configuration key-value pairs of type `string`.
-    
-    If an error occurs, an `Err(error)` is returned.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_config_store_0_2_0_draft_2024_09_27.Error)`
-    """
-    raise NotImplementedError
-
-

Gets a list of configuration key-value pairs of type string.

-

If an error occurs, an Err(error) is returned.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-

Classes

-
-
-class Error_Io -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Io:
-    value: str
-
-

Error_Io(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Error_Upstream -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Upstream:
-    value: str
-
-

Error_Upstream(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_filesystem_preopens_0_2_0.html b/docs/v4/wit/imports/wasi_filesystem_preopens_0_2_0.html deleted file mode 100644 index baf3f6f..0000000 --- a/docs/v4/wit/imports/wasi_filesystem_preopens_0_2_0.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_filesystem_preopens_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_filesystem_preopens_0_2_0

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_directories() ‑> List[Tuple[Descriptor, str]] -
-
-
- -Expand source code - -
def get_directories() -> List[Tuple[wasi_filesystem_types_0_2_0.Descriptor, str]]:
-    """
-    Return the set of preopened directories, and their path.
-    """
-    raise NotImplementedError
-
-

Return the set of preopened directories, and their path.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_filesystem_preopens_0_2_6.html b/docs/v4/wit/imports/wasi_filesystem_preopens_0_2_6.html deleted file mode 100644 index 6354404..0000000 --- a/docs/v4/wit/imports/wasi_filesystem_preopens_0_2_6.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_filesystem_preopens_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_filesystem_preopens_0_2_6

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_directories() ‑> List[Tuple[Descriptor, str]] -
-
-
- -Expand source code - -
def get_directories() -> List[Tuple[wasi_filesystem_types_0_2_6.Descriptor, str]]:
-    """
-    Return the set of preopened directories, and their paths.
-    """
-    raise NotImplementedError
-
-

Return the set of preopened directories, and their paths.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_filesystem_preopens_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_filesystem_preopens_0_3_0_rc_2026_03_15.html deleted file mode 100644 index c116dbf..0000000 --- a/docs/v4/wit/imports/wasi_filesystem_preopens_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_filesystem_preopens_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_filesystem_preopens_0_3_0_rc_2026_03_15

-
-
-
-
-
-
-
-
-

Functions

-
-
-def get_directories() ‑> List[Tuple[Descriptor, str]] -
-
-
- -Expand source code - -
def get_directories() -> List[Tuple[wasi_filesystem_types_0_3_0_rc_2026_03_15.Descriptor, str]]:
-    """
-    Return the set of preopened directories, and their paths.
-    """
-    raise NotImplementedError
-
-

Return the set of preopened directories, and their paths.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_filesystem_types_0_2_0.html b/docs/v4/wit/imports/wasi_filesystem_types_0_2_0.html deleted file mode 100644 index 5a03d06..0000000 --- a/docs/v4/wit/imports/wasi_filesystem_types_0_2_0.html +++ /dev/null @@ -1,2153 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_filesystem_types_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_filesystem_types_0_2_0

-
-
-

WASI filesystem is a filesystem API primarily intended to let users run WASI -programs that access their files on their existing filesystems, without -significant overhead.

-

It is intended to be roughly portable between Unix-family platforms and -Windows, though it does not hide many of the major differences.

-

Paths are passed as interface-type strings, meaning they must consist of -a sequence of Unicode Scalar Values (USVs). Some filesystems may contain -paths which are not accessible by this API.

-

The directory separator in WASI is always the forward-slash (/).

-

All paths in WASI are relative paths, and are interpreted relative to a -descriptor referring to a base directory. If a path argument to any WASI -function starts with /, or if any step of resolving a path, including -.. and symbolic link steps, reaches a directory outside of the base -directory, or reaches a symlink to an absolute or rooted path in the -underlying filesystem, the function fails with error-code::not-permitted.

-

For more information about WASI path resolution and sandboxing, see -WASI filesystem path resolution.

-
-
-
-
-

Global variables

-
-
var NewTimestamp
-
-

When setting a timestamp, this gives the value to set it to.

-
-
-
-
-

Functions

-
-
-def filesystem_error_code(err: Error) ‑> ErrorCode | None -
-
-
- -Expand source code - -
def filesystem_error_code(err: wasi_io_error_0_2_0.Error) -> Optional[ErrorCode]:
-    """
-    Attempts to extract a filesystem-related `error-code` from the stream
-    `error` provided.
-    
-    Stream operations which return `stream-error::last-operation-failed`
-    have a payload with more information about the operation that failed.
-    This payload can be passed through to this function to see if there's
-    filesystem-related information about the error to return.
-    
-    Note that this function is fallible because not all stream-related
-    errors are filesystem-related errors.
-    """
-    raise NotImplementedError
-
-

Attempts to extract a filesystem-related error-code from the stream -error provided.

-

Stream operations which return stream-error::last-operation-failed -have a payload with more information about the operation that failed. -This payload can be passed through to this function to see if there's -filesystem-related information about the error to return.

-

Note that this function is fallible because not all stream-related -errors are filesystem-related errors.

-
-
-
-
-

Classes

-
-
-class Advice -(*args, **kwds) -
-
-
- -Expand source code - -
class Advice(Enum):
-    """
-    File or memory access pattern advisory information.
-    """
-    NORMAL = 0
-    SEQUENTIAL = 1
-    RANDOM = 2
-    WILL_NEED = 3
-    DONT_NEED = 4
-    NO_REUSE = 5
-
-

File or memory access pattern advisory information.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var DONT_NEED
-
-
-
-
var NORMAL
-
-
-
-
var NO_REUSE
-
-
-
-
var RANDOM
-
-
-
-
var SEQUENTIAL
-
-
-
-
var WILL_NEED
-
-
-
-
-
-
-class Descriptor -
-
-
- -Expand source code - -
class Descriptor:
-    """
-    A descriptor is a reference to a filesystem object, which may be a file,
-    directory, named pipe, special file, or other object on which filesystem
-    calls may be made.
-    """
-    
-    def read_via_stream(self, offset: int) -> wasi_io_streams_0_2_0.InputStream:
-        """
-        Return a stream for reading from a file, if available.
-        
-        May fail with an error-code describing why the file cannot be read.
-        
-        Multiple read, write, and append streams may be active on the same open
-        file and they do not interfere with each other.
-        
-        Note: This allows using `read-stream`, which is similar to `read` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def write_via_stream(self, offset: int) -> wasi_io_streams_0_2_0.OutputStream:
-        """
-        Return a stream for writing to a file, if available.
-        
-        May fail with an error-code describing why the file cannot be written.
-        
-        Note: This allows using `write-stream`, which is similar to `write` in
-        POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def append_via_stream(self) -> wasi_io_streams_0_2_0.OutputStream:
-        """
-        Return a stream for appending to a file, if available.
-        
-        May fail with an error-code describing why the file cannot be appended.
-        
-        Note: This allows using `write-stream`, which is similar to `write` with
-        `O_APPEND` in in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def advise(self, offset: int, length: int, advice: Advice) -> None:
-        """
-        Provide file advisory information on a descriptor.
-        
-        This is similar to `posix_fadvise` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def sync_data(self) -> None:
-        """
-        Synchronize the data of a file to disk.
-        
-        This function succeeds with no effect if the file descriptor is not
-        opened for writing.
-        
-        Note: This is similar to `fdatasync` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_flags(self) -> DescriptorFlags:
-        """
-        Get flags associated with a descriptor.
-        
-        Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX.
-        
-        Note: This returns the value that was the `fs_flags` value returned
-        from `fdstat_get` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_type(self) -> DescriptorType:
-        """
-        Get the dynamic type of a descriptor.
-        
-        Note: This returns the same value as the `type` field of the `fd-stat`
-        returned by `stat`, `stat-at` and similar.
-        
-        Note: This returns similar flags to the `st_mode & S_IFMT` value provided
-        by `fstat` in POSIX.
-        
-        Note: This returns the value that was the `fs_filetype` value returned
-        from `fdstat_get` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_size(self, size: int) -> None:
-        """
-        Adjust the size of an open file. If this increases the file's size, the
-        extra bytes are filled with zeros.
-        
-        Note: This was called `fd_filestat_set_size` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_times(self, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp) -> None:
-        """
-        Adjust the timestamps of an open file or directory.
-        
-        Note: This is similar to `futimens` in POSIX.
-        
-        Note: This was called `fd_filestat_set_times` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def read(self, length: int, offset: int) -> Tuple[bytes, bool]:
-        """
-        Read from a descriptor, without using and updating the descriptor's offset.
-        
-        This function returns a list of bytes containing the data that was
-        read, along with a bool which, when true, indicates that the end of the
-        file was reached. The returned list will contain up to `length` bytes; it
-        may return fewer than requested, if the end of the file is reached or
-        if the I/O operation is interrupted.
-        
-        In the future, this may change to return a `stream<u8, error-code>`.
-        
-        Note: This is similar to `pread` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def write(self, buffer: bytes, offset: int) -> int:
-        """
-        Write to a descriptor, without using and updating the descriptor's offset.
-        
-        It is valid to write past the end of a file; the file is extended to the
-        extent of the write, with bytes between the previous end and the start of
-        the write set to zero.
-        
-        In the future, this may change to take a `stream<u8, error-code>`.
-        
-        Note: This is similar to `pwrite` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def read_directory(self) -> DirectoryEntryStream:
-        """
-        Read directory entries from a directory.
-        
-        On filesystems where directories contain entries referring to themselves
-        and their parents, often named `.` and `..` respectively, these entries
-        are omitted.
-        
-        This always returns a new stream which starts at the beginning of the
-        directory. Multiple streams may be active on the same directory, and they
-        do not interfere with each other.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def sync(self) -> None:
-        """
-        Synchronize the data and metadata of a file to disk.
-        
-        This function succeeds with no effect if the file descriptor is not
-        opened for writing.
-        
-        Note: This is similar to `fsync` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def create_directory_at(self, path: str) -> None:
-        """
-        Create a directory.
-        
-        Note: This is similar to `mkdirat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def stat(self) -> DescriptorStat:
-        """
-        Return the attributes of an open file or directory.
-        
-        Note: This is similar to `fstat` in POSIX, except that it does not return
-        device and inode information. For testing whether two descriptors refer to
-        the same underlying filesystem object, use `is-same-object`. To obtain
-        additional data that can be used do determine whether a file has been
-        modified, use `metadata-hash`.
-        
-        Note: This was called `fd_filestat_get` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def stat_at(self, path_flags: PathFlags, path: str) -> DescriptorStat:
-        """
-        Return the attributes of a file or directory.
-        
-        Note: This is similar to `fstatat` in POSIX, except that it does not
-        return device and inode information. See the `stat` description for a
-        discussion of alternatives.
-        
-        Note: This was called `path_filestat_get` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_times_at(self, path_flags: PathFlags, path: str, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp) -> None:
-        """
-        Adjust the timestamps of a file or directory.
-        
-        Note: This is similar to `utimensat` in POSIX.
-        
-        Note: This was called `path_filestat_set_times` in earlier versions of
-        WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def link_at(self, old_path_flags: PathFlags, old_path: str, new_descriptor: Self, new_path: str) -> None:
-        """
-        Create a hard link.
-        
-        Note: This is similar to `linkat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def open_at(self, path_flags: PathFlags, path: str, open_flags: OpenFlags, flags: DescriptorFlags) -> Self:
-        """
-        Open a file or directory.
-        
-        The returned descriptor is not guaranteed to be the lowest-numbered
-        descriptor not currently open/ it is randomized to prevent applications
-        from depending on making assumptions about indexes, since this is
-        error-prone in multi-threaded contexts. The returned descriptor is
-        guaranteed to be less than 2**31.
-        
-        If `flags` contains `descriptor-flags::mutate-directory`, and the base
-        descriptor doesn't have `descriptor-flags::mutate-directory` set,
-        `open-at` fails with `error-code::read-only`.
-        
-        If `flags` contains `write` or `mutate-directory`, or `open-flags`
-        contains `truncate` or `create`, and the base descriptor doesn't have
-        `descriptor-flags::mutate-directory` set, `open-at` fails with
-        `error-code::read-only`.
-        
-        Note: This is similar to `openat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def readlink_at(self, path: str) -> str:
-        """
-        Read the contents of a symbolic link.
-        
-        If the contents contain an absolute or rooted path in the underlying
-        filesystem, this function fails with `error-code::not-permitted`.
-        
-        Note: This is similar to `readlinkat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def remove_directory_at(self, path: str) -> None:
-        """
-        Remove a directory.
-        
-        Return `error-code::not-empty` if the directory is not empty.
-        
-        Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def rename_at(self, old_path: str, new_descriptor: Self, new_path: str) -> None:
-        """
-        Rename a filesystem object.
-        
-        Note: This is similar to `renameat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def symlink_at(self, old_path: str, new_path: str) -> None:
-        """
-        Create a symbolic link (also known as a "symlink").
-        
-        If `old-path` starts with `/`, the function fails with
-        `error-code::not-permitted`.
-        
-        Note: This is similar to `symlinkat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def unlink_file_at(self, path: str) -> None:
-        """
-        Unlink a filesystem object that is not a directory.
-        
-        Return `error-code::is-directory` if the path refers to a directory.
-        Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def is_same_object(self, other: Self) -> bool:
-        """
-        Test whether two descriptors refer to the same filesystem object.
-        
-        In POSIX, this corresponds to testing whether the two descriptors have the
-        same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers.
-        wasi-filesystem does not expose device and inode numbers, so this function
-        may be used instead.
-        """
-        raise NotImplementedError
-    def metadata_hash(self) -> MetadataHashValue:
-        """
-        Return a hash of the metadata associated with a filesystem object referred
-        to by a descriptor.
-        
-        This returns a hash of the last-modification timestamp and file size, and
-        may also include the inode number, device number, birth timestamp, and
-        other metadata fields that may change when the file is modified or
-        replaced. It may also include a secret value chosen by the
-        implementation and not otherwise exposed.
-        
-        Implementations are encourated to provide the following properties:
-        
-         - If the file is not modified or replaced, the computed hash value should
-           usually not change.
-         - If the object is modified or replaced, the computed hash value should
-           usually change.
-         - The inputs to the hash should not be easily computable from the
-           computed hash.
-        
-        However, none of these is required.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def metadata_hash_at(self, path_flags: PathFlags, path: str) -> MetadataHashValue:
-        """
-        Return a hash of the metadata associated with a filesystem object referred
-        to by a directory descriptor and a relative path.
-        
-        This performs the same hash computation as `metadata-hash`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A descriptor is a reference to a filesystem object, which may be a file, -directory, named pipe, special file, or other object on which filesystem -calls may be made.

-

Methods

-
-
-def advise(self,
offset: int,
length: int,
advice: Advice) ‑> None
-
-
-
- -Expand source code - -
def advise(self, offset: int, length: int, advice: Advice) -> None:
-    """
-    Provide file advisory information on a descriptor.
-    
-    This is similar to `posix_fadvise` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Provide file advisory information on a descriptor.

-

This is similar to posix_fadvise in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def append_via_stream(self) ‑> OutputStream -
-
-
- -Expand source code - -
def append_via_stream(self) -> wasi_io_streams_0_2_0.OutputStream:
-    """
-    Return a stream for appending to a file, if available.
-    
-    May fail with an error-code describing why the file cannot be appended.
-    
-    Note: This allows using `write-stream`, which is similar to `write` with
-    `O_APPEND` in in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return a stream for appending to a file, if available.

-

May fail with an error-code describing why the file cannot be appended.

-

Note: This allows using write-stream, which is similar to write with -O_APPEND in in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def create_directory_at(self, path: str) ‑> None -
-
-
- -Expand source code - -
def create_directory_at(self, path: str) -> None:
-    """
-    Create a directory.
-    
-    Note: This is similar to `mkdirat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a directory.

-

Note: This is similar to mkdirat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_flags(self) ‑> DescriptorFlags -
-
-
- -Expand source code - -
def get_flags(self) -> DescriptorFlags:
-    """
-    Get flags associated with a descriptor.
-    
-    Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX.
-    
-    Note: This returns the value that was the `fs_flags` value returned
-    from `fdstat_get` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get flags associated with a descriptor.

-

Note: This returns similar flags to fcntl(fd, F_GETFL) in POSIX.

-

Note: This returns the value that was the fs_flags value returned -from fdstat_get in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_type(self) ‑> DescriptorType -
-
-
- -Expand source code - -
def get_type(self) -> DescriptorType:
-    """
-    Get the dynamic type of a descriptor.
-    
-    Note: This returns the same value as the `type` field of the `fd-stat`
-    returned by `stat`, `stat-at` and similar.
-    
-    Note: This returns similar flags to the `st_mode & S_IFMT` value provided
-    by `fstat` in POSIX.
-    
-    Note: This returns the value that was the `fs_filetype` value returned
-    from `fdstat_get` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get the dynamic type of a descriptor.

-

Note: This returns the same value as the type field of the fd-stat -returned by stat, stat-at and similar.

-

Note: This returns similar flags to the st_mode & S_IFMT value provided -by fstat in POSIX.

-

Note: This returns the value that was the fs_filetype value returned -from fdstat_get in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def is_same_object(self, other: Self) ‑> bool -
-
-
- -Expand source code - -
def is_same_object(self, other: Self) -> bool:
-    """
-    Test whether two descriptors refer to the same filesystem object.
-    
-    In POSIX, this corresponds to testing whether the two descriptors have the
-    same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers.
-    wasi-filesystem does not expose device and inode numbers, so this function
-    may be used instead.
-    """
-    raise NotImplementedError
-
-

Test whether two descriptors refer to the same filesystem object.

-

In POSIX, this corresponds to testing whether the two descriptors have the -same device (st_dev) and inode (st_ino or d_ino) numbers. -wasi-filesystem does not expose device and inode numbers, so this function -may be used instead.

-
- -
-
- -Expand source code - -
def link_at(self, old_path_flags: PathFlags, old_path: str, new_descriptor: Self, new_path: str) -> None:
-    """
-    Create a hard link.
-    
-    Note: This is similar to `linkat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a hard link.

-

Note: This is similar to linkat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def metadata_hash(self) ‑> MetadataHashValue -
-
-
- -Expand source code - -
def metadata_hash(self) -> MetadataHashValue:
-    """
-    Return a hash of the metadata associated with a filesystem object referred
-    to by a descriptor.
-    
-    This returns a hash of the last-modification timestamp and file size, and
-    may also include the inode number, device number, birth timestamp, and
-    other metadata fields that may change when the file is modified or
-    replaced. It may also include a secret value chosen by the
-    implementation and not otherwise exposed.
-    
-    Implementations are encourated to provide the following properties:
-    
-     - If the file is not modified or replaced, the computed hash value should
-       usually not change.
-     - If the object is modified or replaced, the computed hash value should
-       usually change.
-     - The inputs to the hash should not be easily computable from the
-       computed hash.
-    
-    However, none of these is required.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return a hash of the metadata associated with a filesystem object referred -to by a descriptor.

-

This returns a hash of the last-modification timestamp and file size, and -may also include the inode number, device number, birth timestamp, and -other metadata fields that may change when the file is modified or -replaced. It may also include a secret value chosen by the -implementation and not otherwise exposed.

-

Implementations are encourated to provide the following properties:

-
    -
  • If the file is not modified or replaced, the computed hash value should -usually not change.
  • -
  • If the object is modified or replaced, the computed hash value should -usually change.
  • -
  • The inputs to the hash should not be easily computable from the -computed hash.
  • -
-

However, none of these is required.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def metadata_hash_at(self,
path_flags: PathFlags,
path: str) ‑> MetadataHashValue
-
-
-
- -Expand source code - -
def metadata_hash_at(self, path_flags: PathFlags, path: str) -> MetadataHashValue:
-    """
-    Return a hash of the metadata associated with a filesystem object referred
-    to by a directory descriptor and a relative path.
-    
-    This performs the same hash computation as `metadata-hash`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return a hash of the metadata associated with a filesystem object referred -to by a directory descriptor and a relative path.

-

This performs the same hash computation as metadata-hash.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def open_at(self,
path_flags: PathFlags,
path: str,
open_flags: OpenFlags,
flags: DescriptorFlags) ‑> Self
-
-
-
- -Expand source code - -
def open_at(self, path_flags: PathFlags, path: str, open_flags: OpenFlags, flags: DescriptorFlags) -> Self:
-    """
-    Open a file or directory.
-    
-    The returned descriptor is not guaranteed to be the lowest-numbered
-    descriptor not currently open/ it is randomized to prevent applications
-    from depending on making assumptions about indexes, since this is
-    error-prone in multi-threaded contexts. The returned descriptor is
-    guaranteed to be less than 2**31.
-    
-    If `flags` contains `descriptor-flags::mutate-directory`, and the base
-    descriptor doesn't have `descriptor-flags::mutate-directory` set,
-    `open-at` fails with `error-code::read-only`.
-    
-    If `flags` contains `write` or `mutate-directory`, or `open-flags`
-    contains `truncate` or `create`, and the base descriptor doesn't have
-    `descriptor-flags::mutate-directory` set, `open-at` fails with
-    `error-code::read-only`.
-    
-    Note: This is similar to `openat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Open a file or directory.

-

The returned descriptor is not guaranteed to be the lowest-numbered -descriptor not currently open/ it is randomized to prevent applications -from depending on making assumptions about indexes, since this is -error-prone in multi-threaded contexts. The returned descriptor is -guaranteed to be less than 2**31.

-

If flags contains descriptor-flags::mutate-directory, and the base -descriptor doesn't have descriptor-flags::mutate-directory set, -open-at fails with error-code::read-only.

-

If flags contains write or mutate-directory, or open-flags -contains truncate or create, and the base descriptor doesn't have -descriptor-flags::mutate-directory set, open-at fails with -error-code::read-only.

-

Note: This is similar to openat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def read(self, length: int, offset: int) ‑> Tuple[bytes, bool] -
-
-
- -Expand source code - -
def read(self, length: int, offset: int) -> Tuple[bytes, bool]:
-    """
-    Read from a descriptor, without using and updating the descriptor's offset.
-    
-    This function returns a list of bytes containing the data that was
-    read, along with a bool which, when true, indicates that the end of the
-    file was reached. The returned list will contain up to `length` bytes; it
-    may return fewer than requested, if the end of the file is reached or
-    if the I/O operation is interrupted.
-    
-    In the future, this may change to return a `stream<u8, error-code>`.
-    
-    Note: This is similar to `pread` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Read from a descriptor, without using and updating the descriptor's offset.

-

This function returns a list of bytes containing the data that was -read, along with a bool which, when true, indicates that the end of the -file was reached. The returned list will contain up to length bytes; it -may return fewer than requested, if the end of the file is reached or -if the I/O operation is interrupted.

-

In the future, this may change to return a stream<u8, error-code>.

-

Note: This is similar to pread in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def read_directory(self) ‑> DirectoryEntryStream -
-
-
- -Expand source code - -
def read_directory(self) -> DirectoryEntryStream:
-    """
-    Read directory entries from a directory.
-    
-    On filesystems where directories contain entries referring to themselves
-    and their parents, often named `.` and `..` respectively, these entries
-    are omitted.
-    
-    This always returns a new stream which starts at the beginning of the
-    directory. Multiple streams may be active on the same directory, and they
-    do not interfere with each other.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Read directory entries from a directory.

-

On filesystems where directories contain entries referring to themselves -and their parents, often named . and .. respectively, these entries -are omitted.

-

This always returns a new stream which starts at the beginning of the -directory. Multiple streams may be active on the same directory, and they -do not interfere with each other.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def read_via_stream(self, offset: int) ‑> InputStream -
-
-
- -Expand source code - -
def read_via_stream(self, offset: int) -> wasi_io_streams_0_2_0.InputStream:
-    """
-    Return a stream for reading from a file, if available.
-    
-    May fail with an error-code describing why the file cannot be read.
-    
-    Multiple read, write, and append streams may be active on the same open
-    file and they do not interfere with each other.
-    
-    Note: This allows using `read-stream`, which is similar to `read` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return a stream for reading from a file, if available.

-

May fail with an error-code describing why the file cannot be read.

-

Multiple read, write, and append streams may be active on the same open -file and they do not interfere with each other.

-

Note: This allows using read-stream, which is similar to read in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
- -
-
- -Expand source code - -
def readlink_at(self, path: str) -> str:
-    """
-    Read the contents of a symbolic link.
-    
-    If the contents contain an absolute or rooted path in the underlying
-    filesystem, this function fails with `error-code::not-permitted`.
-    
-    Note: This is similar to `readlinkat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Read the contents of a symbolic link.

-

If the contents contain an absolute or rooted path in the underlying -filesystem, this function fails with error-code::not-permitted.

-

Note: This is similar to readlinkat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def remove_directory_at(self, path: str) ‑> None -
-
-
- -Expand source code - -
def remove_directory_at(self, path: str) -> None:
-    """
-    Remove a directory.
-    
-    Return `error-code::not-empty` if the directory is not empty.
-    
-    Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Remove a directory.

-

Return error-code::not-empty if the directory is not empty.

-

Note: This is similar to unlinkat(fd, path, AT_REMOVEDIR) in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def rename_at(self, old_path: str, new_descriptor: Self, new_path: str) ‑> None -
-
-
- -Expand source code - -
def rename_at(self, old_path: str, new_descriptor: Self, new_path: str) -> None:
-    """
-    Rename a filesystem object.
-    
-    Note: This is similar to `renameat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Rename a filesystem object.

-

Note: This is similar to renameat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_size(self, size: int) ‑> None -
-
-
- -Expand source code - -
def set_size(self, size: int) -> None:
-    """
-    Adjust the size of an open file. If this increases the file's size, the
-    extra bytes are filled with zeros.
-    
-    Note: This was called `fd_filestat_set_size` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Adjust the size of an open file. If this increases the file's size, the -extra bytes are filled with zeros.

-

Note: This was called fd_filestat_set_size in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_times(self,
data_access_timestamp: NewTimestamp_NoChange | NewTimestamp_Now | NewTimestamp_Timestamp,
data_modification_timestamp: NewTimestamp_NoChange | NewTimestamp_Now | NewTimestamp_Timestamp) ‑> None
-
-
-
- -Expand source code - -
def set_times(self, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp) -> None:
-    """
-    Adjust the timestamps of an open file or directory.
-    
-    Note: This is similar to `futimens` in POSIX.
-    
-    Note: This was called `fd_filestat_set_times` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Adjust the timestamps of an open file or directory.

-

Note: This is similar to futimens in POSIX.

-

Note: This was called fd_filestat_set_times in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_times_at(self,
path_flags: PathFlags,
path: str,
data_access_timestamp: NewTimestamp_NoChange | NewTimestamp_Now | NewTimestamp_Timestamp,
data_modification_timestamp: NewTimestamp_NoChange | NewTimestamp_Now | NewTimestamp_Timestamp) ‑> None
-
-
-
- -Expand source code - -
def set_times_at(self, path_flags: PathFlags, path: str, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp) -> None:
-    """
-    Adjust the timestamps of a file or directory.
-    
-    Note: This is similar to `utimensat` in POSIX.
-    
-    Note: This was called `path_filestat_set_times` in earlier versions of
-    WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Adjust the timestamps of a file or directory.

-

Note: This is similar to utimensat in POSIX.

-

Note: This was called path_filestat_set_times in earlier versions of -WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def stat(self) ‑> DescriptorStat -
-
-
- -Expand source code - -
def stat(self) -> DescriptorStat:
-    """
-    Return the attributes of an open file or directory.
-    
-    Note: This is similar to `fstat` in POSIX, except that it does not return
-    device and inode information. For testing whether two descriptors refer to
-    the same underlying filesystem object, use `is-same-object`. To obtain
-    additional data that can be used do determine whether a file has been
-    modified, use `metadata-hash`.
-    
-    Note: This was called `fd_filestat_get` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return the attributes of an open file or directory.

-

Note: This is similar to fstat in POSIX, except that it does not return -device and inode information. For testing whether two descriptors refer to -the same underlying filesystem object, use is-same-object. To obtain -additional data that can be used do determine whether a file has been -modified, use metadata-hash.

-

Note: This was called fd_filestat_get in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def stat_at(self,
path_flags: PathFlags,
path: str) ‑> DescriptorStat
-
-
-
- -Expand source code - -
def stat_at(self, path_flags: PathFlags, path: str) -> DescriptorStat:
-    """
-    Return the attributes of a file or directory.
-    
-    Note: This is similar to `fstatat` in POSIX, except that it does not
-    return device and inode information. See the `stat` description for a
-    discussion of alternatives.
-    
-    Note: This was called `path_filestat_get` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return the attributes of a file or directory.

-

Note: This is similar to fstatat in POSIX, except that it does not -return device and inode information. See the stat description for a -discussion of alternatives.

-

Note: This was called path_filestat_get in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
- -
-
- -Expand source code - -
def symlink_at(self, old_path: str, new_path: str) -> None:
-    """
-    Create a symbolic link (also known as a "symlink").
-    
-    If `old-path` starts with `/`, the function fails with
-    `error-code::not-permitted`.
-    
-    Note: This is similar to `symlinkat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a symbolic link (also known as a "symlink").

-

If old-path starts with /, the function fails with -error-code::not-permitted.

-

Note: This is similar to symlinkat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def sync(self) ‑> None -
-
-
- -Expand source code - -
def sync(self) -> None:
-    """
-    Synchronize the data and metadata of a file to disk.
-    
-    This function succeeds with no effect if the file descriptor is not
-    opened for writing.
-    
-    Note: This is similar to `fsync` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Synchronize the data and metadata of a file to disk.

-

This function succeeds with no effect if the file descriptor is not -opened for writing.

-

Note: This is similar to fsync in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def sync_data(self) ‑> None -
-
-
- -Expand source code - -
def sync_data(self) -> None:
-    """
-    Synchronize the data of a file to disk.
-    
-    This function succeeds with no effect if the file descriptor is not
-    opened for writing.
-    
-    Note: This is similar to `fdatasync` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Synchronize the data of a file to disk.

-

This function succeeds with no effect if the file descriptor is not -opened for writing.

-

Note: This is similar to fdatasync in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
- -
-
- -Expand source code - -
def unlink_file_at(self, path: str) -> None:
-    """
-    Unlink a filesystem object that is not a directory.
-    
-    Return `error-code::is-directory` if the path refers to a directory.
-    Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Unlink a filesystem object that is not a directory.

-

Return error-code::is-directory if the path refers to a directory. -Note: This is similar to unlinkat(fd, path, 0) in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def write(self, buffer: bytes, offset: int) ‑> int -
-
-
- -Expand source code - -
def write(self, buffer: bytes, offset: int) -> int:
-    """
-    Write to a descriptor, without using and updating the descriptor's offset.
-    
-    It is valid to write past the end of a file; the file is extended to the
-    extent of the write, with bytes between the previous end and the start of
-    the write set to zero.
-    
-    In the future, this may change to take a `stream<u8, error-code>`.
-    
-    Note: This is similar to `pwrite` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Write to a descriptor, without using and updating the descriptor's offset.

-

It is valid to write past the end of a file; the file is extended to the -extent of the write, with bytes between the previous end and the start of -the write set to zero.

-

In the future, this may change to take a stream<u8, error-code>.

-

Note: This is similar to pwrite in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def write_via_stream(self, offset: int) ‑> OutputStream -
-
-
- -Expand source code - -
def write_via_stream(self, offset: int) -> wasi_io_streams_0_2_0.OutputStream:
-    """
-    Return a stream for writing to a file, if available.
-    
-    May fail with an error-code describing why the file cannot be written.
-    
-    Note: This allows using `write-stream`, which is similar to `write` in
-    POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return a stream for writing to a file, if available.

-

May fail with an error-code describing why the file cannot be written.

-

Note: This allows using write-stream, which is similar to write in -POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-class DescriptorFlags -(*args, **kwds) -
-
-
- -Expand source code - -
class DescriptorFlags(Flag):
-    """
-    Descriptor flags.
-    
-    Note: This was called `fdflags` in earlier versions of WASI.
-    """
-    READ = auto()
-    WRITE = auto()
-    FILE_INTEGRITY_SYNC = auto()
-    DATA_INTEGRITY_SYNC = auto()
-    REQUESTED_WRITE_SYNC = auto()
-    MUTATE_DIRECTORY = auto()
-
-

Descriptor flags.

-

Note: This was called fdflags in earlier versions of WASI.

-

Ancestors

-
    -
  • enum.Flag
  • -
  • enum.Enum
  • -
-

Class variables

-
-
var DATA_INTEGRITY_SYNC
-
-
-
-
var FILE_INTEGRITY_SYNC
-
-
-
-
var MUTATE_DIRECTORY
-
-
-
-
var READ
-
-
-
-
var REQUESTED_WRITE_SYNC
-
-
-
-
var WRITE
-
-
-
-
-
-
-class DescriptorStat -(type: DescriptorType,
link_count: int,
size: int,
data_access_timestamp: Datetime | None,
data_modification_timestamp: Datetime | None,
status_change_timestamp: Datetime | None)
-
-
-
- -Expand source code - -
@dataclass
-class DescriptorStat:
-    """
-    File attributes.
-    
-    Note: This was called `filestat` in earlier versions of WASI.
-    """
-    type: DescriptorType
-    link_count: int
-    size: int
-    data_access_timestamp: Optional[wasi_clocks_wall_clock_0_2_0.Datetime]
-    data_modification_timestamp: Optional[wasi_clocks_wall_clock_0_2_0.Datetime]
-    status_change_timestamp: Optional[wasi_clocks_wall_clock_0_2_0.Datetime]
-
-

File attributes.

-

Note: This was called filestat in earlier versions of WASI.

-

Instance variables

-
-
var data_access_timestampDatetime | None
-
-
-
-
var data_modification_timestampDatetime | None
-
-
-
- -
-
-
-
var size : int
-
-
-
-
var status_change_timestampDatetime | None
-
-
-
-
var typeDescriptorType
-
-
-
-
-
-
-class DescriptorType -(*args, **kwds) -
-
-
- -Expand source code - -
class DescriptorType(Enum):
-    """
-    The type of a filesystem object referenced by a descriptor.
-    
-    Note: This was called `filetype` in earlier versions of WASI.
-    """
-    UNKNOWN = 0
-    BLOCK_DEVICE = 1
-    CHARACTER_DEVICE = 2
-    DIRECTORY = 3
-    FIFO = 4
-    SYMBOLIC_LINK = 5
-    REGULAR_FILE = 6
-    SOCKET = 7
-
-

The type of a filesystem object referenced by a descriptor.

-

Note: This was called filetype in earlier versions of WASI.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var BLOCK_DEVICE
-
-
-
-
var CHARACTER_DEVICE
-
-
-
-
var DIRECTORY
-
-
-
-
var FIFO
-
-
-
-
var REGULAR_FILE
-
-
-
-
var SOCKET
-
-
-
- -
-
-
-
var UNKNOWN
-
-
-
-
-
-
-class DirectoryEntry -(type: DescriptorType,
name: str)
-
-
-
- -Expand source code - -
@dataclass
-class DirectoryEntry:
-    """
-    A directory entry.
-    """
-    type: DescriptorType
-    name: str
-
-

A directory entry.

-

Instance variables

-
-
var name : str
-
-
-
-
var typeDescriptorType
-
-
-
-
-
-
-class DirectoryEntryStream -
-
-
- -Expand source code - -
class DirectoryEntryStream:
-    """
-    A stream of directory entries.
-    """
-    
-    def read_directory_entry(self) -> Optional[DirectoryEntry]:
-        """
-        Read a single directory entry from a `directory-entry-stream`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A stream of directory entries.

-

Methods

-
-
-def read_directory_entry(self) ‑> DirectoryEntry | None -
-
-
- -Expand source code - -
def read_directory_entry(self) -> Optional[DirectoryEntry]:
-    """
-    Read a single directory entry from a `directory-entry-stream`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Read a single directory entry from a directory-entry-stream.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-class ErrorCode -(*args, **kwds) -
-
-
- -Expand source code - -
class ErrorCode(Enum):
-    """
-    Error codes returned by functions, similar to `errno` in POSIX.
-    Not all of these error codes are returned by the functions provided by this
-    API; some are used in higher-level library layers, and others are provided
-    merely for alignment with POSIX.
-    """
-    ACCESS = 0
-    WOULD_BLOCK = 1
-    ALREADY = 2
-    BAD_DESCRIPTOR = 3
-    BUSY = 4
-    DEADLOCK = 5
-    QUOTA = 6
-    EXIST = 7
-    FILE_TOO_LARGE = 8
-    ILLEGAL_BYTE_SEQUENCE = 9
-    IN_PROGRESS = 10
-    INTERRUPTED = 11
-    INVALID = 12
-    IO = 13
-    IS_DIRECTORY = 14
-    LOOP = 15
-    TOO_MANY_LINKS = 16
-    MESSAGE_SIZE = 17
-    NAME_TOO_LONG = 18
-    NO_DEVICE = 19
-    NO_ENTRY = 20
-    NO_LOCK = 21
-    INSUFFICIENT_MEMORY = 22
-    INSUFFICIENT_SPACE = 23
-    NOT_DIRECTORY = 24
-    NOT_EMPTY = 25
-    NOT_RECOVERABLE = 26
-    UNSUPPORTED = 27
-    NO_TTY = 28
-    NO_SUCH_DEVICE = 29
-    OVERFLOW = 30
-    NOT_PERMITTED = 31
-    PIPE = 32
-    READ_ONLY = 33
-    INVALID_SEEK = 34
-    TEXT_FILE_BUSY = 35
-    CROSS_DEVICE = 36
-
-

Error codes returned by functions, similar to errno in POSIX. -Not all of these error codes are returned by the functions provided by this -API; some are used in higher-level library layers, and others are provided -merely for alignment with POSIX.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var ACCESS
-
-
-
-
var ALREADY
-
-
-
-
var BAD_DESCRIPTOR
-
-
-
-
var BUSY
-
-
-
-
var CROSS_DEVICE
-
-
-
-
var DEADLOCK
-
-
-
-
var EXIST
-
-
-
-
var FILE_TOO_LARGE
-
-
-
-
var ILLEGAL_BYTE_SEQUENCE
-
-
-
-
var INSUFFICIENT_MEMORY
-
-
-
-
var INSUFFICIENT_SPACE
-
-
-
-
var INTERRUPTED
-
-
-
-
var INVALID
-
-
-
-
var INVALID_SEEK
-
-
-
-
var IN_PROGRESS
-
-
-
-
var IO
-
-
-
-
var IS_DIRECTORY
-
-
-
-
var LOOP
-
-
-
-
var MESSAGE_SIZE
-
-
-
-
var NAME_TOO_LONG
-
-
-
-
var NOT_DIRECTORY
-
-
-
-
var NOT_EMPTY
-
-
-
-
var NOT_PERMITTED
-
-
-
-
var NOT_RECOVERABLE
-
-
-
-
var NO_DEVICE
-
-
-
-
var NO_ENTRY
-
-
-
-
var NO_LOCK
-
-
-
-
var NO_SUCH_DEVICE
-
-
-
-
var NO_TTY
-
-
-
-
var OVERFLOW
-
-
-
-
var PIPE
-
-
-
-
var QUOTA
-
-
-
-
var READ_ONLY
-
-
-
-
var TEXT_FILE_BUSY
-
-
-
- -
-
-
-
var UNSUPPORTED
-
-
-
-
var WOULD_BLOCK
-
-
-
-
-
-
-class MetadataHashValue -(lower: int, upper: int) -
-
-
- -Expand source code - -
@dataclass
-class MetadataHashValue:
-    """
-    A 128-bit hash value, split into parts because wasm doesn't have a
-    128-bit integer type.
-    """
-    lower: int
-    upper: int
-
-

A 128-bit hash value, split into parts because wasm doesn't have a -128-bit integer type.

-

Instance variables

-
-
var lower : int
-
-
-
-
var upper : int
-
-
-
-
-
-
-class NewTimestamp_NoChange -
-
-
- -Expand source code - -
@dataclass
-class NewTimestamp_NoChange:
-    pass
-
-

NewTimestamp_NoChange()

-
-
-class NewTimestamp_Now -
-
-
- -Expand source code - -
@dataclass
-class NewTimestamp_Now:
-    pass
-
-

NewTimestamp_Now()

-
-
-class NewTimestamp_Timestamp -(value: Datetime) -
-
-
- -Expand source code - -
@dataclass
-class NewTimestamp_Timestamp:
-    value: wasi_clocks_wall_clock_0_2_0.Datetime
-
-

NewTimestamp_Timestamp(value: spin_sdk.wit.imports.wasi_clocks_wall_clock_0_2_0.Datetime)

-

Instance variables

-
-
var valueDatetime
-
-
-
-
-
-
-class OpenFlags -(*args, **kwds) -
-
-
- -Expand source code - -
class OpenFlags(Flag):
-    """
-    Open flags used by `open-at`.
-    """
-    CREATE = auto()
-    DIRECTORY = auto()
-    EXCLUSIVE = auto()
-    TRUNCATE = auto()
-
-

Open flags used by open-at.

-

Ancestors

-
    -
  • enum.Flag
  • -
  • enum.Enum
  • -
-

Class variables

-
-
var CREATE
-
-
-
-
var DIRECTORY
-
-
-
-
var EXCLUSIVE
-
-
-
-
var TRUNCATE
-
-
-
-
-
-
-class PathFlags -(*args, **kwds) -
-
-
- -Expand source code - -
class PathFlags(Flag):
-    """
-    Flags determining the method of how paths are resolved.
-    """
-    SYMLINK_FOLLOW = auto()
-
-

Flags determining the method of how paths are resolved.

-

Ancestors

-
    -
  • enum.Flag
  • -
  • enum.Enum
  • -
-

Class variables

-
- -
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_filesystem_types_0_2_6.html b/docs/v4/wit/imports/wasi_filesystem_types_0_2_6.html deleted file mode 100644 index 27db3ce..0000000 --- a/docs/v4/wit/imports/wasi_filesystem_types_0_2_6.html +++ /dev/null @@ -1,2147 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_filesystem_types_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_filesystem_types_0_2_6

-
-
-

WASI filesystem is a filesystem API primarily intended to let users run WASI -programs that access their files on their existing filesystems, without -significant overhead.

-

It is intended to be roughly portable between Unix-family platforms and -Windows, though it does not hide many of the major differences.

-

Paths are passed as interface-type strings, meaning they must consist of -a sequence of Unicode Scalar Values (USVs). Some filesystems may contain -paths which are not accessible by this API.

-

The directory separator in WASI is always the forward-slash (/).

-

All paths in WASI are relative paths, and are interpreted relative to a -descriptor referring to a base directory. If a path argument to any WASI -function starts with /, or if any step of resolving a path, including -.. and symbolic link steps, reaches a directory outside of the base -directory, or reaches a symlink to an absolute or rooted path in the -underlying filesystem, the function fails with error-code::not-permitted.

-

For more information about WASI path resolution and sandboxing, see -WASI filesystem path resolution.

-
-
-
-
-

Global variables

-
-
var NewTimestamp
-
-

When setting a timestamp, this gives the value to set it to.

-
-
-
-
-

Functions

-
-
-def filesystem_error_code(err: Error) ‑> ErrorCode | None -
-
-
- -Expand source code - -
def filesystem_error_code(err: wasi_io_error_0_2_6.Error) -> Optional[ErrorCode]:
-    """
-    Attempts to extract a filesystem-related `error-code` from the stream
-    `error` provided.
-    
-    Stream operations which return `stream-error::last-operation-failed`
-    have a payload with more information about the operation that failed.
-    This payload can be passed through to this function to see if there's
-    filesystem-related information about the error to return.
-    
-    Note that this function is fallible because not all stream-related
-    errors are filesystem-related errors.
-    """
-    raise NotImplementedError
-
-

Attempts to extract a filesystem-related error-code from the stream -error provided.

-

Stream operations which return stream-error::last-operation-failed -have a payload with more information about the operation that failed. -This payload can be passed through to this function to see if there's -filesystem-related information about the error to return.

-

Note that this function is fallible because not all stream-related -errors are filesystem-related errors.

-
-
-
-
-

Classes

-
-
-class Advice -(*args, **kwds) -
-
-
- -Expand source code - -
class Advice(Enum):
-    """
-    File or memory access pattern advisory information.
-    """
-    NORMAL = 0
-    SEQUENTIAL = 1
-    RANDOM = 2
-    WILL_NEED = 3
-    DONT_NEED = 4
-    NO_REUSE = 5
-
-

File or memory access pattern advisory information.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var DONT_NEED
-
-
-
-
var NORMAL
-
-
-
-
var NO_REUSE
-
-
-
-
var RANDOM
-
-
-
-
var SEQUENTIAL
-
-
-
-
var WILL_NEED
-
-
-
-
-
-
-class Descriptor -
-
-
- -Expand source code - -
class Descriptor:
-    """
-    A descriptor is a reference to a filesystem object, which may be a file,
-    directory, named pipe, special file, or other object on which filesystem
-    calls may be made.
-    """
-    
-    def read_via_stream(self, offset: int) -> wasi_io_streams_0_2_6.InputStream:
-        """
-        Return a stream for reading from a file, if available.
-        
-        May fail with an error-code describing why the file cannot be read.
-        
-        Multiple read, write, and append streams may be active on the same open
-        file and they do not interfere with each other.
-        
-        Note: This allows using `read-stream`, which is similar to `read` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def write_via_stream(self, offset: int) -> wasi_io_streams_0_2_6.OutputStream:
-        """
-        Return a stream for writing to a file, if available.
-        
-        May fail with an error-code describing why the file cannot be written.
-        
-        Note: This allows using `write-stream`, which is similar to `write` in
-        POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def append_via_stream(self) -> wasi_io_streams_0_2_6.OutputStream:
-        """
-        Return a stream for appending to a file, if available.
-        
-        May fail with an error-code describing why the file cannot be appended.
-        
-        Note: This allows using `write-stream`, which is similar to `write` with
-        `O_APPEND` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def advise(self, offset: int, length: int, advice: Advice) -> None:
-        """
-        Provide file advisory information on a descriptor.
-        
-        This is similar to `posix_fadvise` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def sync_data(self) -> None:
-        """
-        Synchronize the data of a file to disk.
-        
-        This function succeeds with no effect if the file descriptor is not
-        opened for writing.
-        
-        Note: This is similar to `fdatasync` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_flags(self) -> DescriptorFlags:
-        """
-        Get flags associated with a descriptor.
-        
-        Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX.
-        
-        Note: This returns the value that was the `fs_flags` value returned
-        from `fdstat_get` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_type(self) -> DescriptorType:
-        """
-        Get the dynamic type of a descriptor.
-        
-        Note: This returns the same value as the `type` field of the `fd-stat`
-        returned by `stat`, `stat-at` and similar.
-        
-        Note: This returns similar flags to the `st_mode & S_IFMT` value provided
-        by `fstat` in POSIX.
-        
-        Note: This returns the value that was the `fs_filetype` value returned
-        from `fdstat_get` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_size(self, size: int) -> None:
-        """
-        Adjust the size of an open file. If this increases the file's size, the
-        extra bytes are filled with zeros.
-        
-        Note: This was called `fd_filestat_set_size` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_times(self, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp) -> None:
-        """
-        Adjust the timestamps of an open file or directory.
-        
-        Note: This is similar to `futimens` in POSIX.
-        
-        Note: This was called `fd_filestat_set_times` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def read(self, length: int, offset: int) -> Tuple[bytes, bool]:
-        """
-        Read from a descriptor, without using and updating the descriptor's offset.
-        
-        This function returns a list of bytes containing the data that was
-        read, along with a bool which, when true, indicates that the end of the
-        file was reached. The returned list will contain up to `length` bytes; it
-        may return fewer than requested, if the end of the file is reached or
-        if the I/O operation is interrupted.
-        
-        In the future, this may change to return a `stream<u8, error-code>`.
-        
-        Note: This is similar to `pread` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def write(self, buffer: bytes, offset: int) -> int:
-        """
-        Write to a descriptor, without using and updating the descriptor's offset.
-        
-        It is valid to write past the end of a file; the file is extended to the
-        extent of the write, with bytes between the previous end and the start of
-        the write set to zero.
-        
-        In the future, this may change to take a `stream<u8, error-code>`.
-        
-        Note: This is similar to `pwrite` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def read_directory(self) -> DirectoryEntryStream:
-        """
-        Read directory entries from a directory.
-        
-        On filesystems where directories contain entries referring to themselves
-        and their parents, often named `.` and `..` respectively, these entries
-        are omitted.
-        
-        This always returns a new stream which starts at the beginning of the
-        directory. Multiple streams may be active on the same directory, and they
-        do not interfere with each other.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def sync(self) -> None:
-        """
-        Synchronize the data and metadata of a file to disk.
-        
-        This function succeeds with no effect if the file descriptor is not
-        opened for writing.
-        
-        Note: This is similar to `fsync` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def create_directory_at(self, path: str) -> None:
-        """
-        Create a directory.
-        
-        Note: This is similar to `mkdirat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def stat(self) -> DescriptorStat:
-        """
-        Return the attributes of an open file or directory.
-        
-        Note: This is similar to `fstat` in POSIX, except that it does not return
-        device and inode information. For testing whether two descriptors refer to
-        the same underlying filesystem object, use `is-same-object`. To obtain
-        additional data that can be used do determine whether a file has been
-        modified, use `metadata-hash`.
-        
-        Note: This was called `fd_filestat_get` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def stat_at(self, path_flags: PathFlags, path: str) -> DescriptorStat:
-        """
-        Return the attributes of a file or directory.
-        
-        Note: This is similar to `fstatat` in POSIX, except that it does not
-        return device and inode information. See the `stat` description for a
-        discussion of alternatives.
-        
-        Note: This was called `path_filestat_get` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_times_at(self, path_flags: PathFlags, path: str, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp) -> None:
-        """
-        Adjust the timestamps of a file or directory.
-        
-        Note: This is similar to `utimensat` in POSIX.
-        
-        Note: This was called `path_filestat_set_times` in earlier versions of
-        WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def link_at(self, old_path_flags: PathFlags, old_path: str, new_descriptor: Self, new_path: str) -> None:
-        """
-        Create a hard link.
-        
-        Fails with `error-code::no-entry` if the old path does not exist,
-        with `error-code::exist` if the new path already exists, and
-        `error-code::not-permitted` if the old path is not a file.
-        
-        Note: This is similar to `linkat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def open_at(self, path_flags: PathFlags, path: str, open_flags: OpenFlags, flags: DescriptorFlags) -> Self:
-        """
-        Open a file or directory.
-        
-        If `flags` contains `descriptor-flags::mutate-directory`, and the base
-        descriptor doesn't have `descriptor-flags::mutate-directory` set,
-        `open-at` fails with `error-code::read-only`.
-        
-        If `flags` contains `write` or `mutate-directory`, or `open-flags`
-        contains `truncate` or `create`, and the base descriptor doesn't have
-        `descriptor-flags::mutate-directory` set, `open-at` fails with
-        `error-code::read-only`.
-        
-        Note: This is similar to `openat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def readlink_at(self, path: str) -> str:
-        """
-        Read the contents of a symbolic link.
-        
-        If the contents contain an absolute or rooted path in the underlying
-        filesystem, this function fails with `error-code::not-permitted`.
-        
-        Note: This is similar to `readlinkat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def remove_directory_at(self, path: str) -> None:
-        """
-        Remove a directory.
-        
-        Return `error-code::not-empty` if the directory is not empty.
-        
-        Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def rename_at(self, old_path: str, new_descriptor: Self, new_path: str) -> None:
-        """
-        Rename a filesystem object.
-        
-        Note: This is similar to `renameat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def symlink_at(self, old_path: str, new_path: str) -> None:
-        """
-        Create a symbolic link (also known as a "symlink").
-        
-        If `old-path` starts with `/`, the function fails with
-        `error-code::not-permitted`.
-        
-        Note: This is similar to `symlinkat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def unlink_file_at(self, path: str) -> None:
-        """
-        Unlink a filesystem object that is not a directory.
-        
-        Return `error-code::is-directory` if the path refers to a directory.
-        Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def is_same_object(self, other: Self) -> bool:
-        """
-        Test whether two descriptors refer to the same filesystem object.
-        
-        In POSIX, this corresponds to testing whether the two descriptors have the
-        same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers.
-        wasi-filesystem does not expose device and inode numbers, so this function
-        may be used instead.
-        """
-        raise NotImplementedError
-    def metadata_hash(self) -> MetadataHashValue:
-        """
-        Return a hash of the metadata associated with a filesystem object referred
-        to by a descriptor.
-        
-        This returns a hash of the last-modification timestamp and file size, and
-        may also include the inode number, device number, birth timestamp, and
-        other metadata fields that may change when the file is modified or
-        replaced. It may also include a secret value chosen by the
-        implementation and not otherwise exposed.
-        
-        Implementations are encouraged to provide the following properties:
-        
-         - If the file is not modified or replaced, the computed hash value should
-           usually not change.
-         - If the object is modified or replaced, the computed hash value should
-           usually change.
-         - The inputs to the hash should not be easily computable from the
-           computed hash.
-        
-        However, none of these is required.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def metadata_hash_at(self, path_flags: PathFlags, path: str) -> MetadataHashValue:
-        """
-        Return a hash of the metadata associated with a filesystem object referred
-        to by a directory descriptor and a relative path.
-        
-        This performs the same hash computation as `metadata-hash`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A descriptor is a reference to a filesystem object, which may be a file, -directory, named pipe, special file, or other object on which filesystem -calls may be made.

-

Methods

-
-
-def advise(self,
offset: int,
length: int,
advice: Advice) ‑> None
-
-
-
- -Expand source code - -
def advise(self, offset: int, length: int, advice: Advice) -> None:
-    """
-    Provide file advisory information on a descriptor.
-    
-    This is similar to `posix_fadvise` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Provide file advisory information on a descriptor.

-

This is similar to posix_fadvise in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def append_via_stream(self) ‑> OutputStream -
-
-
- -Expand source code - -
def append_via_stream(self) -> wasi_io_streams_0_2_6.OutputStream:
-    """
-    Return a stream for appending to a file, if available.
-    
-    May fail with an error-code describing why the file cannot be appended.
-    
-    Note: This allows using `write-stream`, which is similar to `write` with
-    `O_APPEND` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return a stream for appending to a file, if available.

-

May fail with an error-code describing why the file cannot be appended.

-

Note: This allows using write-stream, which is similar to write with -O_APPEND in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def create_directory_at(self, path: str) ‑> None -
-
-
- -Expand source code - -
def create_directory_at(self, path: str) -> None:
-    """
-    Create a directory.
-    
-    Note: This is similar to `mkdirat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a directory.

-

Note: This is similar to mkdirat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_flags(self) ‑> DescriptorFlags -
-
-
- -Expand source code - -
def get_flags(self) -> DescriptorFlags:
-    """
-    Get flags associated with a descriptor.
-    
-    Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX.
-    
-    Note: This returns the value that was the `fs_flags` value returned
-    from `fdstat_get` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get flags associated with a descriptor.

-

Note: This returns similar flags to fcntl(fd, F_GETFL) in POSIX.

-

Note: This returns the value that was the fs_flags value returned -from fdstat_get in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_type(self) ‑> DescriptorType -
-
-
- -Expand source code - -
def get_type(self) -> DescriptorType:
-    """
-    Get the dynamic type of a descriptor.
-    
-    Note: This returns the same value as the `type` field of the `fd-stat`
-    returned by `stat`, `stat-at` and similar.
-    
-    Note: This returns similar flags to the `st_mode & S_IFMT` value provided
-    by `fstat` in POSIX.
-    
-    Note: This returns the value that was the `fs_filetype` value returned
-    from `fdstat_get` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get the dynamic type of a descriptor.

-

Note: This returns the same value as the type field of the fd-stat -returned by stat, stat-at and similar.

-

Note: This returns similar flags to the st_mode & S_IFMT value provided -by fstat in POSIX.

-

Note: This returns the value that was the fs_filetype value returned -from fdstat_get in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def is_same_object(self, other: Self) ‑> bool -
-
-
- -Expand source code - -
def is_same_object(self, other: Self) -> bool:
-    """
-    Test whether two descriptors refer to the same filesystem object.
-    
-    In POSIX, this corresponds to testing whether the two descriptors have the
-    same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers.
-    wasi-filesystem does not expose device and inode numbers, so this function
-    may be used instead.
-    """
-    raise NotImplementedError
-
-

Test whether two descriptors refer to the same filesystem object.

-

In POSIX, this corresponds to testing whether the two descriptors have the -same device (st_dev) and inode (st_ino or d_ino) numbers. -wasi-filesystem does not expose device and inode numbers, so this function -may be used instead.

-
- -
-
- -Expand source code - -
def link_at(self, old_path_flags: PathFlags, old_path: str, new_descriptor: Self, new_path: str) -> None:
-    """
-    Create a hard link.
-    
-    Fails with `error-code::no-entry` if the old path does not exist,
-    with `error-code::exist` if the new path already exists, and
-    `error-code::not-permitted` if the old path is not a file.
-    
-    Note: This is similar to `linkat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a hard link.

-

Fails with error-code::no-entry if the old path does not exist, -with error-code::exist if the new path already exists, and -error-code::not-permitted if the old path is not a file.

-

Note: This is similar to linkat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def metadata_hash(self) ‑> MetadataHashValue -
-
-
- -Expand source code - -
def metadata_hash(self) -> MetadataHashValue:
-    """
-    Return a hash of the metadata associated with a filesystem object referred
-    to by a descriptor.
-    
-    This returns a hash of the last-modification timestamp and file size, and
-    may also include the inode number, device number, birth timestamp, and
-    other metadata fields that may change when the file is modified or
-    replaced. It may also include a secret value chosen by the
-    implementation and not otherwise exposed.
-    
-    Implementations are encouraged to provide the following properties:
-    
-     - If the file is not modified or replaced, the computed hash value should
-       usually not change.
-     - If the object is modified or replaced, the computed hash value should
-       usually change.
-     - The inputs to the hash should not be easily computable from the
-       computed hash.
-    
-    However, none of these is required.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return a hash of the metadata associated with a filesystem object referred -to by a descriptor.

-

This returns a hash of the last-modification timestamp and file size, and -may also include the inode number, device number, birth timestamp, and -other metadata fields that may change when the file is modified or -replaced. It may also include a secret value chosen by the -implementation and not otherwise exposed.

-

Implementations are encouraged to provide the following properties:

-
    -
  • If the file is not modified or replaced, the computed hash value should -usually not change.
  • -
  • If the object is modified or replaced, the computed hash value should -usually change.
  • -
  • The inputs to the hash should not be easily computable from the -computed hash.
  • -
-

However, none of these is required.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def metadata_hash_at(self,
path_flags: PathFlags,
path: str) ‑> MetadataHashValue
-
-
-
- -Expand source code - -
def metadata_hash_at(self, path_flags: PathFlags, path: str) -> MetadataHashValue:
-    """
-    Return a hash of the metadata associated with a filesystem object referred
-    to by a directory descriptor and a relative path.
-    
-    This performs the same hash computation as `metadata-hash`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return a hash of the metadata associated with a filesystem object referred -to by a directory descriptor and a relative path.

-

This performs the same hash computation as metadata-hash.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def open_at(self,
path_flags: PathFlags,
path: str,
open_flags: OpenFlags,
flags: DescriptorFlags) ‑> Self
-
-
-
- -Expand source code - -
def open_at(self, path_flags: PathFlags, path: str, open_flags: OpenFlags, flags: DescriptorFlags) -> Self:
-    """
-    Open a file or directory.
-    
-    If `flags` contains `descriptor-flags::mutate-directory`, and the base
-    descriptor doesn't have `descriptor-flags::mutate-directory` set,
-    `open-at` fails with `error-code::read-only`.
-    
-    If `flags` contains `write` or `mutate-directory`, or `open-flags`
-    contains `truncate` or `create`, and the base descriptor doesn't have
-    `descriptor-flags::mutate-directory` set, `open-at` fails with
-    `error-code::read-only`.
-    
-    Note: This is similar to `openat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Open a file or directory.

-

If flags contains descriptor-flags::mutate-directory, and the base -descriptor doesn't have descriptor-flags::mutate-directory set, -open-at fails with error-code::read-only.

-

If flags contains write or mutate-directory, or open-flags -contains truncate or create, and the base descriptor doesn't have -descriptor-flags::mutate-directory set, open-at fails with -error-code::read-only.

-

Note: This is similar to openat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def read(self, length: int, offset: int) ‑> Tuple[bytes, bool] -
-
-
- -Expand source code - -
def read(self, length: int, offset: int) -> Tuple[bytes, bool]:
-    """
-    Read from a descriptor, without using and updating the descriptor's offset.
-    
-    This function returns a list of bytes containing the data that was
-    read, along with a bool which, when true, indicates that the end of the
-    file was reached. The returned list will contain up to `length` bytes; it
-    may return fewer than requested, if the end of the file is reached or
-    if the I/O operation is interrupted.
-    
-    In the future, this may change to return a `stream<u8, error-code>`.
-    
-    Note: This is similar to `pread` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Read from a descriptor, without using and updating the descriptor's offset.

-

This function returns a list of bytes containing the data that was -read, along with a bool which, when true, indicates that the end of the -file was reached. The returned list will contain up to length bytes; it -may return fewer than requested, if the end of the file is reached or -if the I/O operation is interrupted.

-

In the future, this may change to return a stream<u8, error-code>.

-

Note: This is similar to pread in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def read_directory(self) ‑> DirectoryEntryStream -
-
-
- -Expand source code - -
def read_directory(self) -> DirectoryEntryStream:
-    """
-    Read directory entries from a directory.
-    
-    On filesystems where directories contain entries referring to themselves
-    and their parents, often named `.` and `..` respectively, these entries
-    are omitted.
-    
-    This always returns a new stream which starts at the beginning of the
-    directory. Multiple streams may be active on the same directory, and they
-    do not interfere with each other.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Read directory entries from a directory.

-

On filesystems where directories contain entries referring to themselves -and their parents, often named . and .. respectively, these entries -are omitted.

-

This always returns a new stream which starts at the beginning of the -directory. Multiple streams may be active on the same directory, and they -do not interfere with each other.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def read_via_stream(self, offset: int) ‑> InputStream -
-
-
- -Expand source code - -
def read_via_stream(self, offset: int) -> wasi_io_streams_0_2_6.InputStream:
-    """
-    Return a stream for reading from a file, if available.
-    
-    May fail with an error-code describing why the file cannot be read.
-    
-    Multiple read, write, and append streams may be active on the same open
-    file and they do not interfere with each other.
-    
-    Note: This allows using `read-stream`, which is similar to `read` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return a stream for reading from a file, if available.

-

May fail with an error-code describing why the file cannot be read.

-

Multiple read, write, and append streams may be active on the same open -file and they do not interfere with each other.

-

Note: This allows using read-stream, which is similar to read in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
- -
-
- -Expand source code - -
def readlink_at(self, path: str) -> str:
-    """
-    Read the contents of a symbolic link.
-    
-    If the contents contain an absolute or rooted path in the underlying
-    filesystem, this function fails with `error-code::not-permitted`.
-    
-    Note: This is similar to `readlinkat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Read the contents of a symbolic link.

-

If the contents contain an absolute or rooted path in the underlying -filesystem, this function fails with error-code::not-permitted.

-

Note: This is similar to readlinkat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def remove_directory_at(self, path: str) ‑> None -
-
-
- -Expand source code - -
def remove_directory_at(self, path: str) -> None:
-    """
-    Remove a directory.
-    
-    Return `error-code::not-empty` if the directory is not empty.
-    
-    Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Remove a directory.

-

Return error-code::not-empty if the directory is not empty.

-

Note: This is similar to unlinkat(fd, path, AT_REMOVEDIR) in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def rename_at(self, old_path: str, new_descriptor: Self, new_path: str) ‑> None -
-
-
- -Expand source code - -
def rename_at(self, old_path: str, new_descriptor: Self, new_path: str) -> None:
-    """
-    Rename a filesystem object.
-    
-    Note: This is similar to `renameat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Rename a filesystem object.

-

Note: This is similar to renameat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_size(self, size: int) ‑> None -
-
-
- -Expand source code - -
def set_size(self, size: int) -> None:
-    """
-    Adjust the size of an open file. If this increases the file's size, the
-    extra bytes are filled with zeros.
-    
-    Note: This was called `fd_filestat_set_size` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Adjust the size of an open file. If this increases the file's size, the -extra bytes are filled with zeros.

-

Note: This was called fd_filestat_set_size in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_times(self,
data_access_timestamp: NewTimestamp_NoChange | NewTimestamp_Now | NewTimestamp_Timestamp,
data_modification_timestamp: NewTimestamp_NoChange | NewTimestamp_Now | NewTimestamp_Timestamp) ‑> None
-
-
-
- -Expand source code - -
def set_times(self, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp) -> None:
-    """
-    Adjust the timestamps of an open file or directory.
-    
-    Note: This is similar to `futimens` in POSIX.
-    
-    Note: This was called `fd_filestat_set_times` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Adjust the timestamps of an open file or directory.

-

Note: This is similar to futimens in POSIX.

-

Note: This was called fd_filestat_set_times in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_times_at(self,
path_flags: PathFlags,
path: str,
data_access_timestamp: NewTimestamp_NoChange | NewTimestamp_Now | NewTimestamp_Timestamp,
data_modification_timestamp: NewTimestamp_NoChange | NewTimestamp_Now | NewTimestamp_Timestamp) ‑> None
-
-
-
- -Expand source code - -
def set_times_at(self, path_flags: PathFlags, path: str, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp) -> None:
-    """
-    Adjust the timestamps of a file or directory.
-    
-    Note: This is similar to `utimensat` in POSIX.
-    
-    Note: This was called `path_filestat_set_times` in earlier versions of
-    WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Adjust the timestamps of a file or directory.

-

Note: This is similar to utimensat in POSIX.

-

Note: This was called path_filestat_set_times in earlier versions of -WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def stat(self) ‑> DescriptorStat -
-
-
- -Expand source code - -
def stat(self) -> DescriptorStat:
-    """
-    Return the attributes of an open file or directory.
-    
-    Note: This is similar to `fstat` in POSIX, except that it does not return
-    device and inode information. For testing whether two descriptors refer to
-    the same underlying filesystem object, use `is-same-object`. To obtain
-    additional data that can be used do determine whether a file has been
-    modified, use `metadata-hash`.
-    
-    Note: This was called `fd_filestat_get` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return the attributes of an open file or directory.

-

Note: This is similar to fstat in POSIX, except that it does not return -device and inode information. For testing whether two descriptors refer to -the same underlying filesystem object, use is-same-object. To obtain -additional data that can be used do determine whether a file has been -modified, use metadata-hash.

-

Note: This was called fd_filestat_get in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def stat_at(self,
path_flags: PathFlags,
path: str) ‑> DescriptorStat
-
-
-
- -Expand source code - -
def stat_at(self, path_flags: PathFlags, path: str) -> DescriptorStat:
-    """
-    Return the attributes of a file or directory.
-    
-    Note: This is similar to `fstatat` in POSIX, except that it does not
-    return device and inode information. See the `stat` description for a
-    discussion of alternatives.
-    
-    Note: This was called `path_filestat_get` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return the attributes of a file or directory.

-

Note: This is similar to fstatat in POSIX, except that it does not -return device and inode information. See the stat description for a -discussion of alternatives.

-

Note: This was called path_filestat_get in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
- -
-
- -Expand source code - -
def symlink_at(self, old_path: str, new_path: str) -> None:
-    """
-    Create a symbolic link (also known as a "symlink").
-    
-    If `old-path` starts with `/`, the function fails with
-    `error-code::not-permitted`.
-    
-    Note: This is similar to `symlinkat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a symbolic link (also known as a "symlink").

-

If old-path starts with /, the function fails with -error-code::not-permitted.

-

Note: This is similar to symlinkat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def sync(self) ‑> None -
-
-
- -Expand source code - -
def sync(self) -> None:
-    """
-    Synchronize the data and metadata of a file to disk.
-    
-    This function succeeds with no effect if the file descriptor is not
-    opened for writing.
-    
-    Note: This is similar to `fsync` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Synchronize the data and metadata of a file to disk.

-

This function succeeds with no effect if the file descriptor is not -opened for writing.

-

Note: This is similar to fsync in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def sync_data(self) ‑> None -
-
-
- -Expand source code - -
def sync_data(self) -> None:
-    """
-    Synchronize the data of a file to disk.
-    
-    This function succeeds with no effect if the file descriptor is not
-    opened for writing.
-    
-    Note: This is similar to `fdatasync` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Synchronize the data of a file to disk.

-

This function succeeds with no effect if the file descriptor is not -opened for writing.

-

Note: This is similar to fdatasync in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
- -
-
- -Expand source code - -
def unlink_file_at(self, path: str) -> None:
-    """
-    Unlink a filesystem object that is not a directory.
-    
-    Return `error-code::is-directory` if the path refers to a directory.
-    Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Unlink a filesystem object that is not a directory.

-

Return error-code::is-directory if the path refers to a directory. -Note: This is similar to unlinkat(fd, path, 0) in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def write(self, buffer: bytes, offset: int) ‑> int -
-
-
- -Expand source code - -
def write(self, buffer: bytes, offset: int) -> int:
-    """
-    Write to a descriptor, without using and updating the descriptor's offset.
-    
-    It is valid to write past the end of a file; the file is extended to the
-    extent of the write, with bytes between the previous end and the start of
-    the write set to zero.
-    
-    In the future, this may change to take a `stream<u8, error-code>`.
-    
-    Note: This is similar to `pwrite` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Write to a descriptor, without using and updating the descriptor's offset.

-

It is valid to write past the end of a file; the file is extended to the -extent of the write, with bytes between the previous end and the start of -the write set to zero.

-

In the future, this may change to take a stream<u8, error-code>.

-

Note: This is similar to pwrite in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def write_via_stream(self, offset: int) ‑> OutputStream -
-
-
- -Expand source code - -
def write_via_stream(self, offset: int) -> wasi_io_streams_0_2_6.OutputStream:
-    """
-    Return a stream for writing to a file, if available.
-    
-    May fail with an error-code describing why the file cannot be written.
-    
-    Note: This allows using `write-stream`, which is similar to `write` in
-    POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return a stream for writing to a file, if available.

-

May fail with an error-code describing why the file cannot be written.

-

Note: This allows using write-stream, which is similar to write in -POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-class DescriptorFlags -(*args, **kwds) -
-
-
- -Expand source code - -
class DescriptorFlags(Flag):
-    """
-    Descriptor flags.
-    
-    Note: This was called `fdflags` in earlier versions of WASI.
-    """
-    READ = auto()
-    WRITE = auto()
-    FILE_INTEGRITY_SYNC = auto()
-    DATA_INTEGRITY_SYNC = auto()
-    REQUESTED_WRITE_SYNC = auto()
-    MUTATE_DIRECTORY = auto()
-
-

Descriptor flags.

-

Note: This was called fdflags in earlier versions of WASI.

-

Ancestors

-
    -
  • enum.Flag
  • -
  • enum.Enum
  • -
-

Class variables

-
-
var DATA_INTEGRITY_SYNC
-
-
-
-
var FILE_INTEGRITY_SYNC
-
-
-
-
var MUTATE_DIRECTORY
-
-
-
-
var READ
-
-
-
-
var REQUESTED_WRITE_SYNC
-
-
-
-
var WRITE
-
-
-
-
-
-
-class DescriptorStat -(type: DescriptorType,
link_count: int,
size: int,
data_access_timestamp: Datetime | None,
data_modification_timestamp: Datetime | None,
status_change_timestamp: Datetime | None)
-
-
-
- -Expand source code - -
@dataclass
-class DescriptorStat:
-    """
-    File attributes.
-    
-    Note: This was called `filestat` in earlier versions of WASI.
-    """
-    type: DescriptorType
-    link_count: int
-    size: int
-    data_access_timestamp: Optional[wasi_clocks_wall_clock_0_2_6.Datetime]
-    data_modification_timestamp: Optional[wasi_clocks_wall_clock_0_2_6.Datetime]
-    status_change_timestamp: Optional[wasi_clocks_wall_clock_0_2_6.Datetime]
-
-

File attributes.

-

Note: This was called filestat in earlier versions of WASI.

-

Instance variables

-
-
var data_access_timestampDatetime | None
-
-
-
-
var data_modification_timestampDatetime | None
-
-
-
- -
-
-
-
var size : int
-
-
-
-
var status_change_timestampDatetime | None
-
-
-
-
var typeDescriptorType
-
-
-
-
-
-
-class DescriptorType -(*args, **kwds) -
-
-
- -Expand source code - -
class DescriptorType(Enum):
-    """
-    The type of a filesystem object referenced by a descriptor.
-    
-    Note: This was called `filetype` in earlier versions of WASI.
-    """
-    UNKNOWN = 0
-    BLOCK_DEVICE = 1
-    CHARACTER_DEVICE = 2
-    DIRECTORY = 3
-    FIFO = 4
-    SYMBOLIC_LINK = 5
-    REGULAR_FILE = 6
-    SOCKET = 7
-
-

The type of a filesystem object referenced by a descriptor.

-

Note: This was called filetype in earlier versions of WASI.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var BLOCK_DEVICE
-
-
-
-
var CHARACTER_DEVICE
-
-
-
-
var DIRECTORY
-
-
-
-
var FIFO
-
-
-
-
var REGULAR_FILE
-
-
-
-
var SOCKET
-
-
-
- -
-
-
-
var UNKNOWN
-
-
-
-
-
-
-class DirectoryEntry -(type: DescriptorType,
name: str)
-
-
-
- -Expand source code - -
@dataclass
-class DirectoryEntry:
-    """
-    A directory entry.
-    """
-    type: DescriptorType
-    name: str
-
-

A directory entry.

-

Instance variables

-
-
var name : str
-
-
-
-
var typeDescriptorType
-
-
-
-
-
-
-class DirectoryEntryStream -
-
-
- -Expand source code - -
class DirectoryEntryStream:
-    """
-    A stream of directory entries.
-    """
-    
-    def read_directory_entry(self) -> Optional[DirectoryEntry]:
-        """
-        Read a single directory entry from a `directory-entry-stream`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A stream of directory entries.

-

Methods

-
-
-def read_directory_entry(self) ‑> DirectoryEntry | None -
-
-
- -Expand source code - -
def read_directory_entry(self) -> Optional[DirectoryEntry]:
-    """
-    Read a single directory entry from a `directory-entry-stream`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Read a single directory entry from a directory-entry-stream.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-class ErrorCode -(*args, **kwds) -
-
-
- -Expand source code - -
class ErrorCode(Enum):
-    """
-    Error codes returned by functions, similar to `errno` in POSIX.
-    Not all of these error codes are returned by the functions provided by this
-    API; some are used in higher-level library layers, and others are provided
-    merely for alignment with POSIX.
-    """
-    ACCESS = 0
-    WOULD_BLOCK = 1
-    ALREADY = 2
-    BAD_DESCRIPTOR = 3
-    BUSY = 4
-    DEADLOCK = 5
-    QUOTA = 6
-    EXIST = 7
-    FILE_TOO_LARGE = 8
-    ILLEGAL_BYTE_SEQUENCE = 9
-    IN_PROGRESS = 10
-    INTERRUPTED = 11
-    INVALID = 12
-    IO = 13
-    IS_DIRECTORY = 14
-    LOOP = 15
-    TOO_MANY_LINKS = 16
-    MESSAGE_SIZE = 17
-    NAME_TOO_LONG = 18
-    NO_DEVICE = 19
-    NO_ENTRY = 20
-    NO_LOCK = 21
-    INSUFFICIENT_MEMORY = 22
-    INSUFFICIENT_SPACE = 23
-    NOT_DIRECTORY = 24
-    NOT_EMPTY = 25
-    NOT_RECOVERABLE = 26
-    UNSUPPORTED = 27
-    NO_TTY = 28
-    NO_SUCH_DEVICE = 29
-    OVERFLOW = 30
-    NOT_PERMITTED = 31
-    PIPE = 32
-    READ_ONLY = 33
-    INVALID_SEEK = 34
-    TEXT_FILE_BUSY = 35
-    CROSS_DEVICE = 36
-
-

Error codes returned by functions, similar to errno in POSIX. -Not all of these error codes are returned by the functions provided by this -API; some are used in higher-level library layers, and others are provided -merely for alignment with POSIX.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var ACCESS
-
-
-
-
var ALREADY
-
-
-
-
var BAD_DESCRIPTOR
-
-
-
-
var BUSY
-
-
-
-
var CROSS_DEVICE
-
-
-
-
var DEADLOCK
-
-
-
-
var EXIST
-
-
-
-
var FILE_TOO_LARGE
-
-
-
-
var ILLEGAL_BYTE_SEQUENCE
-
-
-
-
var INSUFFICIENT_MEMORY
-
-
-
-
var INSUFFICIENT_SPACE
-
-
-
-
var INTERRUPTED
-
-
-
-
var INVALID
-
-
-
-
var INVALID_SEEK
-
-
-
-
var IN_PROGRESS
-
-
-
-
var IO
-
-
-
-
var IS_DIRECTORY
-
-
-
-
var LOOP
-
-
-
-
var MESSAGE_SIZE
-
-
-
-
var NAME_TOO_LONG
-
-
-
-
var NOT_DIRECTORY
-
-
-
-
var NOT_EMPTY
-
-
-
-
var NOT_PERMITTED
-
-
-
-
var NOT_RECOVERABLE
-
-
-
-
var NO_DEVICE
-
-
-
-
var NO_ENTRY
-
-
-
-
var NO_LOCK
-
-
-
-
var NO_SUCH_DEVICE
-
-
-
-
var NO_TTY
-
-
-
-
var OVERFLOW
-
-
-
-
var PIPE
-
-
-
-
var QUOTA
-
-
-
-
var READ_ONLY
-
-
-
-
var TEXT_FILE_BUSY
-
-
-
- -
-
-
-
var UNSUPPORTED
-
-
-
-
var WOULD_BLOCK
-
-
-
-
-
-
-class MetadataHashValue -(lower: int, upper: int) -
-
-
- -Expand source code - -
@dataclass
-class MetadataHashValue:
-    """
-    A 128-bit hash value, split into parts because wasm doesn't have a
-    128-bit integer type.
-    """
-    lower: int
-    upper: int
-
-

A 128-bit hash value, split into parts because wasm doesn't have a -128-bit integer type.

-

Instance variables

-
-
var lower : int
-
-
-
-
var upper : int
-
-
-
-
-
-
-class NewTimestamp_NoChange -
-
-
- -Expand source code - -
@dataclass
-class NewTimestamp_NoChange:
-    pass
-
-

NewTimestamp_NoChange()

-
-
-class NewTimestamp_Now -
-
-
- -Expand source code - -
@dataclass
-class NewTimestamp_Now:
-    pass
-
-

NewTimestamp_Now()

-
-
-class NewTimestamp_Timestamp -(value: Datetime) -
-
-
- -Expand source code - -
@dataclass
-class NewTimestamp_Timestamp:
-    value: wasi_clocks_wall_clock_0_2_6.Datetime
-
-

NewTimestamp_Timestamp(value: spin_sdk.wit.imports.wasi_clocks_wall_clock_0_2_6.Datetime)

-

Instance variables

-
-
var valueDatetime
-
-
-
-
-
-
-class OpenFlags -(*args, **kwds) -
-
-
- -Expand source code - -
class OpenFlags(Flag):
-    """
-    Open flags used by `open-at`.
-    """
-    CREATE = auto()
-    DIRECTORY = auto()
-    EXCLUSIVE = auto()
-    TRUNCATE = auto()
-
-

Open flags used by open-at.

-

Ancestors

-
    -
  • enum.Flag
  • -
  • enum.Enum
  • -
-

Class variables

-
-
var CREATE
-
-
-
-
var DIRECTORY
-
-
-
-
var EXCLUSIVE
-
-
-
-
var TRUNCATE
-
-
-
-
-
-
-class PathFlags -(*args, **kwds) -
-
-
- -Expand source code - -
class PathFlags(Flag):
-    """
-    Flags determining the method of how paths are resolved.
-    """
-    SYMLINK_FOLLOW = auto()
-
-

Flags determining the method of how paths are resolved.

-

Ancestors

-
    -
  • enum.Flag
  • -
  • enum.Enum
  • -
-

Class variables

-
- -
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_filesystem_types_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_filesystem_types_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 98e5941..0000000 --- a/docs/v4/wit/imports/wasi_filesystem_types_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,2467 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15

-
-
-

WASI filesystem is a filesystem API primarily intended to let users run WASI -programs that access their files on their existing filesystems, without -significant overhead.

-

Paths are passed as interface-type strings, meaning they must consist of -a sequence of Unicode Scalar Values (USVs). Some filesystems may contain -paths which are not accessible by this API.

-

The directory separator in WASI is always the forward-slash (/).

-

All paths in WASI are relative paths, and are interpreted relative to a -descriptor referring to a base directory. If a path argument to any WASI -function starts with /, or if any step of resolving a path, including -.. and symbolic link steps, reaches a directory outside of the base -directory, or reaches a symlink to an absolute or rooted path in the -underlying filesystem, the function fails with error-code::not-permitted.

-

For more information about WASI path resolution and sandboxing, see -WASI filesystem path resolution.

-

Though this package presents a portable interface modelled on POSIX, it -prioritizes compatibility over portability: allowing users to access their -files on their machine is more important than exposing a single semantics -across all platforms. -Notably, depending on the underlying operating system -and file system: -* Paths may be case-folded or not. -* Deleting (unlinking) a file may fail if there are other file descriptors -open. -* Durability and atomicity of changes to underlying files when there are -concurrent writers.

-

Users that need well-defined, portable semantics should use a key-value -store or a database instead.

-
-
-
-
-

Global variables

-
-
var DescriptorType
-
-

The type of a filesystem object referenced by a descriptor.

-

Note: This was called filetype in earlier versions of WASI.

-
-
var ErrorCode
-
-

Error codes returned by functions, similar to errno in POSIX. -Not all of these error codes are returned by the functions provided by this -API; some are used in higher-level library layers, and others are provided -merely for alignment with POSIX.

-
-
var NewTimestamp
-
-

When setting a timestamp, this gives the value to set it to.

-
-
-
-
-
-
-

Classes

-
-
-class Advice -(*args, **kwds) -
-
-
- -Expand source code - -
class Advice(Enum):
-    """
-    File or memory access pattern advisory information.
-    """
-    NORMAL = 0
-    SEQUENTIAL = 1
-    RANDOM = 2
-    WILL_NEED = 3
-    DONT_NEED = 4
-    NO_REUSE = 5
-
-

File or memory access pattern advisory information.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var DONT_NEED
-
-
-
-
var NORMAL
-
-
-
-
var NO_REUSE
-
-
-
-
var RANDOM
-
-
-
-
var SEQUENTIAL
-
-
-
-
var WILL_NEED
-
-
-
-
-
-
-class Descriptor -
-
-
- -Expand source code - -
class Descriptor:
-    """
-    A descriptor is a reference to a filesystem object, which may be a file,
-    directory, named pipe, special file, or other object on which filesystem
-    calls may be made.
-    """
-    
-    def read_via_stream(self, offset: int) -> Tuple[ByteStreamReader, FutureReader[Result[None, ErrorCode]]]:
-        """
-        Return a stream for reading from a file.
-        
-        Multiple read, write, and append streams may be active on the same open
-        file and they do not interfere with each other.
-        
-        This function returns a `stream` which provides the data received from the
-        file, and a `future` providing additional error information in case an
-        error is encountered.
-        
-        If no error is encountered, `stream.read` on the `stream` will return
-        `read-status::closed` with no `error-context` and the future resolves to
-        the value `ok`. If an error is encountered, `stream.read` on the
-        `stream` returns `read-status::closed` with an `error-context` and the future
-        resolves to `err` with an `error-code`.
-        
-        Note: This is similar to `pread` in POSIX.
-        """
-        raise NotImplementedError
-    def write_via_stream(self, data: ByteStreamReader, offset: int) -> FutureReader[Result[None, ErrorCode]]:
-        """
-        Return a stream for writing to a file, if available.
-        
-        May fail with an error-code describing why the file cannot be written.
-        
-        It is valid to write past the end of a file; the file is extended to the
-        extent of the write, with bytes between the previous end and the start of
-        the write set to zero.
-        
-        This function returns once either full contents of the stream are
-        written or an error is encountered.
-        
-        Note: This is similar to `pwrite` in POSIX.
-        """
-        raise NotImplementedError
-    def append_via_stream(self, data: ByteStreamReader) -> FutureReader[Result[None, ErrorCode]]:
-        """
-        Return a stream for appending to a file, if available.
-        
-        May fail with an error-code describing why the file cannot be appended.
-        
-        This function returns once either full contents of the stream are
-        written or an error is encountered.
-        
-        Note: This is similar to `write` with `O_APPEND` in POSIX.
-        """
-        raise NotImplementedError
-    async def advise(self, offset: int, length: int, advice: Advice) -> None:
-        """
-        Provide file advisory information on a descriptor.
-        
-        This is similar to `posix_fadvise` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def sync_data(self) -> None:
-        """
-        Synchronize the data of a file to disk.
-        
-        This function succeeds with no effect if the file descriptor is not
-        opened for writing.
-        
-        Note: This is similar to `fdatasync` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def get_flags(self) -> DescriptorFlags:
-        """
-        Get flags associated with a descriptor.
-        
-        Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX.
-        
-        Note: This returns the value that was the `fs_flags` value returned
-        from `fdstat_get` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def get_type(self) -> DescriptorType:
-        """
-        Get the dynamic type of a descriptor.
-        
-        Note: This returns the same value as the `type` field of the `fd-stat`
-        returned by `stat`, `stat-at` and similar.
-        
-        Note: This returns similar flags to the `st_mode & S_IFMT` value provided
-        by `fstat` in POSIX.
-        
-        Note: This returns the value that was the `fs_filetype` value returned
-        from `fdstat_get` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def set_size(self, size: int) -> None:
-        """
-        Adjust the size of an open file. If this increases the file's size, the
-        extra bytes are filled with zeros.
-        
-        Note: This was called `fd_filestat_set_size` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def set_times(self, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp) -> None:
-        """
-        Adjust the timestamps of an open file or directory.
-        
-        Note: This is similar to `futimens` in POSIX.
-        
-        Note: This was called `fd_filestat_set_times` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def read_directory(self) -> Tuple[StreamReader[DirectoryEntry], FutureReader[Result[None, ErrorCode]]]:
-        """
-        Read directory entries from a directory.
-        
-        On filesystems where directories contain entries referring to themselves
-        and their parents, often named `.` and `..` respectively, these entries
-        are omitted.
-        
-        This always returns a new stream which starts at the beginning of the
-        directory. Multiple streams may be active on the same directory, and they
-        do not interfere with each other.
-        
-        This function returns a future, which will resolve to an error code if
-        reading full contents of the directory fails.
-        """
-        raise NotImplementedError
-    async def sync(self) -> None:
-        """
-        Synchronize the data and metadata of a file to disk.
-        
-        This function succeeds with no effect if the file descriptor is not
-        opened for writing.
-        
-        Note: This is similar to `fsync` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def create_directory_at(self, path: str) -> None:
-        """
-        Create a directory.
-        
-        Note: This is similar to `mkdirat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def stat(self) -> DescriptorStat:
-        """
-        Return the attributes of an open file or directory.
-        
-        Note: This is similar to `fstat` in POSIX, except that it does not return
-        device and inode information. For testing whether two descriptors refer to
-        the same underlying filesystem object, use `is-same-object`. To obtain
-        additional data that can be used do determine whether a file has been
-        modified, use `metadata-hash`.
-        
-        Note: This was called `fd_filestat_get` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def stat_at(self, path_flags: PathFlags, path: str) -> DescriptorStat:
-        """
-        Return the attributes of a file or directory.
-        
-        Note: This is similar to `fstatat` in POSIX, except that it does not
-        return device and inode information. See the `stat` description for a
-        discussion of alternatives.
-        
-        Note: This was called `path_filestat_get` in earlier versions of WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def set_times_at(self, path_flags: PathFlags, path: str, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp) -> None:
-        """
-        Adjust the timestamps of a file or directory.
-        
-        Note: This is similar to `utimensat` in POSIX.
-        
-        Note: This was called `path_filestat_set_times` in earlier versions of
-        WASI.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def link_at(self, old_path_flags: PathFlags, old_path: str, new_descriptor: Self, new_path: str) -> None:
-        """
-        Create a hard link.
-        
-        Fails with `error-code::no-entry` if the old path does not exist,
-        with `error-code::exist` if the new path already exists, and
-        `error-code::not-permitted` if the old path is not a file.
-        
-        Note: This is similar to `linkat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def open_at(self, path_flags: PathFlags, path: str, open_flags: OpenFlags, flags: DescriptorFlags) -> Self:
-        """
-        Open a file or directory.
-        
-        If `flags` contains `descriptor-flags::mutate-directory`, and the base
-        descriptor doesn't have `descriptor-flags::mutate-directory` set,
-        `open-at` fails with `error-code::read-only`.
-        
-        If `flags` contains `write` or `mutate-directory`, or `open-flags`
-        contains `truncate` or `create`, and the base descriptor doesn't have
-        `descriptor-flags::mutate-directory` set, `open-at` fails with
-        `error-code::read-only`.
-        
-        Note: This is similar to `openat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def readlink_at(self, path: str) -> str:
-        """
-        Read the contents of a symbolic link.
-        
-        If the contents contain an absolute or rooted path in the underlying
-        filesystem, this function fails with `error-code::not-permitted`.
-        
-        Note: This is similar to `readlinkat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def remove_directory_at(self, path: str) -> None:
-        """
-        Remove a directory.
-        
-        Return `error-code::not-empty` if the directory is not empty.
-        
-        Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def rename_at(self, old_path: str, new_descriptor: Self, new_path: str) -> None:
-        """
-        Rename a filesystem object.
-        
-        Note: This is similar to `renameat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def symlink_at(self, old_path: str, new_path: str) -> None:
-        """
-        Create a symbolic link (also known as a "symlink").
-        
-        If `old-path` starts with `/`, the function fails with
-        `error-code::not-permitted`.
-        
-        Note: This is similar to `symlinkat` in POSIX.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def unlink_file_at(self, path: str) -> None:
-        """
-        Unlink a filesystem object that is not a directory.
-        
-        This is similar to `unlinkat(fd, path, 0)` in POSIX.
-        
-        Error returns are as specified by POSIX.
-        
-        If the filesystem object is a directory, `error-code::access` or
-        `error-code::is-directory` may be returned instead of the
-        POSIX-specified `error-code::not-permitted`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def is_same_object(self, other: Self) -> bool:
-        """
-        Test whether two descriptors refer to the same filesystem object.
-        
-        In POSIX, this corresponds to testing whether the two descriptors have the
-        same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers.
-        wasi-filesystem does not expose device and inode numbers, so this function
-        may be used instead.
-        """
-        raise NotImplementedError
-    async def metadata_hash(self) -> MetadataHashValue:
-        """
-        Return a hash of the metadata associated with a filesystem object referred
-        to by a descriptor.
-        
-        This returns a hash of the last-modification timestamp and file size, and
-        may also include the inode number, device number, birth timestamp, and
-        other metadata fields that may change when the file is modified or
-        replaced. It may also include a secret value chosen by the
-        implementation and not otherwise exposed.
-        
-        Implementations are encouraged to provide the following properties:
-        
-         - If the file is not modified or replaced, the computed hash value should
-           usually not change.
-         - If the object is modified or replaced, the computed hash value should
-           usually change.
-         - The inputs to the hash should not be easily computable from the
-           computed hash.
-        
-        However, none of these is required.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def metadata_hash_at(self, path_flags: PathFlags, path: str) -> MetadataHashValue:
-        """
-        Return a hash of the metadata associated with a filesystem object referred
-        to by a directory descriptor and a relative path.
-        
-        This performs the same hash computation as `metadata-hash`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A descriptor is a reference to a filesystem object, which may be a file, -directory, named pipe, special file, or other object on which filesystem -calls may be made.

-

Methods

-
-
-async def advise(self,
offset: int,
length: int,
advice: Advice) ‑> None
-
-
-
- -Expand source code - -
async def advise(self, offset: int, length: int, advice: Advice) -> None:
-    """
-    Provide file advisory information on a descriptor.
-    
-    This is similar to `posix_fadvise` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Provide file advisory information on a descriptor.

-

This is similar to posix_fadvise in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def append_via_stream(self, data: componentize_py_async_support.streams.ByteStreamReader) ‑> componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_Access | ErrorCode_Already | ErrorCode_BadDescriptor | ErrorCode_Busy | ErrorCode_Deadlock | ErrorCode_Quota | ErrorCode_Exist | ErrorCode_FileTooLarge | ErrorCode_IllegalByteSequence | ErrorCode_InProgress | ErrorCode_Interrupted | ErrorCode_Invalid | ErrorCode_Io | ErrorCode_IsDirectory | ErrorCode_Loop | ErrorCode_TooManyLinks | ErrorCode_MessageSize | ErrorCode_NameTooLong | ErrorCode_NoDevice | ErrorCode_NoEntry | ErrorCode_NoLock | ErrorCode_InsufficientMemory | ErrorCode_InsufficientSpace | ErrorCode_NotDirectory | ErrorCode_NotEmpty | ErrorCode_NotRecoverable | ErrorCode_Unsupported | ErrorCode_NoTty | ErrorCode_NoSuchDevice | ErrorCode_Overflow | ErrorCode_NotPermitted | ErrorCode_Pipe | ErrorCode_ReadOnly | ErrorCode_InvalidSeek | ErrorCode_TextFileBusy | ErrorCode_CrossDevice | ErrorCode_Other]] -
-
-
- -Expand source code - -
def append_via_stream(self, data: ByteStreamReader) -> FutureReader[Result[None, ErrorCode]]:
-    """
-    Return a stream for appending to a file, if available.
-    
-    May fail with an error-code describing why the file cannot be appended.
-    
-    This function returns once either full contents of the stream are
-    written or an error is encountered.
-    
-    Note: This is similar to `write` with `O_APPEND` in POSIX.
-    """
-    raise NotImplementedError
-
-

Return a stream for appending to a file, if available.

-

May fail with an error-code describing why the file cannot be appended.

-

This function returns once either full contents of the stream are -written or an error is encountered.

-

Note: This is similar to write with O_APPEND in POSIX.

-
-
-async def create_directory_at(self, path: str) ‑> None -
-
-
- -Expand source code - -
async def create_directory_at(self, path: str) -> None:
-    """
-    Create a directory.
-    
-    Note: This is similar to `mkdirat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a directory.

-

Note: This is similar to mkdirat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def get_flags(self) ‑> DescriptorFlags -
-
-
- -Expand source code - -
async def get_flags(self) -> DescriptorFlags:
-    """
-    Get flags associated with a descriptor.
-    
-    Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX.
-    
-    Note: This returns the value that was the `fs_flags` value returned
-    from `fdstat_get` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get flags associated with a descriptor.

-

Note: This returns similar flags to fcntl(fd, F_GETFL) in POSIX.

-

Note: This returns the value that was the fs_flags value returned -from fdstat_get in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def get_type(self) ‑> DescriptorType_BlockDevice | DescriptorType_CharacterDevice | DescriptorType_Directory | DescriptorType_Fifo | DescriptorType_SymbolicLink | DescriptorType_RegularFile | DescriptorType_Socket | DescriptorType_Other -
-
-
- -Expand source code - -
async def get_type(self) -> DescriptorType:
-    """
-    Get the dynamic type of a descriptor.
-    
-    Note: This returns the same value as the `type` field of the `fd-stat`
-    returned by `stat`, `stat-at` and similar.
-    
-    Note: This returns similar flags to the `st_mode & S_IFMT` value provided
-    by `fstat` in POSIX.
-    
-    Note: This returns the value that was the `fs_filetype` value returned
-    from `fdstat_get` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get the dynamic type of a descriptor.

-

Note: This returns the same value as the type field of the fd-stat -returned by stat, stat-at and similar.

-

Note: This returns similar flags to the st_mode & S_IFMT value provided -by fstat in POSIX.

-

Note: This returns the value that was the fs_filetype value returned -from fdstat_get in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def is_same_object(self, other: Self) ‑> bool -
-
-
- -Expand source code - -
async def is_same_object(self, other: Self) -> bool:
-    """
-    Test whether two descriptors refer to the same filesystem object.
-    
-    In POSIX, this corresponds to testing whether the two descriptors have the
-    same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers.
-    wasi-filesystem does not expose device and inode numbers, so this function
-    may be used instead.
-    """
-    raise NotImplementedError
-
-

Test whether two descriptors refer to the same filesystem object.

-

In POSIX, this corresponds to testing whether the two descriptors have the -same device (st_dev) and inode (st_ino or d_ino) numbers. -wasi-filesystem does not expose device and inode numbers, so this function -may be used instead.

-
- -
-
- -Expand source code - -
async def link_at(self, old_path_flags: PathFlags, old_path: str, new_descriptor: Self, new_path: str) -> None:
-    """
-    Create a hard link.
-    
-    Fails with `error-code::no-entry` if the old path does not exist,
-    with `error-code::exist` if the new path already exists, and
-    `error-code::not-permitted` if the old path is not a file.
-    
-    Note: This is similar to `linkat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a hard link.

-

Fails with error-code::no-entry if the old path does not exist, -with error-code::exist if the new path already exists, and -error-code::not-permitted if the old path is not a file.

-

Note: This is similar to linkat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def metadata_hash(self) ‑> MetadataHashValue -
-
-
- -Expand source code - -
async def metadata_hash(self) -> MetadataHashValue:
-    """
-    Return a hash of the metadata associated with a filesystem object referred
-    to by a descriptor.
-    
-    This returns a hash of the last-modification timestamp and file size, and
-    may also include the inode number, device number, birth timestamp, and
-    other metadata fields that may change when the file is modified or
-    replaced. It may also include a secret value chosen by the
-    implementation and not otherwise exposed.
-    
-    Implementations are encouraged to provide the following properties:
-    
-     - If the file is not modified or replaced, the computed hash value should
-       usually not change.
-     - If the object is modified or replaced, the computed hash value should
-       usually change.
-     - The inputs to the hash should not be easily computable from the
-       computed hash.
-    
-    However, none of these is required.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return a hash of the metadata associated with a filesystem object referred -to by a descriptor.

-

This returns a hash of the last-modification timestamp and file size, and -may also include the inode number, device number, birth timestamp, and -other metadata fields that may change when the file is modified or -replaced. It may also include a secret value chosen by the -implementation and not otherwise exposed.

-

Implementations are encouraged to provide the following properties:

-
    -
  • If the file is not modified or replaced, the computed hash value should -usually not change.
  • -
  • If the object is modified or replaced, the computed hash value should -usually change.
  • -
  • The inputs to the hash should not be easily computable from the -computed hash.
  • -
-

However, none of these is required.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def metadata_hash_at(self,
path_flags: PathFlags,
path: str) ‑> MetadataHashValue
-
-
-
- -Expand source code - -
async def metadata_hash_at(self, path_flags: PathFlags, path: str) -> MetadataHashValue:
-    """
-    Return a hash of the metadata associated with a filesystem object referred
-    to by a directory descriptor and a relative path.
-    
-    This performs the same hash computation as `metadata-hash`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return a hash of the metadata associated with a filesystem object referred -to by a directory descriptor and a relative path.

-

This performs the same hash computation as metadata-hash.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def open_at(self,
path_flags: PathFlags,
path: str,
open_flags: OpenFlags,
flags: DescriptorFlags) ‑> Self
-
-
-
- -Expand source code - -
async def open_at(self, path_flags: PathFlags, path: str, open_flags: OpenFlags, flags: DescriptorFlags) -> Self:
-    """
-    Open a file or directory.
-    
-    If `flags` contains `descriptor-flags::mutate-directory`, and the base
-    descriptor doesn't have `descriptor-flags::mutate-directory` set,
-    `open-at` fails with `error-code::read-only`.
-    
-    If `flags` contains `write` or `mutate-directory`, or `open-flags`
-    contains `truncate` or `create`, and the base descriptor doesn't have
-    `descriptor-flags::mutate-directory` set, `open-at` fails with
-    `error-code::read-only`.
-    
-    Note: This is similar to `openat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Open a file or directory.

-

If flags contains descriptor-flags::mutate-directory, and the base -descriptor doesn't have descriptor-flags::mutate-directory set, -open-at fails with error-code::read-only.

-

If flags contains write or mutate-directory, or open-flags -contains truncate or create, and the base descriptor doesn't have -descriptor-flags::mutate-directory set, open-at fails with -error-code::read-only.

-

Note: This is similar to openat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def read_directory(self) ‑> Tuple[componentize_py_async_support.streams.StreamReader[DirectoryEntry], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_Access | ErrorCode_Already | ErrorCode_BadDescriptor | ErrorCode_Busy | ErrorCode_Deadlock | ErrorCode_Quota | ErrorCode_Exist | ErrorCode_FileTooLarge | ErrorCode_IllegalByteSequence | ErrorCode_InProgress | ErrorCode_Interrupted | ErrorCode_Invalid | ErrorCode_Io | ErrorCode_IsDirectory | ErrorCode_Loop | ErrorCode_TooManyLinks | ErrorCode_MessageSize | ErrorCode_NameTooLong | ErrorCode_NoDevice | ErrorCode_NoEntry | ErrorCode_NoLock | ErrorCode_InsufficientMemory | ErrorCode_InsufficientSpace | ErrorCode_NotDirectory | ErrorCode_NotEmpty | ErrorCode_NotRecoverable | ErrorCode_Unsupported | ErrorCode_NoTty | ErrorCode_NoSuchDevice | ErrorCode_Overflow | ErrorCode_NotPermitted | ErrorCode_Pipe | ErrorCode_ReadOnly | ErrorCode_InvalidSeek | ErrorCode_TextFileBusy | ErrorCode_CrossDevice | ErrorCode_Other]]] -
-
-
- -Expand source code - -
def read_directory(self) -> Tuple[StreamReader[DirectoryEntry], FutureReader[Result[None, ErrorCode]]]:
-    """
-    Read directory entries from a directory.
-    
-    On filesystems where directories contain entries referring to themselves
-    and their parents, often named `.` and `..` respectively, these entries
-    are omitted.
-    
-    This always returns a new stream which starts at the beginning of the
-    directory. Multiple streams may be active on the same directory, and they
-    do not interfere with each other.
-    
-    This function returns a future, which will resolve to an error code if
-    reading full contents of the directory fails.
-    """
-    raise NotImplementedError
-
-

Read directory entries from a directory.

-

On filesystems where directories contain entries referring to themselves -and their parents, often named . and .. respectively, these entries -are omitted.

-

This always returns a new stream which starts at the beginning of the -directory. Multiple streams may be active on the same directory, and they -do not interfere with each other.

-

This function returns a future, which will resolve to an error code if -reading full contents of the directory fails.

-
-
-def read_via_stream(self, offset: int) ‑> Tuple[componentize_py_async_support.streams.ByteStreamReader, componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_Access | ErrorCode_Already | ErrorCode_BadDescriptor | ErrorCode_Busy | ErrorCode_Deadlock | ErrorCode_Quota | ErrorCode_Exist | ErrorCode_FileTooLarge | ErrorCode_IllegalByteSequence | ErrorCode_InProgress | ErrorCode_Interrupted | ErrorCode_Invalid | ErrorCode_Io | ErrorCode_IsDirectory | ErrorCode_Loop | ErrorCode_TooManyLinks | ErrorCode_MessageSize | ErrorCode_NameTooLong | ErrorCode_NoDevice | ErrorCode_NoEntry | ErrorCode_NoLock | ErrorCode_InsufficientMemory | ErrorCode_InsufficientSpace | ErrorCode_NotDirectory | ErrorCode_NotEmpty | ErrorCode_NotRecoverable | ErrorCode_Unsupported | ErrorCode_NoTty | ErrorCode_NoSuchDevice | ErrorCode_Overflow | ErrorCode_NotPermitted | ErrorCode_Pipe | ErrorCode_ReadOnly | ErrorCode_InvalidSeek | ErrorCode_TextFileBusy | ErrorCode_CrossDevice | ErrorCode_Other]]] -
-
-
- -Expand source code - -
def read_via_stream(self, offset: int) -> Tuple[ByteStreamReader, FutureReader[Result[None, ErrorCode]]]:
-    """
-    Return a stream for reading from a file.
-    
-    Multiple read, write, and append streams may be active on the same open
-    file and they do not interfere with each other.
-    
-    This function returns a `stream` which provides the data received from the
-    file, and a `future` providing additional error information in case an
-    error is encountered.
-    
-    If no error is encountered, `stream.read` on the `stream` will return
-    `read-status::closed` with no `error-context` and the future resolves to
-    the value `ok`. If an error is encountered, `stream.read` on the
-    `stream` returns `read-status::closed` with an `error-context` and the future
-    resolves to `err` with an `error-code`.
-    
-    Note: This is similar to `pread` in POSIX.
-    """
-    raise NotImplementedError
-
-

Return a stream for reading from a file.

-

Multiple read, write, and append streams may be active on the same open -file and they do not interfere with each other.

-

This function returns a stream which provides the data received from the -file, and a future providing additional error information in case an -error is encountered.

-

If no error is encountered, stream.read on the stream will return -read-status::closed with no error-context and the future resolves to -the value ok. If an error is encountered, stream.read on the -stream returns read-status::closed with an error-context and the future -resolves to err with an error-code.

-

Note: This is similar to pread in POSIX.

-
- -
-
- -Expand source code - -
async def readlink_at(self, path: str) -> str:
-    """
-    Read the contents of a symbolic link.
-    
-    If the contents contain an absolute or rooted path in the underlying
-    filesystem, this function fails with `error-code::not-permitted`.
-    
-    Note: This is similar to `readlinkat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Read the contents of a symbolic link.

-

If the contents contain an absolute or rooted path in the underlying -filesystem, this function fails with error-code::not-permitted.

-

Note: This is similar to readlinkat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def remove_directory_at(self, path: str) ‑> None -
-
-
- -Expand source code - -
async def remove_directory_at(self, path: str) -> None:
-    """
-    Remove a directory.
-    
-    Return `error-code::not-empty` if the directory is not empty.
-    
-    Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Remove a directory.

-

Return error-code::not-empty if the directory is not empty.

-

Note: This is similar to unlinkat(fd, path, AT_REMOVEDIR) in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def rename_at(self, old_path: str, new_descriptor: Self, new_path: str) ‑> None -
-
-
- -Expand source code - -
async def rename_at(self, old_path: str, new_descriptor: Self, new_path: str) -> None:
-    """
-    Rename a filesystem object.
-    
-    Note: This is similar to `renameat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Rename a filesystem object.

-

Note: This is similar to renameat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def set_size(self, size: int) ‑> None -
-
-
- -Expand source code - -
async def set_size(self, size: int) -> None:
-    """
-    Adjust the size of an open file. If this increases the file's size, the
-    extra bytes are filled with zeros.
-    
-    Note: This was called `fd_filestat_set_size` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Adjust the size of an open file. If this increases the file's size, the -extra bytes are filled with zeros.

-

Note: This was called fd_filestat_set_size in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def set_times(self,
data_access_timestamp: NewTimestamp_NoChange | NewTimestamp_Now | NewTimestamp_Timestamp,
data_modification_timestamp: NewTimestamp_NoChange | NewTimestamp_Now | NewTimestamp_Timestamp) ‑> None
-
-
-
- -Expand source code - -
async def set_times(self, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp) -> None:
-    """
-    Adjust the timestamps of an open file or directory.
-    
-    Note: This is similar to `futimens` in POSIX.
-    
-    Note: This was called `fd_filestat_set_times` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Adjust the timestamps of an open file or directory.

-

Note: This is similar to futimens in POSIX.

-

Note: This was called fd_filestat_set_times in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def set_times_at(self,
path_flags: PathFlags,
path: str,
data_access_timestamp: NewTimestamp_NoChange | NewTimestamp_Now | NewTimestamp_Timestamp,
data_modification_timestamp: NewTimestamp_NoChange | NewTimestamp_Now | NewTimestamp_Timestamp) ‑> None
-
-
-
- -Expand source code - -
async def set_times_at(self, path_flags: PathFlags, path: str, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp) -> None:
-    """
-    Adjust the timestamps of a file or directory.
-    
-    Note: This is similar to `utimensat` in POSIX.
-    
-    Note: This was called `path_filestat_set_times` in earlier versions of
-    WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Adjust the timestamps of a file or directory.

-

Note: This is similar to utimensat in POSIX.

-

Note: This was called path_filestat_set_times in earlier versions of -WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def stat(self) ‑> DescriptorStat -
-
-
- -Expand source code - -
async def stat(self) -> DescriptorStat:
-    """
-    Return the attributes of an open file or directory.
-    
-    Note: This is similar to `fstat` in POSIX, except that it does not return
-    device and inode information. For testing whether two descriptors refer to
-    the same underlying filesystem object, use `is-same-object`. To obtain
-    additional data that can be used do determine whether a file has been
-    modified, use `metadata-hash`.
-    
-    Note: This was called `fd_filestat_get` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return the attributes of an open file or directory.

-

Note: This is similar to fstat in POSIX, except that it does not return -device and inode information. For testing whether two descriptors refer to -the same underlying filesystem object, use is-same-object. To obtain -additional data that can be used do determine whether a file has been -modified, use metadata-hash.

-

Note: This was called fd_filestat_get in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def stat_at(self,
path_flags: PathFlags,
path: str) ‑> DescriptorStat
-
-
-
- -Expand source code - -
async def stat_at(self, path_flags: PathFlags, path: str) -> DescriptorStat:
-    """
-    Return the attributes of a file or directory.
-    
-    Note: This is similar to `fstatat` in POSIX, except that it does not
-    return device and inode information. See the `stat` description for a
-    discussion of alternatives.
-    
-    Note: This was called `path_filestat_get` in earlier versions of WASI.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Return the attributes of a file or directory.

-

Note: This is similar to fstatat in POSIX, except that it does not -return device and inode information. See the stat description for a -discussion of alternatives.

-

Note: This was called path_filestat_get in earlier versions of WASI.

-

Raises: componentize_py_types.Err(ErrorCode)

-
- -
-
- -Expand source code - -
async def symlink_at(self, old_path: str, new_path: str) -> None:
-    """
-    Create a symbolic link (also known as a "symlink").
-    
-    If `old-path` starts with `/`, the function fails with
-    `error-code::not-permitted`.
-    
-    Note: This is similar to `symlinkat` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a symbolic link (also known as a "symlink").

-

If old-path starts with /, the function fails with -error-code::not-permitted.

-

Note: This is similar to symlinkat in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def sync(self) ‑> None -
-
-
- -Expand source code - -
async def sync(self) -> None:
-    """
-    Synchronize the data and metadata of a file to disk.
-    
-    This function succeeds with no effect if the file descriptor is not
-    opened for writing.
-    
-    Note: This is similar to `fsync` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Synchronize the data and metadata of a file to disk.

-

This function succeeds with no effect if the file descriptor is not -opened for writing.

-

Note: This is similar to fsync in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def sync_data(self) ‑> None -
-
-
- -Expand source code - -
async def sync_data(self) -> None:
-    """
-    Synchronize the data of a file to disk.
-    
-    This function succeeds with no effect if the file descriptor is not
-    opened for writing.
-    
-    Note: This is similar to `fdatasync` in POSIX.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Synchronize the data of a file to disk.

-

This function succeeds with no effect if the file descriptor is not -opened for writing.

-

Note: This is similar to fdatasync in POSIX.

-

Raises: componentize_py_types.Err(ErrorCode)

-
- -
-
- -Expand source code - -
async def unlink_file_at(self, path: str) -> None:
-    """
-    Unlink a filesystem object that is not a directory.
-    
-    This is similar to `unlinkat(fd, path, 0)` in POSIX.
-    
-    Error returns are as specified by POSIX.
-    
-    If the filesystem object is a directory, `error-code::access` or
-    `error-code::is-directory` may be returned instead of the
-    POSIX-specified `error-code::not-permitted`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Unlink a filesystem object that is not a directory.

-

This is similar to unlinkat(fd, path, 0) in POSIX.

-

Error returns are as specified by POSIX.

-

If the filesystem object is a directory, error-code::access or -error-code::is-directory may be returned instead of the -POSIX-specified error-code::not-permitted.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def write_via_stream(self, data: componentize_py_async_support.streams.ByteStreamReader, offset: int) ‑> componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_Access | ErrorCode_Already | ErrorCode_BadDescriptor | ErrorCode_Busy | ErrorCode_Deadlock | ErrorCode_Quota | ErrorCode_Exist | ErrorCode_FileTooLarge | ErrorCode_IllegalByteSequence | ErrorCode_InProgress | ErrorCode_Interrupted | ErrorCode_Invalid | ErrorCode_Io | ErrorCode_IsDirectory | ErrorCode_Loop | ErrorCode_TooManyLinks | ErrorCode_MessageSize | ErrorCode_NameTooLong | ErrorCode_NoDevice | ErrorCode_NoEntry | ErrorCode_NoLock | ErrorCode_InsufficientMemory | ErrorCode_InsufficientSpace | ErrorCode_NotDirectory | ErrorCode_NotEmpty | ErrorCode_NotRecoverable | ErrorCode_Unsupported | ErrorCode_NoTty | ErrorCode_NoSuchDevice | ErrorCode_Overflow | ErrorCode_NotPermitted | ErrorCode_Pipe | ErrorCode_ReadOnly | ErrorCode_InvalidSeek | ErrorCode_TextFileBusy | ErrorCode_CrossDevice | ErrorCode_Other]] -
-
-
- -Expand source code - -
def write_via_stream(self, data: ByteStreamReader, offset: int) -> FutureReader[Result[None, ErrorCode]]:
-    """
-    Return a stream for writing to a file, if available.
-    
-    May fail with an error-code describing why the file cannot be written.
-    
-    It is valid to write past the end of a file; the file is extended to the
-    extent of the write, with bytes between the previous end and the start of
-    the write set to zero.
-    
-    This function returns once either full contents of the stream are
-    written or an error is encountered.
-    
-    Note: This is similar to `pwrite` in POSIX.
-    """
-    raise NotImplementedError
-
-

Return a stream for writing to a file, if available.

-

May fail with an error-code describing why the file cannot be written.

-

It is valid to write past the end of a file; the file is extended to the -extent of the write, with bytes between the previous end and the start of -the write set to zero.

-

This function returns once either full contents of the stream are -written or an error is encountered.

-

Note: This is similar to pwrite in POSIX.

-
-
-
-
-class DescriptorFlags -(*args, **kwds) -
-
-
- -Expand source code - -
class DescriptorFlags(Flag):
-    """
-    Descriptor flags.
-    
-    Note: This was called `fdflags` in earlier versions of WASI.
-    """
-    READ = auto()
-    WRITE = auto()
-    FILE_INTEGRITY_SYNC = auto()
-    DATA_INTEGRITY_SYNC = auto()
-    REQUESTED_WRITE_SYNC = auto()
-    MUTATE_DIRECTORY = auto()
-
-

Descriptor flags.

-

Note: This was called fdflags in earlier versions of WASI.

-

Ancestors

-
    -
  • enum.Flag
  • -
  • enum.Enum
  • -
-

Class variables

-
-
var DATA_INTEGRITY_SYNC
-
-
-
-
var FILE_INTEGRITY_SYNC
-
-
-
-
var MUTATE_DIRECTORY
-
-
-
-
var READ
-
-
-
-
var REQUESTED_WRITE_SYNC
-
-
-
-
var WRITE
-
-
-
-
-
-
-class DescriptorStat -(type: DescriptorType_BlockDevice | DescriptorType_CharacterDevice | DescriptorType_Directory | DescriptorType_Fifo | DescriptorType_SymbolicLink | DescriptorType_RegularFile | DescriptorType_Socket | DescriptorType_Other,
link_count: int,
size: int,
data_access_timestamp: Instant | None,
data_modification_timestamp: Instant | None,
status_change_timestamp: Instant | None)
-
-
-
- -Expand source code - -
@dataclass
-class DescriptorStat:
-    """
-    File attributes.
-    
-    Note: This was called `filestat` in earlier versions of WASI.
-    """
-    type: DescriptorType
-    link_count: int
-    size: int
-    data_access_timestamp: Optional[wasi_clocks_system_clock_0_3_0_rc_2026_03_15.Instant]
-    data_modification_timestamp: Optional[wasi_clocks_system_clock_0_3_0_rc_2026_03_15.Instant]
-    status_change_timestamp: Optional[wasi_clocks_system_clock_0_3_0_rc_2026_03_15.Instant]
-
-

File attributes.

-

Note: This was called filestat in earlier versions of WASI.

-

Instance variables

-
-
var data_access_timestampInstant | None
-
-
-
-
var data_modification_timestampInstant | None
-
-
-
- -
-
-
-
var size : int
-
-
-
-
var status_change_timestampInstant | None
-
-
-
-
var typeDescriptorType_BlockDevice | DescriptorType_CharacterDevice | DescriptorType_Directory | DescriptorType_Fifo | DescriptorType_SymbolicLink | DescriptorType_RegularFile | DescriptorType_Socket | DescriptorType_Other
-
-
-
-
-
-
-class DescriptorType_BlockDevice -
-
-
- -Expand source code - -
@dataclass
-class DescriptorType_BlockDevice:
-    pass
-
-

DescriptorType_BlockDevice()

-
-
-class DescriptorType_CharacterDevice -
-
-
- -Expand source code - -
@dataclass
-class DescriptorType_CharacterDevice:
-    pass
-
-

DescriptorType_CharacterDevice()

-
-
-class DescriptorType_Directory -
-
-
- -Expand source code - -
@dataclass
-class DescriptorType_Directory:
-    pass
-
-

DescriptorType_Directory()

-
-
-class DescriptorType_Fifo -
-
-
- -Expand source code - -
@dataclass
-class DescriptorType_Fifo:
-    pass
-
-

DescriptorType_Fifo()

-
-
-class DescriptorType_Other -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class DescriptorType_Other:
-    value: Optional[str]
-
-

DescriptorType_Other(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class DescriptorType_RegularFile -
-
-
- -Expand source code - -
@dataclass
-class DescriptorType_RegularFile:
-    pass
-
-

DescriptorType_RegularFile()

-
-
-class DescriptorType_Socket -
-
-
- -Expand source code - -
@dataclass
-class DescriptorType_Socket:
-    pass
-
-

DescriptorType_Socket()

-
- -
-
- -Expand source code - -
@dataclass
-class DescriptorType_SymbolicLink:
-    pass
-
-

DescriptorType_SymbolicLink()

-
-
-class DirectoryEntry -(type: DescriptorType_BlockDevice | DescriptorType_CharacterDevice | DescriptorType_Directory | DescriptorType_Fifo | DescriptorType_SymbolicLink | DescriptorType_RegularFile | DescriptorType_Socket | DescriptorType_Other,
name: str)
-
-
-
- -Expand source code - -
@dataclass
-class DirectoryEntry:
-    """
-    A directory entry.
-    """
-    type: DescriptorType
-    name: str
-
-

A directory entry.

-

Instance variables

-
-
var name : str
-
-
-
-
var typeDescriptorType_BlockDevice | DescriptorType_CharacterDevice | DescriptorType_Directory | DescriptorType_Fifo | DescriptorType_SymbolicLink | DescriptorType_RegularFile | DescriptorType_Socket | DescriptorType_Other
-
-
-
-
-
-
-class ErrorCode_Access -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Access:
-    pass
-
-

ErrorCode_Access()

-
-
-class ErrorCode_Already -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Already:
-    pass
-
-

ErrorCode_Already()

-
-
-class ErrorCode_BadDescriptor -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_BadDescriptor:
-    pass
-
-

ErrorCode_BadDescriptor()

-
-
-class ErrorCode_Busy -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Busy:
-    pass
-
-

ErrorCode_Busy()

-
-
-class ErrorCode_CrossDevice -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_CrossDevice:
-    pass
-
-

ErrorCode_CrossDevice()

-
-
-class ErrorCode_Deadlock -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Deadlock:
-    pass
-
-

ErrorCode_Deadlock()

-
-
-class ErrorCode_Exist -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Exist:
-    pass
-
-

ErrorCode_Exist()

-
-
-class ErrorCode_FileTooLarge -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_FileTooLarge:
-    pass
-
-

ErrorCode_FileTooLarge()

-
-
-class ErrorCode_IllegalByteSequence -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_IllegalByteSequence:
-    pass
-
-

ErrorCode_IllegalByteSequence()

-
-
-class ErrorCode_InProgress -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_InProgress:
-    pass
-
-

ErrorCode_InProgress()

-
-
-class ErrorCode_InsufficientMemory -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_InsufficientMemory:
-    pass
-
-

ErrorCode_InsufficientMemory()

-
-
-class ErrorCode_InsufficientSpace -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_InsufficientSpace:
-    pass
-
-

ErrorCode_InsufficientSpace()

-
-
-class ErrorCode_Interrupted -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Interrupted:
-    pass
-
-

ErrorCode_Interrupted()

-
-
-class ErrorCode_Invalid -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Invalid:
-    pass
-
-

ErrorCode_Invalid()

-
-
-class ErrorCode_InvalidSeek -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_InvalidSeek:
-    pass
-
-

ErrorCode_InvalidSeek()

-
-
-class ErrorCode_Io -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Io:
-    pass
-
-

ErrorCode_Io()

-
-
-class ErrorCode_IsDirectory -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_IsDirectory:
-    pass
-
-

ErrorCode_IsDirectory()

-
-
-class ErrorCode_Loop -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Loop:
-    pass
-
-

ErrorCode_Loop()

-
-
-class ErrorCode_MessageSize -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_MessageSize:
-    pass
-
-

ErrorCode_MessageSize()

-
-
-class ErrorCode_NameTooLong -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_NameTooLong:
-    pass
-
-

ErrorCode_NameTooLong()

-
-
-class ErrorCode_NoDevice -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_NoDevice:
-    pass
-
-

ErrorCode_NoDevice()

-
-
-class ErrorCode_NoEntry -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_NoEntry:
-    pass
-
-

ErrorCode_NoEntry()

-
-
-class ErrorCode_NoLock -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_NoLock:
-    pass
-
-

ErrorCode_NoLock()

-
-
-class ErrorCode_NoSuchDevice -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_NoSuchDevice:
-    pass
-
-

ErrorCode_NoSuchDevice()

-
-
-class ErrorCode_NoTty -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_NoTty:
-    pass
-
-

ErrorCode_NoTty()

-
-
-class ErrorCode_NotDirectory -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_NotDirectory:
-    pass
-
-

ErrorCode_NotDirectory()

-
-
-class ErrorCode_NotEmpty -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_NotEmpty:
-    pass
-
-

ErrorCode_NotEmpty()

-
-
-class ErrorCode_NotPermitted -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_NotPermitted:
-    pass
-
-

ErrorCode_NotPermitted()

-
-
-class ErrorCode_NotRecoverable -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_NotRecoverable:
-    pass
-
-

ErrorCode_NotRecoverable()

-
-
-class ErrorCode_Other -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Other:
-    value: Optional[str]
-
-

ErrorCode_Other(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_Overflow -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Overflow:
-    pass
-
-

ErrorCode_Overflow()

-
-
-class ErrorCode_Pipe -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Pipe:
-    pass
-
-

ErrorCode_Pipe()

-
-
-class ErrorCode_Quota -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Quota:
-    pass
-
-

ErrorCode_Quota()

-
-
-class ErrorCode_ReadOnly -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ReadOnly:
-    pass
-
-

ErrorCode_ReadOnly()

-
-
-class ErrorCode_TextFileBusy -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TextFileBusy:
-    pass
-
-

ErrorCode_TextFileBusy()

-
- -
-
- -Expand source code - -
@dataclass
-class ErrorCode_TooManyLinks:
-    pass
-
-

ErrorCode_TooManyLinks()

-
-
-class ErrorCode_Unsupported -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Unsupported:
-    pass
-
-

ErrorCode_Unsupported()

-
-
-class MetadataHashValue -(lower: int, upper: int) -
-
-
- -Expand source code - -
@dataclass
-class MetadataHashValue:
-    """
-    A 128-bit hash value, split into parts because wasm doesn't have a
-    128-bit integer type.
-    """
-    lower: int
-    upper: int
-
-

A 128-bit hash value, split into parts because wasm doesn't have a -128-bit integer type.

-

Instance variables

-
-
var lower : int
-
-
-
-
var upper : int
-
-
-
-
-
-
-class NewTimestamp_NoChange -
-
-
- -Expand source code - -
@dataclass
-class NewTimestamp_NoChange:
-    pass
-
-

NewTimestamp_NoChange()

-
-
-class NewTimestamp_Now -
-
-
- -Expand source code - -
@dataclass
-class NewTimestamp_Now:
-    pass
-
-

NewTimestamp_Now()

-
-
-class NewTimestamp_Timestamp -(value: Instant) -
-
-
- -Expand source code - -
@dataclass
-class NewTimestamp_Timestamp:
-    value: wasi_clocks_system_clock_0_3_0_rc_2026_03_15.Instant
-
-

NewTimestamp_Timestamp(value: spin_sdk.wit.imports.wasi_clocks_system_clock_0_3_0_rc_2026_03_15.Instant)

-

Instance variables

-
-
var valueInstant
-
-
-
-
-
-
-class OpenFlags -(*args, **kwds) -
-
-
- -Expand source code - -
class OpenFlags(Flag):
-    """
-    Open flags used by `open-at`.
-    """
-    CREATE = auto()
-    DIRECTORY = auto()
-    EXCLUSIVE = auto()
-    TRUNCATE = auto()
-
-

Open flags used by open-at.

-

Ancestors

-
    -
  • enum.Flag
  • -
  • enum.Enum
  • -
-

Class variables

-
-
var CREATE
-
-
-
-
var DIRECTORY
-
-
-
-
var EXCLUSIVE
-
-
-
-
var TRUNCATE
-
-
-
-
-
-
-class PathFlags -(*args, **kwds) -
-
-
- -Expand source code - -
class PathFlags(Flag):
-    """
-    Flags determining the method of how paths are resolved.
-    """
-    SYMLINK_FOLLOW = auto()
-
-

Flags determining the method of how paths are resolved.

-

Ancestors

-
    -
  • enum.Flag
  • -
  • enum.Enum
  • -
-

Class variables

-
- -
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_http_client_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_http_client_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 7ce788a..0000000 --- a/docs/v4/wit/imports/wasi_http_client_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_http_client_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_http_client_0_3_0_rc_2026_03_15

-
-
-

This interface defines an HTTP client for sending "outgoing" requests.

-

Most components are expected to import this interface to provide the -capability to send HTTP requests to arbitrary destinations on a network.

-

The type signature of client.send is the same as handler.handle. This -duplication is currently necessary because some Component Model tooling -(including WIT itself) is unable to represent a component importing two -instances of the same interface. A client.send import may be linked -directly to a handler.handle export to bypass the network.

-
-
-
-
-
-
-

Functions

-
-
-async def send(request: Request) ‑> Response -
-
-
- -Expand source code - -
async def send(request: wasi_http_types_0_3_0_rc_2026_03_15.Request) -> wasi_http_types_0_3_0_rc_2026_03_15.Response:
-    """
-    This function may be used to either send an outgoing request over the
-    network or to forward it to another component.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

This function may be used to either send an outgoing request over the -network or to forward it to another component.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_http_outgoing_handler_0_2_0.html b/docs/v4/wit/imports/wasi_http_outgoing_handler_0_2_0.html deleted file mode 100644 index 3a4c413..0000000 --- a/docs/v4/wit/imports/wasi_http_outgoing_handler_0_2_0.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_http_outgoing_handler_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_http_outgoing_handler_0_2_0

-
-
-

This interface defines a handler of outgoing HTTP Requests. It should be -imported by components which wish to make HTTP Requests.

-
-
-
-
-
-
-

Functions

-
-
-def handle(request: OutgoingRequest,
options: RequestOptions | None) ‑> FutureIncomingResponse
-
-
-
- -Expand source code - -
def handle(request: wasi_http_types_0_2_0.OutgoingRequest, options: Optional[wasi_http_types_0_2_0.RequestOptions]) -> wasi_http_types_0_2_0.FutureIncomingResponse:
-    """
-    This function is invoked with an outgoing HTTP Request, and it returns
-    a resource `future-incoming-response` which represents an HTTP Response
-    which may arrive in the future.
-    
-    The `options` argument accepts optional parameters for the HTTP
-    protocol's transport layer.
-    
-    This function may return an error if the `outgoing-request` is invalid
-    or not allowed to be made. Otherwise, protocol errors are reported
-    through the `future-incoming-response`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

This function is invoked with an outgoing HTTP Request, and it returns -a resource future-incoming-response which represents an HTTP Response -which may arrive in the future.

-

The options argument accepts optional parameters for the HTTP -protocol's transport layer.

-

This function may return an error if the outgoing-request is invalid -or not allowed to be made. Otherwise, protocol errors are reported -through the future-incoming-response.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_http_outgoing_handler_0_2_6.html b/docs/v4/wit/imports/wasi_http_outgoing_handler_0_2_6.html deleted file mode 100644 index 778b0d3..0000000 --- a/docs/v4/wit/imports/wasi_http_outgoing_handler_0_2_6.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_http_outgoing_handler_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_http_outgoing_handler_0_2_6

-
-
-

This interface defines a handler of outgoing HTTP Requests. It should be -imported by components which wish to make HTTP Requests.

-
-
-
-
-
-
-

Functions

-
-
-def handle(request: OutgoingRequest,
options: RequestOptions | None) ‑> FutureIncomingResponse
-
-
-
- -Expand source code - -
def handle(request: wasi_http_types_0_2_6.OutgoingRequest, options: Optional[wasi_http_types_0_2_6.RequestOptions]) -> wasi_http_types_0_2_6.FutureIncomingResponse:
-    """
-    This function is invoked with an outgoing HTTP Request, and it returns
-    a resource `future-incoming-response` which represents an HTTP Response
-    which may arrive in the future.
-    
-    The `options` argument accepts optional parameters for the HTTP
-    protocol's transport layer.
-    
-    This function may return an error if the `outgoing-request` is invalid
-    or not allowed to be made. Otherwise, protocol errors are reported
-    through the `future-incoming-response`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

This function is invoked with an outgoing HTTP Request, and it returns -a resource future-incoming-response which represents an HTTP Response -which may arrive in the future.

-

The options argument accepts optional parameters for the HTTP -protocol's transport layer.

-

This function may return an error if the outgoing-request is invalid -or not allowed to be made. Otherwise, protocol errors are reported -through the future-incoming-response.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_http_types_0_2_0.html b/docs/v4/wit/imports/wasi_http_types_0_2_0.html deleted file mode 100644 index 1163eb7..0000000 --- a/docs/v4/wit/imports/wasi_http_types_0_2_0.html +++ /dev/null @@ -1,3397 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_http_types_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_http_types_0_2_0

-
-
-

This interface defines all of the types and methods for implementing -HTTP Requests and Responses, both incoming and outgoing, as well as -their headers, trailers, and bodies.

-
-
-
-
-

Global variables

-
-
var ErrorCode
-
- -
-
var HeaderError
-
-

This type enumerates the different kinds of errors that may occur when -setting or appending to a fields resource.

-
-
var Method
-
-

This type corresponds to HTTP standard Methods.

-
-
var Scheme
-
-

This type corresponds to HTTP standard Related Schemes.

-
-
-
-
-

Functions

-
-
-def http_error_code(err: Error) ‑> ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError | None -
-
-
- -Expand source code - -
def http_error_code(err: wasi_io_error_0_2_0.Error) -> Optional[ErrorCode]:
-    """
-    Attempts to extract a http-related `error` from the wasi:io `error`
-    provided.
-    
-    Stream operations which return
-    `wasi:io/stream/stream-error::last-operation-failed` have a payload of
-    type `wasi:io/error/error` with more information about the operation
-    that failed. This payload can be passed through to this function to see
-    if there's http-related information about the error to return.
-    
-    Note that this function is fallible because not all io-errors are
-    http-related errors.
-    """
-    raise NotImplementedError
-
-

Attempts to extract a http-related error from the wasi:io error -provided.

-

Stream operations which return -wasi:io/stream/stream-error::last-operation-failed have a payload of -type wasi:io/error/error with more information about the operation -that failed. This payload can be passed through to this function to see -if there's http-related information about the error to return.

-

Note that this function is fallible because not all io-errors are -http-related errors.

-
-
-
-
-

Classes

-
-
-class DnsErrorPayload -(rcode: str | None, info_code: int | None) -
-
-
- -Expand source code - -
@dataclass
-class DnsErrorPayload:
-    """
-    Defines the case payload type for `DNS-error` above:
-    """
-    rcode: Optional[str]
-    info_code: Optional[int]
-
-

Defines the case payload type for DNS-error above:

-

Instance variables

-
-
var info_code : int | None
-
-
-
-
var rcode : str | None
-
-
-
-
-
-
-class ErrorCode_ConfigurationError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConfigurationError:
-    pass
-
-

ErrorCode_ConfigurationError()

-
-
-class ErrorCode_ConnectionLimitReached -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionLimitReached:
-    pass
-
-

ErrorCode_ConnectionLimitReached()

-
-
-class ErrorCode_ConnectionReadTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionReadTimeout:
-    pass
-
-

ErrorCode_ConnectionReadTimeout()

-
-
-class ErrorCode_ConnectionRefused -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionRefused:
-    pass
-
-

ErrorCode_ConnectionRefused()

-
-
-class ErrorCode_ConnectionTerminated -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionTerminated:
-    pass
-
-

ErrorCode_ConnectionTerminated()

-
-
-class ErrorCode_ConnectionTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionTimeout:
-    pass
-
-

ErrorCode_ConnectionTimeout()

-
-
-class ErrorCode_ConnectionWriteTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionWriteTimeout:
-    pass
-
-

ErrorCode_ConnectionWriteTimeout()

-
-
-class ErrorCode_DestinationIpProhibited -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationIpProhibited:
-    pass
-
-

ErrorCode_DestinationIpProhibited()

-
-
-class ErrorCode_DestinationIpUnroutable -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationIpUnroutable:
-    pass
-
-

ErrorCode_DestinationIpUnroutable()

-
-
-class ErrorCode_DestinationNotFound -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationNotFound:
-    pass
-
-

ErrorCode_DestinationNotFound()

-
-
-class ErrorCode_DestinationUnavailable -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationUnavailable:
-    pass
-
-

ErrorCode_DestinationUnavailable()

-
-
-class ErrorCode_DnsError -(value: DnsErrorPayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DnsError:
-    value: DnsErrorPayload
-
-

ErrorCode_DnsError(value: spin_sdk.wit.imports.wasi_http_types_0_2_0.DnsErrorPayload)

-

Instance variables

-
-
var valueDnsErrorPayload
-
-
-
-
-
-
-class ErrorCode_DnsTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DnsTimeout:
-    pass
-
-

ErrorCode_DnsTimeout()

-
-
-class ErrorCode_HttpProtocolError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpProtocolError:
-    pass
-
-

ErrorCode_HttpProtocolError()

-
-
-class ErrorCode_HttpRequestBodySize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestBodySize:
-    value: Optional[int]
-
-

ErrorCode_HttpRequestBodySize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestDenied -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestDenied:
-    pass
-
-

ErrorCode_HttpRequestDenied()

-
-
-class ErrorCode_HttpRequestHeaderSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestHeaderSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpRequestHeaderSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestHeaderSize -(value: FieldSizePayload | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestHeaderSize:
-    value: Optional[FieldSizePayload]
-
-

ErrorCode_HttpRequestHeaderSize(value: Optional[spin_sdk.wit.imports.wasi_http_types_0_2_0.FieldSizePayload])

-

Instance variables

-
-
var valueFieldSizePayload | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestLengthRequired -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestLengthRequired:
-    pass
-
-

ErrorCode_HttpRequestLengthRequired()

-
-
-class ErrorCode_HttpRequestMethodInvalid -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestMethodInvalid:
-    pass
-
-

ErrorCode_HttpRequestMethodInvalid()

-
-
-class ErrorCode_HttpRequestTrailerSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestTrailerSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpRequestTrailerSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestTrailerSize -(value: FieldSizePayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestTrailerSize:
-    value: FieldSizePayload
-
-

ErrorCode_HttpRequestTrailerSize(value: spin_sdk.wit.imports.wasi_http_types_0_2_0.FieldSizePayload)

-

Instance variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCode_HttpRequestUriInvalid -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestUriInvalid:
-    pass
-
-

ErrorCode_HttpRequestUriInvalid()

-
-
-class ErrorCode_HttpRequestUriTooLong -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestUriTooLong:
-    pass
-
-

ErrorCode_HttpRequestUriTooLong()

-
-
-class ErrorCode_HttpResponseBodySize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseBodySize:
-    value: Optional[int]
-
-

ErrorCode_HttpResponseBodySize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseContentCoding -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseContentCoding:
-    value: Optional[str]
-
-

ErrorCode_HttpResponseContentCoding(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseHeaderSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseHeaderSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpResponseHeaderSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseHeaderSize -(value: FieldSizePayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseHeaderSize:
-    value: FieldSizePayload
-
-

ErrorCode_HttpResponseHeaderSize(value: spin_sdk.wit.imports.wasi_http_types_0_2_0.FieldSizePayload)

-

Instance variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCode_HttpResponseIncomplete -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseIncomplete:
-    pass
-
-

ErrorCode_HttpResponseIncomplete()

-
-
-class ErrorCode_HttpResponseTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTimeout:
-    pass
-
-

ErrorCode_HttpResponseTimeout()

-
-
-class ErrorCode_HttpResponseTrailerSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTrailerSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpResponseTrailerSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseTrailerSize -(value: FieldSizePayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTrailerSize:
-    value: FieldSizePayload
-
-

ErrorCode_HttpResponseTrailerSize(value: spin_sdk.wit.imports.wasi_http_types_0_2_0.FieldSizePayload)

-

Instance variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCode_HttpResponseTransferCoding -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTransferCoding:
-    value: Optional[str]
-
-

ErrorCode_HttpResponseTransferCoding(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_HttpUpgradeFailed -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpUpgradeFailed:
-    pass
-
-

ErrorCode_HttpUpgradeFailed()

-
-
-class ErrorCode_InternalError -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_InternalError:
-    value: Optional[str]
-
-

ErrorCode_InternalError(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_LoopDetected -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_LoopDetected:
-    pass
-
-

ErrorCode_LoopDetected()

-
-
-class ErrorCode_TlsAlertReceived -(value: TlsAlertReceivedPayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TlsAlertReceived:
-    value: TlsAlertReceivedPayload
-
-

ErrorCode_TlsAlertReceived(value: spin_sdk.wit.imports.wasi_http_types_0_2_0.TlsAlertReceivedPayload)

-

Instance variables

-
-
var valueTlsAlertReceivedPayload
-
-
-
-
-
-
-class ErrorCode_TlsCertificateError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TlsCertificateError:
-    pass
-
-

ErrorCode_TlsCertificateError()

-
-
-class ErrorCode_TlsProtocolError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TlsProtocolError:
-    pass
-
-

ErrorCode_TlsProtocolError()

-
-
-class FieldSizePayload -(field_name: str | None, field_size: int | None) -
-
-
- -Expand source code - -
@dataclass
-class FieldSizePayload:
-    """
-    Defines the case payload type for `HTTP-response-{header,trailer}-size` above:
-    """
-    field_name: Optional[str]
-    field_size: Optional[int]
-
-

Defines the case payload type for HTTP-response-{header,trailer}-size above:

-

Instance variables

-
-
var field_name : str | None
-
-
-
-
var field_size : int | None
-
-
-
-
-
-
-class Fields -
-
-
- -Expand source code - -
class Fields:
-    """
-    This following block defines the `fields` resource which corresponds to
-    HTTP standard Fields. Fields are a common representation used for both
-    Headers and Trailers.
-    
-    A `fields` may be mutable or immutable. A `fields` created using the
-    constructor, `from-list`, or `clone` will be mutable, but a `fields`
-    resource given by other means (including, but not limited to,
-    `incoming-request.headers`, `outgoing-request.headers`) might be be
-    immutable. In an immutable fields, the `set`, `append`, and `delete`
-    operations will fail with `header-error.immutable`.
-    """
-    
-    def __init__(self) -> None:
-        """
-        Construct an empty HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def from_list(cls, entries: List[Tuple[str, bytes]]) -> Self:
-        """
-        Construct an HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        
-        The list represents each key-value pair in the Fields. Keys
-        which have multiple values are represented by multiple entries in this
-        list with the same key.
-        
-        The tuple is a pair of the field key, represented as a string, and
-        Value, represented as a list of bytes. In a valid Fields, all keys
-        and values are valid UTF-8 strings. However, values are not always
-        well-formed, so they are represented as a raw list of bytes.
-        
-        An error result will be returned if any header or value was
-        syntactically invalid, or if a header was forbidden.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_0.HeaderError)`
-        """
-        raise NotImplementedError
-    def get(self, name: str) -> List[bytes]:
-        """
-        Get all of the values corresponding to a key. If the key is not present
-        in this `fields`, an empty list is returned. However, if the key is
-        present but empty, this is represented by a list with one or more
-        empty field-values present.
-        """
-        raise NotImplementedError
-    def has(self, name: str) -> bool:
-        """
-        Returns `true` when the key is present in this `fields`. If the key is
-        syntactically invalid, `false` is returned.
-        """
-        raise NotImplementedError
-    def set(self, name: str, value: List[bytes]) -> None:
-        """
-        Set all of the values for a key. Clears any existing values for that
-        key, if they have been set.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_0.HeaderError)`
-        """
-        raise NotImplementedError
-    def delete(self, name: str) -> None:
-        """
-        Delete all values for a key. Does nothing if no values for the key
-        exist.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_0.HeaderError)`
-        """
-        raise NotImplementedError
-    def append(self, name: str, value: bytes) -> None:
-        """
-        Append a value for a key. Does not change or delete any existing
-        values for that key.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_0.HeaderError)`
-        """
-        raise NotImplementedError
-    def entries(self) -> List[Tuple[str, bytes]]:
-        """
-        Retrieve the full set of keys and values in the Fields. Like the
-        constructor, the list represents each key-value pair.
-        
-        The outer list represents each key-value pair in the Fields. Keys
-        which have multiple values are represented by multiple entries in this
-        list with the same key.
-        """
-        raise NotImplementedError
-    def clone(self) -> Self:
-        """
-        Make a deep copy of the Fields. Equivelant in behavior to calling the
-        `fields` constructor on the return value of `entries`. The resulting
-        `fields` is mutable.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

This following block defines the fields resource which corresponds to -HTTP standard Fields. Fields are a common representation used for both -Headers and Trailers.

-

A fields may be mutable or immutable. A fields created using the -constructor, from-list, or clone will be mutable, but a fields -resource given by other means (including, but not limited to, -incoming-request.headers, outgoing-request.headers) might be be -immutable. In an immutable fields, the set, append, and delete -operations will fail with header-error.immutable.

-

Construct an empty HTTP Fields.

-

The resulting fields is mutable.

-

Static methods

-
-
-def from_list(entries: List[Tuple[str, bytes]]) ‑> Self -
-
-

Construct an HTTP Fields.

-

The resulting fields is mutable.

-

The list represents each key-value pair in the Fields. Keys -which have multiple values are represented by multiple entries in this -list with the same key.

-

The tuple is a pair of the field key, represented as a string, and -Value, represented as a list of bytes. In a valid Fields, all keys -and values are valid UTF-8 strings. However, values are not always -well-formed, so they are represented as a raw list of bytes.

-

An error result will be returned if any header or value was -syntactically invalid, or if a header was forbidden.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-

Methods

-
-
-def append(self, name: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
def append(self, name: str, value: bytes) -> None:
-    """
-    Append a value for a key. Does not change or delete any existing
-    values for that key.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_0.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Append a value for a key. Does not change or delete any existing -values for that key.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-def clone(self) ‑> Self -
-
-
- -Expand source code - -
def clone(self) -> Self:
-    """
-    Make a deep copy of the Fields. Equivelant in behavior to calling the
-    `fields` constructor on the return value of `entries`. The resulting
-    `fields` is mutable.
-    """
-    raise NotImplementedError
-
-

Make a deep copy of the Fields. Equivelant in behavior to calling the -fields constructor on the return value of entries. The resulting -fields is mutable.

-
-
-def delete(self, name: str) ‑> None -
-
-
- -Expand source code - -
def delete(self, name: str) -> None:
-    """
-    Delete all values for a key. Does nothing if no values for the key
-    exist.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_0.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Delete all values for a key. Does nothing if no values for the key -exist.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-def entries(self) ‑> List[Tuple[str, bytes]] -
-
-
- -Expand source code - -
def entries(self) -> List[Tuple[str, bytes]]:
-    """
-    Retrieve the full set of keys and values in the Fields. Like the
-    constructor, the list represents each key-value pair.
-    
-    The outer list represents each key-value pair in the Fields. Keys
-    which have multiple values are represented by multiple entries in this
-    list with the same key.
-    """
-    raise NotImplementedError
-
-

Retrieve the full set of keys and values in the Fields. Like the -constructor, the list represents each key-value pair.

-

The outer list represents each key-value pair in the Fields. Keys -which have multiple values are represented by multiple entries in this -list with the same key.

-
-
-def get(self, name: str) ‑> List[bytes] -
-
-
- -Expand source code - -
def get(self, name: str) -> List[bytes]:
-    """
-    Get all of the values corresponding to a key. If the key is not present
-    in this `fields`, an empty list is returned. However, if the key is
-    present but empty, this is represented by a list with one or more
-    empty field-values present.
-    """
-    raise NotImplementedError
-
-

Get all of the values corresponding to a key. If the key is not present -in this fields, an empty list is returned. However, if the key is -present but empty, this is represented by a list with one or more -empty field-values present.

-
-
-def has(self, name: str) ‑> bool -
-
-
- -Expand source code - -
def has(self, name: str) -> bool:
-    """
-    Returns `true` when the key is present in this `fields`. If the key is
-    syntactically invalid, `false` is returned.
-    """
-    raise NotImplementedError
-
-

Returns true when the key is present in this fields. If the key is -syntactically invalid, false is returned.

-
-
-def set(self, name: str, value: List[bytes]) ‑> None -
-
-
- -Expand source code - -
def set(self, name: str, value: List[bytes]) -> None:
-    """
-    Set all of the values for a key. Clears any existing values for that
-    key, if they have been set.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_0.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Set all of the values for a key. Clears any existing values for that -key, if they have been set.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-
-
-class FutureIncomingResponse -
-
-
- -Expand source code - -
class FutureIncomingResponse:
-    """
-    Represents a future which may eventaully return an incoming HTTP
-    Response, or an error.
-    
-    This resource is returned by the `wasi:http/outgoing-handler` interface to
-    provide the HTTP Response corresponding to the sent Request.
-    """
-    
-    def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-        """
-        Returns a pollable which becomes ready when either the Response has
-        been received, or an error has occured. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-    def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
-        """
-        Returns the incoming HTTP Response, or an error, once one is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the response or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the incoming HTTP Response
-        status and headers have recieved successfully, or that an error
-        occured. Errors may also occur while consuming the response body,
-        but those will be reported by the `incoming-body` and its
-        `output-stream` child.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents a future which may eventaully return an incoming HTTP -Response, or an error.

-

This resource is returned by the wasi:http/outgoing-handler interface to -provide the HTTP Response corresponding to the sent Request.

-

Methods

-
-
-def get(self) ‑> componentize_py_types.Ok[componentize_py_types.Ok[IncomingResponse] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]] | componentize_py_types.Err[None] | None -
-
-
- -Expand source code - -
def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
-    """
-    Returns the incoming HTTP Response, or an error, once one is ready.
-    
-    The outer `option` represents future readiness. Users can wait on this
-    `option` to become `some` using the `subscribe` method.
-    
-    The outer `result` is used to retrieve the response or error at most
-    once. It will be success on the first call in which the outer option
-    is `some`, and error on subsequent calls.
-    
-    The inner `result` represents that either the incoming HTTP Response
-    status and headers have recieved successfully, or that an error
-    occured. Errors may also occur while consuming the response body,
-    but those will be reported by the `incoming-body` and its
-    `output-stream` child.
-    """
-    raise NotImplementedError
-
-

Returns the incoming HTTP Response, or an error, once one is ready.

-

The outer option represents future readiness. Users can wait on this -option to become some using the subscribe method.

-

The outer result is used to retrieve the response or error at most -once. It will be success on the first call in which the outer option -is some, and error on subsequent calls.

-

The inner result represents that either the incoming HTTP Response -status and headers have recieved successfully, or that an error -occured. Errors may also occur while consuming the response body, -but those will be reported by the incoming-body and its -output-stream child.

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-    """
-    Returns a pollable which becomes ready when either the Response has
-    been received, or an error has occured. When this pollable is ready,
-    the `get` method will return `some`.
-    """
-    raise NotImplementedError
-
-

Returns a pollable which becomes ready when either the Response has -been received, or an error has occured. When this pollable is ready, -the get method will return some.

-
-
-
-
-class FutureTrailers -
-
-
- -Expand source code - -
class FutureTrailers:
-    """
-    Represents a future which may eventaully return trailers, or an error.
-    
-    In the case that the incoming HTTP Request or Response did not have any
-    trailers, this future will resolve to the empty set of trailers once the
-    complete Request or Response body has been received.
-    """
-    
-    def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-        """
-        Returns a pollable which becomes ready when either the trailers have
-        been received, or an error has occured. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-    def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
-        """
-        Returns the contents of the trailers, or an error which occured,
-        once the future is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the trailers or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the HTTP Request or Response
-        body, as well as any trailers, were received successfully, or that an
-        error occured receiving them. The optional `trailers` indicates whether
-        or not trailers were present in the body.
-        
-        When some `trailers` are returned by this method, the `trailers`
-        resource is immutable, and a child. Use of the `set`, `append`, or
-        `delete` methods will return an error, and the resource must be
-        dropped before the parent `future-trailers` is dropped.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents a future which may eventaully return trailers, or an error.

-

In the case that the incoming HTTP Request or Response did not have any -trailers, this future will resolve to the empty set of trailers once the -complete Request or Response body has been received.

-

Methods

-
-
-def get(self) ‑> componentize_py_types.Ok[componentize_py_types.Ok[Fields | None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]] | componentize_py_types.Err[None] | None -
-
-
- -Expand source code - -
def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
-    """
-    Returns the contents of the trailers, or an error which occured,
-    once the future is ready.
-    
-    The outer `option` represents future readiness. Users can wait on this
-    `option` to become `some` using the `subscribe` method.
-    
-    The outer `result` is used to retrieve the trailers or error at most
-    once. It will be success on the first call in which the outer option
-    is `some`, and error on subsequent calls.
-    
-    The inner `result` represents that either the HTTP Request or Response
-    body, as well as any trailers, were received successfully, or that an
-    error occured receiving them. The optional `trailers` indicates whether
-    or not trailers were present in the body.
-    
-    When some `trailers` are returned by this method, the `trailers`
-    resource is immutable, and a child. Use of the `set`, `append`, or
-    `delete` methods will return an error, and the resource must be
-    dropped before the parent `future-trailers` is dropped.
-    """
-    raise NotImplementedError
-
-

Returns the contents of the trailers, or an error which occured, -once the future is ready.

-

The outer option represents future readiness. Users can wait on this -option to become some using the subscribe method.

-

The outer result is used to retrieve the trailers or error at most -once. It will be success on the first call in which the outer option -is some, and error on subsequent calls.

-

The inner result represents that either the HTTP Request or Response -body, as well as any trailers, were received successfully, or that an -error occured receiving them. The optional trailers indicates whether -or not trailers were present in the body.

-

When some trailers are returned by this method, the trailers -resource is immutable, and a child. Use of the set, append, or -delete methods will return an error, and the resource must be -dropped before the parent future-trailers is dropped.

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-    """
-    Returns a pollable which becomes ready when either the trailers have
-    been received, or an error has occured. When this pollable is ready,
-    the `get` method will return `some`.
-    """
-    raise NotImplementedError
-
-

Returns a pollable which becomes ready when either the trailers have -been received, or an error has occured. When this pollable is ready, -the get method will return some.

-
-
-
-
-class HeaderError_Forbidden -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_Forbidden:
-    pass
-
-

HeaderError_Forbidden()

-
-
-class HeaderError_Immutable -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_Immutable:
-    pass
-
-

HeaderError_Immutable()

-
-
-class HeaderError_InvalidSyntax -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_InvalidSyntax:
-    pass
-
-

HeaderError_InvalidSyntax()

-
-
-class IncomingBody -
-
-
- -Expand source code - -
class IncomingBody:
-    """
-    Represents an incoming HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, indicating that the full contents of the
-    body have been received. This resource represents the contents as
-    an `input-stream` and the delivery of trailers as a `future-trailers`,
-    and ensures that the user of this interface may only be consuming either
-    the body contents or waiting on trailers at any given time.
-    """
-    
-    def stream(self) -> wasi_io_streams_0_2_0.InputStream:
-        """
-        Returns the contents of the body, as a stream of bytes.
-        
-        Returns success on first call: the stream representing the contents
-        can be retrieved at most once. Subsequent calls will return error.
-        
-        The returned `input-stream` resource is a child: it must be dropped
-        before the parent `incoming-body` is dropped, or consumed by
-        `incoming-body.finish`.
-        
-        This invariant ensures that the implementation can determine whether
-        the user is consuming the contents of the body, waiting on the
-        `future-trailers` to be ready, or neither. This allows for network
-        backpressure is to be applied when the user is consuming the body,
-        and for that backpressure to not inhibit delivery of the trailers if
-        the user does not read the entire body.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    @classmethod
-    def finish(cls, this: Self) -> FutureTrailers:
-        """
-        Takes ownership of `incoming-body`, and returns a `future-trailers`.
-        This function will trap if the `input-stream` child is still alive.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an incoming HTTP Request or Response's Body.

-

A body has both its contents - a stream of bytes - and a (possibly -empty) set of trailers, indicating that the full contents of the -body have been received. This resource represents the contents as -an input-stream and the delivery of trailers as a future-trailers, -and ensures that the user of this interface may only be consuming either -the body contents or waiting on trailers at any given time.

-

Static methods

-
-
-def finish(this: Self) ‑> FutureTrailers -
-
-

Takes ownership of incoming-body, and returns a future-trailers. -This function will trap if the input-stream child is still alive.

-
-
-

Methods

-
-
-def stream(self) ‑> InputStream -
-
-
- -Expand source code - -
def stream(self) -> wasi_io_streams_0_2_0.InputStream:
-    """
-    Returns the contents of the body, as a stream of bytes.
-    
-    Returns success on first call: the stream representing the contents
-    can be retrieved at most once. Subsequent calls will return error.
-    
-    The returned `input-stream` resource is a child: it must be dropped
-    before the parent `incoming-body` is dropped, or consumed by
-    `incoming-body.finish`.
-    
-    This invariant ensures that the implementation can determine whether
-    the user is consuming the contents of the body, waiting on the
-    `future-trailers` to be ready, or neither. This allows for network
-    backpressure is to be applied when the user is consuming the body,
-    and for that backpressure to not inhibit delivery of the trailers if
-    the user does not read the entire body.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns the contents of the body, as a stream of bytes.

-

Returns success on first call: the stream representing the contents -can be retrieved at most once. Subsequent calls will return error.

-

The returned input-stream resource is a child: it must be dropped -before the parent incoming-body is dropped, or consumed by -incoming-body.finish.

-

This invariant ensures that the implementation can determine whether -the user is consuming the contents of the body, waiting on the -future-trailers to be ready, or neither. This allows for network -backpressure is to be applied when the user is consuming the body, -and for that backpressure to not inhibit delivery of the trailers if -the user does not read the entire body.

-

Raises: componentize_py_types.Err(None)

-
-
-
-
-class IncomingRequest -
-
-
- -Expand source code - -
class IncomingRequest:
-    """
-    Represents an incoming HTTP Request.
-    """
-    
-    def method(self) -> Method:
-        """
-        Returns the method of the incoming request.
-        """
-        raise NotImplementedError
-    def path_with_query(self) -> Optional[str]:
-        """
-        Returns the path with query parameters from the request, as a string.
-        """
-        raise NotImplementedError
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Returns the protocol scheme from the request.
-        """
-        raise NotImplementedError
-    def authority(self) -> Optional[str]:
-        """
-        Returns the authority from the request, if it was present.
-        """
-        raise NotImplementedError
-    def headers(self) -> Fields:
-        """
-        Get the `headers` associated with the request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        The `headers` returned are a child resource: it must be dropped before
-        the parent `incoming-request` is dropped. Dropping this
-        `incoming-request` before all children are dropped will trap.
-        """
-        raise NotImplementedError
-    def consume(self) -> IncomingBody:
-        """
-        Gives the `incoming-body` associated with this request. Will only
-        return success at most once, and subsequent calls will return error.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an incoming HTTP Request.

-

Methods

-
-
-def authority(self) ‑> str | None -
-
-
- -Expand source code - -
def authority(self) -> Optional[str]:
-    """
-    Returns the authority from the request, if it was present.
-    """
-    raise NotImplementedError
-
-

Returns the authority from the request, if it was present.

-
-
-def consume(self) ‑> IncomingBody -
-
-
- -Expand source code - -
def consume(self) -> IncomingBody:
-    """
-    Gives the `incoming-body` associated with this request. Will only
-    return success at most once, and subsequent calls will return error.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Gives the incoming-body associated with this request. Will only -return success at most once, and subsequent calls will return error.

-

Raises: componentize_py_types.Err(None)

-
-
-def headers(self) ‑> Fields -
-
-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the `headers` associated with the request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    The `headers` returned are a child resource: it must be dropped before
-    the parent `incoming-request` is dropped. Dropping this
-    `incoming-request` before all children are dropped will trap.
-    """
-    raise NotImplementedError
-
-

Get the headers associated with the request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

The headers returned are a child resource: it must be dropped before -the parent incoming-request is dropped. Dropping this -incoming-request before all children are dropped will trap.

-
-
-def method(self) ‑> Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other -
-
-
- -Expand source code - -
def method(self) -> Method:
-    """
-    Returns the method of the incoming request.
-    """
-    raise NotImplementedError
-
-

Returns the method of the incoming request.

-
-
-def path_with_query(self) ‑> str | None -
-
-
- -Expand source code - -
def path_with_query(self) -> Optional[str]:
-    """
-    Returns the path with query parameters from the request, as a string.
-    """
-    raise NotImplementedError
-
-

Returns the path with query parameters from the request, as a string.

-
-
-def scheme(self) ‑> Scheme_Http | Scheme_Https | Scheme_Other | None -
-
-
- -Expand source code - -
def scheme(self) -> Optional[Scheme]:
-    """
-    Returns the protocol scheme from the request.
-    """
-    raise NotImplementedError
-
-

Returns the protocol scheme from the request.

-
-
-
-
-class IncomingResponse -
-
-
- -Expand source code - -
class IncomingResponse:
-    """
-    Represents an incoming HTTP Response.
-    """
-    
-    def status(self) -> int:
-        """
-        Returns the status code from the incoming response.
-        """
-        raise NotImplementedError
-    def headers(self) -> Fields:
-        """
-        Returns the headers from the incoming response.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `incoming-response` is dropped.
-        """
-        raise NotImplementedError
-    def consume(self) -> IncomingBody:
-        """
-        Returns the incoming body. May be called at most once. Returns error
-        if called additional times.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an incoming HTTP Response.

-

Methods

-
-
-def consume(self) ‑> IncomingBody -
-
-
- -Expand source code - -
def consume(self) -> IncomingBody:
-    """
-    Returns the incoming body. May be called at most once. Returns error
-    if called additional times.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns the incoming body. May be called at most once. Returns error -if called additional times.

-

Raises: componentize_py_types.Err(None)

-
-
-def headers(self) ‑> Fields -
-
-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Returns the headers from the incoming response.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `incoming-response` is dropped.
-    """
-    raise NotImplementedError
-
-

Returns the headers from the incoming response.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -incoming-response is dropped.

-
-
-def status(self) ‑> int -
-
-
- -Expand source code - -
def status(self) -> int:
-    """
-    Returns the status code from the incoming response.
-    """
-    raise NotImplementedError
-
-

Returns the status code from the incoming response.

-
-
-
-
-class Method_Connect -
-
-
- -Expand source code - -
@dataclass
-class Method_Connect:
-    pass
-
-

Method_Connect()

-
-
-class Method_Delete -
-
-
- -Expand source code - -
@dataclass
-class Method_Delete:
-    pass
-
-

Method_Delete()

-
-
-class Method_Get -
-
-
- -Expand source code - -
@dataclass
-class Method_Get:
-    pass
-
-

Method_Get()

-
-
-class Method_Head -
-
-
- -Expand source code - -
@dataclass
-class Method_Head:
-    pass
-
-

Method_Head()

-
-
-class Method_Options -
-
-
- -Expand source code - -
@dataclass
-class Method_Options:
-    pass
-
-

Method_Options()

-
-
-class Method_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Method_Other:
-    value: str
-
-

Method_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Method_Patch -
-
-
- -Expand source code - -
@dataclass
-class Method_Patch:
-    pass
-
-

Method_Patch()

-
-
-class Method_Post -
-
-
- -Expand source code - -
@dataclass
-class Method_Post:
-    pass
-
-

Method_Post()

-
-
-class Method_Put -
-
-
- -Expand source code - -
@dataclass
-class Method_Put:
-    pass
-
-

Method_Put()

-
-
-class Method_Trace -
-
-
- -Expand source code - -
@dataclass
-class Method_Trace:
-    pass
-
-

Method_Trace()

-
-
-class OutgoingBody -
-
-
- -Expand source code - -
class OutgoingBody:
-    """
-    Represents an outgoing HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, inducating the full contents of the body
-    have been sent. This resource represents the contents as an
-    `output-stream` child resource, and the completion of the body (with
-    optional trailers) with a static function that consumes the
-    `outgoing-body` resource, and ensures that the user of this interface
-    may not write to the body contents after the body has been finished.
-    
-    If the user code drops this resource, as opposed to calling the static
-    method `finish`, the implementation should treat the body as incomplete,
-    and that an error has occured. The implementation should propogate this
-    error to the HTTP protocol by whatever means it has available,
-    including: corrupting the body on the wire, aborting the associated
-    Request, or sending a late status code for the Response.
-    """
-    
-    def write(self) -> wasi_io_streams_0_2_0.OutputStream:
-        """
-        Returns a stream for writing the body contents.
-        
-        The returned `output-stream` is a child resource: it must be dropped
-        before the parent `outgoing-body` resource is dropped (or finished),
-        otherwise the `outgoing-body` drop or `finish` will trap.
-        
-        Returns success on the first call: the `output-stream` resource for
-        this `outgoing-body` may be retrieved at most once. Subsequent calls
-        will return error.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    @classmethod
-    def finish(cls, this: Self, trailers: Optional[Fields]) -> None:
-        """
-        Finalize an outgoing body, optionally providing trailers. This must be
-        called to signal that the response is complete. If the `outgoing-body`
-        is dropped without calling `outgoing-body.finalize`, the implementation
-        should treat the body as corrupted.
-        
-        Fails if the body's `outgoing-request` or `outgoing-response` was
-        constructed with a Content-Length header, and the contents written
-        to the body (via `write`) does not match the value given in the
-        Content-Length.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an outgoing HTTP Request or Response's Body.

-

A body has both its contents - a stream of bytes - and a (possibly -empty) set of trailers, inducating the full contents of the body -have been sent. This resource represents the contents as an -output-stream child resource, and the completion of the body (with -optional trailers) with a static function that consumes the -outgoing-body resource, and ensures that the user of this interface -may not write to the body contents after the body has been finished.

-

If the user code drops this resource, as opposed to calling the static -method finish, the implementation should treat the body as incomplete, -and that an error has occured. The implementation should propogate this -error to the HTTP protocol by whatever means it has available, -including: corrupting the body on the wire, aborting the associated -Request, or sending a late status code for the Response.

-

Static methods

-
-
-def finish(this: Self,
trailers: Fields | None) ‑> None
-
-
-

Finalize an outgoing body, optionally providing trailers. This must be -called to signal that the response is complete. If the outgoing-body -is dropped without calling outgoing-body.finalize, the implementation -should treat the body as corrupted.

-

Fails if the body's outgoing-request or outgoing-response was -constructed with a Content-Length header, and the contents written -to the body (via write) does not match the value given in the -Content-Length.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-

Methods

-
-
-def write(self) ‑> OutputStream -
-
-
- -Expand source code - -
def write(self) -> wasi_io_streams_0_2_0.OutputStream:
-    """
-    Returns a stream for writing the body contents.
-    
-    The returned `output-stream` is a child resource: it must be dropped
-    before the parent `outgoing-body` resource is dropped (or finished),
-    otherwise the `outgoing-body` drop or `finish` will trap.
-    
-    Returns success on the first call: the `output-stream` resource for
-    this `outgoing-body` may be retrieved at most once. Subsequent calls
-    will return error.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns a stream for writing the body contents.

-

The returned output-stream is a child resource: it must be dropped -before the parent outgoing-body resource is dropped (or finished), -otherwise the outgoing-body drop or finish will trap.

-

Returns success on the first call: the output-stream resource for -this outgoing-body may be retrieved at most once. Subsequent calls -will return error.

-

Raises: componentize_py_types.Err(None)

-
-
-
-
-class OutgoingRequest -(headers: Fields) -
-
-
- -Expand source code - -
class OutgoingRequest:
-    """
-    Represents an outgoing HTTP Request.
-    """
-    
-    def __init__(self, headers: Fields) -> None:
-        """
-        Construct a new `outgoing-request` with a default `method` of `GET`, and
-        `none` values for `path-with-query`, `scheme`, and `authority`.
-        
-        * `headers` is the HTTP Headers for the Request.
-        
-        It is possible to construct, or manipulate with the accessor functions
-        below, an `outgoing-request` with an invalid combination of `scheme`
-        and `authority`, or `headers` which are not permitted to be sent.
-        It is the obligation of the `outgoing-handler.handle` implementation
-        to reject invalid constructions of `outgoing-request`.
-        """
-        raise NotImplementedError
-
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this
-        Request.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-request` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def method(self) -> Method:
-        """
-        Get the Method for the Request.
-        """
-        raise NotImplementedError
-    def set_method(self, method: Method) -> None:
-        """
-        Set the Method for the Request. Fails if the string present in a
-        `method.other` argument is not a syntactically valid method.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def path_with_query(self) -> Optional[str]:
-        """
-        Get the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query.
-        """
-        raise NotImplementedError
-    def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-        """
-        Set the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query. Fails is the
-        string given is not a syntactically valid path and query uri component.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Get the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme.
-        """
-        raise NotImplementedError
-    def set_scheme(self, scheme: Optional[Scheme]) -> None:
-        """
-        Set the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme. Fails if the
-        string given is not a syntactically valid uri scheme.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def authority(self) -> Optional[str]:
-        """
-        Get the HTTP Authority for the Request. A value of `none` may be used
-        with Related Schemes which do not require an Authority. The HTTP and
-        HTTPS schemes always require an authority.
-        """
-        raise NotImplementedError
-    def set_authority(self, authority: Optional[str]) -> None:
-        """
-        Set the HTTP Authority for the Request. A value of `none` may be used
-        with Related Schemes which do not require an Authority. The HTTP and
-        HTTPS schemes always require an authority. Fails if the string given is
-        not a syntactically valid uri authority.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transfered to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an outgoing HTTP Request.

-

Construct a new outgoing-request with a default method of GET, and -none values for path-with-query, scheme, and authority.

-
    -
  • headers is the HTTP Headers for the Request.
  • -
-

It is possible to construct, or manipulate with the accessor functions -below, an outgoing-request with an invalid combination of scheme -and authority, or headers which are not permitted to be sent. -It is the obligation of the outgoing-handler.handle implementation -to reject invalid constructions of outgoing-request.

-

Methods

-
-
-def authority(self) ‑> str | None -
-
-
- -Expand source code - -
def authority(self) -> Optional[str]:
-    """
-    Get the HTTP Authority for the Request. A value of `none` may be used
-    with Related Schemes which do not require an Authority. The HTTP and
-    HTTPS schemes always require an authority.
-    """
-    raise NotImplementedError
-
-

Get the HTTP Authority for the Request. A value of none may be used -with Related Schemes which do not require an Authority. The HTTP and -HTTPS schemes always require an authority.

-
-
-def body(self) ‑> OutgoingBody -
-
-
- -Expand source code - -
def body(self) -> OutgoingBody:
-    """
-    Returns the resource corresponding to the outgoing Body for this
-    Request.
-    
-    Returns success on the first call: the `outgoing-body` resource for
-    this `outgoing-request` can be retrieved at most once. Subsequent
-    calls will return error.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns the resource corresponding to the outgoing Body for this -Request.

-

Returns success on the first call: the outgoing-body resource for -this outgoing-request can be retrieved at most once. Subsequent -calls will return error.

-

Raises: componentize_py_types.Err(None)

-
-
-def headers(self) ‑> Fields -
-
-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the headers associated with the Request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `outgoing-request` is dropped, or its ownership is transfered to
-    another component by e.g. `outgoing-handler.handle`.
-    """
-    raise NotImplementedError
-
-

Get the headers associated with the Request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -outgoing-request is dropped, or its ownership is transfered to -another component by e.g. outgoing-handler.handle.

-
-
-def method(self) ‑> Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other -
-
-
- -Expand source code - -
def method(self) -> Method:
-    """
-    Get the Method for the Request.
-    """
-    raise NotImplementedError
-
-

Get the Method for the Request.

-
-
-def path_with_query(self) ‑> str | None -
-
-
- -Expand source code - -
def path_with_query(self) -> Optional[str]:
-    """
-    Get the combination of the HTTP Path and Query for the Request.
-    When `none`, this represents an empty Path and empty Query.
-    """
-    raise NotImplementedError
-
-

Get the combination of the HTTP Path and Query for the Request. -When none, this represents an empty Path and empty Query.

-
-
-def scheme(self) ‑> Scheme_Http | Scheme_Https | Scheme_Other | None -
-
-
- -Expand source code - -
def scheme(self) -> Optional[Scheme]:
-    """
-    Get the HTTP Related Scheme for the Request. When `none`, the
-    implementation may choose an appropriate default scheme.
-    """
-    raise NotImplementedError
-
-

Get the HTTP Related Scheme for the Request. When none, the -implementation may choose an appropriate default scheme.

-
-
-def set_authority(self, authority: str | None) ‑> None -
-
-
- -Expand source code - -
def set_authority(self, authority: Optional[str]) -> None:
-    """
-    Set the HTTP Authority for the Request. A value of `none` may be used
-    with Related Schemes which do not require an Authority. The HTTP and
-    HTTPS schemes always require an authority. Fails if the string given is
-    not a syntactically valid uri authority.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the HTTP Authority for the Request. A value of none may be used -with Related Schemes which do not require an Authority. The HTTP and -HTTPS schemes always require an authority. Fails if the string given is -not a syntactically valid uri authority.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_method(self,
method: Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other) ‑> None
-
-
-
- -Expand source code - -
def set_method(self, method: Method) -> None:
-    """
-    Set the Method for the Request. Fails if the string present in a
-    `method.other` argument is not a syntactically valid method.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the Method for the Request. Fails if the string present in a -method.other argument is not a syntactically valid method.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_path_with_query(self, path_with_query: str | None) ‑> None -
-
-
- -Expand source code - -
def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-    """
-    Set the combination of the HTTP Path and Query for the Request.
-    When `none`, this represents an empty Path and empty Query. Fails is the
-    string given is not a syntactically valid path and query uri component.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the combination of the HTTP Path and Query for the Request. -When none, this represents an empty Path and empty Query. Fails is the -string given is not a syntactically valid path and query uri component.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_scheme(self,
scheme: Scheme_Http | Scheme_Https | Scheme_Other | None) ‑> None
-
-
-
- -Expand source code - -
def set_scheme(self, scheme: Optional[Scheme]) -> None:
-    """
-    Set the HTTP Related Scheme for the Request. When `none`, the
-    implementation may choose an appropriate default scheme. Fails if the
-    string given is not a syntactically valid uri scheme.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the HTTP Related Scheme for the Request. When none, the -implementation may choose an appropriate default scheme. Fails if the -string given is not a syntactically valid uri scheme.

-

Raises: componentize_py_types.Err(None)

-
-
-
-
-class OutgoingResponse -(headers: Fields) -
-
-
- -Expand source code - -
class OutgoingResponse:
-    """
-    Represents an outgoing HTTP Response.
-    """
-    
-    def __init__(self, headers: Fields) -> None:
-        """
-        Construct an `outgoing-response`, with a default `status-code` of `200`.
-        If a different `status-code` is needed, it must be set via the
-        `set-status-code` method.
-        
-        * `headers` is the HTTP Headers for the Response.
-        """
-        raise NotImplementedError
-
-    def status_code(self) -> int:
-        """
-        Get the HTTP Status Code for the Response.
-        """
-        raise NotImplementedError
-    def set_status_code(self, status_code: int) -> None:
-        """
-        Set the HTTP Status Code for the Response. Fails if the status-code
-        given is not a valid http status code.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transfered to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this Response.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-response` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an outgoing HTTP Response.

-

Construct an outgoing-response, with a default status-code of 200. -If a different status-code is needed, it must be set via the -set-status-code method.

-
    -
  • headers is the HTTP Headers for the Response.
  • -
-

Methods

-
-
-def body(self) ‑> OutgoingBody -
-
-
- -Expand source code - -
def body(self) -> OutgoingBody:
-    """
-    Returns the resource corresponding to the outgoing Body for this Response.
-    
-    Returns success on the first call: the `outgoing-body` resource for
-    this `outgoing-response` can be retrieved at most once. Subsequent
-    calls will return error.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns the resource corresponding to the outgoing Body for this Response.

-

Returns success on the first call: the outgoing-body resource for -this outgoing-response can be retrieved at most once. Subsequent -calls will return error.

-

Raises: componentize_py_types.Err(None)

-
-
-def headers(self) ‑> Fields -
-
-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the headers associated with the Request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `outgoing-request` is dropped, or its ownership is transfered to
-    another component by e.g. `outgoing-handler.handle`.
-    """
-    raise NotImplementedError
-
-

Get the headers associated with the Request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -outgoing-request is dropped, or its ownership is transfered to -another component by e.g. outgoing-handler.handle.

-
-
-def set_status_code(self, status_code: int) ‑> None -
-
-
- -Expand source code - -
def set_status_code(self, status_code: int) -> None:
-    """
-    Set the HTTP Status Code for the Response. Fails if the status-code
-    given is not a valid http status code.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the HTTP Status Code for the Response. Fails if the status-code -given is not a valid http status code.

-

Raises: componentize_py_types.Err(None)

-
-
-def status_code(self) ‑> int -
-
-
- -Expand source code - -
def status_code(self) -> int:
-    """
-    Get the HTTP Status Code for the Response.
-    """
-    raise NotImplementedError
-
-

Get the HTTP Status Code for the Response.

-
-
-
-
-class RequestOptions -
-
-
- -Expand source code - -
class RequestOptions:
-    """
-    Parameters for making an HTTP Request. Each of these parameters is
-    currently an optional timeout applicable to the transport layer of the
-    HTTP protocol.
-    
-    These timeouts are separate from any the user may use to bound a
-    blocking call to `wasi:io/poll.poll`.
-    """
-    
-    def __init__(self) -> None:
-        """
-        Construct a default `request-options` value.
-        """
-        raise NotImplementedError
-
-    def connect_timeout(self) -> Optional[int]:
-        """
-        The timeout for the initial connect to the HTTP Server.
-        """
-        raise NotImplementedError
-    def set_connect_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for the initial connect to the HTTP Server. An error
-        return value indicates that this timeout is not supported.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def first_byte_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving the first byte of the Response body.
-        """
-        raise NotImplementedError
-    def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving the first byte of the Response body. An
-        error return value indicates that this timeout is not supported.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def between_bytes_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving subsequent chunks of bytes in the Response
-        body stream.
-        """
-        raise NotImplementedError
-    def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving subsequent chunks of bytes in the Response
-        body stream. An error return value indicates that this timeout is not
-        supported.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Parameters for making an HTTP Request. Each of these parameters is -currently an optional timeout applicable to the transport layer of the -HTTP protocol.

-

These timeouts are separate from any the user may use to bound a -blocking call to wasi:io/poll.poll.

-

Construct a default request-options value.

-

Methods

-
-
-def between_bytes_timeout(self) ‑> int | None -
-
-
- -Expand source code - -
def between_bytes_timeout(self) -> Optional[int]:
-    """
-    The timeout for receiving subsequent chunks of bytes in the Response
-    body stream.
-    """
-    raise NotImplementedError
-
-

The timeout for receiving subsequent chunks of bytes in the Response -body stream.

-
-
-def connect_timeout(self) ‑> int | None -
-
-
- -Expand source code - -
def connect_timeout(self) -> Optional[int]:
-    """
-    The timeout for the initial connect to the HTTP Server.
-    """
-    raise NotImplementedError
-
-

The timeout for the initial connect to the HTTP Server.

-
-
-def first_byte_timeout(self) ‑> int | None -
-
-
- -Expand source code - -
def first_byte_timeout(self) -> Optional[int]:
-    """
-    The timeout for receiving the first byte of the Response body.
-    """
-    raise NotImplementedError
-
-

The timeout for receiving the first byte of the Response body.

-
-
-def set_between_bytes_timeout(self, duration: int | None) ‑> None -
-
-
- -Expand source code - -
def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for receiving subsequent chunks of bytes in the Response
-    body stream. An error return value indicates that this timeout is not
-    supported.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the timeout for receiving subsequent chunks of bytes in the Response -body stream. An error return value indicates that this timeout is not -supported.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_connect_timeout(self, duration: int | None) ‑> None -
-
-
- -Expand source code - -
def set_connect_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for the initial connect to the HTTP Server. An error
-    return value indicates that this timeout is not supported.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the timeout for the initial connect to the HTTP Server. An error -return value indicates that this timeout is not supported.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_first_byte_timeout(self, duration: int | None) ‑> None -
-
-
- -Expand source code - -
def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for receiving the first byte of the Response body. An
-    error return value indicates that this timeout is not supported.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the timeout for receiving the first byte of the Response body. An -error return value indicates that this timeout is not supported.

-

Raises: componentize_py_types.Err(None)

-
-
-
-
-class ResponseOutparam -
-
-
- -Expand source code - -
class ResponseOutparam:
-    """
-    Represents the ability to send an HTTP Response.
-    
-    This resource is used by the `wasi:http/incoming-handler` interface to
-    allow a Response to be sent corresponding to the Request provided as the
-    other argument to `incoming-handler.handle`.
-    """
-    
-    @classmethod
-    def set(cls, param: Self, response: Result[OutgoingResponse, ErrorCode]) -> None:
-        """
-        Set the value of the `response-outparam` to either send a response,
-        or indicate an error.
-        
-        This method consumes the `response-outparam` to ensure that it is
-        called at most once. If it is never called, the implementation
-        will respond with an error.
-        
-        The user may provide an `error` to `response` to allow the
-        implementation determine how to respond with an HTTP error response.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents the ability to send an HTTP Response.

-

This resource is used by the wasi:http/incoming-handler interface to -allow a Response to be sent corresponding to the Request provided as the -other argument to incoming-handler.handle.

-

Static methods

-
-
-def set(param: Self,
response: componentize_py_types.Ok[OutgoingResponse] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]) ‑> None
-
-
-

Set the value of the response-outparam to either send a response, -or indicate an error.

-

This method consumes the response-outparam to ensure that it is -called at most once. If it is never called, the implementation -will respond with an error.

-

The user may provide an error to response to allow the -implementation determine how to respond with an HTTP error response.

-
-
-
-
-class Scheme_Http -
-
-
- -Expand source code - -
@dataclass
-class Scheme_Http:
-    pass
-
-

Scheme_Http()

-
-
-class Scheme_Https -
-
-
- -Expand source code - -
@dataclass
-class Scheme_Https:
-    pass
-
-

Scheme_Https()

-
-
-class Scheme_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Scheme_Other:
-    value: str
-
-

Scheme_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class TlsAlertReceivedPayload -(alert_id: int | None, alert_message: str | None) -
-
-
- -Expand source code - -
@dataclass
-class TlsAlertReceivedPayload:
-    """
-    Defines the case payload type for `TLS-alert-received` above:
-    """
-    alert_id: Optional[int]
-    alert_message: Optional[str]
-
-

Defines the case payload type for TLS-alert-received above:

-

Instance variables

-
-
var alert_id : int | None
-
-
-
-
var alert_message : str | None
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_http_types_0_2_6.html b/docs/v4/wit/imports/wasi_http_types_0_2_6.html deleted file mode 100644 index 0438bed..0000000 --- a/docs/v4/wit/imports/wasi_http_types_0_2_6.html +++ /dev/null @@ -1,3425 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_http_types_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_http_types_0_2_6

-
-
-

This interface defines all of the types and methods for implementing -HTTP Requests and Responses, both incoming and outgoing, as well as -their headers, trailers, and bodies.

-
-
-
-
-

Global variables

-
-
var ErrorCode
-
- -
-
var HeaderError
-
-

This type enumerates the different kinds of errors that may occur when -setting or appending to a fields resource.

-
-
var Method
-
-

This type corresponds to HTTP standard Methods.

-
-
var Scheme
-
-

This type corresponds to HTTP standard Related Schemes.

-
-
-
-
-

Functions

-
-
-def http_error_code(err: Error) ‑> ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError | None -
-
-
- -Expand source code - -
def http_error_code(err: wasi_io_error_0_2_6.Error) -> Optional[ErrorCode]:
-    """
-    Attempts to extract a http-related `error` from the wasi:io `error`
-    provided.
-    
-    Stream operations which return
-    `wasi:io/stream/stream-error::last-operation-failed` have a payload of
-    type `wasi:io/error/error` with more information about the operation
-    that failed. This payload can be passed through to this function to see
-    if there's http-related information about the error to return.
-    
-    Note that this function is fallible because not all io-errors are
-    http-related errors.
-    """
-    raise NotImplementedError
-
-

Attempts to extract a http-related error from the wasi:io error -provided.

-

Stream operations which return -wasi:io/stream/stream-error::last-operation-failed have a payload of -type wasi:io/error/error with more information about the operation -that failed. This payload can be passed through to this function to see -if there's http-related information about the error to return.

-

Note that this function is fallible because not all io-errors are -http-related errors.

-
-
-
-
-

Classes

-
-
-class DnsErrorPayload -(rcode: str | None, info_code: int | None) -
-
-
- -Expand source code - -
@dataclass
-class DnsErrorPayload:
-    """
-    Defines the case payload type for `DNS-error` above:
-    """
-    rcode: Optional[str]
-    info_code: Optional[int]
-
-

Defines the case payload type for DNS-error above:

-

Instance variables

-
-
var info_code : int | None
-
-
-
-
var rcode : str | None
-
-
-
-
-
-
-class ErrorCode_ConfigurationError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConfigurationError:
-    pass
-
-

ErrorCode_ConfigurationError()

-
-
-class ErrorCode_ConnectionLimitReached -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionLimitReached:
-    pass
-
-

ErrorCode_ConnectionLimitReached()

-
-
-class ErrorCode_ConnectionReadTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionReadTimeout:
-    pass
-
-

ErrorCode_ConnectionReadTimeout()

-
-
-class ErrorCode_ConnectionRefused -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionRefused:
-    pass
-
-

ErrorCode_ConnectionRefused()

-
-
-class ErrorCode_ConnectionTerminated -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionTerminated:
-    pass
-
-

ErrorCode_ConnectionTerminated()

-
-
-class ErrorCode_ConnectionTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionTimeout:
-    pass
-
-

ErrorCode_ConnectionTimeout()

-
-
-class ErrorCode_ConnectionWriteTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionWriteTimeout:
-    pass
-
-

ErrorCode_ConnectionWriteTimeout()

-
-
-class ErrorCode_DestinationIpProhibited -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationIpProhibited:
-    pass
-
-

ErrorCode_DestinationIpProhibited()

-
-
-class ErrorCode_DestinationIpUnroutable -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationIpUnroutable:
-    pass
-
-

ErrorCode_DestinationIpUnroutable()

-
-
-class ErrorCode_DestinationNotFound -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationNotFound:
-    pass
-
-

ErrorCode_DestinationNotFound()

-
-
-class ErrorCode_DestinationUnavailable -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationUnavailable:
-    pass
-
-

ErrorCode_DestinationUnavailable()

-
-
-class ErrorCode_DnsError -(value: DnsErrorPayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DnsError:
-    value: DnsErrorPayload
-
-

ErrorCode_DnsError(value: spin_sdk.wit.imports.wasi_http_types_0_2_6.DnsErrorPayload)

-

Instance variables

-
-
var valueDnsErrorPayload
-
-
-
-
-
-
-class ErrorCode_DnsTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DnsTimeout:
-    pass
-
-

ErrorCode_DnsTimeout()

-
-
-class ErrorCode_HttpProtocolError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpProtocolError:
-    pass
-
-

ErrorCode_HttpProtocolError()

-
-
-class ErrorCode_HttpRequestBodySize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestBodySize:
-    value: Optional[int]
-
-

ErrorCode_HttpRequestBodySize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestDenied -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestDenied:
-    pass
-
-

ErrorCode_HttpRequestDenied()

-
-
-class ErrorCode_HttpRequestHeaderSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestHeaderSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpRequestHeaderSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestHeaderSize -(value: FieldSizePayload | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestHeaderSize:
-    value: Optional[FieldSizePayload]
-
-

ErrorCode_HttpRequestHeaderSize(value: Optional[spin_sdk.wit.imports.wasi_http_types_0_2_6.FieldSizePayload])

-

Instance variables

-
-
var valueFieldSizePayload | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestLengthRequired -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestLengthRequired:
-    pass
-
-

ErrorCode_HttpRequestLengthRequired()

-
-
-class ErrorCode_HttpRequestMethodInvalid -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestMethodInvalid:
-    pass
-
-

ErrorCode_HttpRequestMethodInvalid()

-
-
-class ErrorCode_HttpRequestTrailerSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestTrailerSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpRequestTrailerSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestTrailerSize -(value: FieldSizePayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestTrailerSize:
-    value: FieldSizePayload
-
-

ErrorCode_HttpRequestTrailerSize(value: spin_sdk.wit.imports.wasi_http_types_0_2_6.FieldSizePayload)

-

Instance variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCode_HttpRequestUriInvalid -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestUriInvalid:
-    pass
-
-

ErrorCode_HttpRequestUriInvalid()

-
-
-class ErrorCode_HttpRequestUriTooLong -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestUriTooLong:
-    pass
-
-

ErrorCode_HttpRequestUriTooLong()

-
-
-class ErrorCode_HttpResponseBodySize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseBodySize:
-    value: Optional[int]
-
-

ErrorCode_HttpResponseBodySize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseContentCoding -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseContentCoding:
-    value: Optional[str]
-
-

ErrorCode_HttpResponseContentCoding(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseHeaderSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseHeaderSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpResponseHeaderSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseHeaderSize -(value: FieldSizePayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseHeaderSize:
-    value: FieldSizePayload
-
-

ErrorCode_HttpResponseHeaderSize(value: spin_sdk.wit.imports.wasi_http_types_0_2_6.FieldSizePayload)

-

Instance variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCode_HttpResponseIncomplete -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseIncomplete:
-    pass
-
-

ErrorCode_HttpResponseIncomplete()

-
-
-class ErrorCode_HttpResponseTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTimeout:
-    pass
-
-

ErrorCode_HttpResponseTimeout()

-
-
-class ErrorCode_HttpResponseTrailerSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTrailerSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpResponseTrailerSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseTrailerSize -(value: FieldSizePayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTrailerSize:
-    value: FieldSizePayload
-
-

ErrorCode_HttpResponseTrailerSize(value: spin_sdk.wit.imports.wasi_http_types_0_2_6.FieldSizePayload)

-

Instance variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCode_HttpResponseTransferCoding -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTransferCoding:
-    value: Optional[str]
-
-

ErrorCode_HttpResponseTransferCoding(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_HttpUpgradeFailed -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpUpgradeFailed:
-    pass
-
-

ErrorCode_HttpUpgradeFailed()

-
-
-class ErrorCode_InternalError -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_InternalError:
-    value: Optional[str]
-
-

ErrorCode_InternalError(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_LoopDetected -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_LoopDetected:
-    pass
-
-

ErrorCode_LoopDetected()

-
-
-class ErrorCode_TlsAlertReceived -(value: TlsAlertReceivedPayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TlsAlertReceived:
-    value: TlsAlertReceivedPayload
-
-

ErrorCode_TlsAlertReceived(value: spin_sdk.wit.imports.wasi_http_types_0_2_6.TlsAlertReceivedPayload)

-

Instance variables

-
-
var valueTlsAlertReceivedPayload
-
-
-
-
-
-
-class ErrorCode_TlsCertificateError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TlsCertificateError:
-    pass
-
-

ErrorCode_TlsCertificateError()

-
-
-class ErrorCode_TlsProtocolError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TlsProtocolError:
-    pass
-
-

ErrorCode_TlsProtocolError()

-
-
-class FieldSizePayload -(field_name: str | None, field_size: int | None) -
-
-
- -Expand source code - -
@dataclass
-class FieldSizePayload:
-    """
-    Defines the case payload type for `HTTP-response-{header,trailer}-size` above:
-    """
-    field_name: Optional[str]
-    field_size: Optional[int]
-
-

Defines the case payload type for HTTP-response-{header,trailer}-size above:

-

Instance variables

-
-
var field_name : str | None
-
-
-
-
var field_size : int | None
-
-
-
-
-
-
-class Fields -
-
-
- -Expand source code - -
class Fields:
-    """
-    This following block defines the `fields` resource which corresponds to
-    HTTP standard Fields. Fields are a common representation used for both
-    Headers and Trailers.
-    
-    A `fields` may be mutable or immutable. A `fields` created using the
-    constructor, `from-list`, or `clone` will be mutable, but a `fields`
-    resource given by other means (including, but not limited to,
-    `incoming-request.headers`, `outgoing-request.headers`) might be
-    immutable. In an immutable fields, the `set`, `append`, and `delete`
-    operations will fail with `header-error.immutable`.
-    """
-    
-    def __init__(self) -> None:
-        """
-        Construct an empty HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def from_list(cls, entries: List[Tuple[str, bytes]]) -> Self:
-        """
-        Construct an HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        
-        The list represents each name-value pair in the Fields. Names
-        which have multiple values are represented by multiple entries in this
-        list with the same name.
-        
-        The tuple is a pair of the field name, represented as a string, and
-        Value, represented as a list of bytes.
-        
-        An error result will be returned if any `field-name` or `field-value` is
-        syntactically invalid, or if a field is forbidden.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_6.HeaderError)`
-        """
-        raise NotImplementedError
-    def get(self, name: str) -> List[bytes]:
-        """
-        Get all of the values corresponding to a name. If the name is not present
-        in this `fields` or is syntactically invalid, an empty list is returned.
-        However, if the name is present but empty, this is represented by a list
-        with one or more empty field-values present.
-        """
-        raise NotImplementedError
-    def has(self, name: str) -> bool:
-        """
-        Returns `true` when the name is present in this `fields`. If the name is
-        syntactically invalid, `false` is returned.
-        """
-        raise NotImplementedError
-    def set(self, name: str, value: List[bytes]) -> None:
-        """
-        Set all of the values for a name. Clears any existing values for that
-        name, if they have been set.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Fails with `header-error.invalid-syntax` if the `field-name` or any of
-        the `field-value`s are syntactically invalid.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_6.HeaderError)`
-        """
-        raise NotImplementedError
-    def delete(self, name: str) -> None:
-        """
-        Delete all values for a name. Does nothing if no values for the name
-        exist.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Fails with `header-error.invalid-syntax` if the `field-name` is
-        syntactically invalid.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_6.HeaderError)`
-        """
-        raise NotImplementedError
-    def append(self, name: str, value: bytes) -> None:
-        """
-        Append a value for a name. Does not change or delete any existing
-        values for that name.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Fails with `header-error.invalid-syntax` if the `field-name` or
-        `field-value` are syntactically invalid.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_6.HeaderError)`
-        """
-        raise NotImplementedError
-    def entries(self) -> List[Tuple[str, bytes]]:
-        """
-        Retrieve the full set of names and values in the Fields. Like the
-        constructor, the list represents each name-value pair.
-        
-        The outer list represents each name-value pair in the Fields. Names
-        which have multiple values are represented by multiple entries in this
-        list with the same name.
-        
-        The names and values are always returned in the original casing and in
-        the order in which they will be serialized for transport.
-        """
-        raise NotImplementedError
-    def clone(self) -> Self:
-        """
-        Make a deep copy of the Fields. Equivalent in behavior to calling the
-        `fields` constructor on the return value of `entries`. The resulting
-        `fields` is mutable.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

This following block defines the fields resource which corresponds to -HTTP standard Fields. Fields are a common representation used for both -Headers and Trailers.

-

A fields may be mutable or immutable. A fields created using the -constructor, from-list, or clone will be mutable, but a fields -resource given by other means (including, but not limited to, -incoming-request.headers, outgoing-request.headers) might be -immutable. In an immutable fields, the set, append, and delete -operations will fail with header-error.immutable.

-

Construct an empty HTTP Fields.

-

The resulting fields is mutable.

-

Static methods

-
-
-def from_list(entries: List[Tuple[str, bytes]]) ‑> Self -
-
-

Construct an HTTP Fields.

-

The resulting fields is mutable.

-

The list represents each name-value pair in the Fields. Names -which have multiple values are represented by multiple entries in this -list with the same name.

-

The tuple is a pair of the field name, represented as a string, and -Value, represented as a list of bytes.

-

An error result will be returned if any field-name or field-value is -syntactically invalid, or if a field is forbidden.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-

Methods

-
-
-def append(self, name: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
def append(self, name: str, value: bytes) -> None:
-    """
-    Append a value for a name. Does not change or delete any existing
-    values for that name.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Fails with `header-error.invalid-syntax` if the `field-name` or
-    `field-value` are syntactically invalid.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_6.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Append a value for a name. Does not change or delete any existing -values for that name.

-

Fails with header-error.immutable if the fields are immutable.

-

Fails with header-error.invalid-syntax if the field-name or -field-value are syntactically invalid.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-def clone(self) ‑> Self -
-
-
- -Expand source code - -
def clone(self) -> Self:
-    """
-    Make a deep copy of the Fields. Equivalent in behavior to calling the
-    `fields` constructor on the return value of `entries`. The resulting
-    `fields` is mutable.
-    """
-    raise NotImplementedError
-
-

Make a deep copy of the Fields. Equivalent in behavior to calling the -fields constructor on the return value of entries. The resulting -fields is mutable.

-
-
-def delete(self, name: str) ‑> None -
-
-
- -Expand source code - -
def delete(self, name: str) -> None:
-    """
-    Delete all values for a name. Does nothing if no values for the name
-    exist.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Fails with `header-error.invalid-syntax` if the `field-name` is
-    syntactically invalid.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_6.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Delete all values for a name. Does nothing if no values for the name -exist.

-

Fails with header-error.immutable if the fields are immutable.

-

Fails with header-error.invalid-syntax if the field-name is -syntactically invalid.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-def entries(self) ‑> List[Tuple[str, bytes]] -
-
-
- -Expand source code - -
def entries(self) -> List[Tuple[str, bytes]]:
-    """
-    Retrieve the full set of names and values in the Fields. Like the
-    constructor, the list represents each name-value pair.
-    
-    The outer list represents each name-value pair in the Fields. Names
-    which have multiple values are represented by multiple entries in this
-    list with the same name.
-    
-    The names and values are always returned in the original casing and in
-    the order in which they will be serialized for transport.
-    """
-    raise NotImplementedError
-
-

Retrieve the full set of names and values in the Fields. Like the -constructor, the list represents each name-value pair.

-

The outer list represents each name-value pair in the Fields. Names -which have multiple values are represented by multiple entries in this -list with the same name.

-

The names and values are always returned in the original casing and in -the order in which they will be serialized for transport.

-
-
-def get(self, name: str) ‑> List[bytes] -
-
-
- -Expand source code - -
def get(self, name: str) -> List[bytes]:
-    """
-    Get all of the values corresponding to a name. If the name is not present
-    in this `fields` or is syntactically invalid, an empty list is returned.
-    However, if the name is present but empty, this is represented by a list
-    with one or more empty field-values present.
-    """
-    raise NotImplementedError
-
-

Get all of the values corresponding to a name. If the name is not present -in this fields or is syntactically invalid, an empty list is returned. -However, if the name is present but empty, this is represented by a list -with one or more empty field-values present.

-
-
-def has(self, name: str) ‑> bool -
-
-
- -Expand source code - -
def has(self, name: str) -> bool:
-    """
-    Returns `true` when the name is present in this `fields`. If the name is
-    syntactically invalid, `false` is returned.
-    """
-    raise NotImplementedError
-
-

Returns true when the name is present in this fields. If the name is -syntactically invalid, false is returned.

-
-
-def set(self, name: str, value: List[bytes]) ‑> None -
-
-
- -Expand source code - -
def set(self, name: str, value: List[bytes]) -> None:
-    """
-    Set all of the values for a name. Clears any existing values for that
-    name, if they have been set.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Fails with `header-error.invalid-syntax` if the `field-name` or any of
-    the `field-value`s are syntactically invalid.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_6.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Set all of the values for a name. Clears any existing values for that -name, if they have been set.

-

Fails with header-error.immutable if the fields are immutable.

-

Fails with header-error.invalid-syntax if the field-name or any of -the field-values are syntactically invalid.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-
-
-class FutureIncomingResponse -
-
-
- -Expand source code - -
class FutureIncomingResponse:
-    """
-    Represents a future which may eventually return an incoming HTTP
-    Response, or an error.
-    
-    This resource is returned by the `wasi:http/outgoing-handler` interface to
-    provide the HTTP Response corresponding to the sent Request.
-    """
-    
-    def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-        """
-        Returns a pollable which becomes ready when either the Response has
-        been received, or an error has occurred. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-    def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
-        """
-        Returns the incoming HTTP Response, or an error, once one is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the response or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the incoming HTTP Response
-        status and headers have received successfully, or that an error
-        occurred. Errors may also occur while consuming the response body,
-        but those will be reported by the `incoming-body` and its
-        `output-stream` child.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents a future which may eventually return an incoming HTTP -Response, or an error.

-

This resource is returned by the wasi:http/outgoing-handler interface to -provide the HTTP Response corresponding to the sent Request.

-

Methods

-
-
-def get(self) ‑> componentize_py_types.Ok[componentize_py_types.Ok[IncomingResponse] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]] | componentize_py_types.Err[None] | None -
-
-
- -Expand source code - -
def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
-    """
-    Returns the incoming HTTP Response, or an error, once one is ready.
-    
-    The outer `option` represents future readiness. Users can wait on this
-    `option` to become `some` using the `subscribe` method.
-    
-    The outer `result` is used to retrieve the response or error at most
-    once. It will be success on the first call in which the outer option
-    is `some`, and error on subsequent calls.
-    
-    The inner `result` represents that either the incoming HTTP Response
-    status and headers have received successfully, or that an error
-    occurred. Errors may also occur while consuming the response body,
-    but those will be reported by the `incoming-body` and its
-    `output-stream` child.
-    """
-    raise NotImplementedError
-
-

Returns the incoming HTTP Response, or an error, once one is ready.

-

The outer option represents future readiness. Users can wait on this -option to become some using the subscribe method.

-

The outer result is used to retrieve the response or error at most -once. It will be success on the first call in which the outer option -is some, and error on subsequent calls.

-

The inner result represents that either the incoming HTTP Response -status and headers have received successfully, or that an error -occurred. Errors may also occur while consuming the response body, -but those will be reported by the incoming-body and its -output-stream child.

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-    """
-    Returns a pollable which becomes ready when either the Response has
-    been received, or an error has occurred. When this pollable is ready,
-    the `get` method will return `some`.
-    """
-    raise NotImplementedError
-
-

Returns a pollable which becomes ready when either the Response has -been received, or an error has occurred. When this pollable is ready, -the get method will return some.

-
-
-
-
-class FutureTrailers -
-
-
- -Expand source code - -
class FutureTrailers:
-    """
-    Represents a future which may eventually return trailers, or an error.
-    
-    In the case that the incoming HTTP Request or Response did not have any
-    trailers, this future will resolve to the empty set of trailers once the
-    complete Request or Response body has been received.
-    """
-    
-    def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-        """
-        Returns a pollable which becomes ready when either the trailers have
-        been received, or an error has occurred. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-    def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
-        """
-        Returns the contents of the trailers, or an error which occurred,
-        once the future is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the trailers or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the HTTP Request or Response
-        body, as well as any trailers, were received successfully, or that an
-        error occurred receiving them. The optional `trailers` indicates whether
-        or not trailers were present in the body.
-        
-        When some `trailers` are returned by this method, the `trailers`
-        resource is immutable, and a child. Use of the `set`, `append`, or
-        `delete` methods will return an error, and the resource must be
-        dropped before the parent `future-trailers` is dropped.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents a future which may eventually return trailers, or an error.

-

In the case that the incoming HTTP Request or Response did not have any -trailers, this future will resolve to the empty set of trailers once the -complete Request or Response body has been received.

-

Methods

-
-
-def get(self) ‑> componentize_py_types.Ok[componentize_py_types.Ok[Fields | None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]] | componentize_py_types.Err[None] | None -
-
-
- -Expand source code - -
def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
-    """
-    Returns the contents of the trailers, or an error which occurred,
-    once the future is ready.
-    
-    The outer `option` represents future readiness. Users can wait on this
-    `option` to become `some` using the `subscribe` method.
-    
-    The outer `result` is used to retrieve the trailers or error at most
-    once. It will be success on the first call in which the outer option
-    is `some`, and error on subsequent calls.
-    
-    The inner `result` represents that either the HTTP Request or Response
-    body, as well as any trailers, were received successfully, or that an
-    error occurred receiving them. The optional `trailers` indicates whether
-    or not trailers were present in the body.
-    
-    When some `trailers` are returned by this method, the `trailers`
-    resource is immutable, and a child. Use of the `set`, `append`, or
-    `delete` methods will return an error, and the resource must be
-    dropped before the parent `future-trailers` is dropped.
-    """
-    raise NotImplementedError
-
-

Returns the contents of the trailers, or an error which occurred, -once the future is ready.

-

The outer option represents future readiness. Users can wait on this -option to become some using the subscribe method.

-

The outer result is used to retrieve the trailers or error at most -once. It will be success on the first call in which the outer option -is some, and error on subsequent calls.

-

The inner result represents that either the HTTP Request or Response -body, as well as any trailers, were received successfully, or that an -error occurred receiving them. The optional trailers indicates whether -or not trailers were present in the body.

-

When some trailers are returned by this method, the trailers -resource is immutable, and a child. Use of the set, append, or -delete methods will return an error, and the resource must be -dropped before the parent future-trailers is dropped.

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-    """
-    Returns a pollable which becomes ready when either the trailers have
-    been received, or an error has occurred. When this pollable is ready,
-    the `get` method will return `some`.
-    """
-    raise NotImplementedError
-
-

Returns a pollable which becomes ready when either the trailers have -been received, or an error has occurred. When this pollable is ready, -the get method will return some.

-
-
-
-
-class HeaderError_Forbidden -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_Forbidden:
-    pass
-
-

HeaderError_Forbidden()

-
-
-class HeaderError_Immutable -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_Immutable:
-    pass
-
-

HeaderError_Immutable()

-
-
-class HeaderError_InvalidSyntax -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_InvalidSyntax:
-    pass
-
-

HeaderError_InvalidSyntax()

-
-
-class IncomingBody -
-
-
- -Expand source code - -
class IncomingBody:
-    """
-    Represents an incoming HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, indicating that the full contents of the
-    body have been received. This resource represents the contents as
-    an `input-stream` and the delivery of trailers as a `future-trailers`,
-    and ensures that the user of this interface may only be consuming either
-    the body contents or waiting on trailers at any given time.
-    """
-    
-    def stream(self) -> wasi_io_streams_0_2_6.InputStream:
-        """
-        Returns the contents of the body, as a stream of bytes.
-        
-        Returns success on first call: the stream representing the contents
-        can be retrieved at most once. Subsequent calls will return error.
-        
-        The returned `input-stream` resource is a child: it must be dropped
-        before the parent `incoming-body` is dropped, or consumed by
-        `incoming-body.finish`.
-        
-        This invariant ensures that the implementation can determine whether
-        the user is consuming the contents of the body, waiting on the
-        `future-trailers` to be ready, or neither. This allows for network
-        backpressure is to be applied when the user is consuming the body,
-        and for that backpressure to not inhibit delivery of the trailers if
-        the user does not read the entire body.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    @classmethod
-    def finish(cls, this: Self) -> FutureTrailers:
-        """
-        Takes ownership of `incoming-body`, and returns a `future-trailers`.
-        This function will trap if the `input-stream` child is still alive.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an incoming HTTP Request or Response's Body.

-

A body has both its contents - a stream of bytes - and a (possibly -empty) set of trailers, indicating that the full contents of the -body have been received. This resource represents the contents as -an input-stream and the delivery of trailers as a future-trailers, -and ensures that the user of this interface may only be consuming either -the body contents or waiting on trailers at any given time.

-

Static methods

-
-
-def finish(this: Self) ‑> FutureTrailers -
-
-

Takes ownership of incoming-body, and returns a future-trailers. -This function will trap if the input-stream child is still alive.

-
-
-

Methods

-
-
-def stream(self) ‑> InputStream -
-
-
- -Expand source code - -
def stream(self) -> wasi_io_streams_0_2_6.InputStream:
-    """
-    Returns the contents of the body, as a stream of bytes.
-    
-    Returns success on first call: the stream representing the contents
-    can be retrieved at most once. Subsequent calls will return error.
-    
-    The returned `input-stream` resource is a child: it must be dropped
-    before the parent `incoming-body` is dropped, or consumed by
-    `incoming-body.finish`.
-    
-    This invariant ensures that the implementation can determine whether
-    the user is consuming the contents of the body, waiting on the
-    `future-trailers` to be ready, or neither. This allows for network
-    backpressure is to be applied when the user is consuming the body,
-    and for that backpressure to not inhibit delivery of the trailers if
-    the user does not read the entire body.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns the contents of the body, as a stream of bytes.

-

Returns success on first call: the stream representing the contents -can be retrieved at most once. Subsequent calls will return error.

-

The returned input-stream resource is a child: it must be dropped -before the parent incoming-body is dropped, or consumed by -incoming-body.finish.

-

This invariant ensures that the implementation can determine whether -the user is consuming the contents of the body, waiting on the -future-trailers to be ready, or neither. This allows for network -backpressure is to be applied when the user is consuming the body, -and for that backpressure to not inhibit delivery of the trailers if -the user does not read the entire body.

-

Raises: componentize_py_types.Err(None)

-
-
-
-
-class IncomingRequest -
-
-
- -Expand source code - -
class IncomingRequest:
-    """
-    Represents an incoming HTTP Request.
-    """
-    
-    def method(self) -> Method:
-        """
-        Returns the method of the incoming request.
-        """
-        raise NotImplementedError
-    def path_with_query(self) -> Optional[str]:
-        """
-        Returns the path with query parameters from the request, as a string.
-        """
-        raise NotImplementedError
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Returns the protocol scheme from the request.
-        """
-        raise NotImplementedError
-    def authority(self) -> Optional[str]:
-        """
-        Returns the authority of the Request's target URI, if present.
-        """
-        raise NotImplementedError
-    def headers(self) -> Fields:
-        """
-        Get the `headers` associated with the request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        The `headers` returned are a child resource: it must be dropped before
-        the parent `incoming-request` is dropped. Dropping this
-        `incoming-request` before all children are dropped will trap.
-        """
-        raise NotImplementedError
-    def consume(self) -> IncomingBody:
-        """
-        Gives the `incoming-body` associated with this request. Will only
-        return success at most once, and subsequent calls will return error.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an incoming HTTP Request.

-

Methods

-
-
-def authority(self) ‑> str | None -
-
-
- -Expand source code - -
def authority(self) -> Optional[str]:
-    """
-    Returns the authority of the Request's target URI, if present.
-    """
-    raise NotImplementedError
-
-

Returns the authority of the Request's target URI, if present.

-
-
-def consume(self) ‑> IncomingBody -
-
-
- -Expand source code - -
def consume(self) -> IncomingBody:
-    """
-    Gives the `incoming-body` associated with this request. Will only
-    return success at most once, and subsequent calls will return error.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Gives the incoming-body associated with this request. Will only -return success at most once, and subsequent calls will return error.

-

Raises: componentize_py_types.Err(None)

-
-
-def headers(self) ‑> Fields -
-
-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the `headers` associated with the request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    The `headers` returned are a child resource: it must be dropped before
-    the parent `incoming-request` is dropped. Dropping this
-    `incoming-request` before all children are dropped will trap.
-    """
-    raise NotImplementedError
-
-

Get the headers associated with the request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

The headers returned are a child resource: it must be dropped before -the parent incoming-request is dropped. Dropping this -incoming-request before all children are dropped will trap.

-
-
-def method(self) ‑> Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other -
-
-
- -Expand source code - -
def method(self) -> Method:
-    """
-    Returns the method of the incoming request.
-    """
-    raise NotImplementedError
-
-

Returns the method of the incoming request.

-
-
-def path_with_query(self) ‑> str | None -
-
-
- -Expand source code - -
def path_with_query(self) -> Optional[str]:
-    """
-    Returns the path with query parameters from the request, as a string.
-    """
-    raise NotImplementedError
-
-

Returns the path with query parameters from the request, as a string.

-
-
-def scheme(self) ‑> Scheme_Http | Scheme_Https | Scheme_Other | None -
-
-
- -Expand source code - -
def scheme(self) -> Optional[Scheme]:
-    """
-    Returns the protocol scheme from the request.
-    """
-    raise NotImplementedError
-
-

Returns the protocol scheme from the request.

-
-
-
-
-class IncomingResponse -
-
-
- -Expand source code - -
class IncomingResponse:
-    """
-    Represents an incoming HTTP Response.
-    """
-    
-    def status(self) -> int:
-        """
-        Returns the status code from the incoming response.
-        """
-        raise NotImplementedError
-    def headers(self) -> Fields:
-        """
-        Returns the headers from the incoming response.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `incoming-response` is dropped.
-        """
-        raise NotImplementedError
-    def consume(self) -> IncomingBody:
-        """
-        Returns the incoming body. May be called at most once. Returns error
-        if called additional times.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an incoming HTTP Response.

-

Methods

-
-
-def consume(self) ‑> IncomingBody -
-
-
- -Expand source code - -
def consume(self) -> IncomingBody:
-    """
-    Returns the incoming body. May be called at most once. Returns error
-    if called additional times.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns the incoming body. May be called at most once. Returns error -if called additional times.

-

Raises: componentize_py_types.Err(None)

-
-
-def headers(self) ‑> Fields -
-
-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Returns the headers from the incoming response.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `incoming-response` is dropped.
-    """
-    raise NotImplementedError
-
-

Returns the headers from the incoming response.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -incoming-response is dropped.

-
-
-def status(self) ‑> int -
-
-
- -Expand source code - -
def status(self) -> int:
-    """
-    Returns the status code from the incoming response.
-    """
-    raise NotImplementedError
-
-

Returns the status code from the incoming response.

-
-
-
-
-class Method_Connect -
-
-
- -Expand source code - -
@dataclass
-class Method_Connect:
-    pass
-
-

Method_Connect()

-
-
-class Method_Delete -
-
-
- -Expand source code - -
@dataclass
-class Method_Delete:
-    pass
-
-

Method_Delete()

-
-
-class Method_Get -
-
-
- -Expand source code - -
@dataclass
-class Method_Get:
-    pass
-
-

Method_Get()

-
-
-class Method_Head -
-
-
- -Expand source code - -
@dataclass
-class Method_Head:
-    pass
-
-

Method_Head()

-
-
-class Method_Options -
-
-
- -Expand source code - -
@dataclass
-class Method_Options:
-    pass
-
-

Method_Options()

-
-
-class Method_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Method_Other:
-    value: str
-
-

Method_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Method_Patch -
-
-
- -Expand source code - -
@dataclass
-class Method_Patch:
-    pass
-
-

Method_Patch()

-
-
-class Method_Post -
-
-
- -Expand source code - -
@dataclass
-class Method_Post:
-    pass
-
-

Method_Post()

-
-
-class Method_Put -
-
-
- -Expand source code - -
@dataclass
-class Method_Put:
-    pass
-
-

Method_Put()

-
-
-class Method_Trace -
-
-
- -Expand source code - -
@dataclass
-class Method_Trace:
-    pass
-
-

Method_Trace()

-
-
-class OutgoingBody -
-
-
- -Expand source code - -
class OutgoingBody:
-    """
-    Represents an outgoing HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, inducating the full contents of the body
-    have been sent. This resource represents the contents as an
-    `output-stream` child resource, and the completion of the body (with
-    optional trailers) with a static function that consumes the
-    `outgoing-body` resource, and ensures that the user of this interface
-    may not write to the body contents after the body has been finished.
-    
-    If the user code drops this resource, as opposed to calling the static
-    method `finish`, the implementation should treat the body as incomplete,
-    and that an error has occurred. The implementation should propagate this
-    error to the HTTP protocol by whatever means it has available,
-    including: corrupting the body on the wire, aborting the associated
-    Request, or sending a late status code for the Response.
-    """
-    
-    def write(self) -> wasi_io_streams_0_2_6.OutputStream:
-        """
-        Returns a stream for writing the body contents.
-        
-        The returned `output-stream` is a child resource: it must be dropped
-        before the parent `outgoing-body` resource is dropped (or finished),
-        otherwise the `outgoing-body` drop or `finish` will trap.
-        
-        Returns success on the first call: the `output-stream` resource for
-        this `outgoing-body` may be retrieved at most once. Subsequent calls
-        will return error.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    @classmethod
-    def finish(cls, this: Self, trailers: Optional[Fields]) -> None:
-        """
-        Finalize an outgoing body, optionally providing trailers. This must be
-        called to signal that the response is complete. If the `outgoing-body`
-        is dropped without calling `outgoing-body.finalize`, the implementation
-        should treat the body as corrupted.
-        
-        Fails if the body's `outgoing-request` or `outgoing-response` was
-        constructed with a Content-Length header, and the contents written
-        to the body (via `write`) does not match the value given in the
-        Content-Length.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an outgoing HTTP Request or Response's Body.

-

A body has both its contents - a stream of bytes - and a (possibly -empty) set of trailers, inducating the full contents of the body -have been sent. This resource represents the contents as an -output-stream child resource, and the completion of the body (with -optional trailers) with a static function that consumes the -outgoing-body resource, and ensures that the user of this interface -may not write to the body contents after the body has been finished.

-

If the user code drops this resource, as opposed to calling the static -method finish, the implementation should treat the body as incomplete, -and that an error has occurred. The implementation should propagate this -error to the HTTP protocol by whatever means it has available, -including: corrupting the body on the wire, aborting the associated -Request, or sending a late status code for the Response.

-

Static methods

-
-
-def finish(this: Self,
trailers: Fields | None) ‑> None
-
-
-

Finalize an outgoing body, optionally providing trailers. This must be -called to signal that the response is complete. If the outgoing-body -is dropped without calling outgoing-body.finalize, the implementation -should treat the body as corrupted.

-

Fails if the body's outgoing-request or outgoing-response was -constructed with a Content-Length header, and the contents written -to the body (via write) does not match the value given in the -Content-Length.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-

Methods

-
-
-def write(self) ‑> OutputStream -
-
-
- -Expand source code - -
def write(self) -> wasi_io_streams_0_2_6.OutputStream:
-    """
-    Returns a stream for writing the body contents.
-    
-    The returned `output-stream` is a child resource: it must be dropped
-    before the parent `outgoing-body` resource is dropped (or finished),
-    otherwise the `outgoing-body` drop or `finish` will trap.
-    
-    Returns success on the first call: the `output-stream` resource for
-    this `outgoing-body` may be retrieved at most once. Subsequent calls
-    will return error.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns a stream for writing the body contents.

-

The returned output-stream is a child resource: it must be dropped -before the parent outgoing-body resource is dropped (or finished), -otherwise the outgoing-body drop or finish will trap.

-

Returns success on the first call: the output-stream resource for -this outgoing-body may be retrieved at most once. Subsequent calls -will return error.

-

Raises: componentize_py_types.Err(None)

-
-
-
-
-class OutgoingRequest -(headers: Fields) -
-
-
- -Expand source code - -
class OutgoingRequest:
-    """
-    Represents an outgoing HTTP Request.
-    """
-    
-    def __init__(self, headers: Fields) -> None:
-        """
-        Construct a new `outgoing-request` with a default `method` of `GET`, and
-        `none` values for `path-with-query`, `scheme`, and `authority`.
-        
-        * `headers` is the HTTP Headers for the Request.
-        
-        It is possible to construct, or manipulate with the accessor functions
-        below, an `outgoing-request` with an invalid combination of `scheme`
-        and `authority`, or `headers` which are not permitted to be sent.
-        It is the obligation of the `outgoing-handler.handle` implementation
-        to reject invalid constructions of `outgoing-request`.
-        """
-        raise NotImplementedError
-
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this
-        Request.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-request` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def method(self) -> Method:
-        """
-        Get the Method for the Request.
-        """
-        raise NotImplementedError
-    def set_method(self, method: Method) -> None:
-        """
-        Set the Method for the Request. Fails if the string present in a
-        `method.other` argument is not a syntactically valid method.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def path_with_query(self) -> Optional[str]:
-        """
-        Get the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query.
-        """
-        raise NotImplementedError
-    def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-        """
-        Set the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query. Fails is the
-        string given is not a syntactically valid path and query uri component.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Get the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme.
-        """
-        raise NotImplementedError
-    def set_scheme(self, scheme: Optional[Scheme]) -> None:
-        """
-        Set the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme. Fails if the
-        string given is not a syntactically valid uri scheme.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def authority(self) -> Optional[str]:
-        """
-        Get the authority of the Request's target URI. A value of `none` may be used
-        with Related Schemes which do not require an authority. The HTTP and
-        HTTPS schemes always require an authority.
-        """
-        raise NotImplementedError
-    def set_authority(self, authority: Optional[str]) -> None:
-        """
-        Set the authority of the Request's target URI. A value of `none` may be used
-        with Related Schemes which do not require an authority. The HTTP and
-        HTTPS schemes always require an authority. Fails if the string given is
-        not a syntactically valid URI authority.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transferred to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an outgoing HTTP Request.

-

Construct a new outgoing-request with a default method of GET, and -none values for path-with-query, scheme, and authority.

-
    -
  • headers is the HTTP Headers for the Request.
  • -
-

It is possible to construct, or manipulate with the accessor functions -below, an outgoing-request with an invalid combination of scheme -and authority, or headers which are not permitted to be sent. -It is the obligation of the outgoing-handler.handle implementation -to reject invalid constructions of outgoing-request.

-

Methods

-
-
-def authority(self) ‑> str | None -
-
-
- -Expand source code - -
def authority(self) -> Optional[str]:
-    """
-    Get the authority of the Request's target URI. A value of `none` may be used
-    with Related Schemes which do not require an authority. The HTTP and
-    HTTPS schemes always require an authority.
-    """
-    raise NotImplementedError
-
-

Get the authority of the Request's target URI. A value of none may be used -with Related Schemes which do not require an authority. The HTTP and -HTTPS schemes always require an authority.

-
-
-def body(self) ‑> OutgoingBody -
-
-
- -Expand source code - -
def body(self) -> OutgoingBody:
-    """
-    Returns the resource corresponding to the outgoing Body for this
-    Request.
-    
-    Returns success on the first call: the `outgoing-body` resource for
-    this `outgoing-request` can be retrieved at most once. Subsequent
-    calls will return error.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns the resource corresponding to the outgoing Body for this -Request.

-

Returns success on the first call: the outgoing-body resource for -this outgoing-request can be retrieved at most once. Subsequent -calls will return error.

-

Raises: componentize_py_types.Err(None)

-
-
-def headers(self) ‑> Fields -
-
-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the headers associated with the Request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `outgoing-request` is dropped, or its ownership is transferred to
-    another component by e.g. `outgoing-handler.handle`.
-    """
-    raise NotImplementedError
-
-

Get the headers associated with the Request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -outgoing-request is dropped, or its ownership is transferred to -another component by e.g. outgoing-handler.handle.

-
-
-def method(self) ‑> Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other -
-
-
- -Expand source code - -
def method(self) -> Method:
-    """
-    Get the Method for the Request.
-    """
-    raise NotImplementedError
-
-

Get the Method for the Request.

-
-
-def path_with_query(self) ‑> str | None -
-
-
- -Expand source code - -
def path_with_query(self) -> Optional[str]:
-    """
-    Get the combination of the HTTP Path and Query for the Request.
-    When `none`, this represents an empty Path and empty Query.
-    """
-    raise NotImplementedError
-
-

Get the combination of the HTTP Path and Query for the Request. -When none, this represents an empty Path and empty Query.

-
-
-def scheme(self) ‑> Scheme_Http | Scheme_Https | Scheme_Other | None -
-
-
- -Expand source code - -
def scheme(self) -> Optional[Scheme]:
-    """
-    Get the HTTP Related Scheme for the Request. When `none`, the
-    implementation may choose an appropriate default scheme.
-    """
-    raise NotImplementedError
-
-

Get the HTTP Related Scheme for the Request. When none, the -implementation may choose an appropriate default scheme.

-
-
-def set_authority(self, authority: str | None) ‑> None -
-
-
- -Expand source code - -
def set_authority(self, authority: Optional[str]) -> None:
-    """
-    Set the authority of the Request's target URI. A value of `none` may be used
-    with Related Schemes which do not require an authority. The HTTP and
-    HTTPS schemes always require an authority. Fails if the string given is
-    not a syntactically valid URI authority.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the authority of the Request's target URI. A value of none may be used -with Related Schemes which do not require an authority. The HTTP and -HTTPS schemes always require an authority. Fails if the string given is -not a syntactically valid URI authority.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_method(self,
method: Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other) ‑> None
-
-
-
- -Expand source code - -
def set_method(self, method: Method) -> None:
-    """
-    Set the Method for the Request. Fails if the string present in a
-    `method.other` argument is not a syntactically valid method.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the Method for the Request. Fails if the string present in a -method.other argument is not a syntactically valid method.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_path_with_query(self, path_with_query: str | None) ‑> None -
-
-
- -Expand source code - -
def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-    """
-    Set the combination of the HTTP Path and Query for the Request.
-    When `none`, this represents an empty Path and empty Query. Fails is the
-    string given is not a syntactically valid path and query uri component.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the combination of the HTTP Path and Query for the Request. -When none, this represents an empty Path and empty Query. Fails is the -string given is not a syntactically valid path and query uri component.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_scheme(self,
scheme: Scheme_Http | Scheme_Https | Scheme_Other | None) ‑> None
-
-
-
- -Expand source code - -
def set_scheme(self, scheme: Optional[Scheme]) -> None:
-    """
-    Set the HTTP Related Scheme for the Request. When `none`, the
-    implementation may choose an appropriate default scheme. Fails if the
-    string given is not a syntactically valid uri scheme.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the HTTP Related Scheme for the Request. When none, the -implementation may choose an appropriate default scheme. Fails if the -string given is not a syntactically valid uri scheme.

-

Raises: componentize_py_types.Err(None)

-
-
-
-
-class OutgoingResponse -(headers: Fields) -
-
-
- -Expand source code - -
class OutgoingResponse:
-    """
-    Represents an outgoing HTTP Response.
-    """
-    
-    def __init__(self, headers: Fields) -> None:
-        """
-        Construct an `outgoing-response`, with a default `status-code` of `200`.
-        If a different `status-code` is needed, it must be set via the
-        `set-status-code` method.
-        
-        * `headers` is the HTTP Headers for the Response.
-        """
-        raise NotImplementedError
-
-    def status_code(self) -> int:
-        """
-        Get the HTTP Status Code for the Response.
-        """
-        raise NotImplementedError
-    def set_status_code(self, status_code: int) -> None:
-        """
-        Set the HTTP Status Code for the Response. Fails if the status-code
-        given is not a valid http status code.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transferred to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this Response.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-response` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an outgoing HTTP Response.

-

Construct an outgoing-response, with a default status-code of 200. -If a different status-code is needed, it must be set via the -set-status-code method.

-
    -
  • headers is the HTTP Headers for the Response.
  • -
-

Methods

-
-
-def body(self) ‑> OutgoingBody -
-
-
- -Expand source code - -
def body(self) -> OutgoingBody:
-    """
-    Returns the resource corresponding to the outgoing Body for this Response.
-    
-    Returns success on the first call: the `outgoing-body` resource for
-    this `outgoing-response` can be retrieved at most once. Subsequent
-    calls will return error.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Returns the resource corresponding to the outgoing Body for this Response.

-

Returns success on the first call: the outgoing-body resource for -this outgoing-response can be retrieved at most once. Subsequent -calls will return error.

-

Raises: componentize_py_types.Err(None)

-
-
-def headers(self) ‑> Fields -
-
-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the headers associated with the Request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `outgoing-request` is dropped, or its ownership is transferred to
-    another component by e.g. `outgoing-handler.handle`.
-    """
-    raise NotImplementedError
-
-

Get the headers associated with the Request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -outgoing-request is dropped, or its ownership is transferred to -another component by e.g. outgoing-handler.handle.

-
-
-def set_status_code(self, status_code: int) ‑> None -
-
-
- -Expand source code - -
def set_status_code(self, status_code: int) -> None:
-    """
-    Set the HTTP Status Code for the Response. Fails if the status-code
-    given is not a valid http status code.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the HTTP Status Code for the Response. Fails if the status-code -given is not a valid http status code.

-

Raises: componentize_py_types.Err(None)

-
-
-def status_code(self) ‑> int -
-
-
- -Expand source code - -
def status_code(self) -> int:
-    """
-    Get the HTTP Status Code for the Response.
-    """
-    raise NotImplementedError
-
-

Get the HTTP Status Code for the Response.

-
-
-
-
-class RequestOptions -
-
-
- -Expand source code - -
class RequestOptions:
-    """
-    Parameters for making an HTTP Request. Each of these parameters is
-    currently an optional timeout applicable to the transport layer of the
-    HTTP protocol.
-    
-    These timeouts are separate from any the user may use to bound a
-    blocking call to `wasi:io/poll.poll`.
-    """
-    
-    def __init__(self) -> None:
-        """
-        Construct a default `request-options` value.
-        """
-        raise NotImplementedError
-
-    def connect_timeout(self) -> Optional[int]:
-        """
-        The timeout for the initial connect to the HTTP Server.
-        """
-        raise NotImplementedError
-    def set_connect_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for the initial connect to the HTTP Server. An error
-        return value indicates that this timeout is not supported.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def first_byte_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving the first byte of the Response body.
-        """
-        raise NotImplementedError
-    def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving the first byte of the Response body. An
-        error return value indicates that this timeout is not supported.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def between_bytes_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving subsequent chunks of bytes in the Response
-        body stream.
-        """
-        raise NotImplementedError
-    def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving subsequent chunks of bytes in the Response
-        body stream. An error return value indicates that this timeout is not
-        supported.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Parameters for making an HTTP Request. Each of these parameters is -currently an optional timeout applicable to the transport layer of the -HTTP protocol.

-

These timeouts are separate from any the user may use to bound a -blocking call to wasi:io/poll.poll.

-

Construct a default request-options value.

-

Methods

-
-
-def between_bytes_timeout(self) ‑> int | None -
-
-
- -Expand source code - -
def between_bytes_timeout(self) -> Optional[int]:
-    """
-    The timeout for receiving subsequent chunks of bytes in the Response
-    body stream.
-    """
-    raise NotImplementedError
-
-

The timeout for receiving subsequent chunks of bytes in the Response -body stream.

-
-
-def connect_timeout(self) ‑> int | None -
-
-
- -Expand source code - -
def connect_timeout(self) -> Optional[int]:
-    """
-    The timeout for the initial connect to the HTTP Server.
-    """
-    raise NotImplementedError
-
-

The timeout for the initial connect to the HTTP Server.

-
-
-def first_byte_timeout(self) ‑> int | None -
-
-
- -Expand source code - -
def first_byte_timeout(self) -> Optional[int]:
-    """
-    The timeout for receiving the first byte of the Response body.
-    """
-    raise NotImplementedError
-
-

The timeout for receiving the first byte of the Response body.

-
-
-def set_between_bytes_timeout(self, duration: int | None) ‑> None -
-
-
- -Expand source code - -
def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for receiving subsequent chunks of bytes in the Response
-    body stream. An error return value indicates that this timeout is not
-    supported.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the timeout for receiving subsequent chunks of bytes in the Response -body stream. An error return value indicates that this timeout is not -supported.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_connect_timeout(self, duration: int | None) ‑> None -
-
-
- -Expand source code - -
def set_connect_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for the initial connect to the HTTP Server. An error
-    return value indicates that this timeout is not supported.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the timeout for the initial connect to the HTTP Server. An error -return value indicates that this timeout is not supported.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_first_byte_timeout(self, duration: int | None) ‑> None -
-
-
- -Expand source code - -
def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for receiving the first byte of the Response body. An
-    error return value indicates that this timeout is not supported.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the timeout for receiving the first byte of the Response body. An -error return value indicates that this timeout is not supported.

-

Raises: componentize_py_types.Err(None)

-
-
-
-
-class ResponseOutparam -
-
-
- -Expand source code - -
class ResponseOutparam:
-    """
-    Represents the ability to send an HTTP Response.
-    
-    This resource is used by the `wasi:http/incoming-handler` interface to
-    allow a Response to be sent corresponding to the Request provided as the
-    other argument to `incoming-handler.handle`.
-    """
-    
-    @classmethod
-    def set(cls, param: Self, response: Result[OutgoingResponse, ErrorCode]) -> None:
-        """
-        Set the value of the `response-outparam` to either send a response,
-        or indicate an error.
-        
-        This method consumes the `response-outparam` to ensure that it is
-        called at most once. If it is never called, the implementation
-        will respond with an error.
-        
-        The user may provide an `error` to `response` to allow the
-        implementation determine how to respond with an HTTP error response.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents the ability to send an HTTP Response.

-

This resource is used by the wasi:http/incoming-handler interface to -allow a Response to be sent corresponding to the Request provided as the -other argument to incoming-handler.handle.

-

Static methods

-
-
-def set(param: Self,
response: componentize_py_types.Ok[OutgoingResponse] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]) ‑> None
-
-
-

Set the value of the response-outparam to either send a response, -or indicate an error.

-

This method consumes the response-outparam to ensure that it is -called at most once. If it is never called, the implementation -will respond with an error.

-

The user may provide an error to response to allow the -implementation determine how to respond with an HTTP error response.

-
-
-
-
-class Scheme_Http -
-
-
- -Expand source code - -
@dataclass
-class Scheme_Http:
-    pass
-
-

Scheme_Http()

-
-
-class Scheme_Https -
-
-
- -Expand source code - -
@dataclass
-class Scheme_Https:
-    pass
-
-

Scheme_Https()

-
-
-class Scheme_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Scheme_Other:
-    value: str
-
-

Scheme_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class TlsAlertReceivedPayload -(alert_id: int | None, alert_message: str | None) -
-
-
- -Expand source code - -
@dataclass
-class TlsAlertReceivedPayload:
-    """
-    Defines the case payload type for `TLS-alert-received` above:
-    """
-    alert_id: Optional[int]
-    alert_message: Optional[str]
-
-

Defines the case payload type for TLS-alert-received above:

-

Instance variables

-
-
var alert_id : int | None
-
-
-
-
var alert_message : str | None
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_http_types_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_http_types_0_3_0_rc_2026_03_15.html deleted file mode 100644 index a988100..0000000 --- a/docs/v4/wit/imports/wasi_http_types_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,2708 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15

-
-
-

This interface defines all of the types and methods for implementing HTTP -Requests and Responses, as well as their headers, trailers, and bodies.

-
-
-
-
-

Global variables

-
-
var ErrorCode
-
- -
-
var HeaderError
-
-

This type enumerates the different kinds of errors that may occur when -setting or appending to a fields resource.

-
-
var Method
-
-

This type corresponds to HTTP standard Methods.

-
-
var RequestOptionsError
-
-

This type enumerates the different kinds of errors that may occur when -setting fields of a request-options resource.

-
-
var Scheme
-
-

This type corresponds to HTTP standard Related Schemes.

-
-
-
-
-
-
-

Classes

-
-
-class DnsErrorPayload -(rcode: str | None, info_code: int | None) -
-
-
- -Expand source code - -
@dataclass
-class DnsErrorPayload:
-    """
-    Defines the case payload type for `DNS-error` above:
-    """
-    rcode: Optional[str]
-    info_code: Optional[int]
-
-

Defines the case payload type for DNS-error above:

-

Instance variables

-
-
var info_code : int | None
-
-
-
-
var rcode : str | None
-
-
-
-
-
-
-class ErrorCode_ConfigurationError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConfigurationError:
-    pass
-
-

ErrorCode_ConfigurationError()

-
-
-class ErrorCode_ConnectionLimitReached -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionLimitReached:
-    pass
-
-

ErrorCode_ConnectionLimitReached()

-
-
-class ErrorCode_ConnectionReadTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionReadTimeout:
-    pass
-
-

ErrorCode_ConnectionReadTimeout()

-
-
-class ErrorCode_ConnectionRefused -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionRefused:
-    pass
-
-

ErrorCode_ConnectionRefused()

-
-
-class ErrorCode_ConnectionTerminated -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionTerminated:
-    pass
-
-

ErrorCode_ConnectionTerminated()

-
-
-class ErrorCode_ConnectionTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionTimeout:
-    pass
-
-

ErrorCode_ConnectionTimeout()

-
-
-class ErrorCode_ConnectionWriteTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionWriteTimeout:
-    pass
-
-

ErrorCode_ConnectionWriteTimeout()

-
-
-class ErrorCode_DestinationIpProhibited -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationIpProhibited:
-    pass
-
-

ErrorCode_DestinationIpProhibited()

-
-
-class ErrorCode_DestinationIpUnroutable -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationIpUnroutable:
-    pass
-
-

ErrorCode_DestinationIpUnroutable()

-
-
-class ErrorCode_DestinationNotFound -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationNotFound:
-    pass
-
-

ErrorCode_DestinationNotFound()

-
-
-class ErrorCode_DestinationUnavailable -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DestinationUnavailable:
-    pass
-
-

ErrorCode_DestinationUnavailable()

-
-
-class ErrorCode_DnsError -(value: DnsErrorPayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DnsError:
-    value: DnsErrorPayload
-
-

ErrorCode_DnsError(value: spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.DnsErrorPayload)

-

Instance variables

-
-
var valueDnsErrorPayload
-
-
-
-
-
-
-class ErrorCode_DnsTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DnsTimeout:
-    pass
-
-

ErrorCode_DnsTimeout()

-
-
-class ErrorCode_HttpProtocolError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpProtocolError:
-    pass
-
-

ErrorCode_HttpProtocolError()

-
-
-class ErrorCode_HttpRequestBodySize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestBodySize:
-    value: Optional[int]
-
-

ErrorCode_HttpRequestBodySize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestDenied -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestDenied:
-    pass
-
-

ErrorCode_HttpRequestDenied()

-
-
-class ErrorCode_HttpRequestHeaderSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestHeaderSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpRequestHeaderSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestHeaderSize -(value: FieldSizePayload | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestHeaderSize:
-    value: Optional[FieldSizePayload]
-
-

ErrorCode_HttpRequestHeaderSize(value: Optional[spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.FieldSizePayload])

-

Instance variables

-
-
var valueFieldSizePayload | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestLengthRequired -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestLengthRequired:
-    pass
-
-

ErrorCode_HttpRequestLengthRequired()

-
-
-class ErrorCode_HttpRequestMethodInvalid -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestMethodInvalid:
-    pass
-
-

ErrorCode_HttpRequestMethodInvalid()

-
-
-class ErrorCode_HttpRequestTrailerSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestTrailerSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpRequestTrailerSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpRequestTrailerSize -(value: FieldSizePayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestTrailerSize:
-    value: FieldSizePayload
-
-

ErrorCode_HttpRequestTrailerSize(value: spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.FieldSizePayload)

-

Instance variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCode_HttpRequestUriInvalid -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestUriInvalid:
-    pass
-
-

ErrorCode_HttpRequestUriInvalid()

-
-
-class ErrorCode_HttpRequestUriTooLong -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpRequestUriTooLong:
-    pass
-
-

ErrorCode_HttpRequestUriTooLong()

-
-
-class ErrorCode_HttpResponseBodySize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseBodySize:
-    value: Optional[int]
-
-

ErrorCode_HttpResponseBodySize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseContentCoding -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseContentCoding:
-    value: Optional[str]
-
-

ErrorCode_HttpResponseContentCoding(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseHeaderSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseHeaderSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpResponseHeaderSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseHeaderSize -(value: FieldSizePayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseHeaderSize:
-    value: FieldSizePayload
-
-

ErrorCode_HttpResponseHeaderSize(value: spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.FieldSizePayload)

-

Instance variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCode_HttpResponseIncomplete -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseIncomplete:
-    pass
-
-

ErrorCode_HttpResponseIncomplete()

-
-
-class ErrorCode_HttpResponseTimeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTimeout:
-    pass
-
-

ErrorCode_HttpResponseTimeout()

-
-
-class ErrorCode_HttpResponseTrailerSectionSize -(value: int | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTrailerSectionSize:
-    value: Optional[int]
-
-

ErrorCode_HttpResponseTrailerSectionSize(value: Optional[int])

-

Instance variables

-
-
var value : int | None
-
-
-
-
-
-
-class ErrorCode_HttpResponseTrailerSize -(value: FieldSizePayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTrailerSize:
-    value: FieldSizePayload
-
-

ErrorCode_HttpResponseTrailerSize(value: spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.FieldSizePayload)

-

Instance variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCode_HttpResponseTransferCoding -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpResponseTransferCoding:
-    value: Optional[str]
-
-

ErrorCode_HttpResponseTransferCoding(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_HttpUpgradeFailed -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_HttpUpgradeFailed:
-    pass
-
-

ErrorCode_HttpUpgradeFailed()

-
-
-class ErrorCode_InternalError -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_InternalError:
-    value: Optional[str]
-
-

ErrorCode_InternalError(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_LoopDetected -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_LoopDetected:
-    pass
-
-

ErrorCode_LoopDetected()

-
-
-class ErrorCode_TlsAlertReceived -(value: TlsAlertReceivedPayload) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TlsAlertReceived:
-    value: TlsAlertReceivedPayload
-
-

ErrorCode_TlsAlertReceived(value: spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.TlsAlertReceivedPayload)

-

Instance variables

-
-
var valueTlsAlertReceivedPayload
-
-
-
-
-
-
-class ErrorCode_TlsCertificateError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TlsCertificateError:
-    pass
-
-

ErrorCode_TlsCertificateError()

-
-
-class ErrorCode_TlsProtocolError -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TlsProtocolError:
-    pass
-
-

ErrorCode_TlsProtocolError()

-
-
-class FieldSizePayload -(field_name: str | None, field_size: int | None) -
-
-
- -Expand source code - -
@dataclass
-class FieldSizePayload:
-    """
-    Defines the case payload type for `HTTP-response-{header,trailer}-size` above:
-    """
-    field_name: Optional[str]
-    field_size: Optional[int]
-
-

Defines the case payload type for HTTP-response-{header,trailer}-size above:

-

Instance variables

-
-
var field_name : str | None
-
-
-
-
var field_size : int | None
-
-
-
-
-
-
-class Fields -
-
-
- -Expand source code - -
class Fields:
-    """
-    This following block defines the `fields` resource which corresponds to
-    HTTP standard Fields. Fields are a common representation used for both
-    Headers and Trailers.
-    
-    A `fields` may be mutable or immutable. A `fields` created using the
-    constructor, `from-list`, or `clone` will be mutable, but a `fields`
-    resource given by other means (including, but not limited to,
-    `request.headers`) might be be immutable. In an immutable fields, the
-    `set`, `append`, and `delete` operations will fail with
-    `header-error.immutable`.
-    
-    A `fields` resource should store `field-name`s and `field-value`s in their
-    original casing used to construct or mutate the `fields` resource. The `fields`
-    resource should use that original casing when serializing the fields for
-    transport or when returning them from a method.
-    
-    Implementations may impose limits on individual field values and on total
-    aggregate field section size. Operations that would exceed these limits
-    fail with `header-error.size-exceeded`
-    """
-    
-    def __init__(self) -> None:
-        """
-        Construct an empty HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def from_list(cls, entries: List[Tuple[str, bytes]]) -> Self:
-        """
-        Construct an HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        
-        The list represents each name-value pair in the Fields. Names
-        which have multiple values are represented by multiple entries in this
-        list with the same name.
-        
-        The tuple is a pair of the field name, represented as a string, and
-        Value, represented as a list of bytes. In a valid Fields, all names
-        and values are valid UTF-8 strings. However, values are not always
-        well-formed, so they are represented as a raw list of bytes.
-        
-        An error result will be returned if any header or value was
-        syntactically invalid, if a header was forbidden, or if the
-        entries would exceed an implementation size limit.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.HeaderError)`
-        """
-        raise NotImplementedError
-    def get(self, name: str) -> List[bytes]:
-        """
-        Get all of the values corresponding to a name. If the name is not present
-        in this `fields`, an empty list is returned. However, if the name is
-        present but empty, this is represented by a list with one or more
-        empty field-values present.
-        """
-        raise NotImplementedError
-    def has(self, name: str) -> bool:
-        """
-        Returns `true` when the name is present in this `fields`. If the name is
-        syntactically invalid, `false` is returned.
-        """
-        raise NotImplementedError
-    def set(self, name: str, value: List[bytes]) -> None:
-        """
-        Set all of the values for a name. Clears any existing values for that
-        name, if they have been set.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Fails with `header-error.size-exceeded` if the name or values would
-        exceed an implementation-defined size limit.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.HeaderError)`
-        """
-        raise NotImplementedError
-    def delete(self, name: str) -> None:
-        """
-        Delete all values for a name. Does nothing if no values for the name
-        exist.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.HeaderError)`
-        """
-        raise NotImplementedError
-    def get_and_delete(self, name: str) -> List[bytes]:
-        """
-        Delete all values for a name. Does nothing if no values for the name
-        exist.
-        
-        Returns all values previously corresponding to the name, if any.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.HeaderError)`
-        """
-        raise NotImplementedError
-    def append(self, name: str, value: bytes) -> None:
-        """
-        Append a value for a name. Does not change or delete any existing
-        values for that name.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Fails with `header-error.size-exceeded` if the value would exceed
-        an implementation-defined size limit.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.HeaderError)`
-        """
-        raise NotImplementedError
-    def copy_all(self) -> List[Tuple[str, bytes]]:
-        """
-        Retrieve the full set of names and values in the Fields. Like the
-        constructor, the list represents each name-value pair.
-        
-        The outer list represents each name-value pair in the Fields. Names
-        which have multiple values are represented by multiple entries in this
-        list with the same name.
-        
-        The names and values are always returned in the original casing and in
-        the order in which they will be serialized for transport.
-        """
-        raise NotImplementedError
-    def clone(self) -> Self:
-        """
-        Make a deep copy of the Fields. Equivalent in behavior to calling the
-        `fields` constructor on the return value of `copy-all`. The resulting
-        `fields` is mutable.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

This following block defines the fields resource which corresponds to -HTTP standard Fields. Fields are a common representation used for both -Headers and Trailers.

-

A fields may be mutable or immutable. A fields created using the -constructor, from-list, or clone will be mutable, but a fields -resource given by other means (including, but not limited to, -request.headers) might be be immutable. In an immutable fields, the -set, append, and delete operations will fail with -header-error.immutable.

-

A fields resource should store field-names and field-values in their -original casing used to construct or mutate the fields resource. The fields -resource should use that original casing when serializing the fields for -transport or when returning them from a method.

-

Implementations may impose limits on individual field values and on total -aggregate field section size. Operations that would exceed these limits -fail with header-error.size-exceeded

-

Construct an empty HTTP Fields.

-

The resulting fields is mutable.

-

Static methods

-
-
-def from_list(entries: List[Tuple[str, bytes]]) ‑> Self -
-
-

Construct an HTTP Fields.

-

The resulting fields is mutable.

-

The list represents each name-value pair in the Fields. Names -which have multiple values are represented by multiple entries in this -list with the same name.

-

The tuple is a pair of the field name, represented as a string, and -Value, represented as a list of bytes. In a valid Fields, all names -and values are valid UTF-8 strings. However, values are not always -well-formed, so they are represented as a raw list of bytes.

-

An error result will be returned if any header or value was -syntactically invalid, if a header was forbidden, or if the -entries would exceed an implementation size limit.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-

Methods

-
-
-def append(self, name: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
def append(self, name: str, value: bytes) -> None:
-    """
-    Append a value for a name. Does not change or delete any existing
-    values for that name.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Fails with `header-error.size-exceeded` if the value would exceed
-    an implementation-defined size limit.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Append a value for a name. Does not change or delete any existing -values for that name.

-

Fails with header-error.immutable if the fields are immutable.

-

Fails with header-error.size-exceeded if the value would exceed -an implementation-defined size limit.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-def clone(self) ‑> Self -
-
-
- -Expand source code - -
def clone(self) -> Self:
-    """
-    Make a deep copy of the Fields. Equivalent in behavior to calling the
-    `fields` constructor on the return value of `copy-all`. The resulting
-    `fields` is mutable.
-    """
-    raise NotImplementedError
-
-

Make a deep copy of the Fields. Equivalent in behavior to calling the -fields constructor on the return value of copy-all. The resulting -fields is mutable.

-
-
-def copy_all(self) ‑> List[Tuple[str, bytes]] -
-
-
- -Expand source code - -
def copy_all(self) -> List[Tuple[str, bytes]]:
-    """
-    Retrieve the full set of names and values in the Fields. Like the
-    constructor, the list represents each name-value pair.
-    
-    The outer list represents each name-value pair in the Fields. Names
-    which have multiple values are represented by multiple entries in this
-    list with the same name.
-    
-    The names and values are always returned in the original casing and in
-    the order in which they will be serialized for transport.
-    """
-    raise NotImplementedError
-
-

Retrieve the full set of names and values in the Fields. Like the -constructor, the list represents each name-value pair.

-

The outer list represents each name-value pair in the Fields. Names -which have multiple values are represented by multiple entries in this -list with the same name.

-

The names and values are always returned in the original casing and in -the order in which they will be serialized for transport.

-
-
-def delete(self, name: str) ‑> None -
-
-
- -Expand source code - -
def delete(self, name: str) -> None:
-    """
-    Delete all values for a name. Does nothing if no values for the name
-    exist.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Delete all values for a name. Does nothing if no values for the name -exist.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-def get(self, name: str) ‑> List[bytes] -
-
-
- -Expand source code - -
def get(self, name: str) -> List[bytes]:
-    """
-    Get all of the values corresponding to a name. If the name is not present
-    in this `fields`, an empty list is returned. However, if the name is
-    present but empty, this is represented by a list with one or more
-    empty field-values present.
-    """
-    raise NotImplementedError
-
-

Get all of the values corresponding to a name. If the name is not present -in this fields, an empty list is returned. However, if the name is -present but empty, this is represented by a list with one or more -empty field-values present.

-
-
-def get_and_delete(self, name: str) ‑> List[bytes] -
-
-
- -Expand source code - -
def get_and_delete(self, name: str) -> List[bytes]:
-    """
-    Delete all values for a name. Does nothing if no values for the name
-    exist.
-    
-    Returns all values previously corresponding to the name, if any.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Delete all values for a name. Does nothing if no values for the name -exist.

-

Returns all values previously corresponding to the name, if any.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-def has(self, name: str) ‑> bool -
-
-
- -Expand source code - -
def has(self, name: str) -> bool:
-    """
-    Returns `true` when the name is present in this `fields`. If the name is
-    syntactically invalid, `false` is returned.
-    """
-    raise NotImplementedError
-
-

Returns true when the name is present in this fields. If the name is -syntactically invalid, false is returned.

-
-
-def set(self, name: str, value: List[bytes]) ‑> None -
-
-
- -Expand source code - -
def set(self, name: str, value: List[bytes]) -> None:
-    """
-    Set all of the values for a name. Clears any existing values for that
-    name, if they have been set.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Fails with `header-error.size-exceeded` if the name or values would
-    exceed an implementation-defined size limit.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.HeaderError)`
-    """
-    raise NotImplementedError
-
-

Set all of the values for a name. Clears any existing values for that -name, if they have been set.

-

Fails with header-error.immutable if the fields are immutable.

-

Fails with header-error.size-exceeded if the name or values would -exceed an implementation-defined size limit.

-

Raises: componentize_py_types.Err(HeaderError)

-
-
-
-
-class HeaderError_Forbidden -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_Forbidden:
-    pass
-
-

HeaderError_Forbidden()

-
-
-class HeaderError_Immutable -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_Immutable:
-    pass
-
-

HeaderError_Immutable()

-
-
-class HeaderError_InvalidSyntax -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_InvalidSyntax:
-    pass
-
-

HeaderError_InvalidSyntax()

-
-
-class HeaderError_Other -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_Other:
-    value: Optional[str]
-
-

HeaderError_Other(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class HeaderError_SizeExceeded -
-
-
- -Expand source code - -
@dataclass
-class HeaderError_SizeExceeded:
-    pass
-
-

HeaderError_SizeExceeded()

-
-
-class Method_Connect -
-
-
- -Expand source code - -
@dataclass
-class Method_Connect:
-    pass
-
-

Method_Connect()

-
-
-class Method_Delete -
-
-
- -Expand source code - -
@dataclass
-class Method_Delete:
-    pass
-
-

Method_Delete()

-
-
-class Method_Get -
-
-
- -Expand source code - -
@dataclass
-class Method_Get:
-    pass
-
-

Method_Get()

-
-
-class Method_Head -
-
-
- -Expand source code - -
@dataclass
-class Method_Head:
-    pass
-
-

Method_Head()

-
-
-class Method_Options -
-
-
- -Expand source code - -
@dataclass
-class Method_Options:
-    pass
-
-

Method_Options()

-
-
-class Method_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Method_Other:
-    value: str
-
-

Method_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class Method_Patch -
-
-
- -Expand source code - -
@dataclass
-class Method_Patch:
-    pass
-
-

Method_Patch()

-
-
-class Method_Post -
-
-
- -Expand source code - -
@dataclass
-class Method_Post:
-    pass
-
-

Method_Post()

-
-
-class Method_Put -
-
-
- -Expand source code - -
@dataclass
-class Method_Put:
-    pass
-
-

Method_Put()

-
-
-class Method_Trace -
-
-
- -Expand source code - -
@dataclass
-class Method_Trace:
-    pass
-
-

Method_Trace()

-
-
-class Request -
-
-
- -Expand source code - -
class Request:
-    """
-    Represents an HTTP Request.
-    """
-    
-    @classmethod
-    def new(cls, headers: Fields, contents: Optional[ByteStreamReader], trailers: FutureReader[Result[Optional[Fields], ErrorCode]], options: Optional[RequestOptions]) -> Tuple[Self, FutureReader[Result[None, ErrorCode]]]:
-        """
-        Construct a new `request` with a default `method` of `GET`, and
-        `none` values for `path-with-query`, `scheme`, and `authority`.
-        
-        `headers` is the HTTP Headers for the Request.
-        
-        `contents` is the optional body content stream with `none`
-        representing a zero-length content stream.
-        Once it is closed, `trailers` future must resolve to a result.
-        If `trailers` resolves to an error, underlying connection
-        will be closed immediately.
-        
-        `options` is optional `request-options` resource to be used
-        if the request is sent over a network connection.
-        
-        It is possible to construct, or manipulate with the accessor functions
-        below, a `request` with an invalid combination of `scheme`
-        and `authority`, or `headers` which are not permitted to be sent.
-        It is the obligation of the `handler.handle` implementation
-        to reject invalid constructions of `request`.
-        
-        The returned future resolves to result of transmission of this request.
-        """
-        raise NotImplementedError
-    def get_method(self) -> Method:
-        """
-        Get the Method for the Request.
-        """
-        raise NotImplementedError
-    def set_method(self, method: Method) -> None:
-        """
-        Set the Method for the Request. Fails if the string present in a
-        `method.other` argument is not a syntactically valid method.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def get_path_with_query(self) -> Optional[str]:
-        """
-        Get the combination of the HTTP Path and Query for the Request.  When
-        `none`, this represents an empty Path and empty Query.
-        """
-        raise NotImplementedError
-    def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-        """
-        Set the combination of the HTTP Path and Query for the Request.  When
-        `none`, this represents an empty Path and empty Query. Fails is the
-        string given is not a syntactically valid path and query uri component.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def get_scheme(self) -> Optional[Scheme]:
-        """
-        Get the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme.
-        """
-        raise NotImplementedError
-    def set_scheme(self, scheme: Optional[Scheme]) -> None:
-        """
-        Set the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme. Fails if the
-        string given is not a syntactically valid uri scheme.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def get_authority(self) -> Optional[str]:
-        """
-        Get the authority of the Request's target URI. A value of `none` may be used
-        with Related Schemes which do not require an authority. The HTTP and
-        HTTPS schemes always require an authority.
-        """
-        raise NotImplementedError
-    def set_authority(self, authority: Optional[str]) -> None:
-        """
-        Set the authority of the Request's target URI. A value of `none` may be used
-        with Related Schemes which do not require an authority. The HTTP and
-        HTTPS schemes always require an authority. Fails if the string given is
-        not a syntactically valid URI authority.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def get_options(self) -> Optional[RequestOptions]:
-        """
-        Get the `request-options` to be associated with this request
-        
-        The returned `request-options` resource is immutable: `set-*` operations
-        will fail if invoked.
-        
-        This `request-options` resource is a child: it must be dropped before
-        the parent `request` is dropped, or its ownership is transferred to
-        another component by e.g. `handler.handle`.
-        """
-        raise NotImplementedError
-    def get_headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        """
-        raise NotImplementedError
-    @classmethod
-    def consume_body(cls, this: Self, res: FutureReader[Result[None, ErrorCode]]) -> Tuple[ByteStreamReader, FutureReader[Result[Optional[Fields], ErrorCode]]]:
-        """
-        Get body of the Request.
-        
-        Stream returned by this method represents the contents of the body.
-        Once the stream is reported as closed, callers should await the returned
-        future to determine whether the body was received successfully.
-        The future will only resolve after the stream is reported as closed.
-        
-        This function takes a `res` future as a parameter, which can be used to
-        communicate an error in handling of the request.
-        
-        Note that function will move the `request`, but references to headers or
-        request options acquired from it previously will remain valid.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an HTTP Request.

-

Static methods

-
-
-def consume_body(this: Self,
res: componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]]) ‑> Tuple[componentize_py_async_support.streams.ByteStreamReader, componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[Fields | None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]]]
-
-
-

Get body of the Request.

-

Stream returned by this method represents the contents of the body. -Once the stream is reported as closed, callers should await the returned -future to determine whether the body was received successfully. -The future will only resolve after the stream is reported as closed.

-

This function takes a res future as a parameter, which can be used to -communicate an error in handling of the request.

-

Note that function will move the request, but references to headers or -request options acquired from it previously will remain valid.

-
-
-def new(headers: Fields,
contents: componentize_py_async_support.streams.ByteStreamReader | None,
trailers: componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[Fields | None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]],
options: RequestOptions | None) ‑> Tuple[Self, componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]]]
-
-
-

Construct a new request with a default method of GET, and -none values for path-with-query, scheme, and authority.

-

headers is the HTTP Headers for the Request.

-

contents is the optional body content stream with none -representing a zero-length content stream. -Once it is closed, trailers future must resolve to a result. -If trailers resolves to an error, underlying connection -will be closed immediately.

-

options is optional request-options resource to be used -if the request is sent over a network connection.

-

It is possible to construct, or manipulate with the accessor functions -below, a request with an invalid combination of scheme -and authority, or headers which are not permitted to be sent. -It is the obligation of the handler.handle implementation -to reject invalid constructions of request.

-

The returned future resolves to result of transmission of this request.

-
-
-

Methods

-
-
-def get_authority(self) ‑> str | None -
-
-
- -Expand source code - -
def get_authority(self) -> Optional[str]:
-    """
-    Get the authority of the Request's target URI. A value of `none` may be used
-    with Related Schemes which do not require an authority. The HTTP and
-    HTTPS schemes always require an authority.
-    """
-    raise NotImplementedError
-
-

Get the authority of the Request's target URI. A value of none may be used -with Related Schemes which do not require an authority. The HTTP and -HTTPS schemes always require an authority.

-
-
-def get_headers(self) ‑> Fields -
-
-
- -Expand source code - -
def get_headers(self) -> Fields:
-    """
-    Get the headers associated with the Request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    """
-    raise NotImplementedError
-
-

Get the headers associated with the Request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-
-
-def get_method(self) ‑> Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other -
-
-
- -Expand source code - -
def get_method(self) -> Method:
-    """
-    Get the Method for the Request.
-    """
-    raise NotImplementedError
-
-

Get the Method for the Request.

-
-
-def get_options(self) ‑> RequestOptions | None -
-
-
- -Expand source code - -
def get_options(self) -> Optional[RequestOptions]:
-    """
-    Get the `request-options` to be associated with this request
-    
-    The returned `request-options` resource is immutable: `set-*` operations
-    will fail if invoked.
-    
-    This `request-options` resource is a child: it must be dropped before
-    the parent `request` is dropped, or its ownership is transferred to
-    another component by e.g. `handler.handle`.
-    """
-    raise NotImplementedError
-
-

Get the request-options to be associated with this request

-

The returned request-options resource is immutable: set-* operations -will fail if invoked.

-

This request-options resource is a child: it must be dropped before -the parent request is dropped, or its ownership is transferred to -another component by e.g. handler.handle.

-
-
-def get_path_with_query(self) ‑> str | None -
-
-
- -Expand source code - -
def get_path_with_query(self) -> Optional[str]:
-    """
-    Get the combination of the HTTP Path and Query for the Request.  When
-    `none`, this represents an empty Path and empty Query.
-    """
-    raise NotImplementedError
-
-

Get the combination of the HTTP Path and Query for the Request. -When -none, this represents an empty Path and empty Query.

-
-
-def get_scheme(self) ‑> Scheme_Http | Scheme_Https | Scheme_Other | None -
-
-
- -Expand source code - -
def get_scheme(self) -> Optional[Scheme]:
-    """
-    Get the HTTP Related Scheme for the Request. When `none`, the
-    implementation may choose an appropriate default scheme.
-    """
-    raise NotImplementedError
-
-

Get the HTTP Related Scheme for the Request. When none, the -implementation may choose an appropriate default scheme.

-
-
-def set_authority(self, authority: str | None) ‑> None -
-
-
- -Expand source code - -
def set_authority(self, authority: Optional[str]) -> None:
-    """
-    Set the authority of the Request's target URI. A value of `none` may be used
-    with Related Schemes which do not require an authority. The HTTP and
-    HTTPS schemes always require an authority. Fails if the string given is
-    not a syntactically valid URI authority.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the authority of the Request's target URI. A value of none may be used -with Related Schemes which do not require an authority. The HTTP and -HTTPS schemes always require an authority. Fails if the string given is -not a syntactically valid URI authority.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_method(self,
method: Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other) ‑> None
-
-
-
- -Expand source code - -
def set_method(self, method: Method) -> None:
-    """
-    Set the Method for the Request. Fails if the string present in a
-    `method.other` argument is not a syntactically valid method.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the Method for the Request. Fails if the string present in a -method.other argument is not a syntactically valid method.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_path_with_query(self, path_with_query: str | None) ‑> None -
-
-
- -Expand source code - -
def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-    """
-    Set the combination of the HTTP Path and Query for the Request.  When
-    `none`, this represents an empty Path and empty Query. Fails is the
-    string given is not a syntactically valid path and query uri component.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the combination of the HTTP Path and Query for the Request. -When -none, this represents an empty Path and empty Query. Fails is the -string given is not a syntactically valid path and query uri component.

-

Raises: componentize_py_types.Err(None)

-
-
-def set_scheme(self,
scheme: Scheme_Http | Scheme_Https | Scheme_Other | None) ‑> None
-
-
-
- -Expand source code - -
def set_scheme(self, scheme: Optional[Scheme]) -> None:
-    """
-    Set the HTTP Related Scheme for the Request. When `none`, the
-    implementation may choose an appropriate default scheme. Fails if the
-    string given is not a syntactically valid uri scheme.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the HTTP Related Scheme for the Request. When none, the -implementation may choose an appropriate default scheme. Fails if the -string given is not a syntactically valid uri scheme.

-

Raises: componentize_py_types.Err(None)

-
-
-
-
-class RequestOptions -
-
-
- -Expand source code - -
class RequestOptions:
-    """
-    Parameters for making an HTTP Request. Each of these parameters is
-    currently an optional timeout applicable to the transport layer of the
-    HTTP protocol.
-    
-    These timeouts are separate from any the user may use to bound an
-    asynchronous call.
-    """
-    
-    def __init__(self) -> None:
-        """
-        Construct a default `request-options` value.
-        """
-        raise NotImplementedError
-
-    def get_connect_timeout(self) -> Optional[int]:
-        """
-        The timeout for the initial connect to the HTTP Server.
-        """
-        raise NotImplementedError
-    def set_connect_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for the initial connect to the HTTP Server. An error
-        return value indicates that this timeout is not supported or that this
-        handle is immutable.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.RequestOptionsError)`
-        """
-        raise NotImplementedError
-    def get_first_byte_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving the first byte of the Response body.
-        """
-        raise NotImplementedError
-    def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving the first byte of the Response body. An
-        error return value indicates that this timeout is not supported or that
-        this handle is immutable.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.RequestOptionsError)`
-        """
-        raise NotImplementedError
-    def get_between_bytes_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving subsequent chunks of bytes in the Response
-        body stream.
-        """
-        raise NotImplementedError
-    def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving subsequent chunks of bytes in the Response
-        body stream. An error return value indicates that this timeout is not
-        supported or that this handle is immutable.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.RequestOptionsError)`
-        """
-        raise NotImplementedError
-    def clone(self) -> Self:
-        """
-        Make a deep copy of the `request-options`.
-        The resulting `request-options` is mutable.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Parameters for making an HTTP Request. Each of these parameters is -currently an optional timeout applicable to the transport layer of the -HTTP protocol.

-

These timeouts are separate from any the user may use to bound an -asynchronous call.

-

Construct a default request-options value.

-

Methods

-
-
-def clone(self) ‑> Self -
-
-
- -Expand source code - -
def clone(self) -> Self:
-    """
-    Make a deep copy of the `request-options`.
-    The resulting `request-options` is mutable.
-    """
-    raise NotImplementedError
-
-

Make a deep copy of the request-options. -The resulting request-options is mutable.

-
-
-def get_between_bytes_timeout(self) ‑> int | None -
-
-
- -Expand source code - -
def get_between_bytes_timeout(self) -> Optional[int]:
-    """
-    The timeout for receiving subsequent chunks of bytes in the Response
-    body stream.
-    """
-    raise NotImplementedError
-
-

The timeout for receiving subsequent chunks of bytes in the Response -body stream.

-
-
-def get_connect_timeout(self) ‑> int | None -
-
-
- -Expand source code - -
def get_connect_timeout(self) -> Optional[int]:
-    """
-    The timeout for the initial connect to the HTTP Server.
-    """
-    raise NotImplementedError
-
-

The timeout for the initial connect to the HTTP Server.

-
-
-def get_first_byte_timeout(self) ‑> int | None -
-
-
- -Expand source code - -
def get_first_byte_timeout(self) -> Optional[int]:
-    """
-    The timeout for receiving the first byte of the Response body.
-    """
-    raise NotImplementedError
-
-

The timeout for receiving the first byte of the Response body.

-
-
-def set_between_bytes_timeout(self, duration: int | None) ‑> None -
-
-
- -Expand source code - -
def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for receiving subsequent chunks of bytes in the Response
-    body stream. An error return value indicates that this timeout is not
-    supported or that this handle is immutable.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.RequestOptionsError)`
-    """
-    raise NotImplementedError
-
-

Set the timeout for receiving subsequent chunks of bytes in the Response -body stream. An error return value indicates that this timeout is not -supported or that this handle is immutable.

-

Raises: componentize_py_types.Err(RequestOptionsError)

-
-
-def set_connect_timeout(self, duration: int | None) ‑> None -
-
-
- -Expand source code - -
def set_connect_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for the initial connect to the HTTP Server. An error
-    return value indicates that this timeout is not supported or that this
-    handle is immutable.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.RequestOptionsError)`
-    """
-    raise NotImplementedError
-
-

Set the timeout for the initial connect to the HTTP Server. An error -return value indicates that this timeout is not supported or that this -handle is immutable.

-

Raises: componentize_py_types.Err(RequestOptionsError)

-
-
-def set_first_byte_timeout(self, duration: int | None) ‑> None -
-
-
- -Expand source code - -
def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for receiving the first byte of the Response body. An
-    error return value indicates that this timeout is not supported or that
-    this handle is immutable.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.RequestOptionsError)`
-    """
-    raise NotImplementedError
-
-

Set the timeout for receiving the first byte of the Response body. An -error return value indicates that this timeout is not supported or that -this handle is immutable.

-

Raises: componentize_py_types.Err(RequestOptionsError)

-
-
-
-
-class RequestOptionsError_Immutable -
-
-
- -Expand source code - -
@dataclass
-class RequestOptionsError_Immutable:
-    pass
-
-

RequestOptionsError_Immutable()

-
-
-class RequestOptionsError_NotSupported -
-
-
- -Expand source code - -
@dataclass
-class RequestOptionsError_NotSupported:
-    pass
-
-

RequestOptionsError_NotSupported()

-
-
-class RequestOptionsError_Other -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class RequestOptionsError_Other:
-    value: Optional[str]
-
-

RequestOptionsError_Other(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class Response -
-
-
- -Expand source code - -
class Response:
-    """
-    Represents an HTTP Response.
-    """
-    
-    @classmethod
-    def new(cls, headers: Fields, contents: Optional[ByteStreamReader], trailers: FutureReader[Result[Optional[Fields], ErrorCode]]) -> Tuple[Self, FutureReader[Result[None, ErrorCode]]]:
-        """
-        Construct a new `response`, with a default `status-code` of `200`.
-        If a different `status-code` is needed, it must be set via the
-        `set-status-code` method.
-        
-        `headers` is the HTTP Headers for the Response.
-        
-        `contents` is the optional body content stream with `none`
-        representing a zero-length content stream.
-        Once it is closed, `trailers` future must resolve to a result.
-        If `trailers` resolves to an error, underlying connection
-        will be closed immediately.
-        
-        The returned future resolves to result of transmission of this response.
-        """
-        raise NotImplementedError
-    def get_status_code(self) -> int:
-        """
-        Get the HTTP Status Code for the Response.
-        """
-        raise NotImplementedError
-    def set_status_code(self, status_code: int) -> None:
-        """
-        Set the HTTP Status Code for the Response. Fails if the status-code
-        given is not a valid http status code.
-        
-        Raises: `componentize_py_types.Err(None)`
-        """
-        raise NotImplementedError
-    def get_headers(self) -> Fields:
-        """
-        Get the headers associated with the Response.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        """
-        raise NotImplementedError
-    @classmethod
-    def consume_body(cls, this: Self, res: FutureReader[Result[None, ErrorCode]]) -> Tuple[ByteStreamReader, FutureReader[Result[Optional[Fields], ErrorCode]]]:
-        """
-        Get body of the Response.
-        
-        Stream returned by this method represents the contents of the body.
-        Once the stream is reported as closed, callers should await the returned
-        future to determine whether the body was received successfully.
-        The future will only resolve after the stream is reported as closed.
-        
-        This function takes a `res` future as a parameter, which can be used to
-        communicate an error in handling of the response.
-        
-        Note that function will move the `response`, but references to headers
-        acquired from it previously will remain valid.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Represents an HTTP Response.

-

Static methods

-
-
-def consume_body(this: Self,
res: componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]]) ‑> Tuple[componentize_py_async_support.streams.ByteStreamReader, componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[Fields | None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]]]
-
-
-

Get body of the Response.

-

Stream returned by this method represents the contents of the body. -Once the stream is reported as closed, callers should await the returned -future to determine whether the body was received successfully. -The future will only resolve after the stream is reported as closed.

-

This function takes a res future as a parameter, which can be used to -communicate an error in handling of the response.

-

Note that function will move the response, but references to headers -acquired from it previously will remain valid.

-
-
-def new(headers: Fields,
contents: componentize_py_async_support.streams.ByteStreamReader | None,
trailers: componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[Fields | None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]]) ‑> Tuple[Self, componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]]]
-
-
-

Construct a new response, with a default status-code of 200. -If a different status-code is needed, it must be set via the -set-status-code method.

-

headers is the HTTP Headers for the Response.

-

contents is the optional body content stream with none -representing a zero-length content stream. -Once it is closed, trailers future must resolve to a result. -If trailers resolves to an error, underlying connection -will be closed immediately.

-

The returned future resolves to result of transmission of this response.

-
-
-

Methods

-
-
-def get_headers(self) ‑> Fields -
-
-
- -Expand source code - -
def get_headers(self) -> Fields:
-    """
-    Get the headers associated with the Response.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    """
-    raise NotImplementedError
-
-

Get the headers associated with the Response.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-
-
-def get_status_code(self) ‑> int -
-
-
- -Expand source code - -
def get_status_code(self) -> int:
-    """
-    Get the HTTP Status Code for the Response.
-    """
-    raise NotImplementedError
-
-

Get the HTTP Status Code for the Response.

-
-
-def set_status_code(self, status_code: int) ‑> None -
-
-
- -Expand source code - -
def set_status_code(self, status_code: int) -> None:
-    """
-    Set the HTTP Status Code for the Response. Fails if the status-code
-    given is not a valid http status code.
-    
-    Raises: `componentize_py_types.Err(None)`
-    """
-    raise NotImplementedError
-
-

Set the HTTP Status Code for the Response. Fails if the status-code -given is not a valid http status code.

-

Raises: componentize_py_types.Err(None)

-
-
-
-
-class Scheme_Http -
-
-
- -Expand source code - -
@dataclass
-class Scheme_Http:
-    pass
-
-

Scheme_Http()

-
-
-class Scheme_Https -
-
-
- -Expand source code - -
@dataclass
-class Scheme_Https:
-    pass
-
-

Scheme_Https()

-
-
-class Scheme_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Scheme_Other:
-    value: str
-
-

Scheme_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class TlsAlertReceivedPayload -(alert_id: int | None, alert_message: str | None) -
-
-
- -Expand source code - -
@dataclass
-class TlsAlertReceivedPayload:
-    """
-    Defines the case payload type for `TLS-alert-received` above:
-    """
-    alert_id: Optional[int]
-    alert_message: Optional[str]
-
-

Defines the case payload type for TLS-alert-received above:

-

Instance variables

-
-
var alert_id : int | None
-
-
-
-
var alert_message : str | None
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_io_error_0_2_0.html b/docs/v4/wit/imports/wasi_io_error_0_2_0.html deleted file mode 100644 index 4e84bde..0000000 --- a/docs/v4/wit/imports/wasi_io_error_0_2_0.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_io_error_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_io_error_0_2_0

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Error -
-
-
- -Expand source code - -
class Error:
-    """
-    A resource which represents some error information.
-    
-    The only method provided by this resource is `to-debug-string`,
-    which provides some human-readable information about the error.
-    
-    In the `wasi:io` package, this resource is returned through the
-    `wasi:io/streams/stream-error` type.
-    
-    To provide more specific error information, other interfaces may
-    provide functions to further "downcast" this error into more specific
-    error information. For example, `error`s returned in streams derived
-    from filesystem types to be described using the filesystem's own
-    error-code type, using the function
-    `wasi:filesystem/types/filesystem-error-code`, which takes a parameter
-    `borrow<error>` and returns
-    `option<wasi:filesystem/types/error-code>`.
-    
-    The set of functions which can "downcast" an `error` into a more
-    concrete type is open.
-    """
-    
-    def to_debug_string(self) -> str:
-        """
-        Returns a string that is suitable to assist humans in debugging
-        this error.
-        
-        WARNING: The returned string should not be consumed mechanically!
-        It may change across platforms, hosts, or other implementation
-        details. Parsing this string is a major platform-compatibility
-        hazard.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A resource which represents some error information.

-

The only method provided by this resource is to-debug-string, -which provides some human-readable information about the error.

-

In the wasi:io package, this resource is returned through the -wasi:io/streams/stream-error type.

-

To provide more specific error information, other interfaces may -provide functions to further "downcast" this error into more specific -error information. For example, errors returned in streams derived -from filesystem types to be described using the filesystem's own -error-code type, using the function -wasi:filesystem/types/filesystem-error-code, which takes a parameter -borrow<error> and returns -option<wasi:filesystem/types/error-code>.

-

The set of functions which can "downcast" an error into a more -concrete type is open.

-

Methods

-
-
-def to_debug_string(self) ‑> str -
-
-
- -Expand source code - -
def to_debug_string(self) -> str:
-    """
-    Returns a string that is suitable to assist humans in debugging
-    this error.
-    
-    WARNING: The returned string should not be consumed mechanically!
-    It may change across platforms, hosts, or other implementation
-    details. Parsing this string is a major platform-compatibility
-    hazard.
-    """
-    raise NotImplementedError
-
-

Returns a string that is suitable to assist humans in debugging -this error.

-

WARNING: The returned string should not be consumed mechanically! -It may change across platforms, hosts, or other implementation -details. Parsing this string is a major platform-compatibility -hazard.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_io_error_0_2_6.html b/docs/v4/wit/imports/wasi_io_error_0_2_6.html deleted file mode 100644 index 71a3b3c..0000000 --- a/docs/v4/wit/imports/wasi_io_error_0_2_6.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_io_error_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_io_error_0_2_6

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Error -
-
-
- -Expand source code - -
class Error:
-    """
-    A resource which represents some error information.
-    
-    The only method provided by this resource is `to-debug-string`,
-    which provides some human-readable information about the error.
-    
-    In the `wasi:io` package, this resource is returned through the
-    `wasi:io/streams/stream-error` type.
-    
-    To provide more specific error information, other interfaces may
-    offer functions to "downcast" this error into more specific types. For example,
-    errors returned from streams derived from filesystem types can be described using
-    the filesystem's own error-code type. This is done using the function
-    `wasi:filesystem/types/filesystem-error-code`, which takes a `borrow<error>`
-    parameter and returns an `option<wasi:filesystem/types/error-code>`.
-    
-    The set of functions which can "downcast" an `error` into a more
-    concrete type is open.
-    """
-    
-    def to_debug_string(self) -> str:
-        """
-        Returns a string that is suitable to assist humans in debugging
-        this error.
-        
-        WARNING: The returned string should not be consumed mechanically!
-        It may change across platforms, hosts, or other implementation
-        details. Parsing this string is a major platform-compatibility
-        hazard.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A resource which represents some error information.

-

The only method provided by this resource is to-debug-string, -which provides some human-readable information about the error.

-

In the wasi:io package, this resource is returned through the -wasi:io/streams/stream-error type.

-

To provide more specific error information, other interfaces may -offer functions to "downcast" this error into more specific types. For example, -errors returned from streams derived from filesystem types can be described using -the filesystem's own error-code type. This is done using the function -wasi:filesystem/types/filesystem-error-code, which takes a borrow<error> -parameter and returns an option<wasi:filesystem/types/error-code>.

-

The set of functions which can "downcast" an error into a more -concrete type is open.

-

Methods

-
-
-def to_debug_string(self) ‑> str -
-
-
- -Expand source code - -
def to_debug_string(self) -> str:
-    """
-    Returns a string that is suitable to assist humans in debugging
-    this error.
-    
-    WARNING: The returned string should not be consumed mechanically!
-    It may change across platforms, hosts, or other implementation
-    details. Parsing this string is a major platform-compatibility
-    hazard.
-    """
-    raise NotImplementedError
-
-

Returns a string that is suitable to assist humans in debugging -this error.

-

WARNING: The returned string should not be consumed mechanically! -It may change across platforms, hosts, or other implementation -details. Parsing this string is a major platform-compatibility -hazard.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_io_poll_0_2_0.html b/docs/v4/wit/imports/wasi_io_poll_0_2_0.html deleted file mode 100644 index 7fb4292..0000000 --- a/docs/v4/wit/imports/wasi_io_poll_0_2_0.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_io_poll_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_io_poll_0_2_0

-
-
-

A poll API intended to let users wait for I/O events on multiple handles -at once.

-
-
-
-
-
-
-

Functions

-
-
-def poll(in_: List[Pollable]) ‑> List[int] -
-
-
- -Expand source code - -
def poll(in_: List[Pollable]) -> List[int]:
-    """
-    Poll for completion on a set of pollables.
-    
-    This function takes a list of pollables, which identify I/O sources of
-    interest, and waits until one or more of the events is ready for I/O.
-    
-    The result `list<u32>` contains one or more indices of handles in the
-    argument list that is ready for I/O.
-    
-    If the list contains more elements than can be indexed with a `u32`
-    value, this function traps.
-    
-    A timeout can be implemented by adding a pollable from the
-    wasi-clocks API to the list.
-    
-    This function does not return a `result`; polling in itself does not
-    do any I/O so it doesn't fail. If any of the I/O sources identified by
-    the pollables has an error, it is indicated by marking the source as
-    being reaedy for I/O.
-    """
-    raise NotImplementedError
-
-

Poll for completion on a set of pollables.

-

This function takes a list of pollables, which identify I/O sources of -interest, and waits until one or more of the events is ready for I/O.

-

The result list<u32> contains one or more indices of handles in the -argument list that is ready for I/O.

-

If the list contains more elements than can be indexed with a u32 -value, this function traps.

-

A timeout can be implemented by adding a pollable from the -wasi-clocks API to the list.

-

This function does not return a result; polling in itself does not -do any I/O so it doesn't fail. If any of the I/O sources identified by -the pollables has an error, it is indicated by marking the source as -being reaedy for I/O.

-
-
-
-
-

Classes

-
-
-class Pollable -
-
-
- -Expand source code - -
class Pollable:
-    """
-    `pollable` represents a single I/O event which may be ready, or not.
-    """
-    
-    def ready(self) -> bool:
-        """
-        Return the readiness of a pollable. This function never blocks.
-        
-        Returns `true` when the pollable is ready, and `false` otherwise.
-        """
-        raise NotImplementedError
-    def block(self) -> None:
-        """
-        `block` returns immediately if the pollable is ready, and otherwise
-        blocks until ready.
-        
-        This function is equivalent to calling `poll.poll` on a list
-        containing only this pollable.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

pollable represents a single I/O event which may be ready, or not.

-

Methods

-
-
-def block(self) ‑> None -
-
-
- -Expand source code - -
def block(self) -> None:
-    """
-    `block` returns immediately if the pollable is ready, and otherwise
-    blocks until ready.
-    
-    This function is equivalent to calling `poll.poll` on a list
-    containing only this pollable.
-    """
-    raise NotImplementedError
-
-

block returns immediately if the pollable is ready, and otherwise -blocks until ready.

-

This function is equivalent to calling poll.poll on a list -containing only this pollable.

-
-
-def ready(self) ‑> bool -
-
-
- -Expand source code - -
def ready(self) -> bool:
-    """
-    Return the readiness of a pollable. This function never blocks.
-    
-    Returns `true` when the pollable is ready, and `false` otherwise.
-    """
-    raise NotImplementedError
-
-

Return the readiness of a pollable. This function never blocks.

-

Returns true when the pollable is ready, and false otherwise.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_io_poll_0_2_6.html b/docs/v4/wit/imports/wasi_io_poll_0_2_6.html deleted file mode 100644 index 493c01a..0000000 --- a/docs/v4/wit/imports/wasi_io_poll_0_2_6.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_io_poll_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_io_poll_0_2_6

-
-
-

A poll API intended to let users wait for I/O events on multiple handles -at once.

-
-
-
-
-
-
-

Functions

-
-
-def poll(in_: List[Pollable]) ‑> List[int] -
-
-
- -Expand source code - -
def poll(in_: List[Pollable]) -> List[int]:
-    """
-    Poll for completion on a set of pollables.
-    
-    This function takes a list of pollables, which identify I/O sources of
-    interest, and waits until one or more of the events is ready for I/O.
-    
-    The result `list<u32>` contains one or more indices of handles in the
-    argument list that is ready for I/O.
-    
-    This function traps if either:
-    - the list is empty, or:
-    - the list contains more elements than can be indexed with a `u32` value.
-    
-    A timeout can be implemented by adding a pollable from the
-    wasi-clocks API to the list.
-    
-    This function does not return a `result`; polling in itself does not
-    do any I/O so it doesn't fail. If any of the I/O sources identified by
-    the pollables has an error, it is indicated by marking the source as
-    being ready for I/O.
-    """
-    raise NotImplementedError
-
-

Poll for completion on a set of pollables.

-

This function takes a list of pollables, which identify I/O sources of -interest, and waits until one or more of the events is ready for I/O.

-

The result list<u32> contains one or more indices of handles in the -argument list that is ready for I/O.

-

This function traps if either: -- the list is empty, or: -- the list contains more elements than can be indexed with a u32 value.

-

A timeout can be implemented by adding a pollable from the -wasi-clocks API to the list.

-

This function does not return a result; polling in itself does not -do any I/O so it doesn't fail. If any of the I/O sources identified by -the pollables has an error, it is indicated by marking the source as -being ready for I/O.

-
-
-
-
-

Classes

-
-
-class Pollable -
-
-
- -Expand source code - -
class Pollable:
-    """
-    `pollable` represents a single I/O event which may be ready, or not.
-    """
-    
-    def ready(self) -> bool:
-        """
-        Return the readiness of a pollable. This function never blocks.
-        
-        Returns `true` when the pollable is ready, and `false` otherwise.
-        """
-        raise NotImplementedError
-    def block(self) -> None:
-        """
-        `block` returns immediately if the pollable is ready, and otherwise
-        blocks until ready.
-        
-        This function is equivalent to calling `poll.poll` on a list
-        containing only this pollable.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

pollable represents a single I/O event which may be ready, or not.

-

Methods

-
-
-def block(self) ‑> None -
-
-
- -Expand source code - -
def block(self) -> None:
-    """
-    `block` returns immediately if the pollable is ready, and otherwise
-    blocks until ready.
-    
-    This function is equivalent to calling `poll.poll` on a list
-    containing only this pollable.
-    """
-    raise NotImplementedError
-
-

block returns immediately if the pollable is ready, and otherwise -blocks until ready.

-

This function is equivalent to calling poll.poll on a list -containing only this pollable.

-
-
-def ready(self) ‑> bool -
-
-
- -Expand source code - -
def ready(self) -> bool:
-    """
-    Return the readiness of a pollable. This function never blocks.
-    
-    Returns `true` when the pollable is ready, and `false` otherwise.
-    """
-    raise NotImplementedError
-
-

Return the readiness of a pollable. This function never blocks.

-

Returns true when the pollable is ready, and false otherwise.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_io_streams_0_2_0.html b/docs/v4/wit/imports/wasi_io_streams_0_2_0.html deleted file mode 100644 index f77d71d..0000000 --- a/docs/v4/wit/imports/wasi_io_streams_0_2_0.html +++ /dev/null @@ -1,1019 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_io_streams_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_io_streams_0_2_0

-
-
-

WASI I/O is an I/O abstraction API which is currently focused on providing -stream types.

-

In the future, the component model is expected to add built-in stream types; -when it does, they are expected to subsume this API.

-
-
-
-
-

Global variables

-
-
var StreamError
-
-

An error for input-stream and output-stream operations.

-
-
-
-
-
-
-

Classes

-
-
-class InputStream -
-
-
- -Expand source code - -
class InputStream:
-    """
-    An input bytestream.
-    
-    `input-stream`s are *non-blocking* to the extent practical on underlying
-    platforms. I/O operations always return promptly; if fewer bytes are
-    promptly available than requested, they return the number of bytes promptly
-    available, which could even be zero. To wait for data to be available,
-    use the `subscribe` function to obtain a `pollable` which can be polled
-    for using `wasi:io/poll`.
-    """
-    
-    def read(self, len: int) -> bytes:
-        """
-        Perform a non-blocking read from the stream.
-        
-        When the source of a `read` is binary data, the bytes from the source
-        are returned verbatim. When the source of a `read` is known to the
-        implementation to be text, bytes containing the UTF-8 encoding of the
-        text are returned.
-        
-        This function returns a list of bytes containing the read data,
-        when successful. The returned list will contain up to `len` bytes;
-        it may return fewer than requested, but not more. The list is
-        empty when no bytes are available for reading at this time. The
-        pollable given by `subscribe` will be ready when more bytes are
-        available.
-        
-        This function fails with a `stream-error` when the operation
-        encounters an error, giving `last-operation-failed`, or when the
-        stream is closed, giving `closed`.
-        
-        When the caller gives a `len` of 0, it represents a request to
-        read 0 bytes. If the stream is still open, this call should
-        succeed and return an empty list, or otherwise fail with `closed`.
-        
-        The `len` parameter is a `u64`, which could represent a list of u8 which
-        is not possible to allocate in wasm32, or not desirable to allocate as
-        as a return value by the callee. The callee may return a list of bytes
-        less than `len` in size while more bytes are available for reading.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_read(self, len: int) -> bytes:
-        """
-        Read bytes from a stream, after blocking until at least one byte can
-        be read. Except for blocking, behavior is identical to `read`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream. Returns number of bytes skipped.
-        
-        Behaves identical to `read`, except instead of returning a list
-        of bytes, returns the number of bytes consumed from the stream.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream, after blocking until at least one byte
-        can be skipped. Except for blocking behavior, identical to `skip`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-        """
-        Create a `pollable` which will resolve once either the specified stream
-        has bytes available to read or the other end of the stream has been
-        closed.
-        The created `pollable` is a child resource of the `input-stream`.
-        Implementations may trap if the `input-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

An input bytestream.

-

input-streams are non-blocking to the extent practical on underlying -platforms. I/O operations always return promptly; if fewer bytes are -promptly available than requested, they return the number of bytes promptly -available, which could even be zero. To wait for data to be available, -use the subscribe function to obtain a pollable which can be polled -for using wasi:io/poll.

-

Methods

-
-
-def blocking_read(self, len: int) ‑> bytes -
-
-
- -Expand source code - -
def blocking_read(self, len: int) -> bytes:
-    """
-    Read bytes from a stream, after blocking until at least one byte can
-    be read. Except for blocking, behavior is identical to `read`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Read bytes from a stream, after blocking until at least one byte can -be read. Except for blocking, behavior is identical to read.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def blocking_skip(self, len: int) ‑> int -
-
-
- -Expand source code - -
def blocking_skip(self, len: int) -> int:
-    """
-    Skip bytes from a stream, after blocking until at least one byte
-    can be skipped. Except for blocking behavior, identical to `skip`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Skip bytes from a stream, after blocking until at least one byte -can be skipped. Except for blocking behavior, identical to skip.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def read(self, len: int) ‑> bytes -
-
-
- -Expand source code - -
def read(self, len: int) -> bytes:
-    """
-    Perform a non-blocking read from the stream.
-    
-    When the source of a `read` is binary data, the bytes from the source
-    are returned verbatim. When the source of a `read` is known to the
-    implementation to be text, bytes containing the UTF-8 encoding of the
-    text are returned.
-    
-    This function returns a list of bytes containing the read data,
-    when successful. The returned list will contain up to `len` bytes;
-    it may return fewer than requested, but not more. The list is
-    empty when no bytes are available for reading at this time. The
-    pollable given by `subscribe` will be ready when more bytes are
-    available.
-    
-    This function fails with a `stream-error` when the operation
-    encounters an error, giving `last-operation-failed`, or when the
-    stream is closed, giving `closed`.
-    
-    When the caller gives a `len` of 0, it represents a request to
-    read 0 bytes. If the stream is still open, this call should
-    succeed and return an empty list, or otherwise fail with `closed`.
-    
-    The `len` parameter is a `u64`, which could represent a list of u8 which
-    is not possible to allocate in wasm32, or not desirable to allocate as
-    as a return value by the callee. The callee may return a list of bytes
-    less than `len` in size while more bytes are available for reading.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Perform a non-blocking read from the stream.

-

When the source of a read is binary data, the bytes from the source -are returned verbatim. When the source of a read is known to the -implementation to be text, bytes containing the UTF-8 encoding of the -text are returned.

-

This function returns a list of bytes containing the read data, -when successful. The returned list will contain up to len bytes; -it may return fewer than requested, but not more. The list is -empty when no bytes are available for reading at this time. The -pollable given by subscribe will be ready when more bytes are -available.

-

This function fails with a stream-error when the operation -encounters an error, giving last-operation-failed, or when the -stream is closed, giving closed.

-

When the caller gives a len of 0, it represents a request to -read 0 bytes. If the stream is still open, this call should -succeed and return an empty list, or otherwise fail with closed.

-

The len parameter is a u64, which could represent a list of u8 which -is not possible to allocate in wasm32, or not desirable to allocate as -as a return value by the callee. The callee may return a list of bytes -less than len in size while more bytes are available for reading.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def skip(self, len: int) ‑> int -
-
-
- -Expand source code - -
def skip(self, len: int) -> int:
-    """
-    Skip bytes from a stream. Returns number of bytes skipped.
-    
-    Behaves identical to `read`, except instead of returning a list
-    of bytes, returns the number of bytes consumed from the stream.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Skip bytes from a stream. Returns number of bytes skipped.

-

Behaves identical to read, except instead of returning a list -of bytes, returns the number of bytes consumed from the stream.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-    """
-    Create a `pollable` which will resolve once either the specified stream
-    has bytes available to read or the other end of the stream has been
-    closed.
-    The created `pollable` is a child resource of the `input-stream`.
-    Implementations may trap if the `input-stream` is dropped before
-    all derived `pollable`s created with this function are dropped.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once either the specified stream -has bytes available to read or the other end of the stream has been -closed. -The created pollable is a child resource of the input-stream. -Implementations may trap if the input-stream is dropped before -all derived pollables created with this function are dropped.

-
-
-
-
-class OutputStream -
-
-
- -Expand source code - -
class OutputStream:
-    """
-    An output bytestream.
-    
-    `output-stream`s are *non-blocking* to the extent practical on
-    underlying platforms. Except where specified otherwise, I/O operations also
-    always return promptly, after the number of bytes that can be written
-    promptly, which could even be zero. To wait for the stream to be ready to
-    accept data, the `subscribe` function to obtain a `pollable` which can be
-    polled for using `wasi:io/poll`.
-    """
-    
-    def check_write(self) -> int:
-        """
-        Check readiness for writing. This function never blocks.
-        
-        Returns the number of bytes permitted for the next call to `write`,
-        or an error. Calling `write` with more bytes than this function has
-        permitted will trap.
-        
-        When this function returns 0 bytes, the `subscribe` pollable will
-        become ready when this function will report at least 1 byte, or an
-        error.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def write(self, contents: bytes) -> None:
-        """
-        Perform a write. This function never blocks.
-        
-        When the destination of a `write` is binary data, the bytes from
-        `contents` are written verbatim. When the destination of a `write` is
-        known to the implementation to be text, the bytes of `contents` are
-        transcoded from UTF-8 into the encoding of the destination and then
-        written.
-        
-        Precondition: check-write gave permit of Ok(n) and contents has a
-        length of less than or equal to n. Otherwise, this function will trap.
-        
-        returns Err(closed) without writing if the stream has closed since
-        the last call to check-write provided a permit.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_write_and_flush(self, contents: bytes) -> None:
-        """
-        Perform a write of up to 4096 bytes, and then flush the stream. Block
-        until all of these operations are complete, or an error occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write`, and `flush`, and is implemented with the
-        following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while !contents.is_empty() {
-            // Wait for the stream to become writable
-            pollable.block();
-            let Ok(n) = this.check-write(); // eliding error handling
-            let len = min(n, contents.len());
-            let (chunk, rest) = contents.split_at(len);
-            this.write(chunk  );            // eliding error handling
-            contents = rest;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def flush(self) -> None:
-        """
-        Request to flush buffered output. This function never blocks.
-        
-        This tells the output-stream that the caller intends any buffered
-        output to be flushed. the output which is expected to be flushed
-        is all that has been passed to `write` prior to this call.
-        
-        Upon calling this function, the `output-stream` will not accept any
-        writes (`check-write` will return `ok(0)`) until the flush has
-        completed. The `subscribe` pollable will become ready when the
-        flush has completed and the stream can accept more writes.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_flush(self) -> None:
-        """
-        Request to flush buffered output, and block until flush completes
-        and stream is ready for writing again.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-        """
-        Create a `pollable` which will resolve once the output-stream
-        is ready for more writing, or an error has occured. When this
-        pollable is ready, `check-write` will return `ok(n)` with n>0, or an
-        error.
-        
-        If the stream is closed, this pollable is always ready immediately.
-        
-        The created `pollable` is a child resource of the `output-stream`.
-        Implementations may trap if the `output-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-    def write_zeroes(self, len: int) -> None:
-        """
-        Write zeroes to a stream.
-        
-        This should be used precisely like `write` with the exact same
-        preconditions (must use check-write first), but instead of
-        passing a list of bytes, you simply pass the number of zero-bytes
-        that should be written.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_write_zeroes_and_flush(self, len: int) -> None:
-        """
-        Perform a write of up to 4096 zeroes, and then flush the stream.
-        Block until all of these operations are complete, or an error
-        occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write-zeroes`, and `flush`, and is implemented with
-        the following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while num_zeroes != 0 {
-            // Wait for the stream to become writable
-            pollable.block();
-            let Ok(n) = this.check-write(); // eliding error handling
-            let len = min(n, num_zeroes);
-            this.write-zeroes(len);         // eliding error handling
-            num_zeroes -= len;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another.
-        
-        The behavior of splice is equivelant to:
-        1. calling `check-write` on the `output-stream`
-        2. calling `read` on the `input-stream` with the smaller of the
-        `check-write` permitted length and the `len` provided to `splice`
-        3. calling `write` on the `output-stream` with that read data.
-        
-        Any error reported by the call to `check-write`, `read`, or
-        `write` ends the splice and reports that error.
-        
-        This function returns the number of bytes transferred; it may be less
-        than `len`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another, with blocking.
-        
-        This is similar to `splice`, except that it blocks until the
-        `output-stream` is ready for writing, and the `input-stream`
-        is ready for reading, before performing the `splice`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

An output bytestream.

-

output-streams are non-blocking to the extent practical on -underlying platforms. Except where specified otherwise, I/O operations also -always return promptly, after the number of bytes that can be written -promptly, which could even be zero. To wait for the stream to be ready to -accept data, the subscribe function to obtain a pollable which can be -polled for using wasi:io/poll.

-

Methods

-
-
-def blocking_flush(self) ‑> None -
-
-
- -Expand source code - -
def blocking_flush(self) -> None:
-    """
-    Request to flush buffered output, and block until flush completes
-    and stream is ready for writing again.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Request to flush buffered output, and block until flush completes -and stream is ready for writing again.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def blocking_splice(self,
src: InputStream,
len: int) ‑> int
-
-
-
- -Expand source code - -
def blocking_splice(self, src: InputStream, len: int) -> int:
-    """
-    Read from one stream and write to another, with blocking.
-    
-    This is similar to `splice`, except that it blocks until the
-    `output-stream` is ready for writing, and the `input-stream`
-    is ready for reading, before performing the `splice`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Read from one stream and write to another, with blocking.

-

This is similar to splice, except that it blocks until the -output-stream is ready for writing, and the input-stream -is ready for reading, before performing the splice.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def blocking_write_and_flush(self, contents: bytes) ‑> None -
-
-
- -Expand source code - -
def blocking_write_and_flush(self, contents: bytes) -> None:
-    """
-    Perform a write of up to 4096 bytes, and then flush the stream. Block
-    until all of these operations are complete, or an error occurs.
-    
-    This is a convenience wrapper around the use of `check-write`,
-    `subscribe`, `write`, and `flush`, and is implemented with the
-    following pseudo-code:
-    
-    ```text
-    let pollable = this.subscribe();
-    while !contents.is_empty() {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, contents.len());
-        let (chunk, rest) = contents.split_at(len);
-        this.write(chunk  );            // eliding error handling
-        contents = rest;
-    }
-    this.flush();
-    // Wait for completion of `flush`
-    pollable.block();
-    // Check for any errors that arose during `flush`
-    let _ = this.check-write();         // eliding error handling
-    ```
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Perform a write of up to 4096 bytes, and then flush the stream. Block -until all of these operations are complete, or an error occurs.

-

This is a convenience wrapper around the use of check-write, -subscribe, write, and flush, and is implemented with the -following pseudo-code:

-
let pollable = this.subscribe();
-while !contents.is_empty() {
-    // Wait for the stream to become writable
-    pollable.block();
-    let Ok(n) = this.check-write(); // eliding error handling
-    let len = min(n, contents.len());
-    let (chunk, rest) = contents.split_at(len);
-    this.write(chunk  );            // eliding error handling
-    contents = rest;
-}
-this.flush();
-// Wait for completion of `flush`
-pollable.block();
-// Check for any errors that arose during `flush`
-let _ = this.check-write();         // eliding error handling
-
-

Raises: componentize_py_types.Err(StreamError)

-
-
-def blocking_write_zeroes_and_flush(self, len: int) ‑> None -
-
-
- -Expand source code - -
def blocking_write_zeroes_and_flush(self, len: int) -> None:
-    """
-    Perform a write of up to 4096 zeroes, and then flush the stream.
-    Block until all of these operations are complete, or an error
-    occurs.
-    
-    This is a convenience wrapper around the use of `check-write`,
-    `subscribe`, `write-zeroes`, and `flush`, and is implemented with
-    the following pseudo-code:
-    
-    ```text
-    let pollable = this.subscribe();
-    while num_zeroes != 0 {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, num_zeroes);
-        this.write-zeroes(len);         // eliding error handling
-        num_zeroes -= len;
-    }
-    this.flush();
-    // Wait for completion of `flush`
-    pollable.block();
-    // Check for any errors that arose during `flush`
-    let _ = this.check-write();         // eliding error handling
-    ```
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Perform a write of up to 4096 zeroes, and then flush the stream. -Block until all of these operations are complete, or an error -occurs.

-

This is a convenience wrapper around the use of check-write, -subscribe, write-zeroes, and flush, and is implemented with -the following pseudo-code:

-
let pollable = this.subscribe();
-while num_zeroes != 0 {
-    // Wait for the stream to become writable
-    pollable.block();
-    let Ok(n) = this.check-write(); // eliding error handling
-    let len = min(n, num_zeroes);
-    this.write-zeroes(len);         // eliding error handling
-    num_zeroes -= len;
-}
-this.flush();
-// Wait for completion of `flush`
-pollable.block();
-// Check for any errors that arose during `flush`
-let _ = this.check-write();         // eliding error handling
-
-

Raises: componentize_py_types.Err(StreamError)

-
-
-def check_write(self) ‑> int -
-
-
- -Expand source code - -
def check_write(self) -> int:
-    """
-    Check readiness for writing. This function never blocks.
-    
-    Returns the number of bytes permitted for the next call to `write`,
-    or an error. Calling `write` with more bytes than this function has
-    permitted will trap.
-    
-    When this function returns 0 bytes, the `subscribe` pollable will
-    become ready when this function will report at least 1 byte, or an
-    error.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Check readiness for writing. This function never blocks.

-

Returns the number of bytes permitted for the next call to write, -or an error. Calling write with more bytes than this function has -permitted will trap.

-

When this function returns 0 bytes, the subscribe pollable will -become ready when this function will report at least 1 byte, or an -error.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def flush(self) ‑> None -
-
-
- -Expand source code - -
def flush(self) -> None:
-    """
-    Request to flush buffered output. This function never blocks.
-    
-    This tells the output-stream that the caller intends any buffered
-    output to be flushed. the output which is expected to be flushed
-    is all that has been passed to `write` prior to this call.
-    
-    Upon calling this function, the `output-stream` will not accept any
-    writes (`check-write` will return `ok(0)`) until the flush has
-    completed. The `subscribe` pollable will become ready when the
-    flush has completed and the stream can accept more writes.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Request to flush buffered output. This function never blocks.

-

This tells the output-stream that the caller intends any buffered -output to be flushed. the output which is expected to be flushed -is all that has been passed to write prior to this call.

-

Upon calling this function, the output-stream will not accept any -writes (check-write will return ok(0)) until the flush has -completed. The subscribe pollable will become ready when the -flush has completed and the stream can accept more writes.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def splice(self,
src: InputStream,
len: int) ‑> int
-
-
-
- -Expand source code - -
def splice(self, src: InputStream, len: int) -> int:
-    """
-    Read from one stream and write to another.
-    
-    The behavior of splice is equivelant to:
-    1. calling `check-write` on the `output-stream`
-    2. calling `read` on the `input-stream` with the smaller of the
-    `check-write` permitted length and the `len` provided to `splice`
-    3. calling `write` on the `output-stream` with that read data.
-    
-    Any error reported by the call to `check-write`, `read`, or
-    `write` ends the splice and reports that error.
-    
-    This function returns the number of bytes transferred; it may be less
-    than `len`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Read from one stream and write to another.

-

The behavior of splice is equivelant to: -1. calling check-write on the output-stream -2. calling read on the input-stream with the smaller of the -check-write permitted length and the len provided to splice -3. calling write on the output-stream with that read data.

-

Any error reported by the call to check-write, read, or -write ends the splice and reports that error.

-

This function returns the number of bytes transferred; it may be less -than len.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-    """
-    Create a `pollable` which will resolve once the output-stream
-    is ready for more writing, or an error has occured. When this
-    pollable is ready, `check-write` will return `ok(n)` with n>0, or an
-    error.
-    
-    If the stream is closed, this pollable is always ready immediately.
-    
-    The created `pollable` is a child resource of the `output-stream`.
-    Implementations may trap if the `output-stream` is dropped before
-    all derived `pollable`s created with this function are dropped.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the output-stream -is ready for more writing, or an error has occured. When this -pollable is ready, check-write will return ok(n) with n>0, or an -error.

-

If the stream is closed, this pollable is always ready immediately.

-

The created pollable is a child resource of the output-stream. -Implementations may trap if the output-stream is dropped before -all derived pollables created with this function are dropped.

-
-
-def write(self, contents: bytes) ‑> None -
-
-
- -Expand source code - -
def write(self, contents: bytes) -> None:
-    """
-    Perform a write. This function never blocks.
-    
-    When the destination of a `write` is binary data, the bytes from
-    `contents` are written verbatim. When the destination of a `write` is
-    known to the implementation to be text, the bytes of `contents` are
-    transcoded from UTF-8 into the encoding of the destination and then
-    written.
-    
-    Precondition: check-write gave permit of Ok(n) and contents has a
-    length of less than or equal to n. Otherwise, this function will trap.
-    
-    returns Err(closed) without writing if the stream has closed since
-    the last call to check-write provided a permit.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Perform a write. This function never blocks.

-

When the destination of a write is binary data, the bytes from -contents are written verbatim. When the destination of a write is -known to the implementation to be text, the bytes of contents are -transcoded from UTF-8 into the encoding of the destination and then -written.

-

Precondition: check-write gave permit of Ok(n) and contents has a -length of less than or equal to n. Otherwise, this function will trap.

-

returns Err(closed) without writing if the stream has closed since -the last call to check-write provided a permit.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def write_zeroes(self, len: int) ‑> None -
-
-
- -Expand source code - -
def write_zeroes(self, len: int) -> None:
-    """
-    Write zeroes to a stream.
-    
-    This should be used precisely like `write` with the exact same
-    preconditions (must use check-write first), but instead of
-    passing a list of bytes, you simply pass the number of zero-bytes
-    that should be written.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_0.StreamError)`
-    """
-    raise NotImplementedError
-
-

Write zeroes to a stream.

-

This should be used precisely like write with the exact same -preconditions (must use check-write first), but instead of -passing a list of bytes, you simply pass the number of zero-bytes -that should be written.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-
-
-class StreamError_Closed -
-
-
- -Expand source code - -
@dataclass
-class StreamError_Closed:
-    pass
-
-

StreamError_Closed()

-
-
-class StreamError_LastOperationFailed -(value: Error) -
-
-
- -Expand source code - -
@dataclass
-class StreamError_LastOperationFailed:
-    value: wasi_io_error_0_2_0.Error
-
-

StreamError_LastOperationFailed(value: spin_sdk.wit.imports.wasi_io_error_0_2_0.Error)

-

Instance variables

-
-
var valueError
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_io_streams_0_2_6.html b/docs/v4/wit/imports/wasi_io_streams_0_2_6.html deleted file mode 100644 index b4ec34d..0000000 --- a/docs/v4/wit/imports/wasi_io_streams_0_2_6.html +++ /dev/null @@ -1,1026 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_io_streams_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_io_streams_0_2_6

-
-
-

WASI I/O is an I/O abstraction API which is currently focused on providing -stream types.

-

In the future, the component model is expected to add built-in stream types; -when it does, they are expected to subsume this API.

-
-
-
-
-

Global variables

-
-
var StreamError
-
-

An error for input-stream and output-stream operations.

-
-
-
-
-
-
-

Classes

-
-
-class InputStream -
-
-
- -Expand source code - -
class InputStream:
-    """
-    An input bytestream.
-    
-    `input-stream`s are *non-blocking* to the extent practical on underlying
-    platforms. I/O operations always return promptly; if fewer bytes are
-    promptly available than requested, they return the number of bytes promptly
-    available, which could even be zero. To wait for data to be available,
-    use the `subscribe` function to obtain a `pollable` which can be polled
-    for using `wasi:io/poll`.
-    """
-    
-    def read(self, len: int) -> bytes:
-        """
-        Perform a non-blocking read from the stream.
-        
-        When the source of a `read` is binary data, the bytes from the source
-        are returned verbatim. When the source of a `read` is known to the
-        implementation to be text, bytes containing the UTF-8 encoding of the
-        text are returned.
-        
-        This function returns a list of bytes containing the read data,
-        when successful. The returned list will contain up to `len` bytes;
-        it may return fewer than requested, but not more. The list is
-        empty when no bytes are available for reading at this time. The
-        pollable given by `subscribe` will be ready when more bytes are
-        available.
-        
-        This function fails with a `stream-error` when the operation
-        encounters an error, giving `last-operation-failed`, or when the
-        stream is closed, giving `closed`.
-        
-        When the caller gives a `len` of 0, it represents a request to
-        read 0 bytes. If the stream is still open, this call should
-        succeed and return an empty list, or otherwise fail with `closed`.
-        
-        The `len` parameter is a `u64`, which could represent a list of u8 which
-        is not possible to allocate in wasm32, or not desirable to allocate as
-        as a return value by the callee. The callee may return a list of bytes
-        less than `len` in size while more bytes are available for reading.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_read(self, len: int) -> bytes:
-        """
-        Read bytes from a stream, after blocking until at least one byte can
-        be read. Except for blocking, behavior is identical to `read`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream. Returns number of bytes skipped.
-        
-        Behaves identical to `read`, except instead of returning a list
-        of bytes, returns the number of bytes consumed from the stream.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream, after blocking until at least one byte
-        can be skipped. Except for blocking behavior, identical to `skip`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-        """
-        Create a `pollable` which will resolve once either the specified stream
-        has bytes available to read or the other end of the stream has been
-        closed.
-        The created `pollable` is a child resource of the `input-stream`.
-        Implementations may trap if the `input-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

An input bytestream.

-

input-streams are non-blocking to the extent practical on underlying -platforms. I/O operations always return promptly; if fewer bytes are -promptly available than requested, they return the number of bytes promptly -available, which could even be zero. To wait for data to be available, -use the subscribe function to obtain a pollable which can be polled -for using wasi:io/poll.

-

Methods

-
-
-def blocking_read(self, len: int) ‑> bytes -
-
-
- -Expand source code - -
def blocking_read(self, len: int) -> bytes:
-    """
-    Read bytes from a stream, after blocking until at least one byte can
-    be read. Except for blocking, behavior is identical to `read`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Read bytes from a stream, after blocking until at least one byte can -be read. Except for blocking, behavior is identical to read.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def blocking_skip(self, len: int) ‑> int -
-
-
- -Expand source code - -
def blocking_skip(self, len: int) -> int:
-    """
-    Skip bytes from a stream, after blocking until at least one byte
-    can be skipped. Except for blocking behavior, identical to `skip`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Skip bytes from a stream, after blocking until at least one byte -can be skipped. Except for blocking behavior, identical to skip.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def read(self, len: int) ‑> bytes -
-
-
- -Expand source code - -
def read(self, len: int) -> bytes:
-    """
-    Perform a non-blocking read from the stream.
-    
-    When the source of a `read` is binary data, the bytes from the source
-    are returned verbatim. When the source of a `read` is known to the
-    implementation to be text, bytes containing the UTF-8 encoding of the
-    text are returned.
-    
-    This function returns a list of bytes containing the read data,
-    when successful. The returned list will contain up to `len` bytes;
-    it may return fewer than requested, but not more. The list is
-    empty when no bytes are available for reading at this time. The
-    pollable given by `subscribe` will be ready when more bytes are
-    available.
-    
-    This function fails with a `stream-error` when the operation
-    encounters an error, giving `last-operation-failed`, or when the
-    stream is closed, giving `closed`.
-    
-    When the caller gives a `len` of 0, it represents a request to
-    read 0 bytes. If the stream is still open, this call should
-    succeed and return an empty list, or otherwise fail with `closed`.
-    
-    The `len` parameter is a `u64`, which could represent a list of u8 which
-    is not possible to allocate in wasm32, or not desirable to allocate as
-    as a return value by the callee. The callee may return a list of bytes
-    less than `len` in size while more bytes are available for reading.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Perform a non-blocking read from the stream.

-

When the source of a read is binary data, the bytes from the source -are returned verbatim. When the source of a read is known to the -implementation to be text, bytes containing the UTF-8 encoding of the -text are returned.

-

This function returns a list of bytes containing the read data, -when successful. The returned list will contain up to len bytes; -it may return fewer than requested, but not more. The list is -empty when no bytes are available for reading at this time. The -pollable given by subscribe will be ready when more bytes are -available.

-

This function fails with a stream-error when the operation -encounters an error, giving last-operation-failed, or when the -stream is closed, giving closed.

-

When the caller gives a len of 0, it represents a request to -read 0 bytes. If the stream is still open, this call should -succeed and return an empty list, or otherwise fail with closed.

-

The len parameter is a u64, which could represent a list of u8 which -is not possible to allocate in wasm32, or not desirable to allocate as -as a return value by the callee. The callee may return a list of bytes -less than len in size while more bytes are available for reading.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def skip(self, len: int) ‑> int -
-
-
- -Expand source code - -
def skip(self, len: int) -> int:
-    """
-    Skip bytes from a stream. Returns number of bytes skipped.
-    
-    Behaves identical to `read`, except instead of returning a list
-    of bytes, returns the number of bytes consumed from the stream.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Skip bytes from a stream. Returns number of bytes skipped.

-

Behaves identical to read, except instead of returning a list -of bytes, returns the number of bytes consumed from the stream.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-    """
-    Create a `pollable` which will resolve once either the specified stream
-    has bytes available to read or the other end of the stream has been
-    closed.
-    The created `pollable` is a child resource of the `input-stream`.
-    Implementations may trap if the `input-stream` is dropped before
-    all derived `pollable`s created with this function are dropped.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once either the specified stream -has bytes available to read or the other end of the stream has been -closed. -The created pollable is a child resource of the input-stream. -Implementations may trap if the input-stream is dropped before -all derived pollables created with this function are dropped.

-
-
-
-
-class OutputStream -
-
-
- -Expand source code - -
class OutputStream:
-    """
-    An output bytestream.
-    
-    `output-stream`s are *non-blocking* to the extent practical on
-    underlying platforms. Except where specified otherwise, I/O operations also
-    always return promptly, after the number of bytes that can be written
-    promptly, which could even be zero. To wait for the stream to be ready to
-    accept data, the `subscribe` function to obtain a `pollable` which can be
-    polled for using `wasi:io/poll`.
-    
-    Dropping an `output-stream` while there's still an active write in
-    progress may result in the data being lost. Before dropping the stream,
-    be sure to fully flush your writes.
-    """
-    
-    def check_write(self) -> int:
-        """
-        Check readiness for writing. This function never blocks.
-        
-        Returns the number of bytes permitted for the next call to `write`,
-        or an error. Calling `write` with more bytes than this function has
-        permitted will trap.
-        
-        When this function returns 0 bytes, the `subscribe` pollable will
-        become ready when this function will report at least 1 byte, or an
-        error.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def write(self, contents: bytes) -> None:
-        """
-        Perform a write. This function never blocks.
-        
-        When the destination of a `write` is binary data, the bytes from
-        `contents` are written verbatim. When the destination of a `write` is
-        known to the implementation to be text, the bytes of `contents` are
-        transcoded from UTF-8 into the encoding of the destination and then
-        written.
-        
-        Precondition: check-write gave permit of Ok(n) and contents has a
-        length of less than or equal to n. Otherwise, this function will trap.
-        
-        returns Err(closed) without writing if the stream has closed since
-        the last call to check-write provided a permit.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_write_and_flush(self, contents: bytes) -> None:
-        """
-        Perform a write of up to 4096 bytes, and then flush the stream. Block
-        until all of these operations are complete, or an error occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write`, and `flush`, and is implemented with the
-        following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while !contents.is_empty() {
-            // Wait for the stream to become writable
-            pollable.block();
-            let Ok(n) = this.check-write(); // eliding error handling
-            let len = min(n, contents.len());
-            let (chunk, rest) = contents.split_at(len);
-            this.write(chunk  );            // eliding error handling
-            contents = rest;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def flush(self) -> None:
-        """
-        Request to flush buffered output. This function never blocks.
-        
-        This tells the output-stream that the caller intends any buffered
-        output to be flushed. the output which is expected to be flushed
-        is all that has been passed to `write` prior to this call.
-        
-        Upon calling this function, the `output-stream` will not accept any
-        writes (`check-write` will return `ok(0)`) until the flush has
-        completed. The `subscribe` pollable will become ready when the
-        flush has completed and the stream can accept more writes.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_flush(self) -> None:
-        """
-        Request to flush buffered output, and block until flush completes
-        and stream is ready for writing again.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-        """
-        Create a `pollable` which will resolve once the output-stream
-        is ready for more writing, or an error has occurred. When this
-        pollable is ready, `check-write` will return `ok(n)` with n>0, or an
-        error.
-        
-        If the stream is closed, this pollable is always ready immediately.
-        
-        The created `pollable` is a child resource of the `output-stream`.
-        Implementations may trap if the `output-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-    def write_zeroes(self, len: int) -> None:
-        """
-        Write zeroes to a stream.
-        
-        This should be used precisely like `write` with the exact same
-        preconditions (must use check-write first), but instead of
-        passing a list of bytes, you simply pass the number of zero-bytes
-        that should be written.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_write_zeroes_and_flush(self, len: int) -> None:
-        """
-        Perform a write of up to 4096 zeroes, and then flush the stream.
-        Block until all of these operations are complete, or an error
-        occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write-zeroes`, and `flush`, and is implemented with
-        the following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while num_zeroes != 0 {
-            // Wait for the stream to become writable
-            pollable.block();
-            let Ok(n) = this.check-write(); // eliding error handling
-            let len = min(n, num_zeroes);
-            this.write-zeroes(len);         // eliding error handling
-            num_zeroes -= len;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another.
-        
-        The behavior of splice is equivalent to:
-        1. calling `check-write` on the `output-stream`
-        2. calling `read` on the `input-stream` with the smaller of the
-        `check-write` permitted length and the `len` provided to `splice`
-        3. calling `write` on the `output-stream` with that read data.
-        
-        Any error reported by the call to `check-write`, `read`, or
-        `write` ends the splice and reports that error.
-        
-        This function returns the number of bytes transferred; it may be less
-        than `len`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def blocking_splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another, with blocking.
-        
-        This is similar to `splice`, except that it blocks until the
-        `output-stream` is ready for writing, and the `input-stream`
-        is ready for reading, before performing the `splice`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

An output bytestream.

-

output-streams are non-blocking to the extent practical on -underlying platforms. Except where specified otherwise, I/O operations also -always return promptly, after the number of bytes that can be written -promptly, which could even be zero. To wait for the stream to be ready to -accept data, the subscribe function to obtain a pollable which can be -polled for using wasi:io/poll.

-

Dropping an output-stream while there's still an active write in -progress may result in the data being lost. Before dropping the stream, -be sure to fully flush your writes.

-

Methods

-
-
-def blocking_flush(self) ‑> None -
-
-
- -Expand source code - -
def blocking_flush(self) -> None:
-    """
-    Request to flush buffered output, and block until flush completes
-    and stream is ready for writing again.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Request to flush buffered output, and block until flush completes -and stream is ready for writing again.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def blocking_splice(self,
src: InputStream,
len: int) ‑> int
-
-
-
- -Expand source code - -
def blocking_splice(self, src: InputStream, len: int) -> int:
-    """
-    Read from one stream and write to another, with blocking.
-    
-    This is similar to `splice`, except that it blocks until the
-    `output-stream` is ready for writing, and the `input-stream`
-    is ready for reading, before performing the `splice`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Read from one stream and write to another, with blocking.

-

This is similar to splice, except that it blocks until the -output-stream is ready for writing, and the input-stream -is ready for reading, before performing the splice.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def blocking_write_and_flush(self, contents: bytes) ‑> None -
-
-
- -Expand source code - -
def blocking_write_and_flush(self, contents: bytes) -> None:
-    """
-    Perform a write of up to 4096 bytes, and then flush the stream. Block
-    until all of these operations are complete, or an error occurs.
-    
-    This is a convenience wrapper around the use of `check-write`,
-    `subscribe`, `write`, and `flush`, and is implemented with the
-    following pseudo-code:
-    
-    ```text
-    let pollable = this.subscribe();
-    while !contents.is_empty() {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, contents.len());
-        let (chunk, rest) = contents.split_at(len);
-        this.write(chunk  );            // eliding error handling
-        contents = rest;
-    }
-    this.flush();
-    // Wait for completion of `flush`
-    pollable.block();
-    // Check for any errors that arose during `flush`
-    let _ = this.check-write();         // eliding error handling
-    ```
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Perform a write of up to 4096 bytes, and then flush the stream. Block -until all of these operations are complete, or an error occurs.

-

This is a convenience wrapper around the use of check-write, -subscribe, write, and flush, and is implemented with the -following pseudo-code:

-
let pollable = this.subscribe();
-while !contents.is_empty() {
-    // Wait for the stream to become writable
-    pollable.block();
-    let Ok(n) = this.check-write(); // eliding error handling
-    let len = min(n, contents.len());
-    let (chunk, rest) = contents.split_at(len);
-    this.write(chunk  );            // eliding error handling
-    contents = rest;
-}
-this.flush();
-// Wait for completion of `flush`
-pollable.block();
-// Check for any errors that arose during `flush`
-let _ = this.check-write();         // eliding error handling
-
-

Raises: componentize_py_types.Err(StreamError)

-
-
-def blocking_write_zeroes_and_flush(self, len: int) ‑> None -
-
-
- -Expand source code - -
def blocking_write_zeroes_and_flush(self, len: int) -> None:
-    """
-    Perform a write of up to 4096 zeroes, and then flush the stream.
-    Block until all of these operations are complete, or an error
-    occurs.
-    
-    This is a convenience wrapper around the use of `check-write`,
-    `subscribe`, `write-zeroes`, and `flush`, and is implemented with
-    the following pseudo-code:
-    
-    ```text
-    let pollable = this.subscribe();
-    while num_zeroes != 0 {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, num_zeroes);
-        this.write-zeroes(len);         // eliding error handling
-        num_zeroes -= len;
-    }
-    this.flush();
-    // Wait for completion of `flush`
-    pollable.block();
-    // Check for any errors that arose during `flush`
-    let _ = this.check-write();         // eliding error handling
-    ```
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Perform a write of up to 4096 zeroes, and then flush the stream. -Block until all of these operations are complete, or an error -occurs.

-

This is a convenience wrapper around the use of check-write, -subscribe, write-zeroes, and flush, and is implemented with -the following pseudo-code:

-
let pollable = this.subscribe();
-while num_zeroes != 0 {
-    // Wait for the stream to become writable
-    pollable.block();
-    let Ok(n) = this.check-write(); // eliding error handling
-    let len = min(n, num_zeroes);
-    this.write-zeroes(len);         // eliding error handling
-    num_zeroes -= len;
-}
-this.flush();
-// Wait for completion of `flush`
-pollable.block();
-// Check for any errors that arose during `flush`
-let _ = this.check-write();         // eliding error handling
-
-

Raises: componentize_py_types.Err(StreamError)

-
-
-def check_write(self) ‑> int -
-
-
- -Expand source code - -
def check_write(self) -> int:
-    """
-    Check readiness for writing. This function never blocks.
-    
-    Returns the number of bytes permitted for the next call to `write`,
-    or an error. Calling `write` with more bytes than this function has
-    permitted will trap.
-    
-    When this function returns 0 bytes, the `subscribe` pollable will
-    become ready when this function will report at least 1 byte, or an
-    error.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Check readiness for writing. This function never blocks.

-

Returns the number of bytes permitted for the next call to write, -or an error. Calling write with more bytes than this function has -permitted will trap.

-

When this function returns 0 bytes, the subscribe pollable will -become ready when this function will report at least 1 byte, or an -error.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def flush(self) ‑> None -
-
-
- -Expand source code - -
def flush(self) -> None:
-    """
-    Request to flush buffered output. This function never blocks.
-    
-    This tells the output-stream that the caller intends any buffered
-    output to be flushed. the output which is expected to be flushed
-    is all that has been passed to `write` prior to this call.
-    
-    Upon calling this function, the `output-stream` will not accept any
-    writes (`check-write` will return `ok(0)`) until the flush has
-    completed. The `subscribe` pollable will become ready when the
-    flush has completed and the stream can accept more writes.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Request to flush buffered output. This function never blocks.

-

This tells the output-stream that the caller intends any buffered -output to be flushed. the output which is expected to be flushed -is all that has been passed to write prior to this call.

-

Upon calling this function, the output-stream will not accept any -writes (check-write will return ok(0)) until the flush has -completed. The subscribe pollable will become ready when the -flush has completed and the stream can accept more writes.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def splice(self,
src: InputStream,
len: int) ‑> int
-
-
-
- -Expand source code - -
def splice(self, src: InputStream, len: int) -> int:
-    """
-    Read from one stream and write to another.
-    
-    The behavior of splice is equivalent to:
-    1. calling `check-write` on the `output-stream`
-    2. calling `read` on the `input-stream` with the smaller of the
-    `check-write` permitted length and the `len` provided to `splice`
-    3. calling `write` on the `output-stream` with that read data.
-    
-    Any error reported by the call to `check-write`, `read`, or
-    `write` ends the splice and reports that error.
-    
-    This function returns the number of bytes transferred; it may be less
-    than `len`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Read from one stream and write to another.

-

The behavior of splice is equivalent to: -1. calling check-write on the output-stream -2. calling read on the input-stream with the smaller of the -check-write permitted length and the len provided to splice -3. calling write on the output-stream with that read data.

-

Any error reported by the call to check-write, read, or -write ends the splice and reports that error.

-

This function returns the number of bytes transferred; it may be less -than len.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-    """
-    Create a `pollable` which will resolve once the output-stream
-    is ready for more writing, or an error has occurred. When this
-    pollable is ready, `check-write` will return `ok(n)` with n>0, or an
-    error.
-    
-    If the stream is closed, this pollable is always ready immediately.
-    
-    The created `pollable` is a child resource of the `output-stream`.
-    Implementations may trap if the `output-stream` is dropped before
-    all derived `pollable`s created with this function are dropped.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the output-stream -is ready for more writing, or an error has occurred. When this -pollable is ready, check-write will return ok(n) with n>0, or an -error.

-

If the stream is closed, this pollable is always ready immediately.

-

The created pollable is a child resource of the output-stream. -Implementations may trap if the output-stream is dropped before -all derived pollables created with this function are dropped.

-
-
-def write(self, contents: bytes) ‑> None -
-
-
- -Expand source code - -
def write(self, contents: bytes) -> None:
-    """
-    Perform a write. This function never blocks.
-    
-    When the destination of a `write` is binary data, the bytes from
-    `contents` are written verbatim. When the destination of a `write` is
-    known to the implementation to be text, the bytes of `contents` are
-    transcoded from UTF-8 into the encoding of the destination and then
-    written.
-    
-    Precondition: check-write gave permit of Ok(n) and contents has a
-    length of less than or equal to n. Otherwise, this function will trap.
-    
-    returns Err(closed) without writing if the stream has closed since
-    the last call to check-write provided a permit.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Perform a write. This function never blocks.

-

When the destination of a write is binary data, the bytes from -contents are written verbatim. When the destination of a write is -known to the implementation to be text, the bytes of contents are -transcoded from UTF-8 into the encoding of the destination and then -written.

-

Precondition: check-write gave permit of Ok(n) and contents has a -length of less than or equal to n. Otherwise, this function will trap.

-

returns Err(closed) without writing if the stream has closed since -the last call to check-write provided a permit.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-def write_zeroes(self, len: int) ‑> None -
-
-
- -Expand source code - -
def write_zeroes(self, len: int) -> None:
-    """
-    Write zeroes to a stream.
-    
-    This should be used precisely like `write` with the exact same
-    preconditions (must use check-write first), but instead of
-    passing a list of bytes, you simply pass the number of zero-bytes
-    that should be written.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_io_streams_0_2_6.StreamError)`
-    """
-    raise NotImplementedError
-
-

Write zeroes to a stream.

-

This should be used precisely like write with the exact same -preconditions (must use check-write first), but instead of -passing a list of bytes, you simply pass the number of zero-bytes -that should be written.

-

Raises: componentize_py_types.Err(StreamError)

-
-
-
-
-class StreamError_Closed -
-
-
- -Expand source code - -
@dataclass
-class StreamError_Closed:
-    pass
-
-

StreamError_Closed()

-
-
-class StreamError_LastOperationFailed -(value: Error) -
-
-
- -Expand source code - -
@dataclass
-class StreamError_LastOperationFailed:
-    value: wasi_io_error_0_2_6.Error
-
-

StreamError_LastOperationFailed(value: spin_sdk.wit.imports.wasi_io_error_0_2_6.Error)

-

Instance variables

-
-
var valueError
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_keyvalue_atomics_0_2_0_draft2.html b/docs/v4/wit/imports/wasi_keyvalue_atomics_0_2_0_draft2.html deleted file mode 100644 index 1cc3df5..0000000 --- a/docs/v4/wit/imports/wasi_keyvalue_atomics_0_2_0_draft2.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_keyvalue_atomics_0_2_0_draft2 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_keyvalue_atomics_0_2_0_draft2

-
-
-

A keyvalue interface that provides atomic operations.

-

Atomic operations are single, indivisible operations. When a fault causes an atomic operation to -fail, it will appear to the invoker of the atomic operation that the action either completed -successfully or did nothing at all.

-

Please note that this interface is bare functions that take a reference to a bucket. This is to -get around the current lack of a way to "extend" a resource with additional methods inside of -wit. Future version of the interface will instead extend these methods on the base bucket -resource.

-
-
-
-
-

Global variables

-
-
var CasError
-
-

The error returned by a CAS operation

-
-
-
-
-

Functions

-
-
-def increment(bucket: Bucket,
key: str,
delta: int) ‑> int
-
-
-
- -Expand source code - -
def increment(bucket: wasi_keyvalue_store_0_2_0_draft2.Bucket, key: str, delta: int) -> int:
-    """
-    Atomically increment the value associated with the key in the store by the given delta. It
-    returns the new value.
-    
-    If the key does not exist in the store, it creates a new key-value pair with the value set
-    to the given delta.
-    
-    If any other error occurs, it returns an `Err(error)`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-    """
-    raise NotImplementedError
-
-

Atomically increment the value associated with the key in the store by the given delta. It -returns the new value.

-

If the key does not exist in the store, it creates a new key-value pair with the value set -to the given delta.

-

If any other error occurs, it returns an Err(error).

-

Raises: componentize_py_types.Err(Error)

-
-
-def swap(cas: Cas,
value: bytes) ‑> None
-
-
-
- -Expand source code - -
def swap(cas: Cas, value: bytes) -> None:
-    """
-    Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if
-    the CAS operation failed.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_atomics_0_2_0_draft2.CasError)`
-    """
-    raise NotImplementedError
-
-

Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if -the CAS operation failed.

-

Raises: componentize_py_types.Err(CasError)

-
-
-
-
-

Classes

-
-
-class Cas -
-
-
- -Expand source code - -
class Cas:
-    """
-    A handle to a CAS (compare-and-swap) operation.
-    """
-    
-    @classmethod
-    def new(cls, bucket: wasi_keyvalue_store_0_2_0_draft2.Bucket, key: str) -> Self:
-        """
-        Construct a new CAS operation. Implementors can map the underlying functionality
-        (transactions, versions, etc) as desired.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-        """
-        raise NotImplementedError
-    def current(self) -> Optional[bytes]:
-        """
-        Get the current value of the key (if it exists). This allows for avoiding reads if all
-        that is needed to ensure the atomicity of the operation
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A handle to a CAS (compare-and-swap) operation.

-

Static methods

-
-
-def new(bucket: Bucket,
key: str) ‑> Self
-
-
-

Construct a new CAS operation. Implementors can map the underlying functionality -(transactions, versions, etc) as desired.

-

Raises: componentize_py_types.Err(Error)

-
-
-

Methods

-
-
-def current(self) ‑> bytes | None -
-
-
- -Expand source code - -
def current(self) -> Optional[bytes]:
-    """
-    Get the current value of the key (if it exists). This allows for avoiding reads if all
-    that is needed to ensure the atomicity of the operation
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-    """
-    raise NotImplementedError
-
-

Get the current value of the key (if it exists). This allows for avoiding reads if all -that is needed to ensure the atomicity of the operation

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-class CasError_CasFailed -(value: Cas) -
-
-
- -Expand source code - -
@dataclass
-class CasError_CasFailed:
-    value: Cas
-
-

CasError_CasFailed(value: spin_sdk.wit.imports.wasi_keyvalue_atomics_0_2_0_draft2.Cas)

-

Instance variables

-
-
var valueCas
-
-
-
-
-
-
-class CasError_StoreError -(value: Error_NoSuchStore | Error_AccessDenied | Error_Other) -
-
-
- -Expand source code - -
@dataclass
-class CasError_StoreError:
-    value: wasi_keyvalue_store_0_2_0_draft2.Error
-
-

CasError_StoreError(value: Union[spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error_NoSuchStore, spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error_AccessDenied, spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error_Other])

-

Instance variables

-
-
var valueError_NoSuchStore | Error_AccessDenied | Error_Other
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_keyvalue_batch_0_2_0_draft2.html b/docs/v4/wit/imports/wasi_keyvalue_batch_0_2_0_draft2.html deleted file mode 100644 index 3887fc7..0000000 --- a/docs/v4/wit/imports/wasi_keyvalue_batch_0_2_0_draft2.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_keyvalue_batch_0_2_0_draft2 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_keyvalue_batch_0_2_0_draft2

-
-
-

A keyvalue interface that provides batch operations.

-

A batch operation is an operation that operates on multiple keys at once.

-

Batch operations are useful for reducing network round-trip time. For example, if you want to -get the values associated with 100 keys, you can either do 100 get operations or you can do 1 -batch get operation. The batch operation is faster because it only needs to make 1 network call -instead of 100.

-

A batch operation does not guarantee atomicity, meaning that if the batch operation fails, some -of the keys may have been modified and some may not.

-

This interface does has the same consistency guarantees as the store interface, meaning that -you should be able to "read your writes."

-

Please note that this interface is bare functions that take a reference to a bucket. This is to -get around the current lack of a way to "extend" a resource with additional methods inside of -wit. Future version of the interface will instead extend these methods on the base bucket -resource.

-
-
-
-
-
-
-

Functions

-
-
-def delete_many(bucket: Bucket,
keys: List[str]) ‑> None
-
-
-
- -Expand source code - -
def delete_many(bucket: wasi_keyvalue_store_0_2_0_draft2.Bucket, keys: List[str]) -> None:
-    """
-    Delete the key-value pairs associated with the keys in the store.
-    
-    Note that the key-value pairs are not guaranteed to be deleted in the order they are
-    provided.
-    
-    If any of the keys do not exist in the store, it skips the key.
-    
-    If any other error occurs, it returns an `Err(error)`. When an error occurs, it does not
-    rollback the key-value pairs that were already deleted. Thus, this batch operation does not
-    guarantee atomicity, implying that some key-value pairs could be deleted while others might
-    fail.
-    
-    Other concurrent operations may also be able to see the partial results.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-    """
-    raise NotImplementedError
-
-

Delete the key-value pairs associated with the keys in the store.

-

Note that the key-value pairs are not guaranteed to be deleted in the order they are -provided.

-

If any of the keys do not exist in the store, it skips the key.

-

If any other error occurs, it returns an Err(error). When an error occurs, it does not -rollback the key-value pairs that were already deleted. Thus, this batch operation does not -guarantee atomicity, implying that some key-value pairs could be deleted while others might -fail.

-

Other concurrent operations may also be able to see the partial results.

-

Raises: componentize_py_types.Err(Error)

-
-
-def get_many(bucket: Bucket,
keys: List[str]) ‑> List[Tuple[str, bytes | None]]
-
-
-
- -Expand source code - -
def get_many(bucket: wasi_keyvalue_store_0_2_0_draft2.Bucket, keys: List[str]) -> List[Tuple[str, Optional[bytes]]]:
-    """
-    Get the key-value pairs associated with the keys in the store. It returns a list of
-    key-value pairs.
-    
-    If any of the keys do not exist in the store, it returns a `none` value for that pair in the
-    list.
-    
-    MAY show an out-of-date value if there are concurrent writes to the store.
-    
-    If any other error occurs, it returns an `Err(error)`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-    """
-    raise NotImplementedError
-
-

Get the key-value pairs associated with the keys in the store. It returns a list of -key-value pairs.

-

If any of the keys do not exist in the store, it returns a none value for that pair in the -list.

-

MAY show an out-of-date value if there are concurrent writes to the store.

-

If any other error occurs, it returns an Err(error).

-

Raises: componentize_py_types.Err(Error)

-
-
-def set_many(bucket: Bucket,
key_values: List[Tuple[str, bytes]]) ‑> None
-
-
-
- -Expand source code - -
def set_many(bucket: wasi_keyvalue_store_0_2_0_draft2.Bucket, key_values: List[Tuple[str, bytes]]) -> None:
-    """
-    Set the values associated with the keys in the store. If the key already exists in the
-    store, it overwrites the value.
-    
-    Note that the key-value pairs are not guaranteed to be set in the order they are provided.
-    
-    If any of the keys do not exist in the store, it creates a new key-value pair.
-    
-    If any other error occurs, it returns an `Err(error)`. When an error occurs, it does not
-    rollback the key-value pairs that were already set. Thus, this batch operation does not
-    guarantee atomicity, implying that some key-value pairs could be set while others might
-    fail.
-    
-    Other concurrent operations may also be able to see the partial results.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-    """
-    raise NotImplementedError
-
-

Set the values associated with the keys in the store. If the key already exists in the -store, it overwrites the value.

-

Note that the key-value pairs are not guaranteed to be set in the order they are provided.

-

If any of the keys do not exist in the store, it creates a new key-value pair.

-

If any other error occurs, it returns an Err(error). When an error occurs, it does not -rollback the key-value pairs that were already set. Thus, this batch operation does not -guarantee atomicity, implying that some key-value pairs could be set while others might -fail.

-

Other concurrent operations may also be able to see the partial results.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_keyvalue_store_0_2_0_draft2.html b/docs/v4/wit/imports/wasi_keyvalue_store_0_2_0_draft2.html deleted file mode 100644 index 53d2536..0000000 --- a/docs/v4/wit/imports/wasi_keyvalue_store_0_2_0_draft2.html +++ /dev/null @@ -1,526 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2

-
-
-

A keyvalue interface that provides eventually consistent key-value operations.

-

Each of these operations acts on a single key-value pair.

-

The value in the key-value pair is defined as a u8 byte array and the intention is that it is -the common denominator for all data types defined by different key-value stores to handle data, -ensuring compatibility between different key-value stores. Note: the clients will be expecting -serialization/deserialization overhead to be handled by the key-value store. The value could be -a serialized object from JSON, HTML or vendor-specific data types like AWS S3 objects.

-

Data consistency in a key value store refers to the guarantee that once a write operation -completes, all subsequent read operations will return the value that was written.

-

Any implementation of this interface must have enough consistency to guarantee "reading your -writes." In particular, this means that the client should never get a value that is older than -the one it wrote, but it MAY get a newer value if one was written around the same time. These -guarantees only apply to the same client (which will likely be provided by the host or an -external capability of some kind). In this context a "client" is referring to the caller or -guest that is consuming this interface. Once a write request is committed by a specific client, -all subsequent read requests by the same client will reflect that write or any subsequent -writes. Another client running in a different context may or may not immediately see the result -due to the replication lag. As an example of all of this, if a value at a given key is A, and -the client writes B, then immediately reads, it should get B. If something else writes C in -quick succession, then the client may get C. However, a client running in a separate context may -still see A or B

-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this package

-
-
-
-
-

Functions

-
-
-def open(identifier: str) ‑> Bucket -
-
-
- -Expand source code - -
def open(identifier: str) -> Bucket:
-    """
-    Get the bucket with the specified identifier.
-    
-    `identifier` must refer to a bucket provided by the host.
-    
-    `error::no-such-store` will be raised if the `identifier` is not recognized.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-    """
-    raise NotImplementedError
-
-

Get the bucket with the specified identifier.

-

identifier must refer to a bucket provided by the host.

-

error::no-such-store will be raised if the identifier is not recognized.

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-

Classes

-
-
-class Bucket -
-
-
- -Expand source code - -
class Bucket:
-    """
-    A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the
-    bucket, and the bucket itself acts as a collection of all these entries.
-    
-    It is worth noting that the exact terminology for bucket in key-value stores can very
-    depending on the specific implementation. For example:
-    
-    1. Amazon DynamoDB calls a collection of key-value pairs a table
-    2. Redis has hashes, sets, and sorted sets as different types of collections
-    3. Cassandra calls a collection of key-value pairs a column family
-    4. MongoDB calls a collection of key-value pairs a collection
-    5. Riak calls a collection of key-value pairs a bucket
-    6. Memcached calls a collection of key-value pairs a slab
-    7. Azure Cosmos DB calls a collection of key-value pairs a container
-    
-    In this interface, we use the term `bucket` to refer to a collection of key-value pairs
-    """
-    
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value associated with the specified `key`
-        
-        The value is returned as an option. If the key-value pair exists in the
-        store, it returns `Ok(value)`. If the key does not exist in the
-        store, it returns `Ok(none)`.
-        
-        If any other error occurs, it returns an `Err(error)`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-        """
-        raise NotImplementedError
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set the value associated with the key in the store. If the key already
-        exists in the store, it overwrites the value.
-        
-        If the key does not exist in the store, it creates a new key-value pair.
-        
-        If any other error occurs, it returns an `Err(error)`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-        """
-        raise NotImplementedError
-    def delete(self, key: str) -> None:
-        """
-        Delete the key-value pair associated with the key in the store.
-        
-        If the key does not exist in the store, it does nothing.
-        
-        If any other error occurs, it returns an `Err(error)`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-        """
-        raise NotImplementedError
-    def exists(self, key: str) -> bool:
-        """
-        Check if the key exists in the store.
-        
-        If the key exists in the store, it returns `Ok(true)`. If the key does
-        not exist in the store, it returns `Ok(false)`.
-        
-        If any other error occurs, it returns an `Err(error)`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-        """
-        raise NotImplementedError
-    def list_keys(self, cursor: Optional[str]) -> KeyResponse:
-        """
-        Get all the keys in the store with an optional cursor (for use in pagination). It
-        returns a list of keys. Please note that for most KeyValue implementations, this is a
-        can be a very expensive operation and so it should be used judiciously. Implementations
-        can return any number of keys in a single response, but they should never attempt to
-        send more data than is reasonable (i.e. on a small edge device, this may only be a few
-        KB, while on a large machine this could be several MB). Any response should also return
-        a cursor that can be used to fetch the next page of keys. See the `key-response` record
-        for more information.
-        
-        Note that the keys are not guaranteed to be returned in any particular order.
-        
-        If the store is empty, it returns an empty list.
-        
-        MAY show an out-of-date list of keys if there are concurrent writes to the store.
-        
-        If any error occurs, it returns an `Err(error)`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the -bucket, and the bucket itself acts as a collection of all these entries.

-

It is worth noting that the exact terminology for bucket in key-value stores can very -depending on the specific implementation. For example:

-
    -
  1. Amazon DynamoDB calls a collection of key-value pairs a table
  2. -
  3. Redis has hashes, sets, and sorted sets as different types of collections
  4. -
  5. Cassandra calls a collection of key-value pairs a column family
  6. -
  7. MongoDB calls a collection of key-value pairs a collection
  8. -
  9. Riak calls a collection of key-value pairs a bucket
  10. -
  11. Memcached calls a collection of key-value pairs a slab
  12. -
  13. Azure Cosmos DB calls a collection of key-value pairs a container
  14. -
-

In this interface, we use the term bucket to refer to a collection of key-value pairs

-

Methods

-
-
-def delete(self, key: str) ‑> None -
-
-
- -Expand source code - -
def delete(self, key: str) -> None:
-    """
-    Delete the key-value pair associated with the key in the store.
-    
-    If the key does not exist in the store, it does nothing.
-    
-    If any other error occurs, it returns an `Err(error)`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-    """
-    raise NotImplementedError
-
-

Delete the key-value pair associated with the key in the store.

-

If the key does not exist in the store, it does nothing.

-

If any other error occurs, it returns an Err(error).

-

Raises: componentize_py_types.Err(Error)

-
-
-def exists(self, key: str) ‑> bool -
-
-
- -Expand source code - -
def exists(self, key: str) -> bool:
-    """
-    Check if the key exists in the store.
-    
-    If the key exists in the store, it returns `Ok(true)`. If the key does
-    not exist in the store, it returns `Ok(false)`.
-    
-    If any other error occurs, it returns an `Err(error)`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-    """
-    raise NotImplementedError
-
-

Check if the key exists in the store.

-

If the key exists in the store, it returns Ok(true). If the key does -not exist in the store, it returns Ok(false).

-

If any other error occurs, it returns an Err(error).

-

Raises: componentize_py_types.Err(Error)

-
-
-def get(self, key: str) ‑> bytes | None -
-
-
- -Expand source code - -
def get(self, key: str) -> Optional[bytes]:
-    """
-    Get the value associated with the specified `key`
-    
-    The value is returned as an option. If the key-value pair exists in the
-    store, it returns `Ok(value)`. If the key does not exist in the
-    store, it returns `Ok(none)`.
-    
-    If any other error occurs, it returns an `Err(error)`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-    """
-    raise NotImplementedError
-
-

Get the value associated with the specified key

-

The value is returned as an option. If the key-value pair exists in the -store, it returns Ok(value). If the key does not exist in the -store, it returns Ok(none).

-

If any other error occurs, it returns an Err(error).

-

Raises: componentize_py_types.Err(Error)

-
-
-def list_keys(self, cursor: str | None) ‑> KeyResponse -
-
-
- -Expand source code - -
def list_keys(self, cursor: Optional[str]) -> KeyResponse:
-    """
-    Get all the keys in the store with an optional cursor (for use in pagination). It
-    returns a list of keys. Please note that for most KeyValue implementations, this is a
-    can be a very expensive operation and so it should be used judiciously. Implementations
-    can return any number of keys in a single response, but they should never attempt to
-    send more data than is reasonable (i.e. on a small edge device, this may only be a few
-    KB, while on a large machine this could be several MB). Any response should also return
-    a cursor that can be used to fetch the next page of keys. See the `key-response` record
-    for more information.
-    
-    Note that the keys are not guaranteed to be returned in any particular order.
-    
-    If the store is empty, it returns an empty list.
-    
-    MAY show an out-of-date list of keys if there are concurrent writes to the store.
-    
-    If any error occurs, it returns an `Err(error)`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-    """
-    raise NotImplementedError
-
-

Get all the keys in the store with an optional cursor (for use in pagination). It -returns a list of keys. Please note that for most KeyValue implementations, this is a -can be a very expensive operation and so it should be used judiciously. Implementations -can return any number of keys in a single response, but they should never attempt to -send more data than is reasonable (i.e. on a small edge device, this may only be a few -KB, while on a large machine this could be several MB). Any response should also return -a cursor that can be used to fetch the next page of keys. See the key-response record -for more information.

-

Note that the keys are not guaranteed to be returned in any particular order.

-

If the store is empty, it returns an empty list.

-

MAY show an out-of-date list of keys if there are concurrent writes to the store.

-

If any error occurs, it returns an Err(error).

-

Raises: componentize_py_types.Err(Error)

-
-
-def set(self, key: str, value: bytes) ‑> None -
-
-
- -Expand source code - -
def set(self, key: str, value: bytes) -> None:
-    """
-    Set the value associated with the key in the store. If the key already
-    exists in the store, it overwrites the value.
-    
-    If the key does not exist in the store, it creates a new key-value pair.
-    
-    If any other error occurs, it returns an `Err(error)`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_keyvalue_store_0_2_0_draft2.Error)`
-    """
-    raise NotImplementedError
-
-

Set the value associated with the key in the store. If the key already -exists in the store, it overwrites the value.

-

If the key does not exist in the store, it creates a new key-value pair.

-

If any other error occurs, it returns an Err(error).

-

Raises: componentize_py_types.Err(Error)

-
-
-
-
-class Error_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class Error_AccessDenied:
-    pass
-
-

Error_AccessDenied()

-
-
-class Error_NoSuchStore -
-
-
- -Expand source code - -
@dataclass
-class Error_NoSuchStore:
-    pass
-
-

Error_NoSuchStore()

-
-
-class Error_Other -(value: str) -
-
-
- -Expand source code - -
@dataclass
-class Error_Other:
-    value: str
-
-

Error_Other(value: str)

-

Instance variables

-
-
var value : str
-
-
-
-
-
-
-class KeyResponse -(keys: List[str], cursor: str | None) -
-
-
- -Expand source code - -
@dataclass
-class KeyResponse:
-    """
-    A response to a `list-keys` operation.
-    """
-    keys: List[str]
-    cursor: Optional[str]
-
-

A response to a list-keys operation.

-

Instance variables

-
-
var cursor : str | None
-
-
-
-
var keys : List[str]
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_random_insecure_0_2_0.html b/docs/v4/wit/imports/wasi_random_insecure_0_2_0.html deleted file mode 100644 index e831db7..0000000 --- a/docs/v4/wit/imports/wasi_random_insecure_0_2_0.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_random_insecure_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_random_insecure_0_2_0

-
-
-

The insecure interface for insecure pseudo-random numbers.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-
-
-
-
-
-
-

Functions

-
-
-def get_insecure_random_bytes(len: int) ‑> bytes -
-
-
- -Expand source code - -
def get_insecure_random_bytes(len: int) -> bytes:
-    """
-    Return `len` insecure pseudo-random bytes.
-    
-    This function is not cryptographically secure. Do not use it for
-    anything related to security.
-    
-    There are no requirements on the values of the returned bytes, however
-    implementations are encouraged to return evenly distributed values with
-    a long period.
-    """
-    raise NotImplementedError
-
-

Return len insecure pseudo-random bytes.

-

This function is not cryptographically secure. Do not use it for -anything related to security.

-

There are no requirements on the values of the returned bytes, however -implementations are encouraged to return evenly distributed values with -a long period.

-
-
-def get_insecure_random_u64() ‑> int -
-
-
- -Expand source code - -
def get_insecure_random_u64() -> int:
-    """
-    Return an insecure pseudo-random `u64` value.
-    
-    This function returns the same type of pseudo-random data as
-    `get-insecure-random-bytes`, represented as a `u64`.
-    """
-    raise NotImplementedError
-
-

Return an insecure pseudo-random u64 value.

-

This function returns the same type of pseudo-random data as -get-insecure-random-bytes, represented as a u64.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_random_insecure_0_2_6.html b/docs/v4/wit/imports/wasi_random_insecure_0_2_6.html deleted file mode 100644 index 90c82c1..0000000 --- a/docs/v4/wit/imports/wasi_random_insecure_0_2_6.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_random_insecure_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_random_insecure_0_2_6

-
-
-

The insecure interface for insecure pseudo-random numbers.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-
-
-
-
-
-
-

Functions

-
-
-def get_insecure_random_bytes(len: int) ‑> bytes -
-
-
- -Expand source code - -
def get_insecure_random_bytes(len: int) -> bytes:
-    """
-    Return `len` insecure pseudo-random bytes.
-    
-    This function is not cryptographically secure. Do not use it for
-    anything related to security.
-    
-    There are no requirements on the values of the returned bytes, however
-    implementations are encouraged to return evenly distributed values with
-    a long period.
-    """
-    raise NotImplementedError
-
-

Return len insecure pseudo-random bytes.

-

This function is not cryptographically secure. Do not use it for -anything related to security.

-

There are no requirements on the values of the returned bytes, however -implementations are encouraged to return evenly distributed values with -a long period.

-
-
-def get_insecure_random_u64() ‑> int -
-
-
- -Expand source code - -
def get_insecure_random_u64() -> int:
-    """
-    Return an insecure pseudo-random `u64` value.
-    
-    This function returns the same type of pseudo-random data as
-    `get-insecure-random-bytes`, represented as a `u64`.
-    """
-    raise NotImplementedError
-
-

Return an insecure pseudo-random u64 value.

-

This function returns the same type of pseudo-random data as -get-insecure-random-bytes, represented as a u64.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_random_insecure_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_random_insecure_0_3_0_rc_2026_03_15.html deleted file mode 100644 index fe38a4f..0000000 --- a/docs/v4/wit/imports/wasi_random_insecure_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_random_insecure_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_random_insecure_0_3_0_rc_2026_03_15

-
-
-

The insecure interface for insecure pseudo-random numbers.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-
-
-
-
-
-
-

Functions

-
-
-def get_insecure_random_bytes(max_len: int) ‑> bytes -
-
-
- -Expand source code - -
def get_insecure_random_bytes(max_len: int) -> bytes:
-    """
-    Return up to `max-len` insecure pseudo-random bytes.
-    
-    This function is not cryptographically secure. Do not use it for
-    anything related to security.
-    
-    There are no requirements on the values of the returned bytes, however
-    implementations are encouraged to return evenly distributed values with
-    a long period.
-    
-    Implementations MAY return fewer bytes than requested (a short read).
-    Callers that require exactly `max-len` bytes MUST call this function in
-    a loop until the desired number of bytes has been accumulated.
-    Implementations MUST return at least 1 byte when `max-len` is greater
-    than zero. When `max-len` is zero, implementations MUST return an empty
-    list without trapping.
-    """
-    raise NotImplementedError
-
-

Return up to max-len insecure pseudo-random bytes.

-

This function is not cryptographically secure. Do not use it for -anything related to security.

-

There are no requirements on the values of the returned bytes, however -implementations are encouraged to return evenly distributed values with -a long period.

-

Implementations MAY return fewer bytes than requested (a short read). -Callers that require exactly max-len bytes MUST call this function in -a loop until the desired number of bytes has been accumulated. -Implementations MUST return at least 1 byte when max-len is greater -than zero. When max-len is zero, implementations MUST return an empty -list without trapping.

-
-
-def get_insecure_random_u64() ‑> int -
-
-
- -Expand source code - -
def get_insecure_random_u64() -> int:
-    """
-    Return an insecure pseudo-random `u64` value.
-    
-    This function returns the same type of pseudo-random data as
-    `get-insecure-random-bytes`, represented as a `u64`.
-    """
-    raise NotImplementedError
-
-

Return an insecure pseudo-random u64 value.

-

This function returns the same type of pseudo-random data as -get-insecure-random-bytes, represented as a u64.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_random_insecure_seed_0_2_0.html b/docs/v4/wit/imports/wasi_random_insecure_seed_0_2_0.html deleted file mode 100644 index f1d9880..0000000 --- a/docs/v4/wit/imports/wasi_random_insecure_seed_0_2_0.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_random_insecure_seed_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_random_insecure_seed_0_2_0

-
-
-

The insecure-seed interface for seeding hash-map DoS resistance.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-
-
-
-
-
-
-

Functions

-
-
-def insecure_seed() ‑> Tuple[int, int] -
-
-
- -Expand source code - -
def insecure_seed() -> Tuple[int, int]:
-    """
-    Return a 128-bit value that may contain a pseudo-random value.
-    
-    The returned value is not required to be computed from a CSPRNG, and may
-    even be entirely deterministic. Host implementations are encouraged to
-    provide pseudo-random values to any program exposed to
-    attacker-controlled content, to enable DoS protection built into many
-    languages' hash-map implementations.
-    
-    This function is intended to only be called once, by a source language
-    to initialize Denial Of Service (DoS) protection in its hash-map
-    implementation.
-    
-    # Expected future evolution
-    
-    This will likely be changed to a value import, to prevent it from being
-    called multiple times and potentially used for purposes other than DoS
-    protection.
-    """
-    raise NotImplementedError
-
-

Return a 128-bit value that may contain a pseudo-random value.

-

The returned value is not required to be computed from a CSPRNG, and may -even be entirely deterministic. Host implementations are encouraged to -provide pseudo-random values to any program exposed to -attacker-controlled content, to enable DoS protection built into many -languages' hash-map implementations.

-

This function is intended to only be called once, by a source language -to initialize Denial Of Service (DoS) protection in its hash-map -implementation.

-

Expected future evolution

-

This will likely be changed to a value import, to prevent it from being -called multiple times and potentially used for purposes other than DoS -protection.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_random_insecure_seed_0_2_6.html b/docs/v4/wit/imports/wasi_random_insecure_seed_0_2_6.html deleted file mode 100644 index b3a89d5..0000000 --- a/docs/v4/wit/imports/wasi_random_insecure_seed_0_2_6.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_random_insecure_seed_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_random_insecure_seed_0_2_6

-
-
-

The insecure-seed interface for seeding hash-map DoS resistance.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-
-
-
-
-
-
-

Functions

-
-
-def insecure_seed() ‑> Tuple[int, int] -
-
-
- -Expand source code - -
def insecure_seed() -> Tuple[int, int]:
-    """
-    Return a 128-bit value that may contain a pseudo-random value.
-    
-    The returned value is not required to be computed from a CSPRNG, and may
-    even be entirely deterministic. Host implementations are encouraged to
-    provide pseudo-random values to any program exposed to
-    attacker-controlled content, to enable DoS protection built into many
-    languages' hash-map implementations.
-    
-    This function is intended to only be called once, by a source language
-    to initialize Denial Of Service (DoS) protection in its hash-map
-    implementation.
-    
-    # Expected future evolution
-    
-    This will likely be changed to a value import, to prevent it from being
-    called multiple times and potentially used for purposes other than DoS
-    protection.
-    """
-    raise NotImplementedError
-
-

Return a 128-bit value that may contain a pseudo-random value.

-

The returned value is not required to be computed from a CSPRNG, and may -even be entirely deterministic. Host implementations are encouraged to -provide pseudo-random values to any program exposed to -attacker-controlled content, to enable DoS protection built into many -languages' hash-map implementations.

-

This function is intended to only be called once, by a source language -to initialize Denial Of Service (DoS) protection in its hash-map -implementation.

-

Expected future evolution

-

This will likely be changed to a value import, to prevent it from being -called multiple times and potentially used for purposes other than DoS -protection.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_random_insecure_seed_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_random_insecure_seed_0_3_0_rc_2026_03_15.html deleted file mode 100644 index e1577d4..0000000 --- a/docs/v4/wit/imports/wasi_random_insecure_seed_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_random_insecure_seed_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_random_insecure_seed_0_3_0_rc_2026_03_15

-
-
-

The insecure-seed interface for seeding hash-map DoS resistance.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-
-
-
-
-
-
-

Functions

-
-
-def get_insecure_seed() ‑> Tuple[int, int] -
-
-
- -Expand source code - -
def get_insecure_seed() -> Tuple[int, int]:
-    """
-    Return a 128-bit value that may contain a pseudo-random value.
-    
-    The returned value is not required to be computed from a CSPRNG, and may
-    even be entirely deterministic. Host implementations are encouraged to
-    provide pseudo-random values to any program exposed to
-    attacker-controlled content, to enable DoS protection built into many
-    languages' hash-map implementations.
-    
-    This function is intended to only be called once, by a source language
-    to initialize Denial Of Service (DoS) protection in its hash-map
-    implementation.
-    
-    # Expected future evolution
-    
-    This will likely be changed to a value import, to prevent it from being
-    called multiple times and potentially used for purposes other than DoS
-    protection.
-    """
-    raise NotImplementedError
-
-

Return a 128-bit value that may contain a pseudo-random value.

-

The returned value is not required to be computed from a CSPRNG, and may -even be entirely deterministic. Host implementations are encouraged to -provide pseudo-random values to any program exposed to -attacker-controlled content, to enable DoS protection built into many -languages' hash-map implementations.

-

This function is intended to only be called once, by a source language -to initialize Denial Of Service (DoS) protection in its hash-map -implementation.

-

Expected future evolution

-

This will likely be changed to a value import, to prevent it from being -called multiple times and potentially used for purposes other than DoS -protection.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_random_random_0_2_0.html b/docs/v4/wit/imports/wasi_random_random_0_2_0.html deleted file mode 100644 index 17b87e5..0000000 --- a/docs/v4/wit/imports/wasi_random_random_0_2_0.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_random_random_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_random_random_0_2_0

-
-
-

WASI Random is a random data API.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-
-
-
-
-
-
-

Functions

-
-
-def get_random_bytes(len: int) ‑> bytes -
-
-
- -Expand source code - -
def get_random_bytes(len: int) -> bytes:
-    """
-    Return `len` cryptographically-secure random or pseudo-random bytes.
-    
-    This function must produce data at least as cryptographically secure and
-    fast as an adequately seeded cryptographically-secure pseudo-random
-    number generator (CSPRNG). It must not block, from the perspective of
-    the calling program, under any circumstances, including on the first
-    request and on requests for numbers of bytes. The returned data must
-    always be unpredictable.
-    
-    This function must always return fresh data. Deterministic environments
-    must omit this function, rather than implementing it with deterministic
-    data.
-    """
-    raise NotImplementedError
-
-

Return len cryptographically-secure random or pseudo-random bytes.

-

This function must produce data at least as cryptographically secure and -fast as an adequately seeded cryptographically-secure pseudo-random -number generator (CSPRNG). It must not block, from the perspective of -the calling program, under any circumstances, including on the first -request and on requests for numbers of bytes. The returned data must -always be unpredictable.

-

This function must always return fresh data. Deterministic environments -must omit this function, rather than implementing it with deterministic -data.

-
-
-def get_random_u64() ‑> int -
-
-
- -Expand source code - -
def get_random_u64() -> int:
-    """
-    Return a cryptographically-secure random or pseudo-random `u64` value.
-    
-    This function returns the same type of data as `get-random-bytes`,
-    represented as a `u64`.
-    """
-    raise NotImplementedError
-
-

Return a cryptographically-secure random or pseudo-random u64 value.

-

This function returns the same type of data as get-random-bytes, -represented as a u64.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_random_random_0_2_6.html b/docs/v4/wit/imports/wasi_random_random_0_2_6.html deleted file mode 100644 index d911efe..0000000 --- a/docs/v4/wit/imports/wasi_random_random_0_2_6.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_random_random_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_random_random_0_2_6

-
-
-

WASI Random is a random data API.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-
-
-
-
-
-
-

Functions

-
-
-def get_random_bytes(len: int) ‑> bytes -
-
-
- -Expand source code - -
def get_random_bytes(len: int) -> bytes:
-    """
-    Return `len` cryptographically-secure random or pseudo-random bytes.
-    
-    This function must produce data at least as cryptographically secure and
-    fast as an adequately seeded cryptographically-secure pseudo-random
-    number generator (CSPRNG). It must not block, from the perspective of
-    the calling program, under any circumstances, including on the first
-    request and on requests for numbers of bytes. The returned data must
-    always be unpredictable.
-    
-    This function must always return fresh data. Deterministic environments
-    must omit this function, rather than implementing it with deterministic
-    data.
-    """
-    raise NotImplementedError
-
-

Return len cryptographically-secure random or pseudo-random bytes.

-

This function must produce data at least as cryptographically secure and -fast as an adequately seeded cryptographically-secure pseudo-random -number generator (CSPRNG). It must not block, from the perspective of -the calling program, under any circumstances, including on the first -request and on requests for numbers of bytes. The returned data must -always be unpredictable.

-

This function must always return fresh data. Deterministic environments -must omit this function, rather than implementing it with deterministic -data.

-
-
-def get_random_u64() ‑> int -
-
-
- -Expand source code - -
def get_random_u64() -> int:
-    """
-    Return a cryptographically-secure random or pseudo-random `u64` value.
-    
-    This function returns the same type of data as `get-random-bytes`,
-    represented as a `u64`.
-    """
-    raise NotImplementedError
-
-

Return a cryptographically-secure random or pseudo-random u64 value.

-

This function returns the same type of data as get-random-bytes, -represented as a u64.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_random_random_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_random_random_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 4b9b008..0000000 --- a/docs/v4/wit/imports/wasi_random_random_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_random_random_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_random_random_0_3_0_rc_2026_03_15

-
-
-

WASI Random is a random data API.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-
-
-
-
-
-
-

Functions

-
-
-def get_random_bytes(max_len: int) ‑> bytes -
-
-
- -Expand source code - -
def get_random_bytes(max_len: int) -> bytes:
-    """
-    Return up to `max-len` cryptographically-secure random or pseudo-random
-    bytes.
-    
-    This function must produce data at least as cryptographically secure and
-    fast as an adequately seeded cryptographically-secure pseudo-random
-    number generator (CSPRNG). It must not block, from the perspective of
-    the calling program, under any circumstances, including on the first
-    request and on requests for numbers of bytes. The returned data must
-    always be unpredictable.
-    
-    Implementations MAY return fewer bytes than requested (a short read).
-    Callers that require exactly `max-len` bytes MUST call this function in
-    a loop until the desired number of bytes has been accumulated.
-    Implementations MUST return at least 1 byte when `max-len` is greater
-    than zero. When `max-len` is zero, implementations MUST return an empty
-    list without trapping.
-    
-    This function must always return fresh data. Deterministic environments
-    must omit this function, rather than implementing it with deterministic
-    data.
-    """
-    raise NotImplementedError
-
-

Return up to max-len cryptographically-secure random or pseudo-random -bytes.

-

This function must produce data at least as cryptographically secure and -fast as an adequately seeded cryptographically-secure pseudo-random -number generator (CSPRNG). It must not block, from the perspective of -the calling program, under any circumstances, including on the first -request and on requests for numbers of bytes. The returned data must -always be unpredictable.

-

Implementations MAY return fewer bytes than requested (a short read). -Callers that require exactly max-len bytes MUST call this function in -a loop until the desired number of bytes has been accumulated. -Implementations MUST return at least 1 byte when max-len is greater -than zero. When max-len is zero, implementations MUST return an empty -list without trapping.

-

This function must always return fresh data. Deterministic environments -must omit this function, rather than implementing it with deterministic -data.

-
-
-def get_random_u64() ‑> int -
-
-
- -Expand source code - -
def get_random_u64() -> int:
-    """
-    Return a cryptographically-secure random or pseudo-random `u64` value.
-    
-    This function returns the same type of data as `get-random-bytes`,
-    represented as a `u64`.
-    """
-    raise NotImplementedError
-
-

Return a cryptographically-secure random or pseudo-random u64 value.

-

This function returns the same type of data as get-random-bytes, -represented as a u64.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_instance_network_0_2_0.html b/docs/v4/wit/imports/wasi_sockets_instance_network_0_2_0.html deleted file mode 100644 index 6587d26..0000000 --- a/docs/v4/wit/imports/wasi_sockets_instance_network_0_2_0.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_instance_network_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_instance_network_0_2_0

-
-
-

This interface provides a value-export of the default network handle..

-
-
-
-
-
-
-

Functions

-
-
-def instance_network() ‑> Network -
-
-
- -Expand source code - -
def instance_network() -> wasi_sockets_network_0_2_0.Network:
-    """
-    Get a handle to the default network.
-    """
-    raise NotImplementedError
-
-

Get a handle to the default network.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_instance_network_0_2_6.html b/docs/v4/wit/imports/wasi_sockets_instance_network_0_2_6.html deleted file mode 100644 index 8d768ac..0000000 --- a/docs/v4/wit/imports/wasi_sockets_instance_network_0_2_6.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_instance_network_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_instance_network_0_2_6

-
-
-

This interface provides a value-export of the default network handle..

-
-
-
-
-
-
-

Functions

-
-
-def instance_network() ‑> Network -
-
-
- -Expand source code - -
def instance_network() -> wasi_sockets_network_0_2_6.Network:
-    """
-    Get a handle to the default network.
-    """
-    raise NotImplementedError
-
-

Get a handle to the default network.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_ip_name_lookup_0_2_0.html b/docs/v4/wit/imports/wasi_sockets_ip_name_lookup_0_2_0.html deleted file mode 100644 index c355756..0000000 --- a/docs/v4/wit/imports/wasi_sockets_ip_name_lookup_0_2_0.html +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_ip_name_lookup_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_ip_name_lookup_0_2_0

-
-
-
-
-
-
-
-
-

Functions

-
-
-def resolve_addresses(network: Network,
name: str) ‑> ResolveAddressStream
-
-
-
- -Expand source code - -
def resolve_addresses(network: wasi_sockets_network_0_2_0.Network, name: str) -> ResolveAddressStream:
-    """
-    Resolve an internet host name to a list of IP addresses.
-    
-    Unicode domain names are automatically converted to ASCII using IDNA encoding.
-    If the input is an IP address string, the address is parsed and returned
-    as-is without making any external requests.
-    
-    See the wasi-socket proposal README.md for a comparison with getaddrinfo.
-    
-    This function never blocks. It either immediately fails or immediately
-    returns successfully with a `resolve-address-stream` that can be used
-    to (asynchronously) fetch the results.
-    
-    # Typical errors
-    - `invalid-argument`: `name` is a syntactically invalid domain name or IP address.
-    
-    # References:
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>
-    - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
-    - <https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Resolve an internet host name to a list of IP addresses.

-

Unicode domain names are automatically converted to ASCII using IDNA encoding. -If the input is an IP address string, the address is parsed and returned -as-is without making any external requests.

-

See the wasi-socket proposal README.md for a comparison with getaddrinfo.

-

This function never blocks. It either immediately fails or immediately -returns successfully with a resolve-address-stream that can be used -to (asynchronously) fetch the results.

-

Typical errors

-
    -
  • invalid-argument: name is a syntactically invalid domain name or IP address.
  • -
-

References:

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-

Classes

-
-
-class ResolveAddressStream -
-
-
- -Expand source code - -
class ResolveAddressStream:
-    
-    def resolve_next_address(self) -> Optional[wasi_sockets_network_0_2_0.IpAddress]:
-        """
-        Returns the next address from the resolver.
-        
-        This function should be called multiple times. On each call, it will
-        return the next address in connection order preference. If all
-        addresses have been exhausted, this function returns `none`.
-        
-        This function never returns IPv4-mapped IPv6 addresses.
-        
-        # Typical errors
-        - `name-unresolvable`:          Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY)
-        - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN)
-        - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL)
-        - `would-block`:                A result is not available yet. (EWOULDBLOCK, EAGAIN)
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-        """
-        Create a `pollable` which will resolve once the stream is ready for I/O.
-        
-        Note: this function is here for WASI Preview2 only.
-        It's planned to be removed when `future` is natively supported in Preview3.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Methods

-
-
-def resolve_next_address(self) ‑> IpAddress_Ipv4 | IpAddress_Ipv6 | None -
-
-
- -Expand source code - -
def resolve_next_address(self) -> Optional[wasi_sockets_network_0_2_0.IpAddress]:
-    """
-    Returns the next address from the resolver.
-    
-    This function should be called multiple times. On each call, it will
-    return the next address in connection order preference. If all
-    addresses have been exhausted, this function returns `none`.
-    
-    This function never returns IPv4-mapped IPv6 addresses.
-    
-    # Typical errors
-    - `name-unresolvable`:          Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY)
-    - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN)
-    - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL)
-    - `would-block`:                A result is not available yet. (EWOULDBLOCK, EAGAIN)
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Returns the next address from the resolver.

-

This function should be called multiple times. On each call, it will -return the next address in connection order preference. If all -addresses have been exhausted, this function returns none.

-

This function never returns IPv4-mapped IPv6 addresses.

-

Typical errors

-
    -
  • name-unresolvable: -Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY)
  • -
  • temporary-resolver-failure: A temporary failure in name resolution occurred. (EAI_AGAIN)
  • -
  • permanent-resolver-failure: A permanent failure in name resolution occurred. (EAI_FAIL)
  • -
  • would-block: -A result is not available yet. (EWOULDBLOCK, EAGAIN)
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-    """
-    Create a `pollable` which will resolve once the stream is ready for I/O.
-    
-    Note: this function is here for WASI Preview2 only.
-    It's planned to be removed when `future` is natively supported in Preview3.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the stream is ready for I/O.

-

Note: this function is here for WASI Preview2 only. -It's planned to be removed when future is natively supported in Preview3.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_ip_name_lookup_0_2_6.html b/docs/v4/wit/imports/wasi_sockets_ip_name_lookup_0_2_6.html deleted file mode 100644 index a791f37..0000000 --- a/docs/v4/wit/imports/wasi_sockets_ip_name_lookup_0_2_6.html +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_ip_name_lookup_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_ip_name_lookup_0_2_6

-
-
-
-
-
-
-
-
-

Functions

-
-
-def resolve_addresses(network: Network,
name: str) ‑> ResolveAddressStream
-
-
-
- -Expand source code - -
def resolve_addresses(network: wasi_sockets_network_0_2_6.Network, name: str) -> ResolveAddressStream:
-    """
-    Resolve an internet host name to a list of IP addresses.
-    
-    Unicode domain names are automatically converted to ASCII using IDNA encoding.
-    If the input is an IP address string, the address is parsed and returned
-    as-is without making any external requests.
-    
-    See the wasi-socket proposal README.md for a comparison with getaddrinfo.
-    
-    This function never blocks. It either immediately fails or immediately
-    returns successfully with a `resolve-address-stream` that can be used
-    to (asynchronously) fetch the results.
-    
-    # Typical errors
-    - `invalid-argument`: `name` is a syntactically invalid domain name or IP address.
-    
-    # References:
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>
-    - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
-    - <https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Resolve an internet host name to a list of IP addresses.

-

Unicode domain names are automatically converted to ASCII using IDNA encoding. -If the input is an IP address string, the address is parsed and returned -as-is without making any external requests.

-

See the wasi-socket proposal README.md for a comparison with getaddrinfo.

-

This function never blocks. It either immediately fails or immediately -returns successfully with a resolve-address-stream that can be used -to (asynchronously) fetch the results.

-

Typical errors

-
    -
  • invalid-argument: name is a syntactically invalid domain name or IP address.
  • -
-

References:

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-

Classes

-
-
-class ResolveAddressStream -
-
-
- -Expand source code - -
class ResolveAddressStream:
-    
-    def resolve_next_address(self) -> Optional[wasi_sockets_network_0_2_6.IpAddress]:
-        """
-        Returns the next address from the resolver.
-        
-        This function should be called multiple times. On each call, it will
-        return the next address in connection order preference. If all
-        addresses have been exhausted, this function returns `none`.
-        
-        This function never returns IPv4-mapped IPv6 addresses.
-        
-        # Typical errors
-        - `name-unresolvable`:          Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY)
-        - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN)
-        - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL)
-        - `would-block`:                A result is not available yet. (EWOULDBLOCK, EAGAIN)
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-        """
-        Create a `pollable` which will resolve once the stream is ready for I/O.
-        
-        Note: this function is here for WASI 0.2 only.
-        It's planned to be removed when `future` is natively supported in Preview3.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Methods

-
-
-def resolve_next_address(self) ‑> IpAddress_Ipv4 | IpAddress_Ipv6 | None -
-
-
- -Expand source code - -
def resolve_next_address(self) -> Optional[wasi_sockets_network_0_2_6.IpAddress]:
-    """
-    Returns the next address from the resolver.
-    
-    This function should be called multiple times. On each call, it will
-    return the next address in connection order preference. If all
-    addresses have been exhausted, this function returns `none`.
-    
-    This function never returns IPv4-mapped IPv6 addresses.
-    
-    # Typical errors
-    - `name-unresolvable`:          Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY)
-    - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN)
-    - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL)
-    - `would-block`:                A result is not available yet. (EWOULDBLOCK, EAGAIN)
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Returns the next address from the resolver.

-

This function should be called multiple times. On each call, it will -return the next address in connection order preference. If all -addresses have been exhausted, this function returns none.

-

This function never returns IPv4-mapped IPv6 addresses.

-

Typical errors

-
    -
  • name-unresolvable: -Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY)
  • -
  • temporary-resolver-failure: A temporary failure in name resolution occurred. (EAI_AGAIN)
  • -
  • permanent-resolver-failure: A permanent failure in name resolution occurred. (EAI_FAIL)
  • -
  • would-block: -A result is not available yet. (EWOULDBLOCK, EAGAIN)
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-    """
-    Create a `pollable` which will resolve once the stream is ready for I/O.
-    
-    Note: this function is here for WASI 0.2 only.
-    It's planned to be removed when `future` is natively supported in Preview3.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the stream is ready for I/O.

-

Note: this function is here for WASI 0.2 only. -It's planned to be removed when future is natively supported in Preview3.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_ip_name_lookup_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_sockets_ip_name_lookup_0_3_0_rc_2026_03_15.html deleted file mode 100644 index b5e20d9..0000000 --- a/docs/v4/wit/imports/wasi_sockets_ip_name_lookup_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_ip_name_lookup_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_ip_name_lookup_0_3_0_rc_2026_03_15

-
-
-
-
-
-
-

Global variables

-
-
var ErrorCode
-
-

Lookup error codes.

-
-
-
-
-

Functions

-
-
-async def resolve_addresses(name: str) ‑> List[IpAddress_Ipv4 | IpAddress_Ipv6] -
-
-
- -Expand source code - -
async def resolve_addresses(name: str) -> List[wasi_sockets_types_0_3_0_rc_2026_03_15.IpAddress]:
-    """
-    Resolve an internet host name to a list of IP addresses.
-    
-    Unicode domain names are automatically converted to ASCII using IDNA
-    encoding. If the input is an IP address string, the address is parsed
-    and returned as-is without making any external requests.
-    
-    See the wasi-socket proposal README.md for a comparison with getaddrinfo.
-    
-    The results are returned in connection order preference.
-    
-    This function never succeeds with 0 results. It either fails or succeeds
-    with at least one address. Additionally, this function never returns
-    IPv4-mapped IPv6 addresses.
-    
-    # References:
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>
-    - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
-    - <https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_ip_name_lookup_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Resolve an internet host name to a list of IP addresses.

-

Unicode domain names are automatically converted to ASCII using IDNA -encoding. If the input is an IP address string, the address is parsed -and returned as-is without making any external requests.

-

See the wasi-socket proposal README.md for a comparison with getaddrinfo.

-

The results are returned in connection order preference.

-

This function never succeeds with 0 results. It either fails or succeeds -with at least one address. Additionally, this function never returns -IPv4-mapped IPv6 addresses.

-

References:

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-

Classes

-
-
-class ErrorCode_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_AccessDenied:
-    pass
-
-

ErrorCode_AccessDenied()

-
-
-class ErrorCode_InvalidArgument -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_InvalidArgument:
-    pass
-
-

ErrorCode_InvalidArgument()

-
-
-class ErrorCode_NameUnresolvable -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_NameUnresolvable:
-    pass
-
-

ErrorCode_NameUnresolvable()

-
-
-class ErrorCode_Other -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Other:
-    value: Optional[str]
-
-

ErrorCode_Other(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_PermanentResolverFailure -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_PermanentResolverFailure:
-    pass
-
-

ErrorCode_PermanentResolverFailure()

-
-
-class ErrorCode_TemporaryResolverFailure -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_TemporaryResolverFailure:
-    pass
-
-

ErrorCode_TemporaryResolverFailure()

-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_network_0_2_0.html b/docs/v4/wit/imports/wasi_sockets_network_0_2_0.html deleted file mode 100644 index 68a3ee9..0000000 --- a/docs/v4/wit/imports/wasi_sockets_network_0_2_0.html +++ /dev/null @@ -1,557 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_network_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_network_0_2_0

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class ErrorCode -(*args, **kwds) -
-
-
- -Expand source code - -
class ErrorCode(Enum):
-    """
-    Error codes.
-    
-    In theory, every API can return any error code.
-    In practice, API's typically only return the errors documented per API
-    combined with a couple of errors that are always possible:
-    - `unknown`
-    - `access-denied`
-    - `not-supported`
-    - `out-of-memory`
-    - `concurrency-conflict`
-    
-    See each individual API for what the POSIX equivalents are. They sometimes differ per API.
-    """
-    UNKNOWN = 0
-    ACCESS_DENIED = 1
-    NOT_SUPPORTED = 2
-    INVALID_ARGUMENT = 3
-    OUT_OF_MEMORY = 4
-    TIMEOUT = 5
-    CONCURRENCY_CONFLICT = 6
-    NOT_IN_PROGRESS = 7
-    WOULD_BLOCK = 8
-    INVALID_STATE = 9
-    NEW_SOCKET_LIMIT = 10
-    ADDRESS_NOT_BINDABLE = 11
-    ADDRESS_IN_USE = 12
-    REMOTE_UNREACHABLE = 13
-    CONNECTION_REFUSED = 14
-    CONNECTION_RESET = 15
-    CONNECTION_ABORTED = 16
-    DATAGRAM_TOO_LARGE = 17
-    NAME_UNRESOLVABLE = 18
-    TEMPORARY_RESOLVER_FAILURE = 19
-    PERMANENT_RESOLVER_FAILURE = 20
-
-

Error codes.

-

In theory, every API can return any error code. -In practice, API's typically only return the errors documented per API -combined with a couple of errors that are always possible: -- unknown -- access-denied -- not-supported -- out-of-memory -- concurrency-conflict

-

See each individual API for what the POSIX equivalents are. They sometimes differ per API.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var ACCESS_DENIED
-
-
-
-
var ADDRESS_IN_USE
-
-
-
-
var ADDRESS_NOT_BINDABLE
-
-
-
-
var CONCURRENCY_CONFLICT
-
-
-
-
var CONNECTION_ABORTED
-
-
-
-
var CONNECTION_REFUSED
-
-
-
-
var CONNECTION_RESET
-
-
-
-
var DATAGRAM_TOO_LARGE
-
-
-
-
var INVALID_ARGUMENT
-
-
-
-
var INVALID_STATE
-
-
-
-
var NAME_UNRESOLVABLE
-
-
-
-
var NEW_SOCKET_LIMIT
-
-
-
-
var NOT_IN_PROGRESS
-
-
-
-
var NOT_SUPPORTED
-
-
-
-
var OUT_OF_MEMORY
-
-
-
-
var PERMANENT_RESOLVER_FAILURE
-
-
-
-
var REMOTE_UNREACHABLE
-
-
-
-
var TEMPORARY_RESOLVER_FAILURE
-
-
-
-
var TIMEOUT
-
-
-
-
var UNKNOWN
-
-
-
-
var WOULD_BLOCK
-
-
-
-
-
-
-class IpAddressFamily -(*args, **kwds) -
-
-
- -Expand source code - -
class IpAddressFamily(Enum):
-    IPV4 = 0
-    IPV6 = 1
-
-

Create a collection of name/value pairs.

-

Example enumeration:

-
>>> class Color(Enum):
-...     RED = 1
-...     BLUE = 2
-...     GREEN = 3
-
-

Access them by:

-
    -
  • attribute access:
  • -
-
-
-
-

Color.RED -

-
-
-
-
    -
  • value lookup:
  • -
-
-
-
-

Color(1) -

-
-
-
-
    -
  • name lookup:
  • -
-
-
-
-

Color['RED'] -

-
-
-
-

Enumerations can be iterated over, and know how many members they have:

-
>>> len(Color)
-3
-
-
>>> list(Color)
-[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
-
-

Methods can be added to enumerations, and members can have their own -attributes – see the documentation for details.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var IPV4
-
-
-
-
var IPV6
-
-
-
-
-
-
-class IpAddress_Ipv4 -(value: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class IpAddress_Ipv4:
-    value: Tuple[int, int, int, int]
-
-

IpAddress_Ipv4(value: Tuple[int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int]
-
-
-
-
-
-
-class IpAddress_Ipv6 -(value: Tuple[int, int, int, int, int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class IpAddress_Ipv6:
-    value: Tuple[int, int, int, int, int, int, int, int]
-
-

IpAddress_Ipv6(value: Tuple[int, int, int, int, int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int, int, int, int, int]
-
-
-
-
-
-
-class IpSocketAddress_Ipv4 -(value: Ipv4SocketAddress) -
-
-
- -Expand source code - -
@dataclass
-class IpSocketAddress_Ipv4:
-    value: Ipv4SocketAddress
-
-

IpSocketAddress_Ipv4(value: spin_sdk.wit.imports.wasi_sockets_network_0_2_0.Ipv4SocketAddress)

-

Instance variables

-
-
var valueIpv4SocketAddress
-
-
-
-
-
-
-class IpSocketAddress_Ipv6 -(value: Ipv6SocketAddress) -
-
-
- -Expand source code - -
@dataclass
-class IpSocketAddress_Ipv6:
-    value: Ipv6SocketAddress
-
-

IpSocketAddress_Ipv6(value: spin_sdk.wit.imports.wasi_sockets_network_0_2_0.Ipv6SocketAddress)

-

Instance variables

-
-
var valueIpv6SocketAddress
-
-
-
-
-
-
-class Ipv4SocketAddress -(port: int, address: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class Ipv4SocketAddress:
-    port: int
-    address: Tuple[int, int, int, int]
-
-

Ipv4SocketAddress(port: int, address: Tuple[int, int, int, int])

-

Instance variables

-
-
var address : Tuple[int, int, int, int]
-
-
-
-
var port : int
-
-
-
-
-
-
-class Ipv6SocketAddress -(port: int,
flow_info: int,
address: Tuple[int, int, int, int, int, int, int, int],
scope_id: int)
-
-
-
- -Expand source code - -
@dataclass
-class Ipv6SocketAddress:
-    port: int
-    flow_info: int
-    address: Tuple[int, int, int, int, int, int, int, int]
-    scope_id: int
-
-

Ipv6SocketAddress(port: int, flow_info: int, address: Tuple[int, int, int, int, int, int, int, int], scope_id: int)

-

Instance variables

-
-
var address : Tuple[int, int, int, int, int, int, int, int]
-
-
-
-
var flow_info : int
-
-
-
-
var port : int
-
-
-
-
var scope_id : int
-
-
-
-
-
-
-class Network -
-
-
- -Expand source code - -
class Network:
-    """
-    An opaque resource that represents access to (a subset of) the network.
-    This enables context-based security for networking.
-    There is no need for this to map 1:1 to a physical network interface.
-    """
-    
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

An opaque resource that represents access to (a subset of) the network. -This enables context-based security for networking. -There is no need for this to map 1:1 to a physical network interface.

-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_network_0_2_6.html b/docs/v4/wit/imports/wasi_sockets_network_0_2_6.html deleted file mode 100644 index 55d8392..0000000 --- a/docs/v4/wit/imports/wasi_sockets_network_0_2_6.html +++ /dev/null @@ -1,557 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_network_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_network_0_2_6

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class ErrorCode -(*args, **kwds) -
-
-
- -Expand source code - -
class ErrorCode(Enum):
-    """
-    Error codes.
-    
-    In theory, every API can return any error code.
-    In practice, API's typically only return the errors documented per API
-    combined with a couple of errors that are always possible:
-    - `unknown`
-    - `access-denied`
-    - `not-supported`
-    - `out-of-memory`
-    - `concurrency-conflict`
-    
-    See each individual API for what the POSIX equivalents are. They sometimes differ per API.
-    """
-    UNKNOWN = 0
-    ACCESS_DENIED = 1
-    NOT_SUPPORTED = 2
-    INVALID_ARGUMENT = 3
-    OUT_OF_MEMORY = 4
-    TIMEOUT = 5
-    CONCURRENCY_CONFLICT = 6
-    NOT_IN_PROGRESS = 7
-    WOULD_BLOCK = 8
-    INVALID_STATE = 9
-    NEW_SOCKET_LIMIT = 10
-    ADDRESS_NOT_BINDABLE = 11
-    ADDRESS_IN_USE = 12
-    REMOTE_UNREACHABLE = 13
-    CONNECTION_REFUSED = 14
-    CONNECTION_RESET = 15
-    CONNECTION_ABORTED = 16
-    DATAGRAM_TOO_LARGE = 17
-    NAME_UNRESOLVABLE = 18
-    TEMPORARY_RESOLVER_FAILURE = 19
-    PERMANENT_RESOLVER_FAILURE = 20
-
-

Error codes.

-

In theory, every API can return any error code. -In practice, API's typically only return the errors documented per API -combined with a couple of errors that are always possible: -- unknown -- access-denied -- not-supported -- out-of-memory -- concurrency-conflict

-

See each individual API for what the POSIX equivalents are. They sometimes differ per API.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var ACCESS_DENIED
-
-
-
-
var ADDRESS_IN_USE
-
-
-
-
var ADDRESS_NOT_BINDABLE
-
-
-
-
var CONCURRENCY_CONFLICT
-
-
-
-
var CONNECTION_ABORTED
-
-
-
-
var CONNECTION_REFUSED
-
-
-
-
var CONNECTION_RESET
-
-
-
-
var DATAGRAM_TOO_LARGE
-
-
-
-
var INVALID_ARGUMENT
-
-
-
-
var INVALID_STATE
-
-
-
-
var NAME_UNRESOLVABLE
-
-
-
-
var NEW_SOCKET_LIMIT
-
-
-
-
var NOT_IN_PROGRESS
-
-
-
-
var NOT_SUPPORTED
-
-
-
-
var OUT_OF_MEMORY
-
-
-
-
var PERMANENT_RESOLVER_FAILURE
-
-
-
-
var REMOTE_UNREACHABLE
-
-
-
-
var TEMPORARY_RESOLVER_FAILURE
-
-
-
-
var TIMEOUT
-
-
-
-
var UNKNOWN
-
-
-
-
var WOULD_BLOCK
-
-
-
-
-
-
-class IpAddressFamily -(*args, **kwds) -
-
-
- -Expand source code - -
class IpAddressFamily(Enum):
-    IPV4 = 0
-    IPV6 = 1
-
-

Create a collection of name/value pairs.

-

Example enumeration:

-
>>> class Color(Enum):
-...     RED = 1
-...     BLUE = 2
-...     GREEN = 3
-
-

Access them by:

-
    -
  • attribute access:
  • -
-
-
-
-

Color.RED -

-
-
-
-
    -
  • value lookup:
  • -
-
-
-
-

Color(1) -

-
-
-
-
    -
  • name lookup:
  • -
-
-
-
-

Color['RED'] -

-
-
-
-

Enumerations can be iterated over, and know how many members they have:

-
>>> len(Color)
-3
-
-
>>> list(Color)
-[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
-
-

Methods can be added to enumerations, and members can have their own -attributes – see the documentation for details.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var IPV4
-
-
-
-
var IPV6
-
-
-
-
-
-
-class IpAddress_Ipv4 -(value: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class IpAddress_Ipv4:
-    value: Tuple[int, int, int, int]
-
-

IpAddress_Ipv4(value: Tuple[int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int]
-
-
-
-
-
-
-class IpAddress_Ipv6 -(value: Tuple[int, int, int, int, int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class IpAddress_Ipv6:
-    value: Tuple[int, int, int, int, int, int, int, int]
-
-

IpAddress_Ipv6(value: Tuple[int, int, int, int, int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int, int, int, int, int]
-
-
-
-
-
-
-class IpSocketAddress_Ipv4 -(value: Ipv4SocketAddress) -
-
-
- -Expand source code - -
@dataclass
-class IpSocketAddress_Ipv4:
-    value: Ipv4SocketAddress
-
-

IpSocketAddress_Ipv4(value: spin_sdk.wit.imports.wasi_sockets_network_0_2_6.Ipv4SocketAddress)

-

Instance variables

-
-
var valueIpv4SocketAddress
-
-
-
-
-
-
-class IpSocketAddress_Ipv6 -(value: Ipv6SocketAddress) -
-
-
- -Expand source code - -
@dataclass
-class IpSocketAddress_Ipv6:
-    value: Ipv6SocketAddress
-
-

IpSocketAddress_Ipv6(value: spin_sdk.wit.imports.wasi_sockets_network_0_2_6.Ipv6SocketAddress)

-

Instance variables

-
-
var valueIpv6SocketAddress
-
-
-
-
-
-
-class Ipv4SocketAddress -(port: int, address: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class Ipv4SocketAddress:
-    port: int
-    address: Tuple[int, int, int, int]
-
-

Ipv4SocketAddress(port: int, address: Tuple[int, int, int, int])

-

Instance variables

-
-
var address : Tuple[int, int, int, int]
-
-
-
-
var port : int
-
-
-
-
-
-
-class Ipv6SocketAddress -(port: int,
flow_info: int,
address: Tuple[int, int, int, int, int, int, int, int],
scope_id: int)
-
-
-
- -Expand source code - -
@dataclass
-class Ipv6SocketAddress:
-    port: int
-    flow_info: int
-    address: Tuple[int, int, int, int, int, int, int, int]
-    scope_id: int
-
-

Ipv6SocketAddress(port: int, flow_info: int, address: Tuple[int, int, int, int, int, int, int, int], scope_id: int)

-

Instance variables

-
-
var address : Tuple[int, int, int, int, int, int, int, int]
-
-
-
-
var flow_info : int
-
-
-
-
var port : int
-
-
-
-
var scope_id : int
-
-
-
-
-
-
-class Network -
-
-
- -Expand source code - -
class Network:
-    """
-    An opaque resource that represents access to (a subset of) the network.
-    This enables context-based security for networking.
-    There is no need for this to map 1:1 to a physical network interface.
-    """
-    
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

An opaque resource that represents access to (a subset of) the network. -This enables context-based security for networking. -There is no need for this to map 1:1 to a physical network interface.

-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_tcp_0_2_0.html b/docs/v4/wit/imports/wasi_sockets_tcp_0_2_0.html deleted file mode 100644 index e14d340..0000000 --- a/docs/v4/wit/imports/wasi_sockets_tcp_0_2_0.html +++ /dev/null @@ -1,1701 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_tcp_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_tcp_0_2_0

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class ShutdownType -(*args, **kwds) -
-
-
- -Expand source code - -
class ShutdownType(Enum):
-    RECEIVE = 0
-    SEND = 1
-    BOTH = 2
-
-

Create a collection of name/value pairs.

-

Example enumeration:

-
>>> class Color(Enum):
-...     RED = 1
-...     BLUE = 2
-...     GREEN = 3
-
-

Access them by:

-
    -
  • attribute access:
  • -
-
-
-
-

Color.RED -

-
-
-
-
    -
  • value lookup:
  • -
-
-
-
-

Color(1) -

-
-
-
-
    -
  • name lookup:
  • -
-
-
-
-

Color['RED'] -

-
-
-
-

Enumerations can be iterated over, and know how many members they have:

-
>>> len(Color)
-3
-
-
>>> list(Color)
-[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
-
-

Methods can be added to enumerations, and members can have their own -attributes – see the documentation for details.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var BOTH
-
-
-
-
var RECEIVE
-
-
-
-
var SEND
-
-
-
-
-
-
-class TcpSocket -
-
-
- -Expand source code - -
class TcpSocket:
-    """
-    A TCP socket resource.
-    
-    The socket can be in one of the following states:
-    - `unbound`
-    - `bind-in-progress`
-    - `bound` (See note below)
-    - `listen-in-progress`
-    - `listening`
-    - `connect-in-progress`
-    - `connected`
-    - `closed`
-    See <https://github.com/WebAssembly/wasi-sockets/TcpSocketOperationalSemantics.md>
-    for a more information.
-    
-    Note: Except where explicitly mentioned, whenever this documentation uses
-    the term "bound" without backticks it actually means: in the `bound` state *or higher*.
-    (i.e. `bound`, `listen-in-progress`, `listening`, `connect-in-progress` or `connected`)
-    
-    In addition to the general error codes documented on the
-    `network::error-code` type, TCP socket methods may always return
-    `error(invalid-state)` when in the `closed` state.
-    """
-    
-    def start_bind(self, network: wasi_sockets_network_0_2_0.Network, local_address: wasi_sockets_network_0_2_0.IpSocketAddress) -> None:
-        """
-        Bind the socket to a specific network on the provided IP address and port.
-        
-        If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which
-        network interface(s) to bind to.
-        If the TCP/UDP port is zero, the socket will be bound to a random free port.
-        
-        Bind can be attempted multiple times on the same socket, even with
-        different arguments on each iteration. But never concurrently and
-        only as long as the previous bind failed. Once a bind succeeds, the
-        binding can't be changed anymore.
-        
-        # Typical errors
-        - `invalid-argument`:          The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
-        - `invalid-argument`:          `local-address` is not a unicast address. (EINVAL)
-        - `invalid-argument`:          `local-address` is an IPv4-mapped IPv6 address. (EINVAL)
-        - `invalid-state`:             The socket is already bound. (EINVAL)
-        - `address-in-use`:            No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
-        - `address-in-use`:            Address is already in use. (EADDRINUSE)
-        - `address-not-bindable`:      `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL)
-        - `not-in-progress`:           A `bind` operation is not in progress.
-        - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-        
-        # Implementors note
-        When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT
-        state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR
-        socket option should be set implicitly on all platforms, except on Windows where this is the default behavior
-        and SO_REUSEADDR performs something different entirely.
-        
-        Unlike in POSIX, in WASI the bind operation is async. This enables
-        interactive WASI hosts to inject permission prompts. Runtimes that
-        don't want to make use of this ability can simply call the native
-        `bind` as part of either `start-bind` or `finish-bind`.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
-        - <https://man7.org/linux/man-pages/man2/bind.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
-        - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def finish_bind(self) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def start_connect(self, network: wasi_sockets_network_0_2_0.Network, remote_address: wasi_sockets_network_0_2_0.IpSocketAddress) -> None:
-        """
-        Connect to a remote endpoint.
-        
-        On success:
-        - the socket is transitioned into the `connection` state.
-        - a pair of streams is returned that can be used to read & write to the connection
-        
-        After a failed connection attempt, the socket will be in the `closed`
-        state and the only valid action left is to `drop` the socket. A single
-        socket can not be used to connect more than once.
-        
-        # Typical errors
-        - `invalid-argument`:          The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-        - `invalid-argument`:          `remote-address` is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS)
-        - `invalid-argument`:          `remote-address` is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos)
-        - `invalid-argument`:          The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows)
-        - `invalid-argument`:          The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows)
-        - `invalid-argument`:          The socket is already attached to a different network. The `network` passed to `connect` must be identical to the one passed to `bind`.
-        - `invalid-state`:             The socket is already in the `connected` state. (EISCONN)
-        - `invalid-state`:             The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows)
-        - `timeout`:                   Connection timed out. (ETIMEDOUT)
-        - `connection-refused`:        The connection was forcefully rejected. (ECONNREFUSED)
-        - `connection-reset`:          The connection was reset. (ECONNRESET)
-        - `connection-aborted`:        The connection was aborted. (ECONNABORTED)
-        - `remote-unreachable`:        The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
-        - `not-in-progress`:           A connect operation is not in progress.
-        - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-        
-        # Implementors note
-        The POSIX equivalent of `start-connect` is the regular `connect` syscall.
-        Because all WASI sockets are non-blocking this is expected to return
-        EINPROGRESS, which should be translated to `ok()` in WASI.
-        
-        The POSIX equivalent of `finish-connect` is a `poll` for event `POLLOUT`
-        with a timeout of 0 on the socket descriptor. Followed by a check for
-        the `SO_ERROR` socket option, in case the poll signaled readiness.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-        - <https://man7.org/linux/man-pages/man2/connect.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-        - <https://man.freebsd.org/cgi/man.cgi?connect>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def finish_connect(self) -> Tuple[wasi_io_streams_0_2_0.InputStream, wasi_io_streams_0_2_0.OutputStream]:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def start_listen(self) -> None:
-        """
-        Start listening for new connections.
-        
-        Transitions the socket into the `listening` state.
-        
-        Unlike POSIX, the socket must already be explicitly bound.
-        
-        # Typical errors
-        - `invalid-state`:             The socket is not bound to any local address. (EDESTADDRREQ)
-        - `invalid-state`:             The socket is already in the `connected` state. (EISCONN, EINVAL on BSD)
-        - `invalid-state`:             The socket is already in the `listening` state.
-        - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
-        - `not-in-progress`:           A listen operation is not in progress.
-        - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-        
-        # Implementors note
-        Unlike in POSIX, in WASI the listen operation is async. This enables
-        interactive WASI hosts to inject permission prompts. Runtimes that
-        don't want to make use of this ability can simply call the native
-        `listen` as part of either `start-listen` or `finish-listen`.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html>
-        - <https://man7.org/linux/man-pages/man2/listen.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen>
-        - <https://man.freebsd.org/cgi/man.cgi?query=listen&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def finish_listen(self) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def accept(self) -> Tuple[Self, wasi_io_streams_0_2_0.InputStream, wasi_io_streams_0_2_0.OutputStream]:
-        """
-        Accept a new client socket.
-        
-        The returned socket is bound and in the `connected` state. The following properties are inherited from the listener socket:
-        - `address-family`
-        - `keep-alive-enabled`
-        - `keep-alive-idle-time`
-        - `keep-alive-interval`
-        - `keep-alive-count`
-        - `hop-limit`
-        - `receive-buffer-size`
-        - `send-buffer-size`
-        
-        On success, this function returns the newly accepted client socket along with
-        a pair of streams that can be used to read & write to the connection.
-        
-        # Typical errors
-        - `invalid-state`:      Socket is not in the `listening` state. (EINVAL)
-        - `would-block`:        No pending connections at the moment. (EWOULDBLOCK, EAGAIN)
-        - `connection-aborted`: An incoming connection was pending, but was terminated by the client before this listener could accept it. (ECONNABORTED)
-        - `new-socket-limit`:   The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html>
-        - <https://man7.org/linux/man-pages/man2/accept.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept>
-        - <https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def local_address(self) -> wasi_sockets_network_0_2_0.IpSocketAddress:
-        """
-        Get the bound local address.
-        
-        POSIX mentions:
-        > If the socket has not been bound to a local name, the value
-        > stored in the object pointed to by `address` is unspecified.
-        
-        WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not bound to any local address.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
-        - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
-        - <https://man.freebsd.org/cgi/man.cgi?getsockname>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def remote_address(self) -> wasi_sockets_network_0_2_0.IpSocketAddress:
-        """
-        Get the remote address.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
-        - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
-        - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def is_listening(self) -> bool:
-        """
-        Whether the socket is in the `listening` state.
-        
-        Equivalent to the SO_ACCEPTCONN socket option.
-        """
-        raise NotImplementedError
-    def address_family(self) -> wasi_sockets_network_0_2_0.IpAddressFamily:
-        """
-        Whether this is a IPv4 or IPv6 socket.
-        
-        Equivalent to the SO_DOMAIN socket option.
-        """
-        raise NotImplementedError
-    def set_listen_backlog_size(self, value: int) -> None:
-        """
-        Hints the desired listen queue size. Implementations are free to ignore this.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently clamped and/or rounded.
-        
-        # Typical errors
-        - `not-supported`:        (set) The platform does not support changing the backlog size after the initial listen.
-        - `invalid-argument`:     (set) The provided value was 0.
-        - `invalid-state`:        (set) The socket is in the `connect-in-progress` or `connected` state.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def keep_alive_enabled(self) -> bool:
-        """
-        Enables or disables keepalive.
-        
-        The keepalive behavior can be adjusted using:
-        - `keep-alive-idle-time`
-        - `keep-alive-interval`
-        - `keep-alive-count`
-        These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true.
-        
-        Equivalent to the SO_KEEPALIVE socket option.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_keep_alive_enabled(self, value: bool) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def keep_alive_idle_time(self) -> int:
-        """
-        Amount of time the connection has to be idle before TCP starts sending keepalive packets.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently clamped and/or rounded.
-        I.e. after setting a value, reading the same setting back may return a different value.
-        
-        Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS)
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_keep_alive_idle_time(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def keep_alive_interval(self) -> int:
-        """
-        The time between keepalive packets.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently clamped and/or rounded.
-        I.e. after setting a value, reading the same setting back may return a different value.
-        
-        Equivalent to the TCP_KEEPINTVL socket option.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_keep_alive_interval(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def keep_alive_count(self) -> int:
-        """
-        The maximum amount of keepalive packets TCP should send before aborting the connection.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently clamped and/or rounded.
-        I.e. after setting a value, reading the same setting back may return a different value.
-        
-        Equivalent to the TCP_KEEPCNT socket option.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_keep_alive_count(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def hop_limit(self) -> int:
-        """
-        Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The TTL value must be 1 or higher.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_hop_limit(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def receive_buffer_size(self) -> int:
-        """
-        The kernel buffer space reserved for sends/receives on this socket.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently clamped and/or rounded.
-        I.e. after setting a value, reading the same setting back may return a different value.
-        
-        Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_receive_buffer_size(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def send_buffer_size(self) -> int:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_send_buffer_size(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-        """
-        Create a `pollable` which can be used to poll for, or block on,
-        completion of any of the asynchronous operations of this socket.
-        
-        When `finish-bind`, `finish-listen`, `finish-connect` or `accept`
-        return `error(would-block)`, this pollable can be used to wait for
-        their success or failure, after which the method can be retried.
-        
-        The pollable is not limited to the async operation that happens to be
-        in progress at the time of calling `subscribe` (if any). Theoretically,
-        `subscribe` only has to be called once per socket and can then be
-        (re)used for the remainder of the socket's lifetime.
-        
-        See <https://github.com/WebAssembly/wasi-sockets/TcpSocketOperationalSemantics.md#Pollable-readiness>
-        for a more information.
-        
-        Note: this function is here for WASI Preview2 only.
-        It's planned to be removed when `future` is natively supported in Preview3.
-        """
-        raise NotImplementedError
-    def shutdown(self, shutdown_type: ShutdownType) -> None:
-        """
-        Initiate a graceful shutdown.
-        
-        - `receive`: The socket is not expecting to receive any data from
-          the peer. The `input-stream` associated with this socket will be
-          closed. Any data still in the receive queue at time of calling
-          this method will be discarded.
-        - `send`: The socket has no more data to send to the peer. The `output-stream`
-          associated with this socket will be closed and a FIN packet will be sent.
-        - `both`: Same effect as `receive` & `send` combined.
-        
-        This function is idempotent. Shutting a down a direction more than once
-        has no effect and returns `ok`.
-        
-        The shutdown function does not close (drop) the socket.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html>
-        - <https://man7.org/linux/man-pages/man2/shutdown.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-shutdown>
-        - <https://man.freebsd.org/cgi/man.cgi?query=shutdown&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A TCP socket resource.

-

The socket can be in one of the following states: -- unbound -- bind-in-progress -- bound (See note below) -- listen-in-progress -- listening -- connect-in-progress -- connected -- closed -See https://github.com/WebAssembly/wasi-sockets/TcpSocketOperationalSemantics.md -for a more information.

-

Note: Except where explicitly mentioned, whenever this documentation uses -the term "bound" without backticks it actually means: in the bound state or higher. -(i.e. bound, listen-in-progress, listening, connect-in-progress or connected)

-

In addition to the general error codes documented on the -network::error-code type, TCP socket methods may always return -error(invalid-state) when in the closed state.

-

Methods

-
-
-def accept(self) ‑> Tuple[Self, InputStreamOutputStream] -
-
-
- -Expand source code - -
def accept(self) -> Tuple[Self, wasi_io_streams_0_2_0.InputStream, wasi_io_streams_0_2_0.OutputStream]:
-    """
-    Accept a new client socket.
-    
-    The returned socket is bound and in the `connected` state. The following properties are inherited from the listener socket:
-    - `address-family`
-    - `keep-alive-enabled`
-    - `keep-alive-idle-time`
-    - `keep-alive-interval`
-    - `keep-alive-count`
-    - `hop-limit`
-    - `receive-buffer-size`
-    - `send-buffer-size`
-    
-    On success, this function returns the newly accepted client socket along with
-    a pair of streams that can be used to read & write to the connection.
-    
-    # Typical errors
-    - `invalid-state`:      Socket is not in the `listening` state. (EINVAL)
-    - `would-block`:        No pending connections at the moment. (EWOULDBLOCK, EAGAIN)
-    - `connection-aborted`: An incoming connection was pending, but was terminated by the client before this listener could accept it. (ECONNABORTED)
-    - `new-socket-limit`:   The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html>
-    - <https://man7.org/linux/man-pages/man2/accept.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept>
-    - <https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Accept a new client socket.

-

The returned socket is bound and in the connected state. The following properties are inherited from the listener socket: -- address-family -- keep-alive-enabled -- keep-alive-idle-time -- keep-alive-interval -- keep-alive-count -- hop-limit -- receive-buffer-size -- send-buffer-size

-

On success, this function returns the newly accepted client socket along with -a pair of streams that can be used to read & write to the connection.

-

Typical errors

-
    -
  • invalid-state: -Socket is not in the listening state. (EINVAL)
  • -
  • would-block: -No pending connections at the moment. (EWOULDBLOCK, EAGAIN)
  • -
  • connection-aborted: An incoming connection was pending, but was terminated by the client before this listener could accept it. (ECONNABORTED)
  • -
  • new-socket-limit: -The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def address_family(self) ‑> IpAddressFamily -
-
-
- -Expand source code - -
def address_family(self) -> wasi_sockets_network_0_2_0.IpAddressFamily:
-    """
-    Whether this is a IPv4 or IPv6 socket.
-    
-    Equivalent to the SO_DOMAIN socket option.
-    """
-    raise NotImplementedError
-
-

Whether this is a IPv4 or IPv6 socket.

-

Equivalent to the SO_DOMAIN socket option.

-
-
-def finish_bind(self) ‑> None -
-
-
- -Expand source code - -
def finish_bind(self) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def finish_connect(self) ‑> Tuple[InputStreamOutputStream] -
-
-
- -Expand source code - -
def finish_connect(self) -> Tuple[wasi_io_streams_0_2_0.InputStream, wasi_io_streams_0_2_0.OutputStream]:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def finish_listen(self) ‑> None -
-
-
- -Expand source code - -
def finish_listen(self) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def hop_limit(self) ‑> int -
-
-
- -Expand source code - -
def hop_limit(self) -> int:
-    """
-    Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The TTL value must be 1 or higher.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.

-

If the provided value is 0, an invalid-argument error is returned.

-

Typical errors

-
    -
  • invalid-argument: -(set) The TTL value must be 1 or higher.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def is_listening(self) ‑> bool -
-
-
- -Expand source code - -
def is_listening(self) -> bool:
-    """
-    Whether the socket is in the `listening` state.
-    
-    Equivalent to the SO_ACCEPTCONN socket option.
-    """
-    raise NotImplementedError
-
-

Whether the socket is in the listening state.

-

Equivalent to the SO_ACCEPTCONN socket option.

-
-
-def keep_alive_count(self) ‑> int -
-
-
- -Expand source code - -
def keep_alive_count(self) -> int:
-    """
-    The maximum amount of keepalive packets TCP should send before aborting the connection.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently clamped and/or rounded.
-    I.e. after setting a value, reading the same setting back may return a different value.
-    
-    Equivalent to the TCP_KEEPCNT socket option.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

The maximum amount of keepalive packets TCP should send before aborting the connection.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently clamped and/or rounded. -I.e. after setting a value, reading the same setting back may return a different value.

-

Equivalent to the TCP_KEEPCNT socket option.

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def keep_alive_enabled(self) ‑> bool -
-
-
- -Expand source code - -
def keep_alive_enabled(self) -> bool:
-    """
-    Enables or disables keepalive.
-    
-    The keepalive behavior can be adjusted using:
-    - `keep-alive-idle-time`
-    - `keep-alive-interval`
-    - `keep-alive-count`
-    These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true.
-    
-    Equivalent to the SO_KEEPALIVE socket option.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Enables or disables keepalive.

-

The keepalive behavior can be adjusted using: -- keep-alive-idle-time -- keep-alive-interval -- keep-alive-count -These properties can be configured while keep-alive-enabled is false, but only come into effect when keep-alive-enabled is true.

-

Equivalent to the SO_KEEPALIVE socket option.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def keep_alive_idle_time(self) ‑> int -
-
-
- -Expand source code - -
def keep_alive_idle_time(self) -> int:
-    """
-    Amount of time the connection has to be idle before TCP starts sending keepalive packets.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently clamped and/or rounded.
-    I.e. after setting a value, reading the same setting back may return a different value.
-    
-    Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS)
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Amount of time the connection has to be idle before TCP starts sending keepalive packets.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently clamped and/or rounded. -I.e. after setting a value, reading the same setting back may return a different value.

-

Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS)

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def keep_alive_interval(self) ‑> int -
-
-
- -Expand source code - -
def keep_alive_interval(self) -> int:
-    """
-    The time between keepalive packets.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently clamped and/or rounded.
-    I.e. after setting a value, reading the same setting back may return a different value.
-    
-    Equivalent to the TCP_KEEPINTVL socket option.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

The time between keepalive packets.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently clamped and/or rounded. -I.e. after setting a value, reading the same setting back may return a different value.

-

Equivalent to the TCP_KEEPINTVL socket option.

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def local_address(self) ‑> IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 -
-
-
- -Expand source code - -
def local_address(self) -> wasi_sockets_network_0_2_0.IpSocketAddress:
-    """
-    Get the bound local address.
-    
-    POSIX mentions:
-    > If the socket has not been bound to a local name, the value
-    > stored in the object pointed to by `address` is unspecified.
-    
-    WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not bound to any local address.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
-    - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
-    - <https://man.freebsd.org/cgi/man.cgi?getsockname>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get the bound local address.

-

POSIX mentions:

-
-

If the socket has not been bound to a local name, the value -stored in the object pointed to by address is unspecified.

-
-

WASI is stricter and requires local-address to return invalid-state when the socket hasn't been bound yet.

-

Typical errors

-
    -
  • invalid-state: The socket is not bound to any local address.
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def receive_buffer_size(self) ‑> int -
-
-
- -Expand source code - -
def receive_buffer_size(self) -> int:
-    """
-    The kernel buffer space reserved for sends/receives on this socket.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently clamped and/or rounded.
-    I.e. after setting a value, reading the same setting back may return a different value.
-    
-    Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

The kernel buffer space reserved for sends/receives on this socket.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently clamped and/or rounded. -I.e. after setting a value, reading the same setting back may return a different value.

-

Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def remote_address(self) ‑> IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 -
-
-
- -Expand source code - -
def remote_address(self) -> wasi_sockets_network_0_2_0.IpSocketAddress:
-    """
-    Get the remote address.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
-    - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
-    - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
- -
-
-def send_buffer_size(self) ‑> int -
-
-
- -Expand source code - -
def send_buffer_size(self) -> int:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_hop_limit(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_hop_limit(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_keep_alive_count(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_keep_alive_count(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_keep_alive_enabled(self, value: bool) ‑> None -
-
-
- -Expand source code - -
def set_keep_alive_enabled(self, value: bool) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_keep_alive_idle_time(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_keep_alive_idle_time(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_keep_alive_interval(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_keep_alive_interval(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_listen_backlog_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_listen_backlog_size(self, value: int) -> None:
-    """
-    Hints the desired listen queue size. Implementations are free to ignore this.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently clamped and/or rounded.
-    
-    # Typical errors
-    - `not-supported`:        (set) The platform does not support changing the backlog size after the initial listen.
-    - `invalid-argument`:     (set) The provided value was 0.
-    - `invalid-state`:        (set) The socket is in the `connect-in-progress` or `connected` state.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Hints the desired listen queue size. Implementations are free to ignore this.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently clamped and/or rounded.

-

Typical errors

-
    -
  • not-supported: -(set) The platform does not support changing the backlog size after the initial listen.
  • -
  • invalid-argument: -(set) The provided value was 0.
  • -
  • invalid-state: -(set) The socket is in the connect-in-progress or connected state.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_receive_buffer_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_receive_buffer_size(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_send_buffer_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_send_buffer_size(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def shutdown(self,
shutdown_type: ShutdownType) ‑> None
-
-
-
- -Expand source code - -
def shutdown(self, shutdown_type: ShutdownType) -> None:
-    """
-    Initiate a graceful shutdown.
-    
-    - `receive`: The socket is not expecting to receive any data from
-      the peer. The `input-stream` associated with this socket will be
-      closed. Any data still in the receive queue at time of calling
-      this method will be discarded.
-    - `send`: The socket has no more data to send to the peer. The `output-stream`
-      associated with this socket will be closed and a FIN packet will be sent.
-    - `both`: Same effect as `receive` & `send` combined.
-    
-    This function is idempotent. Shutting a down a direction more than once
-    has no effect and returns `ok`.
-    
-    The shutdown function does not close (drop) the socket.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html>
-    - <https://man7.org/linux/man-pages/man2/shutdown.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-shutdown>
-    - <https://man.freebsd.org/cgi/man.cgi?query=shutdown&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Initiate a graceful shutdown.

-
    -
  • receive: The socket is not expecting to receive any data from -the peer. The input-stream associated with this socket will be -closed. Any data still in the receive queue at time of calling -this method will be discarded.
  • -
  • send: The socket has no more data to send to the peer. The output-stream -associated with this socket will be closed and a FIN packet will be sent.
  • -
  • both: Same effect as receive & send combined.
  • -
-

This function is idempotent. Shutting a down a direction more than once -has no effect and returns ok.

-

The shutdown function does not close (drop) the socket.

-

Typical errors

-
    -
  • invalid-state: The socket is not in the connected state. (ENOTCONN)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def start_bind(self,
network: Network,
local_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6) ‑> None
-
-
-
- -Expand source code - -
def start_bind(self, network: wasi_sockets_network_0_2_0.Network, local_address: wasi_sockets_network_0_2_0.IpSocketAddress) -> None:
-    """
-    Bind the socket to a specific network on the provided IP address and port.
-    
-    If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which
-    network interface(s) to bind to.
-    If the TCP/UDP port is zero, the socket will be bound to a random free port.
-    
-    Bind can be attempted multiple times on the same socket, even with
-    different arguments on each iteration. But never concurrently and
-    only as long as the previous bind failed. Once a bind succeeds, the
-    binding can't be changed anymore.
-    
-    # Typical errors
-    - `invalid-argument`:          The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
-    - `invalid-argument`:          `local-address` is not a unicast address. (EINVAL)
-    - `invalid-argument`:          `local-address` is an IPv4-mapped IPv6 address. (EINVAL)
-    - `invalid-state`:             The socket is already bound. (EINVAL)
-    - `address-in-use`:            No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
-    - `address-in-use`:            Address is already in use. (EADDRINUSE)
-    - `address-not-bindable`:      `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL)
-    - `not-in-progress`:           A `bind` operation is not in progress.
-    - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-    
-    # Implementors note
-    When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT
-    state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR
-    socket option should be set implicitly on all platforms, except on Windows where this is the default behavior
-    and SO_REUSEADDR performs something different entirely.
-    
-    Unlike in POSIX, in WASI the bind operation is async. This enables
-    interactive WASI hosts to inject permission prompts. Runtimes that
-    don't want to make use of this ability can simply call the native
-    `bind` as part of either `start-bind` or `finish-bind`.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
-    - <https://man7.org/linux/man-pages/man2/bind.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
-    - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Bind the socket to a specific network on the provided IP address and port.

-

If the IP address is zero (0.0.0.0 in IPv4, :: in IPv6), it is left to the implementation to decide which -network interface(s) to bind to. -If the TCP/UDP port is zero, the socket will be bound to a random free port.

-

Bind can be attempted multiple times on the same socket, even with -different arguments on each iteration. But never concurrently and -only as long as the previous bind failed. Once a bind succeeds, the -binding can't be changed anymore.

-

Typical errors

-
    -
  • invalid-argument: -The local-address has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
  • -
  • invalid-argument: -local-address is not a unicast address. (EINVAL)
  • -
  • invalid-argument: -local-address is an IPv4-mapped IPv6 address. (EINVAL)
  • -
  • invalid-state: -The socket is already bound. (EINVAL)
  • -
  • address-in-use: -No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
  • -
  • address-in-use: -Address is already in use. (EADDRINUSE)
  • -
  • address-not-bindable: -local-address is not an address that the network can bind to. (EADDRNOTAVAIL)
  • -
  • not-in-progress: -A bind operation is not in progress.
  • -
  • would-block: -Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
  • -
-

Implementors note

-

When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT -state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR -socket option should be set implicitly on all platforms, except on Windows where this is the default behavior -and SO_REUSEADDR performs something different entirely.

-

Unlike in POSIX, in WASI the bind operation is async. This enables -interactive WASI hosts to inject permission prompts. Runtimes that -don't want to make use of this ability can simply call the native -bind as part of either start-bind or finish-bind.

-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def start_connect(self,
network: Network,
remote_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6) ‑> None
-
-
-
- -Expand source code - -
def start_connect(self, network: wasi_sockets_network_0_2_0.Network, remote_address: wasi_sockets_network_0_2_0.IpSocketAddress) -> None:
-    """
-    Connect to a remote endpoint.
-    
-    On success:
-    - the socket is transitioned into the `connection` state.
-    - a pair of streams is returned that can be used to read & write to the connection
-    
-    After a failed connection attempt, the socket will be in the `closed`
-    state and the only valid action left is to `drop` the socket. A single
-    socket can not be used to connect more than once.
-    
-    # Typical errors
-    - `invalid-argument`:          The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-    - `invalid-argument`:          `remote-address` is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS)
-    - `invalid-argument`:          `remote-address` is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos)
-    - `invalid-argument`:          The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows)
-    - `invalid-argument`:          The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows)
-    - `invalid-argument`:          The socket is already attached to a different network. The `network` passed to `connect` must be identical to the one passed to `bind`.
-    - `invalid-state`:             The socket is already in the `connected` state. (EISCONN)
-    - `invalid-state`:             The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows)
-    - `timeout`:                   Connection timed out. (ETIMEDOUT)
-    - `connection-refused`:        The connection was forcefully rejected. (ECONNREFUSED)
-    - `connection-reset`:          The connection was reset. (ECONNRESET)
-    - `connection-aborted`:        The connection was aborted. (ECONNABORTED)
-    - `remote-unreachable`:        The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
-    - `not-in-progress`:           A connect operation is not in progress.
-    - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-    
-    # Implementors note
-    The POSIX equivalent of `start-connect` is the regular `connect` syscall.
-    Because all WASI sockets are non-blocking this is expected to return
-    EINPROGRESS, which should be translated to `ok()` in WASI.
-    
-    The POSIX equivalent of `finish-connect` is a `poll` for event `POLLOUT`
-    with a timeout of 0 on the socket descriptor. Followed by a check for
-    the `SO_ERROR` socket option, in case the poll signaled readiness.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-    - <https://man7.org/linux/man-pages/man2/connect.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-    - <https://man.freebsd.org/cgi/man.cgi?connect>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Connect to a remote endpoint.

-

On success: -- the socket is transitioned into the connection state. -- a pair of streams is returned that can be used to read & write to the connection

-

After a failed connection attempt, the socket will be in the closed -state and the only valid action left is to drop the socket. A single -socket can not be used to connect more than once.

-

Typical errors

-
    -
  • invalid-argument: -The remote-address has the wrong address family. (EAFNOSUPPORT)
  • -
  • invalid-argument: -remote-address is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS)
  • -
  • invalid-argument: -remote-address is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos)
  • -
  • invalid-argument: -The IP address in remote-address is set to INADDR_ANY (0.0.0.0 / ::). (EADDRNOTAVAIL on Windows)
  • -
  • invalid-argument: -The port in remote-address is set to 0. (EADDRNOTAVAIL on Windows)
  • -
  • invalid-argument: -The socket is already attached to a different network. The network passed to connect must be identical to the one passed to bind.
  • -
  • invalid-state: -The socket is already in the connected state. (EISCONN)
  • -
  • invalid-state: -The socket is already in the listening state. (EOPNOTSUPP, EINVAL on Windows)
  • -
  • timeout: -Connection timed out. (ETIMEDOUT)
  • -
  • connection-refused: -The connection was forcefully rejected. (ECONNREFUSED)
  • -
  • connection-reset: -The connection was reset. (ECONNRESET)
  • -
  • connection-aborted: -The connection was aborted. (ECONNABORTED)
  • -
  • remote-unreachable: -The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
  • address-in-use: -Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
  • -
  • not-in-progress: -A connect operation is not in progress.
  • -
  • would-block: -Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
  • -
-

Implementors note

-

The POSIX equivalent of start-connect is the regular connect syscall. -Because all WASI sockets are non-blocking this is expected to return -EINPROGRESS, which should be translated to ok() in WASI.

-

The POSIX equivalent of finish-connect is a poll for event POLLOUT -with a timeout of 0 on the socket descriptor. Followed by a check for -the SO_ERROR socket option, in case the poll signaled readiness.

-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def start_listen(self) ‑> None -
-
-
- -Expand source code - -
def start_listen(self) -> None:
-    """
-    Start listening for new connections.
-    
-    Transitions the socket into the `listening` state.
-    
-    Unlike POSIX, the socket must already be explicitly bound.
-    
-    # Typical errors
-    - `invalid-state`:             The socket is not bound to any local address. (EDESTADDRREQ)
-    - `invalid-state`:             The socket is already in the `connected` state. (EISCONN, EINVAL on BSD)
-    - `invalid-state`:             The socket is already in the `listening` state.
-    - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
-    - `not-in-progress`:           A listen operation is not in progress.
-    - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-    
-    # Implementors note
-    Unlike in POSIX, in WASI the listen operation is async. This enables
-    interactive WASI hosts to inject permission prompts. Runtimes that
-    don't want to make use of this ability can simply call the native
-    `listen` as part of either `start-listen` or `finish-listen`.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html>
-    - <https://man7.org/linux/man-pages/man2/listen.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen>
-    - <https://man.freebsd.org/cgi/man.cgi?query=listen&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Start listening for new connections.

-

Transitions the socket into the listening state.

-

Unlike POSIX, the socket must already be explicitly bound.

-

Typical errors

-
    -
  • invalid-state: -The socket is not bound to any local address. (EDESTADDRREQ)
  • -
  • invalid-state: -The socket is already in the connected state. (EISCONN, EINVAL on BSD)
  • -
  • invalid-state: -The socket is already in the listening state.
  • -
  • address-in-use: -Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
  • -
  • not-in-progress: -A listen operation is not in progress.
  • -
  • would-block: -Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
  • -
-

Implementors note

-

Unlike in POSIX, in WASI the listen operation is async. This enables -interactive WASI hosts to inject permission prompts. Runtimes that -don't want to make use of this ability can simply call the native -listen as part of either start-listen or finish-listen.

-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-    """
-    Create a `pollable` which can be used to poll for, or block on,
-    completion of any of the asynchronous operations of this socket.
-    
-    When `finish-bind`, `finish-listen`, `finish-connect` or `accept`
-    return `error(would-block)`, this pollable can be used to wait for
-    their success or failure, after which the method can be retried.
-    
-    The pollable is not limited to the async operation that happens to be
-    in progress at the time of calling `subscribe` (if any). Theoretically,
-    `subscribe` only has to be called once per socket and can then be
-    (re)used for the remainder of the socket's lifetime.
-    
-    See <https://github.com/WebAssembly/wasi-sockets/TcpSocketOperationalSemantics.md#Pollable-readiness>
-    for a more information.
-    
-    Note: this function is here for WASI Preview2 only.
-    It's planned to be removed when `future` is natively supported in Preview3.
-    """
-    raise NotImplementedError
-
-

Create a pollable which can be used to poll for, or block on, -completion of any of the asynchronous operations of this socket.

-

When finish-bind, finish-listen, finish-connect or accept -return error(would-block), this pollable can be used to wait for -their success or failure, after which the method can be retried.

-

The pollable is not limited to the async operation that happens to be -in progress at the time of calling subscribe (if any). Theoretically, -subscribe only has to be called once per socket and can then be -(re)used for the remainder of the socket's lifetime.

-

See https://github.com/WebAssembly/wasi-sockets/TcpSocketOperationalSemantics.md#Pollable-readiness -for a more information.

-

Note: this function is here for WASI Preview2 only. -It's planned to be removed when future is natively supported in Preview3.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_tcp_0_2_6.html b/docs/v4/wit/imports/wasi_sockets_tcp_0_2_6.html deleted file mode 100644 index 1879a06..0000000 --- a/docs/v4/wit/imports/wasi_sockets_tcp_0_2_6.html +++ /dev/null @@ -1,1701 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_tcp_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_tcp_0_2_6

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class ShutdownType -(*args, **kwds) -
-
-
- -Expand source code - -
class ShutdownType(Enum):
-    RECEIVE = 0
-    SEND = 1
-    BOTH = 2
-
-

Create a collection of name/value pairs.

-

Example enumeration:

-
>>> class Color(Enum):
-...     RED = 1
-...     BLUE = 2
-...     GREEN = 3
-
-

Access them by:

-
    -
  • attribute access:
  • -
-
-
-
-

Color.RED -

-
-
-
-
    -
  • value lookup:
  • -
-
-
-
-

Color(1) -

-
-
-
-
    -
  • name lookup:
  • -
-
-
-
-

Color['RED'] -

-
-
-
-

Enumerations can be iterated over, and know how many members they have:

-
>>> len(Color)
-3
-
-
>>> list(Color)
-[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
-
-

Methods can be added to enumerations, and members can have their own -attributes – see the documentation for details.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var BOTH
-
-
-
-
var RECEIVE
-
-
-
-
var SEND
-
-
-
-
-
-
-class TcpSocket -
-
-
- -Expand source code - -
class TcpSocket:
-    """
-    A TCP socket resource.
-    
-    The socket can be in one of the following states:
-    - `unbound`
-    - `bind-in-progress`
-    - `bound` (See note below)
-    - `listen-in-progress`
-    - `listening`
-    - `connect-in-progress`
-    - `connected`
-    - `closed`
-    See <https://github.com/WebAssembly/wasi-sockets/blob/main/TcpSocketOperationalSemantics.md>
-    for more information.
-    
-    Note: Except where explicitly mentioned, whenever this documentation uses
-    the term "bound" without backticks it actually means: in the `bound` state *or higher*.
-    (i.e. `bound`, `listen-in-progress`, `listening`, `connect-in-progress` or `connected`)
-    
-    In addition to the general error codes documented on the
-    `network::error-code` type, TCP socket methods may always return
-    `error(invalid-state)` when in the `closed` state.
-    """
-    
-    def start_bind(self, network: wasi_sockets_network_0_2_6.Network, local_address: wasi_sockets_network_0_2_6.IpSocketAddress) -> None:
-        """
-        Bind the socket to a specific network on the provided IP address and port.
-        
-        If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which
-        network interface(s) to bind to.
-        If the TCP/UDP port is zero, the socket will be bound to a random free port.
-        
-        Bind can be attempted multiple times on the same socket, even with
-        different arguments on each iteration. But never concurrently and
-        only as long as the previous bind failed. Once a bind succeeds, the
-        binding can't be changed anymore.
-        
-        # Typical errors
-        - `invalid-argument`:          The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
-        - `invalid-argument`:          `local-address` is not a unicast address. (EINVAL)
-        - `invalid-argument`:          `local-address` is an IPv4-mapped IPv6 address. (EINVAL)
-        - `invalid-state`:             The socket is already bound. (EINVAL)
-        - `address-in-use`:            No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
-        - `address-in-use`:            Address is already in use. (EADDRINUSE)
-        - `address-not-bindable`:      `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL)
-        - `not-in-progress`:           A `bind` operation is not in progress.
-        - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-        
-        # Implementors note
-        When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT
-        state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR
-        socket option should be set implicitly on all platforms, except on Windows where this is the default behavior
-        and SO_REUSEADDR performs something different entirely.
-        
-        Unlike in POSIX, in WASI the bind operation is async. This enables
-        interactive WASI hosts to inject permission prompts. Runtimes that
-        don't want to make use of this ability can simply call the native
-        `bind` as part of either `start-bind` or `finish-bind`.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
-        - <https://man7.org/linux/man-pages/man2/bind.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
-        - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def finish_bind(self) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def start_connect(self, network: wasi_sockets_network_0_2_6.Network, remote_address: wasi_sockets_network_0_2_6.IpSocketAddress) -> None:
-        """
-        Connect to a remote endpoint.
-        
-        On success:
-        - the socket is transitioned into the `connected` state.
-        - a pair of streams is returned that can be used to read & write to the connection
-        
-        After a failed connection attempt, the socket will be in the `closed`
-        state and the only valid action left is to `drop` the socket. A single
-        socket can not be used to connect more than once.
-        
-        # Typical errors
-        - `invalid-argument`:          The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-        - `invalid-argument`:          `remote-address` is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS)
-        - `invalid-argument`:          `remote-address` is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos)
-        - `invalid-argument`:          The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows)
-        - `invalid-argument`:          The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows)
-        - `invalid-argument`:          The socket is already attached to a different network. The `network` passed to `connect` must be identical to the one passed to `bind`.
-        - `invalid-state`:             The socket is already in the `connected` state. (EISCONN)
-        - `invalid-state`:             The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows)
-        - `timeout`:                   Connection timed out. (ETIMEDOUT)
-        - `connection-refused`:        The connection was forcefully rejected. (ECONNREFUSED)
-        - `connection-reset`:          The connection was reset. (ECONNRESET)
-        - `connection-aborted`:        The connection was aborted. (ECONNABORTED)
-        - `remote-unreachable`:        The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
-        - `not-in-progress`:           A connect operation is not in progress.
-        - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-        
-        # Implementors note
-        The POSIX equivalent of `start-connect` is the regular `connect` syscall.
-        Because all WASI sockets are non-blocking this is expected to return
-        EINPROGRESS, which should be translated to `ok()` in WASI.
-        
-        The POSIX equivalent of `finish-connect` is a `poll` for event `POLLOUT`
-        with a timeout of 0 on the socket descriptor. Followed by a check for
-        the `SO_ERROR` socket option, in case the poll signaled readiness.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-        - <https://man7.org/linux/man-pages/man2/connect.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-        - <https://man.freebsd.org/cgi/man.cgi?connect>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def finish_connect(self) -> Tuple[wasi_io_streams_0_2_6.InputStream, wasi_io_streams_0_2_6.OutputStream]:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def start_listen(self) -> None:
-        """
-        Start listening for new connections.
-        
-        Transitions the socket into the `listening` state.
-        
-        Unlike POSIX, the socket must already be explicitly bound.
-        
-        # Typical errors
-        - `invalid-state`:             The socket is not bound to any local address. (EDESTADDRREQ)
-        - `invalid-state`:             The socket is already in the `connected` state. (EISCONN, EINVAL on BSD)
-        - `invalid-state`:             The socket is already in the `listening` state.
-        - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
-        - `not-in-progress`:           A listen operation is not in progress.
-        - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-        
-        # Implementors note
-        Unlike in POSIX, in WASI the listen operation is async. This enables
-        interactive WASI hosts to inject permission prompts. Runtimes that
-        don't want to make use of this ability can simply call the native
-        `listen` as part of either `start-listen` or `finish-listen`.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html>
-        - <https://man7.org/linux/man-pages/man2/listen.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen>
-        - <https://man.freebsd.org/cgi/man.cgi?query=listen&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def finish_listen(self) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def accept(self) -> Tuple[Self, wasi_io_streams_0_2_6.InputStream, wasi_io_streams_0_2_6.OutputStream]:
-        """
-        Accept a new client socket.
-        
-        The returned socket is bound and in the `connected` state. The following properties are inherited from the listener socket:
-        - `address-family`
-        - `keep-alive-enabled`
-        - `keep-alive-idle-time`
-        - `keep-alive-interval`
-        - `keep-alive-count`
-        - `hop-limit`
-        - `receive-buffer-size`
-        - `send-buffer-size`
-        
-        On success, this function returns the newly accepted client socket along with
-        a pair of streams that can be used to read & write to the connection.
-        
-        # Typical errors
-        - `invalid-state`:      Socket is not in the `listening` state. (EINVAL)
-        - `would-block`:        No pending connections at the moment. (EWOULDBLOCK, EAGAIN)
-        - `connection-aborted`: An incoming connection was pending, but was terminated by the client before this listener could accept it. (ECONNABORTED)
-        - `new-socket-limit`:   The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html>
-        - <https://man7.org/linux/man-pages/man2/accept.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept>
-        - <https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def local_address(self) -> wasi_sockets_network_0_2_6.IpSocketAddress:
-        """
-        Get the bound local address.
-        
-        POSIX mentions:
-        > If the socket has not been bound to a local name, the value
-        > stored in the object pointed to by `address` is unspecified.
-        
-        WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not bound to any local address.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
-        - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
-        - <https://man.freebsd.org/cgi/man.cgi?getsockname>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def remote_address(self) -> wasi_sockets_network_0_2_6.IpSocketAddress:
-        """
-        Get the remote address.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
-        - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
-        - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def is_listening(self) -> bool:
-        """
-        Whether the socket is in the `listening` state.
-        
-        Equivalent to the SO_ACCEPTCONN socket option.
-        """
-        raise NotImplementedError
-    def address_family(self) -> wasi_sockets_network_0_2_6.IpAddressFamily:
-        """
-        Whether this is a IPv4 or IPv6 socket.
-        
-        Equivalent to the SO_DOMAIN socket option.
-        """
-        raise NotImplementedError
-    def set_listen_backlog_size(self, value: int) -> None:
-        """
-        Hints the desired listen queue size. Implementations are free to ignore this.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently clamped and/or rounded.
-        
-        # Typical errors
-        - `not-supported`:        (set) The platform does not support changing the backlog size after the initial listen.
-        - `invalid-argument`:     (set) The provided value was 0.
-        - `invalid-state`:        (set) The socket is in the `connect-in-progress` or `connected` state.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def keep_alive_enabled(self) -> bool:
-        """
-        Enables or disables keepalive.
-        
-        The keepalive behavior can be adjusted using:
-        - `keep-alive-idle-time`
-        - `keep-alive-interval`
-        - `keep-alive-count`
-        These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true.
-        
-        Equivalent to the SO_KEEPALIVE socket option.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_keep_alive_enabled(self, value: bool) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def keep_alive_idle_time(self) -> int:
-        """
-        Amount of time the connection has to be idle before TCP starts sending keepalive packets.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently clamped and/or rounded.
-        I.e. after setting a value, reading the same setting back may return a different value.
-        
-        Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS)
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_keep_alive_idle_time(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def keep_alive_interval(self) -> int:
-        """
-        The time between keepalive packets.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently clamped and/or rounded.
-        I.e. after setting a value, reading the same setting back may return a different value.
-        
-        Equivalent to the TCP_KEEPINTVL socket option.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_keep_alive_interval(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def keep_alive_count(self) -> int:
-        """
-        The maximum amount of keepalive packets TCP should send before aborting the connection.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently clamped and/or rounded.
-        I.e. after setting a value, reading the same setting back may return a different value.
-        
-        Equivalent to the TCP_KEEPCNT socket option.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_keep_alive_count(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def hop_limit(self) -> int:
-        """
-        Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The TTL value must be 1 or higher.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_hop_limit(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def receive_buffer_size(self) -> int:
-        """
-        The kernel buffer space reserved for sends/receives on this socket.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently clamped and/or rounded.
-        I.e. after setting a value, reading the same setting back may return a different value.
-        
-        Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_receive_buffer_size(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def send_buffer_size(self) -> int:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_send_buffer_size(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-        """
-        Create a `pollable` which can be used to poll for, or block on,
-        completion of any of the asynchronous operations of this socket.
-        
-        When `finish-bind`, `finish-listen`, `finish-connect` or `accept`
-        return `error(would-block)`, this pollable can be used to wait for
-        their success or failure, after which the method can be retried.
-        
-        The pollable is not limited to the async operation that happens to be
-        in progress at the time of calling `subscribe` (if any). Theoretically,
-        `subscribe` only has to be called once per socket and can then be
-        (re)used for the remainder of the socket's lifetime.
-        
-        See <https://github.com/WebAssembly/wasi-sockets/blob/main/TcpSocketOperationalSemantics.md#pollable-readiness>
-        for more information.
-        
-        Note: this function is here for WASI 0.2 only.
-        It's planned to be removed when `future` is natively supported in Preview3.
-        """
-        raise NotImplementedError
-    def shutdown(self, shutdown_type: ShutdownType) -> None:
-        """
-        Initiate a graceful shutdown.
-        
-        - `receive`: The socket is not expecting to receive any data from
-          the peer. The `input-stream` associated with this socket will be
-          closed. Any data still in the receive queue at time of calling
-          this method will be discarded.
-        - `send`: The socket has no more data to send to the peer. The `output-stream`
-          associated with this socket will be closed and a FIN packet will be sent.
-        - `both`: Same effect as `receive` & `send` combined.
-        
-        This function is idempotent; shutting down a direction more than once
-        has no effect and returns `ok`.
-        
-        The shutdown function does not close (drop) the socket.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html>
-        - <https://man7.org/linux/man-pages/man2/shutdown.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-shutdown>
-        - <https://man.freebsd.org/cgi/man.cgi?query=shutdown&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A TCP socket resource.

-

The socket can be in one of the following states: -- unbound -- bind-in-progress -- bound (See note below) -- listen-in-progress -- listening -- connect-in-progress -- connected -- closed -See https://github.com/WebAssembly/wasi-sockets/blob/main/TcpSocketOperationalSemantics.md -for more information.

-

Note: Except where explicitly mentioned, whenever this documentation uses -the term "bound" without backticks it actually means: in the bound state or higher. -(i.e. bound, listen-in-progress, listening, connect-in-progress or connected)

-

In addition to the general error codes documented on the -network::error-code type, TCP socket methods may always return -error(invalid-state) when in the closed state.

-

Methods

-
-
-def accept(self) ‑> Tuple[Self, InputStreamOutputStream] -
-
-
- -Expand source code - -
def accept(self) -> Tuple[Self, wasi_io_streams_0_2_6.InputStream, wasi_io_streams_0_2_6.OutputStream]:
-    """
-    Accept a new client socket.
-    
-    The returned socket is bound and in the `connected` state. The following properties are inherited from the listener socket:
-    - `address-family`
-    - `keep-alive-enabled`
-    - `keep-alive-idle-time`
-    - `keep-alive-interval`
-    - `keep-alive-count`
-    - `hop-limit`
-    - `receive-buffer-size`
-    - `send-buffer-size`
-    
-    On success, this function returns the newly accepted client socket along with
-    a pair of streams that can be used to read & write to the connection.
-    
-    # Typical errors
-    - `invalid-state`:      Socket is not in the `listening` state. (EINVAL)
-    - `would-block`:        No pending connections at the moment. (EWOULDBLOCK, EAGAIN)
-    - `connection-aborted`: An incoming connection was pending, but was terminated by the client before this listener could accept it. (ECONNABORTED)
-    - `new-socket-limit`:   The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html>
-    - <https://man7.org/linux/man-pages/man2/accept.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept>
-    - <https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Accept a new client socket.

-

The returned socket is bound and in the connected state. The following properties are inherited from the listener socket: -- address-family -- keep-alive-enabled -- keep-alive-idle-time -- keep-alive-interval -- keep-alive-count -- hop-limit -- receive-buffer-size -- send-buffer-size

-

On success, this function returns the newly accepted client socket along with -a pair of streams that can be used to read & write to the connection.

-

Typical errors

-
    -
  • invalid-state: -Socket is not in the listening state. (EINVAL)
  • -
  • would-block: -No pending connections at the moment. (EWOULDBLOCK, EAGAIN)
  • -
  • connection-aborted: An incoming connection was pending, but was terminated by the client before this listener could accept it. (ECONNABORTED)
  • -
  • new-socket-limit: -The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def address_family(self) ‑> IpAddressFamily -
-
-
- -Expand source code - -
def address_family(self) -> wasi_sockets_network_0_2_6.IpAddressFamily:
-    """
-    Whether this is a IPv4 or IPv6 socket.
-    
-    Equivalent to the SO_DOMAIN socket option.
-    """
-    raise NotImplementedError
-
-

Whether this is a IPv4 or IPv6 socket.

-

Equivalent to the SO_DOMAIN socket option.

-
-
-def finish_bind(self) ‑> None -
-
-
- -Expand source code - -
def finish_bind(self) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def finish_connect(self) ‑> Tuple[InputStreamOutputStream] -
-
-
- -Expand source code - -
def finish_connect(self) -> Tuple[wasi_io_streams_0_2_6.InputStream, wasi_io_streams_0_2_6.OutputStream]:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def finish_listen(self) ‑> None -
-
-
- -Expand source code - -
def finish_listen(self) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def hop_limit(self) ‑> int -
-
-
- -Expand source code - -
def hop_limit(self) -> int:
-    """
-    Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The TTL value must be 1 or higher.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.

-

If the provided value is 0, an invalid-argument error is returned.

-

Typical errors

-
    -
  • invalid-argument: -(set) The TTL value must be 1 or higher.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def is_listening(self) ‑> bool -
-
-
- -Expand source code - -
def is_listening(self) -> bool:
-    """
-    Whether the socket is in the `listening` state.
-    
-    Equivalent to the SO_ACCEPTCONN socket option.
-    """
-    raise NotImplementedError
-
-

Whether the socket is in the listening state.

-

Equivalent to the SO_ACCEPTCONN socket option.

-
-
-def keep_alive_count(self) ‑> int -
-
-
- -Expand source code - -
def keep_alive_count(self) -> int:
-    """
-    The maximum amount of keepalive packets TCP should send before aborting the connection.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently clamped and/or rounded.
-    I.e. after setting a value, reading the same setting back may return a different value.
-    
-    Equivalent to the TCP_KEEPCNT socket option.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

The maximum amount of keepalive packets TCP should send before aborting the connection.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently clamped and/or rounded. -I.e. after setting a value, reading the same setting back may return a different value.

-

Equivalent to the TCP_KEEPCNT socket option.

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def keep_alive_enabled(self) ‑> bool -
-
-
- -Expand source code - -
def keep_alive_enabled(self) -> bool:
-    """
-    Enables or disables keepalive.
-    
-    The keepalive behavior can be adjusted using:
-    - `keep-alive-idle-time`
-    - `keep-alive-interval`
-    - `keep-alive-count`
-    These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true.
-    
-    Equivalent to the SO_KEEPALIVE socket option.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Enables or disables keepalive.

-

The keepalive behavior can be adjusted using: -- keep-alive-idle-time -- keep-alive-interval -- keep-alive-count -These properties can be configured while keep-alive-enabled is false, but only come into effect when keep-alive-enabled is true.

-

Equivalent to the SO_KEEPALIVE socket option.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def keep_alive_idle_time(self) ‑> int -
-
-
- -Expand source code - -
def keep_alive_idle_time(self) -> int:
-    """
-    Amount of time the connection has to be idle before TCP starts sending keepalive packets.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently clamped and/or rounded.
-    I.e. after setting a value, reading the same setting back may return a different value.
-    
-    Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS)
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Amount of time the connection has to be idle before TCP starts sending keepalive packets.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently clamped and/or rounded. -I.e. after setting a value, reading the same setting back may return a different value.

-

Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS)

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def keep_alive_interval(self) ‑> int -
-
-
- -Expand source code - -
def keep_alive_interval(self) -> int:
-    """
-    The time between keepalive packets.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently clamped and/or rounded.
-    I.e. after setting a value, reading the same setting back may return a different value.
-    
-    Equivalent to the TCP_KEEPINTVL socket option.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

The time between keepalive packets.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently clamped and/or rounded. -I.e. after setting a value, reading the same setting back may return a different value.

-

Equivalent to the TCP_KEEPINTVL socket option.

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def local_address(self) ‑> IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 -
-
-
- -Expand source code - -
def local_address(self) -> wasi_sockets_network_0_2_6.IpSocketAddress:
-    """
-    Get the bound local address.
-    
-    POSIX mentions:
-    > If the socket has not been bound to a local name, the value
-    > stored in the object pointed to by `address` is unspecified.
-    
-    WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not bound to any local address.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
-    - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
-    - <https://man.freebsd.org/cgi/man.cgi?getsockname>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get the bound local address.

-

POSIX mentions:

-
-

If the socket has not been bound to a local name, the value -stored in the object pointed to by address is unspecified.

-
-

WASI is stricter and requires local-address to return invalid-state when the socket hasn't been bound yet.

-

Typical errors

-
    -
  • invalid-state: The socket is not bound to any local address.
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def receive_buffer_size(self) ‑> int -
-
-
- -Expand source code - -
def receive_buffer_size(self) -> int:
-    """
-    The kernel buffer space reserved for sends/receives on this socket.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently clamped and/or rounded.
-    I.e. after setting a value, reading the same setting back may return a different value.
-    
-    Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

The kernel buffer space reserved for sends/receives on this socket.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently clamped and/or rounded. -I.e. after setting a value, reading the same setting back may return a different value.

-

Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def remote_address(self) ‑> IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 -
-
-
- -Expand source code - -
def remote_address(self) -> wasi_sockets_network_0_2_6.IpSocketAddress:
-    """
-    Get the remote address.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
-    - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
-    - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
- -
-
-def send_buffer_size(self) ‑> int -
-
-
- -Expand source code - -
def send_buffer_size(self) -> int:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_hop_limit(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_hop_limit(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_keep_alive_count(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_keep_alive_count(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_keep_alive_enabled(self, value: bool) ‑> None -
-
-
- -Expand source code - -
def set_keep_alive_enabled(self, value: bool) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_keep_alive_idle_time(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_keep_alive_idle_time(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_keep_alive_interval(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_keep_alive_interval(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_listen_backlog_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_listen_backlog_size(self, value: int) -> None:
-    """
-    Hints the desired listen queue size. Implementations are free to ignore this.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently clamped and/or rounded.
-    
-    # Typical errors
-    - `not-supported`:        (set) The platform does not support changing the backlog size after the initial listen.
-    - `invalid-argument`:     (set) The provided value was 0.
-    - `invalid-state`:        (set) The socket is in the `connect-in-progress` or `connected` state.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Hints the desired listen queue size. Implementations are free to ignore this.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently clamped and/or rounded.

-

Typical errors

-
    -
  • not-supported: -(set) The platform does not support changing the backlog size after the initial listen.
  • -
  • invalid-argument: -(set) The provided value was 0.
  • -
  • invalid-state: -(set) The socket is in the connect-in-progress or connected state.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_receive_buffer_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_receive_buffer_size(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_send_buffer_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_send_buffer_size(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def shutdown(self,
shutdown_type: ShutdownType) ‑> None
-
-
-
- -Expand source code - -
def shutdown(self, shutdown_type: ShutdownType) -> None:
-    """
-    Initiate a graceful shutdown.
-    
-    - `receive`: The socket is not expecting to receive any data from
-      the peer. The `input-stream` associated with this socket will be
-      closed. Any data still in the receive queue at time of calling
-      this method will be discarded.
-    - `send`: The socket has no more data to send to the peer. The `output-stream`
-      associated with this socket will be closed and a FIN packet will be sent.
-    - `both`: Same effect as `receive` & `send` combined.
-    
-    This function is idempotent; shutting down a direction more than once
-    has no effect and returns `ok`.
-    
-    The shutdown function does not close (drop) the socket.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html>
-    - <https://man7.org/linux/man-pages/man2/shutdown.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-shutdown>
-    - <https://man.freebsd.org/cgi/man.cgi?query=shutdown&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Initiate a graceful shutdown.

-
    -
  • receive: The socket is not expecting to receive any data from -the peer. The input-stream associated with this socket will be -closed. Any data still in the receive queue at time of calling -this method will be discarded.
  • -
  • send: The socket has no more data to send to the peer. The output-stream -associated with this socket will be closed and a FIN packet will be sent.
  • -
  • both: Same effect as receive & send combined.
  • -
-

This function is idempotent; shutting down a direction more than once -has no effect and returns ok.

-

The shutdown function does not close (drop) the socket.

-

Typical errors

-
    -
  • invalid-state: The socket is not in the connected state. (ENOTCONN)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def start_bind(self,
network: Network,
local_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6) ‑> None
-
-
-
- -Expand source code - -
def start_bind(self, network: wasi_sockets_network_0_2_6.Network, local_address: wasi_sockets_network_0_2_6.IpSocketAddress) -> None:
-    """
-    Bind the socket to a specific network on the provided IP address and port.
-    
-    If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which
-    network interface(s) to bind to.
-    If the TCP/UDP port is zero, the socket will be bound to a random free port.
-    
-    Bind can be attempted multiple times on the same socket, even with
-    different arguments on each iteration. But never concurrently and
-    only as long as the previous bind failed. Once a bind succeeds, the
-    binding can't be changed anymore.
-    
-    # Typical errors
-    - `invalid-argument`:          The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
-    - `invalid-argument`:          `local-address` is not a unicast address. (EINVAL)
-    - `invalid-argument`:          `local-address` is an IPv4-mapped IPv6 address. (EINVAL)
-    - `invalid-state`:             The socket is already bound. (EINVAL)
-    - `address-in-use`:            No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
-    - `address-in-use`:            Address is already in use. (EADDRINUSE)
-    - `address-not-bindable`:      `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL)
-    - `not-in-progress`:           A `bind` operation is not in progress.
-    - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-    
-    # Implementors note
-    When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT
-    state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR
-    socket option should be set implicitly on all platforms, except on Windows where this is the default behavior
-    and SO_REUSEADDR performs something different entirely.
-    
-    Unlike in POSIX, in WASI the bind operation is async. This enables
-    interactive WASI hosts to inject permission prompts. Runtimes that
-    don't want to make use of this ability can simply call the native
-    `bind` as part of either `start-bind` or `finish-bind`.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
-    - <https://man7.org/linux/man-pages/man2/bind.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
-    - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Bind the socket to a specific network on the provided IP address and port.

-

If the IP address is zero (0.0.0.0 in IPv4, :: in IPv6), it is left to the implementation to decide which -network interface(s) to bind to. -If the TCP/UDP port is zero, the socket will be bound to a random free port.

-

Bind can be attempted multiple times on the same socket, even with -different arguments on each iteration. But never concurrently and -only as long as the previous bind failed. Once a bind succeeds, the -binding can't be changed anymore.

-

Typical errors

-
    -
  • invalid-argument: -The local-address has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
  • -
  • invalid-argument: -local-address is not a unicast address. (EINVAL)
  • -
  • invalid-argument: -local-address is an IPv4-mapped IPv6 address. (EINVAL)
  • -
  • invalid-state: -The socket is already bound. (EINVAL)
  • -
  • address-in-use: -No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
  • -
  • address-in-use: -Address is already in use. (EADDRINUSE)
  • -
  • address-not-bindable: -local-address is not an address that the network can bind to. (EADDRNOTAVAIL)
  • -
  • not-in-progress: -A bind operation is not in progress.
  • -
  • would-block: -Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
  • -
-

Implementors note

-

When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT -state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR -socket option should be set implicitly on all platforms, except on Windows where this is the default behavior -and SO_REUSEADDR performs something different entirely.

-

Unlike in POSIX, in WASI the bind operation is async. This enables -interactive WASI hosts to inject permission prompts. Runtimes that -don't want to make use of this ability can simply call the native -bind as part of either start-bind or finish-bind.

-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def start_connect(self,
network: Network,
remote_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6) ‑> None
-
-
-
- -Expand source code - -
def start_connect(self, network: wasi_sockets_network_0_2_6.Network, remote_address: wasi_sockets_network_0_2_6.IpSocketAddress) -> None:
-    """
-    Connect to a remote endpoint.
-    
-    On success:
-    - the socket is transitioned into the `connected` state.
-    - a pair of streams is returned that can be used to read & write to the connection
-    
-    After a failed connection attempt, the socket will be in the `closed`
-    state and the only valid action left is to `drop` the socket. A single
-    socket can not be used to connect more than once.
-    
-    # Typical errors
-    - `invalid-argument`:          The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-    - `invalid-argument`:          `remote-address` is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS)
-    - `invalid-argument`:          `remote-address` is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos)
-    - `invalid-argument`:          The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows)
-    - `invalid-argument`:          The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows)
-    - `invalid-argument`:          The socket is already attached to a different network. The `network` passed to `connect` must be identical to the one passed to `bind`.
-    - `invalid-state`:             The socket is already in the `connected` state. (EISCONN)
-    - `invalid-state`:             The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows)
-    - `timeout`:                   Connection timed out. (ETIMEDOUT)
-    - `connection-refused`:        The connection was forcefully rejected. (ECONNREFUSED)
-    - `connection-reset`:          The connection was reset. (ECONNRESET)
-    - `connection-aborted`:        The connection was aborted. (ECONNABORTED)
-    - `remote-unreachable`:        The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
-    - `not-in-progress`:           A connect operation is not in progress.
-    - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-    
-    # Implementors note
-    The POSIX equivalent of `start-connect` is the regular `connect` syscall.
-    Because all WASI sockets are non-blocking this is expected to return
-    EINPROGRESS, which should be translated to `ok()` in WASI.
-    
-    The POSIX equivalent of `finish-connect` is a `poll` for event `POLLOUT`
-    with a timeout of 0 on the socket descriptor. Followed by a check for
-    the `SO_ERROR` socket option, in case the poll signaled readiness.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-    - <https://man7.org/linux/man-pages/man2/connect.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-    - <https://man.freebsd.org/cgi/man.cgi?connect>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Connect to a remote endpoint.

-

On success: -- the socket is transitioned into the connected state. -- a pair of streams is returned that can be used to read & write to the connection

-

After a failed connection attempt, the socket will be in the closed -state and the only valid action left is to drop the socket. A single -socket can not be used to connect more than once.

-

Typical errors

-
    -
  • invalid-argument: -The remote-address has the wrong address family. (EAFNOSUPPORT)
  • -
  • invalid-argument: -remote-address is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS)
  • -
  • invalid-argument: -remote-address is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos)
  • -
  • invalid-argument: -The IP address in remote-address is set to INADDR_ANY (0.0.0.0 / ::). (EADDRNOTAVAIL on Windows)
  • -
  • invalid-argument: -The port in remote-address is set to 0. (EADDRNOTAVAIL on Windows)
  • -
  • invalid-argument: -The socket is already attached to a different network. The network passed to connect must be identical to the one passed to bind.
  • -
  • invalid-state: -The socket is already in the connected state. (EISCONN)
  • -
  • invalid-state: -The socket is already in the listening state. (EOPNOTSUPP, EINVAL on Windows)
  • -
  • timeout: -Connection timed out. (ETIMEDOUT)
  • -
  • connection-refused: -The connection was forcefully rejected. (ECONNREFUSED)
  • -
  • connection-reset: -The connection was reset. (ECONNRESET)
  • -
  • connection-aborted: -The connection was aborted. (ECONNABORTED)
  • -
  • remote-unreachable: -The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
  • address-in-use: -Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
  • -
  • not-in-progress: -A connect operation is not in progress.
  • -
  • would-block: -Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
  • -
-

Implementors note

-

The POSIX equivalent of start-connect is the regular connect syscall. -Because all WASI sockets are non-blocking this is expected to return -EINPROGRESS, which should be translated to ok() in WASI.

-

The POSIX equivalent of finish-connect is a poll for event POLLOUT -with a timeout of 0 on the socket descriptor. Followed by a check for -the SO_ERROR socket option, in case the poll signaled readiness.

-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def start_listen(self) ‑> None -
-
-
- -Expand source code - -
def start_listen(self) -> None:
-    """
-    Start listening for new connections.
-    
-    Transitions the socket into the `listening` state.
-    
-    Unlike POSIX, the socket must already be explicitly bound.
-    
-    # Typical errors
-    - `invalid-state`:             The socket is not bound to any local address. (EDESTADDRREQ)
-    - `invalid-state`:             The socket is already in the `connected` state. (EISCONN, EINVAL on BSD)
-    - `invalid-state`:             The socket is already in the `listening` state.
-    - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
-    - `not-in-progress`:           A listen operation is not in progress.
-    - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-    
-    # Implementors note
-    Unlike in POSIX, in WASI the listen operation is async. This enables
-    interactive WASI hosts to inject permission prompts. Runtimes that
-    don't want to make use of this ability can simply call the native
-    `listen` as part of either `start-listen` or `finish-listen`.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html>
-    - <https://man7.org/linux/man-pages/man2/listen.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen>
-    - <https://man.freebsd.org/cgi/man.cgi?query=listen&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Start listening for new connections.

-

Transitions the socket into the listening state.

-

Unlike POSIX, the socket must already be explicitly bound.

-

Typical errors

-
    -
  • invalid-state: -The socket is not bound to any local address. (EDESTADDRREQ)
  • -
  • invalid-state: -The socket is already in the connected state. (EISCONN, EINVAL on BSD)
  • -
  • invalid-state: -The socket is already in the listening state.
  • -
  • address-in-use: -Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
  • -
  • not-in-progress: -A listen operation is not in progress.
  • -
  • would-block: -Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
  • -
-

Implementors note

-

Unlike in POSIX, in WASI the listen operation is async. This enables -interactive WASI hosts to inject permission prompts. Runtimes that -don't want to make use of this ability can simply call the native -listen as part of either start-listen or finish-listen.

-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-    """
-    Create a `pollable` which can be used to poll for, or block on,
-    completion of any of the asynchronous operations of this socket.
-    
-    When `finish-bind`, `finish-listen`, `finish-connect` or `accept`
-    return `error(would-block)`, this pollable can be used to wait for
-    their success or failure, after which the method can be retried.
-    
-    The pollable is not limited to the async operation that happens to be
-    in progress at the time of calling `subscribe` (if any). Theoretically,
-    `subscribe` only has to be called once per socket and can then be
-    (re)used for the remainder of the socket's lifetime.
-    
-    See <https://github.com/WebAssembly/wasi-sockets/blob/main/TcpSocketOperationalSemantics.md#pollable-readiness>
-    for more information.
-    
-    Note: this function is here for WASI 0.2 only.
-    It's planned to be removed when `future` is natively supported in Preview3.
-    """
-    raise NotImplementedError
-
-

Create a pollable which can be used to poll for, or block on, -completion of any of the asynchronous operations of this socket.

-

When finish-bind, finish-listen, finish-connect or accept -return error(would-block), this pollable can be used to wait for -their success or failure, after which the method can be retried.

-

The pollable is not limited to the async operation that happens to be -in progress at the time of calling subscribe (if any). Theoretically, -subscribe only has to be called once per socket and can then be -(re)used for the remainder of the socket's lifetime.

-

See https://github.com/WebAssembly/wasi-sockets/blob/main/TcpSocketOperationalSemantics.md#pollable-readiness -for more information.

-

Note: this function is here for WASI 0.2 only. -It's planned to be removed when future is natively supported in Preview3.

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_tcp_create_socket_0_2_0.html b/docs/v4/wit/imports/wasi_sockets_tcp_create_socket_0_2_0.html deleted file mode 100644 index 470396e..0000000 --- a/docs/v4/wit/imports/wasi_sockets_tcp_create_socket_0_2_0.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_tcp_create_socket_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_tcp_create_socket_0_2_0

-
-
-
-
-
-
-
-
-

Functions

-
-
-def create_tcp_socket(address_family: IpAddressFamily) ‑> TcpSocket -
-
-
- -Expand source code - -
def create_tcp_socket(address_family: wasi_sockets_network_0_2_0.IpAddressFamily) -> wasi_sockets_tcp_0_2_0.TcpSocket:
-    """
-    Create a new TCP socket.
-    
-    Similar to `socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)` in POSIX.
-    On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.
-    
-    This function does not require a network capability handle. This is considered to be safe because
-    at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind`/`connect`
-    is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world.
-    
-    All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.
-    
-    # Typical errors
-    - `not-supported`:     The specified `address-family` is not supported. (EAFNOSUPPORT)
-    - `new-socket-limit`:  The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html>
-    - <https://man7.org/linux/man-pages/man2/socket.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
-    - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a new TCP socket.

-

Similar to socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP) in POSIX. -On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.

-

This function does not require a network capability handle. This is considered to be safe because -at time of creation, the socket is not bound to any network yet. Up to the moment bind/connect -is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world.

-

All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.

-

Typical errors

-
    -
  • not-supported: -The specified address-family is not supported. (EAFNOSUPPORT)
  • -
  • new-socket-limit: -The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_tcp_create_socket_0_2_6.html b/docs/v4/wit/imports/wasi_sockets_tcp_create_socket_0_2_6.html deleted file mode 100644 index d665997..0000000 --- a/docs/v4/wit/imports/wasi_sockets_tcp_create_socket_0_2_6.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_tcp_create_socket_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_tcp_create_socket_0_2_6

-
-
-
-
-
-
-
-
-

Functions

-
-
-def create_tcp_socket(address_family: IpAddressFamily) ‑> TcpSocket -
-
-
- -Expand source code - -
def create_tcp_socket(address_family: wasi_sockets_network_0_2_6.IpAddressFamily) -> wasi_sockets_tcp_0_2_6.TcpSocket:
-    """
-    Create a new TCP socket.
-    
-    Similar to `socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)` in POSIX.
-    On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.
-    
-    This function does not require a network capability handle. This is considered to be safe because
-    at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind`/`connect`
-    is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world.
-    
-    All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.
-    
-    # Typical errors
-    - `not-supported`:     The specified `address-family` is not supported. (EAFNOSUPPORT)
-    - `new-socket-limit`:  The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html>
-    - <https://man7.org/linux/man-pages/man2/socket.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
-    - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a new TCP socket.

-

Similar to socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP) in POSIX. -On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.

-

This function does not require a network capability handle. This is considered to be safe because -at time of creation, the socket is not bound to any network yet. Up to the moment bind/connect -is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world.

-

All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.

-

Typical errors

-
    -
  • not-supported: -The specified address-family is not supported. (EAFNOSUPPORT)
  • -
  • new-socket-limit: -The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_types_0_3_0_rc_2026_03_15.html b/docs/v4/wit/imports/wasi_sockets_types_0_3_0_rc_2026_03_15.html deleted file mode 100644 index 494473e..0000000 --- a/docs/v4/wit/imports/wasi_sockets_types_0_3_0_rc_2026_03_15.html +++ /dev/null @@ -1,3238 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15

-
-
-
-
-
-
-

Global variables

-
-
var ErrorCode
-
-

Error codes.

-

In theory, every API can return any error code. -In practice, API's typically only return the errors documented per API -combined with a couple of errors that are always possible: -- other -- access-denied -- not-supported -- out-of-memory

-

See each individual API for what the POSIX equivalents are. They sometimes differ per API.

-
-
-
-
-
-
-

Classes

-
-
-class ErrorCode_AccessDenied -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_AccessDenied:
-    pass
-
-

ErrorCode_AccessDenied()

-
-
-class ErrorCode_AddressInUse -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_AddressInUse:
-    pass
-
-

ErrorCode_AddressInUse()

-
-
-class ErrorCode_AddressNotBindable -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_AddressNotBindable:
-    pass
-
-

ErrorCode_AddressNotBindable()

-
-
-class ErrorCode_ConnectionAborted -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionAborted:
-    pass
-
-

ErrorCode_ConnectionAborted()

-
-
-class ErrorCode_ConnectionBroken -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionBroken:
-    pass
-
-

ErrorCode_ConnectionBroken()

-
-
-class ErrorCode_ConnectionRefused -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionRefused:
-    pass
-
-

ErrorCode_ConnectionRefused()

-
-
-class ErrorCode_ConnectionReset -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_ConnectionReset:
-    pass
-
-

ErrorCode_ConnectionReset()

-
-
-class ErrorCode_DatagramTooLarge -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_DatagramTooLarge:
-    pass
-
-

ErrorCode_DatagramTooLarge()

-
-
-class ErrorCode_InvalidArgument -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_InvalidArgument:
-    pass
-
-

ErrorCode_InvalidArgument()

-
-
-class ErrorCode_InvalidState -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_InvalidState:
-    pass
-
-

ErrorCode_InvalidState()

-
-
-class ErrorCode_NotSupported -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_NotSupported:
-    pass
-
-

ErrorCode_NotSupported()

-
-
-class ErrorCode_Other -(value: str | None) -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Other:
-    value: Optional[str]
-
-

ErrorCode_Other(value: Optional[str])

-

Instance variables

-
-
var value : str | None
-
-
-
-
-
-
-class ErrorCode_OutOfMemory -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_OutOfMemory:
-    pass
-
-

ErrorCode_OutOfMemory()

-
-
-class ErrorCode_RemoteUnreachable -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_RemoteUnreachable:
-    pass
-
-

ErrorCode_RemoteUnreachable()

-
-
-class ErrorCode_Timeout -
-
-
- -Expand source code - -
@dataclass
-class ErrorCode_Timeout:
-    pass
-
-

ErrorCode_Timeout()

-
-
-class IpAddressFamily -(*args, **kwds) -
-
-
- -Expand source code - -
class IpAddressFamily(Enum):
-    IPV4 = 0
-    IPV6 = 1
-
-

Create a collection of name/value pairs.

-

Example enumeration:

-
>>> class Color(Enum):
-...     RED = 1
-...     BLUE = 2
-...     GREEN = 3
-
-

Access them by:

-
    -
  • attribute access:
  • -
-
-
-
-

Color.RED -

-
-
-
-
    -
  • value lookup:
  • -
-
-
-
-

Color(1) -

-
-
-
-
    -
  • name lookup:
  • -
-
-
-
-

Color['RED'] -

-
-
-
-

Enumerations can be iterated over, and know how many members they have:

-
>>> len(Color)
-3
-
-
>>> list(Color)
-[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
-
-

Methods can be added to enumerations, and members can have their own -attributes – see the documentation for details.

-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var IPV4
-
-
-
-
var IPV6
-
-
-
-
-
-
-class IpAddress_Ipv4 -(value: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class IpAddress_Ipv4:
-    value: Tuple[int, int, int, int]
-
-

IpAddress_Ipv4(value: Tuple[int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int]
-
-
-
-
-
-
-class IpAddress_Ipv6 -(value: Tuple[int, int, int, int, int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class IpAddress_Ipv6:
-    value: Tuple[int, int, int, int, int, int, int, int]
-
-

IpAddress_Ipv6(value: Tuple[int, int, int, int, int, int, int, int])

-

Instance variables

-
-
var value : Tuple[int, int, int, int, int, int, int, int]
-
-
-
-
-
-
-class IpSocketAddress_Ipv4 -(value: Ipv4SocketAddress) -
-
-
- -Expand source code - -
@dataclass
-class IpSocketAddress_Ipv4:
-    value: Ipv4SocketAddress
-
-

IpSocketAddress_Ipv4(value: spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.Ipv4SocketAddress)

-

Instance variables

-
-
var valueIpv4SocketAddress
-
-
-
-
-
-
-class IpSocketAddress_Ipv6 -(value: Ipv6SocketAddress) -
-
-
- -Expand source code - -
@dataclass
-class IpSocketAddress_Ipv6:
-    value: Ipv6SocketAddress
-
-

IpSocketAddress_Ipv6(value: spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.Ipv6SocketAddress)

-

Instance variables

-
-
var valueIpv6SocketAddress
-
-
-
-
-
-
-class Ipv4SocketAddress -(port: int, address: Tuple[int, int, int, int]) -
-
-
- -Expand source code - -
@dataclass
-class Ipv4SocketAddress:
-    port: int
-    address: Tuple[int, int, int, int]
-
-

Ipv4SocketAddress(port: int, address: Tuple[int, int, int, int])

-

Instance variables

-
-
var address : Tuple[int, int, int, int]
-
-
-
-
var port : int
-
-
-
-
-
-
-class Ipv6SocketAddress -(port: int,
flow_info: int,
address: Tuple[int, int, int, int, int, int, int, int],
scope_id: int)
-
-
-
- -Expand source code - -
@dataclass
-class Ipv6SocketAddress:
-    port: int
-    flow_info: int
-    address: Tuple[int, int, int, int, int, int, int, int]
-    scope_id: int
-
-

Ipv6SocketAddress(port: int, flow_info: int, address: Tuple[int, int, int, int, int, int, int, int], scope_id: int)

-

Instance variables

-
-
var address : Tuple[int, int, int, int, int, int, int, int]
-
-
-
-
var flow_info : int
-
-
-
-
var port : int
-
-
-
-
var scope_id : int
-
-
-
-
-
-
-class TcpSocket -
-
-
- -Expand source code - -
class TcpSocket:
-    """
-    A TCP socket resource.
-    
-    The socket can be in one of the following states:
-    - `unbound`
-    - `bound` (See note below)
-    - `listening`
-    - `connecting`
-    - `connected`
-    - `closed`
-    See <https://github.com/WebAssembly/WASI/blob/main/proposals/sockets/TcpSocketOperationalSemantics-0.3.0-draft.md>
-    for more information.
-    
-    Note: Except where explicitly mentioned, whenever this documentation uses
-    the term "bound" without backticks it actually means: in the `bound` state *or higher*.
-    (i.e. `bound`, `listening`, `connecting` or `connected`)
-    
-    WASI uses shared ownership semantics: the `tcp-socket` handle and all
-    derived `stream` and `future` values reference a single underlying OS
-    socket:
-    - Send/receive streams remain functional after the original `tcp-socket`
-      handle is dropped.
-    - The stream returned by `listen` behaves similarly.
-    - Client sockets returned by `tcp-socket::listen` are independent and do
-      not keep the listening socket alive.
-    
-    The OS socket is closed only after the last handle is dropped. This
-    model has observable effects; for example, it affects when the local
-    port binding is released.
-    
-    In addition to the general error codes documented on the
-    `types::error-code` type, TCP socket methods may always return
-    `error(invalid-state)` when in the `closed` state.
-    """
-    
-    @classmethod
-    def create(cls, address_family: IpAddressFamily) -> Self:
-        """
-        Create a new TCP socket.
-        
-        Similar to `socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)`
-        in POSIX. On IPv6 sockets, IPV6_V6ONLY is enabled by default and
-        can't be configured otherwise.
-        
-        Unlike POSIX, WASI sockets have no notion of a socket-level
-        `O_NONBLOCK` flag. Instead they fully rely on the Component Model's
-        async support.
-        
-        # Typical errors
-        - `not-supported`: The `address-family` is not supported. (EAFNOSUPPORT)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html>
-        - <https://man7.org/linux/man-pages/man2/socket.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
-        - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def bind(self, local_address: IpSocketAddress) -> None:
-        """
-        Bind the socket to the provided IP address and port.
-        
-        If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is
-        left to the implementation to decide which network interface(s) to
-        bind to. If the TCP/UDP port is zero, the socket will be bound to a
-        random free port.
-        
-        Bind can be attempted multiple times on the same socket, even with
-        different arguments on each iteration. But never concurrently and
-        only as long as the previous bind failed. Once a bind succeeds, the
-        binding can't be changed anymore.
-        
-        # Typical errors
-        - `invalid-argument`:          The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
-        - `invalid-argument`:          `local-address` is not a unicast address. (EINVAL)
-        - `invalid-argument`:          `local-address` is an IPv4-mapped IPv6 address. (EINVAL)
-        - `invalid-state`:             The socket is already bound. (EINVAL)
-        - `address-in-use`:            No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
-        - `address-in-use`:            Address is already in use. (EADDRINUSE)
-        - `address-not-bindable`:      `local-address` is not an address that can be bound to. (EADDRNOTAVAIL)
-        
-        # Implementors note
-        The bind operation shouldn't be affected by the TIME_WAIT state of a
-        recently closed socket on the same local address. In practice this
-        means that the SO_REUSEADDR socket option should be set implicitly
-        on all platforms, except on Windows where this is the default
-        behavior and SO_REUSEADDR performs something different.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
-        - <https://man7.org/linux/man-pages/man2/bind.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
-        - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def connect(self, remote_address: IpSocketAddress) -> None:
-        """
-        Connect to a remote endpoint.
-        
-        On success, the socket is transitioned into the `connected` state
-        and the `remote-address` of the socket is updated.
-        The `local-address` may be updated as well, based on the best network
-        path to `remote-address`. If the socket was not already explicitly
-        bound, this function will implicitly bind the socket to a random
-        free port.
-        
-        After a failed connection attempt, the socket will be in the `closed`
-        state and the only valid action left is to `drop` the socket. A single
-        socket can not be used to connect more than once.
-        
-        # Typical errors
-        - `invalid-argument`:          The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-        - `invalid-argument`:          `remote-address` is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS)
-        - `invalid-argument`:          `remote-address` is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos)
-        - `invalid-argument`:          The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows)
-        - `invalid-argument`:          The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows)
-        - `invalid-state`:             The socket is already in the `connecting` state. (EALREADY)
-        - `invalid-state`:             The socket is already in the `connected` state. (EISCONN)
-        - `invalid-state`:             The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows)
-        - `timeout`:                   Connection timed out. (ETIMEDOUT)
-        - `connection-refused`:        The connection was forcefully rejected. (ECONNREFUSED)
-        - `connection-reset`:          The connection was reset. (ECONNRESET)
-        - `connection-aborted`:        The connection was aborted. (ECONNABORTED)
-        - `remote-unreachable`:        The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-        - <https://man7.org/linux/man-pages/man2/connect.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-        - <https://man.freebsd.org/cgi/man.cgi?connect>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def listen(self) -> StreamReader[Self]:
-        """
-        Start listening and return a stream of new inbound connections.
-        
-        Transitions the socket into the `listening` state. This can be called
-        at most once per socket.
-        
-        If the socket is not already explicitly bound, this function will
-        implicitly bind the socket to a random free port.
-        
-        Normally, the returned sockets are bound, in the `connected` state
-        and immediately ready for I/O. Though, depending on exact timing and
-        circumstances, a newly accepted connection may already be `closed`
-        by the time the server attempts to perform its first I/O on it. This
-        is true regardless of whether the WASI implementation uses
-        "synthesized" sockets or not (see Implementors Notes below).
-        
-        The following properties are inherited from the listener socket:
-        - `address-family`
-        - `keep-alive-enabled`
-        - `keep-alive-idle-time`
-        - `keep-alive-interval`
-        - `keep-alive-count`
-        - `hop-limit`
-        - `receive-buffer-size`
-        - `send-buffer-size`
-        
-        # Typical errors
-        - `invalid-state`:             The socket is already in the `connected` state. (EISCONN, EINVAL on BSD)
-        - `invalid-state`:             The socket is already in the `listening` state.
-        - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
-        
-        # Implementors note
-        This method returns a single perpetual stream that should only close
-        on fatal errors (if any). Yet, the POSIX' `accept` function may also
-        return transient errors (e.g. ECONNABORTED). The exact details differ
-        per operation system. For example, the Linux manual mentions:
-        
-        > Linux accept() passes already-pending network errors on the new
-        > socket as an error code from accept(). This behavior differs from
-        > other BSD socket implementations. For reliable operation the
-        > application should detect the network errors defined for the
-        > protocol after accept() and treat them like EAGAIN by retrying.
-        > In the case of TCP/IP, these are ENETDOWN, EPROTO, ENOPROTOOPT,
-        > EHOSTDOWN, ENONET, EHOSTUNREACH, EOPNOTSUPP, and ENETUNREACH.
-        Source: https://man7.org/linux/man-pages/man2/accept.2.html
-        
-        WASI implementations have two options to handle this:
-        - Optionally log it and then skip over non-fatal errors returned by
-          `accept`. Guest code never gets to see these failures. Or:
-        - Synthesize a `tcp-socket` resource that exposes the error when
-          attempting to send or receive on it. Guest code then sees these
-          failures as regular I/O errors.
-        
-        In either case, the stream returned by this `listen` method remains
-        operational.
-        
-        WASI requires `listen` to perform an implicit bind if the socket
-        has not already been bound. Not all platforms (notably Windows)
-        exhibit this behavior out of the box. On platforms that require it,
-        the WASI implementation can emulate this behavior by performing
-        the bind itself if the guest hasn't already done so.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html>
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html>
-        - <https://man7.org/linux/man-pages/man2/listen.2.html>
-        - <https://man7.org/linux/man-pages/man2/accept.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept>
-        - <https://man.freebsd.org/cgi/man.cgi?query=listen&sektion=2>
-        - <https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def send(self, data: ByteStreamReader) -> FutureReader[Result[None, ErrorCode]]:
-        """
-        Transmit data to peer.
-        
-        The caller should close the stream when it has no more data to send
-        to the peer. Under normal circumstances this will cause a FIN packet
-        to be sent out. Closing the stream is equivalent to calling
-        `shutdown(SHUT_WR)` in POSIX.
-        
-        This function may be called at most once and returns once the full
-        contents of the stream are transmitted or an error is encountered.
-        
-        # Typical errors
-        - `invalid-state`:             The socket is not in the `connected` state. (ENOTCONN)
-        - `invalid-state`:             `send` has already been called on this socket.
-        - `connection-broken`:         The connection is not writable anymore. (EPIPE, ECONNABORTED on Windows)
-        - `connection-reset`:          The connection was reset. (ECONNRESET)
-        - `remote-unreachable`:        The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        
-         # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html>
-        - <https://man7.org/linux/man-pages/man2/send.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>
-        - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
-        """
-        raise NotImplementedError
-    def receive(self) -> Tuple[ByteStreamReader, FutureReader[Result[None, ErrorCode]]]:
-        """
-        Read data from peer.
-        
-        Returns a `stream` of data sent by the peer. The implementation
-        drops the stream once no more data is available. At that point, the
-        returned `future` resolves to:
-        - `ok` after a graceful shutdown from the peer (i.e. a FIN packet), or
-        - `err` if the socket was closed abnormally.
-        
-        `receive` may be called only once per socket. Subsequent calls return
-        a closed stream and a future resolved to `err(invalid-state)`.
-        
-        If the caller is not expecting to receive any more data from the peer,
-        they should drop the stream. Any data still in the receive queue
-        will be discarded. This is equivalent to calling `shutdown(SHUT_RD)`
-        in POSIX.
-        
-        # Typical errors
-        - `invalid-state`:             The socket is not in the `connected` state. (ENOTCONN)
-        - `invalid-state`:             `receive` has already been called on this socket.
-        - `connection-reset`:          The connection was reset. (ECONNRESET)
-        - `remote-unreachable`:        The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html>
-        - <https://man7.org/linux/man-pages/man2/recv.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recv>
-        - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>
-        """
-        raise NotImplementedError
-    def get_local_address(self) -> IpSocketAddress:
-        """
-        Get the bound local address.
-        
-        POSIX mentions:
-        > If the socket has not been bound to a local name, the value
-        > stored in the object pointed to by `address` is unspecified.
-        
-        WASI is stricter and requires `get-local-address` to return
-        `invalid-state` when the socket hasn't been bound yet.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not bound to any local address.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
-        - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
-        - <https://man.freebsd.org/cgi/man.cgi?getsockname>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_remote_address(self) -> IpSocketAddress:
-        """
-        Get the remote address.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
-        - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
-        - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_is_listening(self) -> bool:
-        """
-        Whether the socket is in the `listening` state.
-        
-        Equivalent to the SO_ACCEPTCONN socket option.
-        """
-        raise NotImplementedError
-    def get_address_family(self) -> IpAddressFamily:
-        """
-        Whether this is a IPv4 or IPv6 socket.
-        
-        This is the value passed to the constructor.
-        
-        Equivalent to the SO_DOMAIN socket option.
-        """
-        raise NotImplementedError
-    def set_listen_backlog_size(self, value: int) -> None:
-        """
-        Hints the desired listen queue size. Implementations are free to
-        ignore this.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently
-        clamped and/or rounded.
-        
-        # Typical errors
-        - `not-supported`:        (set) The platform does not support changing the backlog size after the initial listen.
-        - `invalid-argument`:     (set) The provided value was 0.
-        - `invalid-state`:        (set) The socket is in the `connecting` or `connected` state.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_keep_alive_enabled(self) -> bool:
-        """
-        Enables or disables keepalive.
-        
-        The keepalive behavior can be adjusted using:
-        - `keep-alive-idle-time`
-        - `keep-alive-interval`
-        - `keep-alive-count`
-        These properties can be configured while `keep-alive-enabled` is
-        false, but only come into effect when `keep-alive-enabled` is true.
-        
-        Equivalent to the SO_KEEPALIVE socket option.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_keep_alive_enabled(self, value: bool) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_keep_alive_idle_time(self) -> int:
-        """
-        Amount of time the connection has to be idle before TCP starts
-        sending keepalive packets.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        All other values are accepted without error, but may be
-        clamped or rounded. As a result, the value read back from
-        this setting may differ from the value that was set.
-        
-        Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS)
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_keep_alive_idle_time(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_keep_alive_interval(self) -> int:
-        """
-        The time between keepalive packets.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        All other values are accepted without error, but may be
-        clamped or rounded. As a result, the value read back from
-        this setting may differ from the value that was set.
-        
-        Equivalent to the TCP_KEEPINTVL socket option.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_keep_alive_interval(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_keep_alive_count(self) -> int:
-        """
-        The maximum amount of keepalive packets TCP should send before
-        aborting the connection.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        All other values are accepted without error, but may be
-        clamped or rounded. As a result, the value read back from
-        this setting may differ from the value that was set.
-        
-        Equivalent to the TCP_KEEPCNT socket option.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_keep_alive_count(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_hop_limit(self) -> int:
-        """
-        Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The TTL value must be 1 or higher.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_hop_limit(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_receive_buffer_size(self) -> int:
-        """
-        Kernel buffer space reserved for sending/receiving on this socket.
-        Implementations usually treat this as a cap the buffer can grow to,
-        rather than allocating the full amount immediately.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        All other values are accepted without error, but may be
-        clamped or rounded. As a result, the value read back from
-        this setting may differ from the value that was set.
-        
-        This is only a performance hint. The implementation may ignore it or
-        tweak it based on real traffic patterns.
-        Linux and macOS appear to behave differently depending on whether a
-        buffer size was explicitly set. When set, they tend to honor it; when
-        not set, they dynamically adjust the buffer size as the connection
-        progresses. This is especially noticeable when comparing the values
-        from before and after connection establishment.
-        
-        Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_receive_buffer_size(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_send_buffer_size(self) -> int:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_send_buffer_size(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A TCP socket resource.

-

The socket can be in one of the following states: -- unbound -- bound (See note below) -- listening -- connecting -- connected -- closed -See https://github.com/WebAssembly/WASI/blob/main/proposals/sockets/TcpSocketOperationalSemantics-0.3.0-draft.md -for more information.

-

Note: Except where explicitly mentioned, whenever this documentation uses -the term "bound" without backticks it actually means: in the bound state or higher. -(i.e. bound, listening, connecting or connected)

-

WASI uses shared ownership semantics: the tcp-socket handle and all -derived stream and future values reference a single underlying OS -socket: -- Send/receive streams remain functional after the original tcp-socket -handle is dropped. -- The stream returned by listen behaves similarly. -- Client sockets returned by tcp-socket::listen are independent and do -not keep the listening socket alive.

-

The OS socket is closed only after the last handle is dropped. This -model has observable effects; for example, it affects when the local -port binding is released.

-

In addition to the general error codes documented on the -types::error-code type, TCP socket methods may always return -error(invalid-state) when in the closed state.

-

Static methods

-
-
-def create(address_family: IpAddressFamily) ‑> Self -
-
-

Create a new TCP socket.

-

Similar to socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP) -in POSIX. On IPv6 sockets, IPV6_V6ONLY is enabled by default and -can't be configured otherwise.

-

Unlike POSIX, WASI sockets have no notion of a socket-level -O_NONBLOCK flag. Instead they fully rely on the Component Model's -async support.

-

Typical errors

-
    -
  • not-supported: The address-family is not supported. (EAFNOSUPPORT)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-

Methods

-
-
-def bind(self,
local_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6) ‑> None
-
-
-
- -Expand source code - -
def bind(self, local_address: IpSocketAddress) -> None:
-    """
-    Bind the socket to the provided IP address and port.
-    
-    If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is
-    left to the implementation to decide which network interface(s) to
-    bind to. If the TCP/UDP port is zero, the socket will be bound to a
-    random free port.
-    
-    Bind can be attempted multiple times on the same socket, even with
-    different arguments on each iteration. But never concurrently and
-    only as long as the previous bind failed. Once a bind succeeds, the
-    binding can't be changed anymore.
-    
-    # Typical errors
-    - `invalid-argument`:          The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
-    - `invalid-argument`:          `local-address` is not a unicast address. (EINVAL)
-    - `invalid-argument`:          `local-address` is an IPv4-mapped IPv6 address. (EINVAL)
-    - `invalid-state`:             The socket is already bound. (EINVAL)
-    - `address-in-use`:            No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
-    - `address-in-use`:            Address is already in use. (EADDRINUSE)
-    - `address-not-bindable`:      `local-address` is not an address that can be bound to. (EADDRNOTAVAIL)
-    
-    # Implementors note
-    The bind operation shouldn't be affected by the TIME_WAIT state of a
-    recently closed socket on the same local address. In practice this
-    means that the SO_REUSEADDR socket option should be set implicitly
-    on all platforms, except on Windows where this is the default
-    behavior and SO_REUSEADDR performs something different.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
-    - <https://man7.org/linux/man-pages/man2/bind.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
-    - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Bind the socket to the provided IP address and port.

-

If the IP address is zero (0.0.0.0 in IPv4, :: in IPv6), it is -left to the implementation to decide which network interface(s) to -bind to. If the TCP/UDP port is zero, the socket will be bound to a -random free port.

-

Bind can be attempted multiple times on the same socket, even with -different arguments on each iteration. But never concurrently and -only as long as the previous bind failed. Once a bind succeeds, the -binding can't be changed anymore.

-

Typical errors

-
    -
  • invalid-argument: -The local-address has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
  • -
  • invalid-argument: -local-address is not a unicast address. (EINVAL)
  • -
  • invalid-argument: -local-address is an IPv4-mapped IPv6 address. (EINVAL)
  • -
  • invalid-state: -The socket is already bound. (EINVAL)
  • -
  • address-in-use: -No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
  • -
  • address-in-use: -Address is already in use. (EADDRINUSE)
  • -
  • address-not-bindable: -local-address is not an address that can be bound to. (EADDRNOTAVAIL)
  • -
-

Implementors note

-

The bind operation shouldn't be affected by the TIME_WAIT state of a -recently closed socket on the same local address. In practice this -means that the SO_REUSEADDR socket option should be set implicitly -on all platforms, except on Windows where this is the default -behavior and SO_REUSEADDR performs something different.

-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def connect(self,
remote_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6) ‑> None
-
-
-
- -Expand source code - -
async def connect(self, remote_address: IpSocketAddress) -> None:
-    """
-    Connect to a remote endpoint.
-    
-    On success, the socket is transitioned into the `connected` state
-    and the `remote-address` of the socket is updated.
-    The `local-address` may be updated as well, based on the best network
-    path to `remote-address`. If the socket was not already explicitly
-    bound, this function will implicitly bind the socket to a random
-    free port.
-    
-    After a failed connection attempt, the socket will be in the `closed`
-    state and the only valid action left is to `drop` the socket. A single
-    socket can not be used to connect more than once.
-    
-    # Typical errors
-    - `invalid-argument`:          The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-    - `invalid-argument`:          `remote-address` is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS)
-    - `invalid-argument`:          `remote-address` is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos)
-    - `invalid-argument`:          The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows)
-    - `invalid-argument`:          The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows)
-    - `invalid-state`:             The socket is already in the `connecting` state. (EALREADY)
-    - `invalid-state`:             The socket is already in the `connected` state. (EISCONN)
-    - `invalid-state`:             The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows)
-    - `timeout`:                   Connection timed out. (ETIMEDOUT)
-    - `connection-refused`:        The connection was forcefully rejected. (ECONNREFUSED)
-    - `connection-reset`:          The connection was reset. (ECONNRESET)
-    - `connection-aborted`:        The connection was aborted. (ECONNABORTED)
-    - `remote-unreachable`:        The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-    - <https://man7.org/linux/man-pages/man2/connect.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-    - <https://man.freebsd.org/cgi/man.cgi?connect>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Connect to a remote endpoint.

-

On success, the socket is transitioned into the connected state -and the remote-address of the socket is updated. -The local-address may be updated as well, based on the best network -path to remote-address. If the socket was not already explicitly -bound, this function will implicitly bind the socket to a random -free port.

-

After a failed connection attempt, the socket will be in the closed -state and the only valid action left is to drop the socket. A single -socket can not be used to connect more than once.

-

Typical errors

-
    -
  • invalid-argument: -The remote-address has the wrong address family. (EAFNOSUPPORT)
  • -
  • invalid-argument: -remote-address is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS)
  • -
  • invalid-argument: -remote-address is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos)
  • -
  • invalid-argument: -The IP address in remote-address is set to INADDR_ANY (0.0.0.0 / ::). (EADDRNOTAVAIL on Windows)
  • -
  • invalid-argument: -The port in remote-address is set to 0. (EADDRNOTAVAIL on Windows)
  • -
  • invalid-state: -The socket is already in the connecting state. (EALREADY)
  • -
  • invalid-state: -The socket is already in the connected state. (EISCONN)
  • -
  • invalid-state: -The socket is already in the listening state. (EOPNOTSUPP, EINVAL on Windows)
  • -
  • timeout: -Connection timed out. (ETIMEDOUT)
  • -
  • connection-refused: -The connection was forcefully rejected. (ECONNREFUSED)
  • -
  • connection-reset: -The connection was reset. (ECONNRESET)
  • -
  • connection-aborted: -The connection was aborted. (ECONNABORTED)
  • -
  • remote-unreachable: -The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
  • address-in-use: -Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_address_family(self) ‑> IpAddressFamily -
-
-
- -Expand source code - -
def get_address_family(self) -> IpAddressFamily:
-    """
-    Whether this is a IPv4 or IPv6 socket.
-    
-    This is the value passed to the constructor.
-    
-    Equivalent to the SO_DOMAIN socket option.
-    """
-    raise NotImplementedError
-
-

Whether this is a IPv4 or IPv6 socket.

-

This is the value passed to the constructor.

-

Equivalent to the SO_DOMAIN socket option.

-
-
-def get_hop_limit(self) ‑> int -
-
-
- -Expand source code - -
def get_hop_limit(self) -> int:
-    """
-    Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The TTL value must be 1 or higher.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.

-

If the provided value is 0, an invalid-argument error is returned.

-

Typical errors

-
    -
  • invalid-argument: -(set) The TTL value must be 1 or higher.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_is_listening(self) ‑> bool -
-
-
- -Expand source code - -
def get_is_listening(self) -> bool:
-    """
-    Whether the socket is in the `listening` state.
-    
-    Equivalent to the SO_ACCEPTCONN socket option.
-    """
-    raise NotImplementedError
-
-

Whether the socket is in the listening state.

-

Equivalent to the SO_ACCEPTCONN socket option.

-
-
-def get_keep_alive_count(self) ‑> int -
-
-
- -Expand source code - -
def get_keep_alive_count(self) -> int:
-    """
-    The maximum amount of keepalive packets TCP should send before
-    aborting the connection.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    All other values are accepted without error, but may be
-    clamped or rounded. As a result, the value read back from
-    this setting may differ from the value that was set.
-    
-    Equivalent to the TCP_KEEPCNT socket option.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

The maximum amount of keepalive packets TCP should send before -aborting the connection.

-

If the provided value is 0, an invalid-argument error is returned. -All other values are accepted without error, but may be -clamped or rounded. As a result, the value read back from -this setting may differ from the value that was set.

-

Equivalent to the TCP_KEEPCNT socket option.

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_keep_alive_enabled(self) ‑> bool -
-
-
- -Expand source code - -
def get_keep_alive_enabled(self) -> bool:
-    """
-    Enables or disables keepalive.
-    
-    The keepalive behavior can be adjusted using:
-    - `keep-alive-idle-time`
-    - `keep-alive-interval`
-    - `keep-alive-count`
-    These properties can be configured while `keep-alive-enabled` is
-    false, but only come into effect when `keep-alive-enabled` is true.
-    
-    Equivalent to the SO_KEEPALIVE socket option.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Enables or disables keepalive.

-

The keepalive behavior can be adjusted using: -- keep-alive-idle-time -- keep-alive-interval -- keep-alive-count -These properties can be configured while keep-alive-enabled is -false, but only come into effect when keep-alive-enabled is true.

-

Equivalent to the SO_KEEPALIVE socket option.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_keep_alive_idle_time(self) ‑> int -
-
-
- -Expand source code - -
def get_keep_alive_idle_time(self) -> int:
-    """
-    Amount of time the connection has to be idle before TCP starts
-    sending keepalive packets.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    All other values are accepted without error, but may be
-    clamped or rounded. As a result, the value read back from
-    this setting may differ from the value that was set.
-    
-    Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS)
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Amount of time the connection has to be idle before TCP starts -sending keepalive packets.

-

If the provided value is 0, an invalid-argument error is returned. -All other values are accepted without error, but may be -clamped or rounded. As a result, the value read back from -this setting may differ from the value that was set.

-

Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS)

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_keep_alive_interval(self) ‑> int -
-
-
- -Expand source code - -
def get_keep_alive_interval(self) -> int:
-    """
-    The time between keepalive packets.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    All other values are accepted without error, but may be
-    clamped or rounded. As a result, the value read back from
-    this setting may differ from the value that was set.
-    
-    Equivalent to the TCP_KEEPINTVL socket option.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

The time between keepalive packets.

-

If the provided value is 0, an invalid-argument error is returned. -All other values are accepted without error, but may be -clamped or rounded. As a result, the value read back from -this setting may differ from the value that was set.

-

Equivalent to the TCP_KEEPINTVL socket option.

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_local_address(self) ‑> IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 -
-
-
- -Expand source code - -
def get_local_address(self) -> IpSocketAddress:
-    """
-    Get the bound local address.
-    
-    POSIX mentions:
-    > If the socket has not been bound to a local name, the value
-    > stored in the object pointed to by `address` is unspecified.
-    
-    WASI is stricter and requires `get-local-address` to return
-    `invalid-state` when the socket hasn't been bound yet.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not bound to any local address.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
-    - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
-    - <https://man.freebsd.org/cgi/man.cgi?getsockname>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get the bound local address.

-

POSIX mentions:

-
-

If the socket has not been bound to a local name, the value -stored in the object pointed to by address is unspecified.

-
-

WASI is stricter and requires get-local-address to return -invalid-state when the socket hasn't been bound yet.

-

Typical errors

-
    -
  • invalid-state: The socket is not bound to any local address.
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_receive_buffer_size(self) ‑> int -
-
-
- -Expand source code - -
def get_receive_buffer_size(self) -> int:
-    """
-    Kernel buffer space reserved for sending/receiving on this socket.
-    Implementations usually treat this as a cap the buffer can grow to,
-    rather than allocating the full amount immediately.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    All other values are accepted without error, but may be
-    clamped or rounded. As a result, the value read back from
-    this setting may differ from the value that was set.
-    
-    This is only a performance hint. The implementation may ignore it or
-    tweak it based on real traffic patterns.
-    Linux and macOS appear to behave differently depending on whether a
-    buffer size was explicitly set. When set, they tend to honor it; when
-    not set, they dynamically adjust the buffer size as the connection
-    progresses. This is especially noticeable when comparing the values
-    from before and after connection establishment.
-    
-    Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Kernel buffer space reserved for sending/receiving on this socket. -Implementations usually treat this as a cap the buffer can grow to, -rather than allocating the full amount immediately.

-

If the provided value is 0, an invalid-argument error is returned. -All other values are accepted without error, but may be -clamped or rounded. As a result, the value read back from -this setting may differ from the value that was set.

-

This is only a performance hint. The implementation may ignore it or -tweak it based on real traffic patterns. -Linux and macOS appear to behave differently depending on whether a -buffer size was explicitly set. When set, they tend to honor it; when -not set, they dynamically adjust the buffer size as the connection -progresses. This is especially noticeable when comparing the values -from before and after connection establishment.

-

Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_remote_address(self) ‑> IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 -
-
-
- -Expand source code - -
def get_remote_address(self) -> IpSocketAddress:
-    """
-    Get the remote address.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
-    - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
-    - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
- -
-
-def get_send_buffer_size(self) ‑> int -
-
-
- -Expand source code - -
def get_send_buffer_size(self) -> int:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def listen(self) ‑> componentize_py_async_support.streams.StreamReader[typing.Self] -
-
-
- -Expand source code - -
def listen(self) -> StreamReader[Self]:
-    """
-    Start listening and return a stream of new inbound connections.
-    
-    Transitions the socket into the `listening` state. This can be called
-    at most once per socket.
-    
-    If the socket is not already explicitly bound, this function will
-    implicitly bind the socket to a random free port.
-    
-    Normally, the returned sockets are bound, in the `connected` state
-    and immediately ready for I/O. Though, depending on exact timing and
-    circumstances, a newly accepted connection may already be `closed`
-    by the time the server attempts to perform its first I/O on it. This
-    is true regardless of whether the WASI implementation uses
-    "synthesized" sockets or not (see Implementors Notes below).
-    
-    The following properties are inherited from the listener socket:
-    - `address-family`
-    - `keep-alive-enabled`
-    - `keep-alive-idle-time`
-    - `keep-alive-interval`
-    - `keep-alive-count`
-    - `hop-limit`
-    - `receive-buffer-size`
-    - `send-buffer-size`
-    
-    # Typical errors
-    - `invalid-state`:             The socket is already in the `connected` state. (EISCONN, EINVAL on BSD)
-    - `invalid-state`:             The socket is already in the `listening` state.
-    - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
-    
-    # Implementors note
-    This method returns a single perpetual stream that should only close
-    on fatal errors (if any). Yet, the POSIX' `accept` function may also
-    return transient errors (e.g. ECONNABORTED). The exact details differ
-    per operation system. For example, the Linux manual mentions:
-    
-    > Linux accept() passes already-pending network errors on the new
-    > socket as an error code from accept(). This behavior differs from
-    > other BSD socket implementations. For reliable operation the
-    > application should detect the network errors defined for the
-    > protocol after accept() and treat them like EAGAIN by retrying.
-    > In the case of TCP/IP, these are ENETDOWN, EPROTO, ENOPROTOOPT,
-    > EHOSTDOWN, ENONET, EHOSTUNREACH, EOPNOTSUPP, and ENETUNREACH.
-    Source: https://man7.org/linux/man-pages/man2/accept.2.html
-    
-    WASI implementations have two options to handle this:
-    - Optionally log it and then skip over non-fatal errors returned by
-      `accept`. Guest code never gets to see these failures. Or:
-    - Synthesize a `tcp-socket` resource that exposes the error when
-      attempting to send or receive on it. Guest code then sees these
-      failures as regular I/O errors.
-    
-    In either case, the stream returned by this `listen` method remains
-    operational.
-    
-    WASI requires `listen` to perform an implicit bind if the socket
-    has not already been bound. Not all platforms (notably Windows)
-    exhibit this behavior out of the box. On platforms that require it,
-    the WASI implementation can emulate this behavior by performing
-    the bind itself if the guest hasn't already done so.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html>
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html>
-    - <https://man7.org/linux/man-pages/man2/listen.2.html>
-    - <https://man7.org/linux/man-pages/man2/accept.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept>
-    - <https://man.freebsd.org/cgi/man.cgi?query=listen&sektion=2>
-    - <https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Start listening and return a stream of new inbound connections.

-

Transitions the socket into the listening state. This can be called -at most once per socket.

-

If the socket is not already explicitly bound, this function will -implicitly bind the socket to a random free port.

-

Normally, the returned sockets are bound, in the connected state -and immediately ready for I/O. Though, depending on exact timing and -circumstances, a newly accepted connection may already be closed -by the time the server attempts to perform its first I/O on it. This -is true regardless of whether the WASI implementation uses -"synthesized" sockets or not (see Implementors Notes below).

-

The following properties are inherited from the listener socket: -- address-family -- keep-alive-enabled -- keep-alive-idle-time -- keep-alive-interval -- keep-alive-count -- hop-limit -- receive-buffer-size -- send-buffer-size

-

Typical errors

-
    -
  • invalid-state: -The socket is already in the connected state. (EISCONN, EINVAL on BSD)
  • -
  • invalid-state: -The socket is already in the listening state.
  • -
  • address-in-use: -Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
  • -
-

Implementors note

-

This method returns a single perpetual stream that should only close -on fatal errors (if any). Yet, the POSIX' accept function may also -return transient errors (e.g. ECONNABORTED). The exact details differ -per operation system. For example, the Linux manual mentions:

-
-

Linux accept() passes already-pending network errors on the new -socket as an error code from accept(). This behavior differs from -other BSD socket implementations. For reliable operation the -application should detect the network errors defined for the -protocol after accept() and treat them like EAGAIN by retrying. -In the case of TCP/IP, these are ENETDOWN, EPROTO, ENOPROTOOPT, -EHOSTDOWN, ENONET, EHOSTUNREACH, EOPNOTSUPP, and ENETUNREACH. -Source: https://man7.org/linux/man-pages/man2/accept.2.html

-
-

WASI implementations have two options to handle this: -- Optionally log it and then skip over non-fatal errors returned by -accept. Guest code never gets to see these failures. Or: -- Synthesize a tcp-socket resource that exposes the error when -attempting to send or receive on it. Guest code then sees these -failures as regular I/O errors.

-

In either case, the stream returned by this listen method remains -operational.

-

WASI requires listen to perform an implicit bind if the socket -has not already been bound. Not all platforms (notably Windows) -exhibit this behavior out of the box. On platforms that require it, -the WASI implementation can emulate this behavior by performing -the bind itself if the guest hasn't already done so.

-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def receive(self) ‑> Tuple[componentize_py_async_support.streams.ByteStreamReader, componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_AccessDenied | ErrorCode_NotSupported | ErrorCode_InvalidArgument | ErrorCode_OutOfMemory | ErrorCode_Timeout | ErrorCode_InvalidState | ErrorCode_AddressNotBindable | ErrorCode_AddressInUse | ErrorCode_RemoteUnreachable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionBroken | ErrorCode_ConnectionReset | ErrorCode_ConnectionAborted | ErrorCode_DatagramTooLarge | ErrorCode_Other]]] -
-
-
- -Expand source code - -
def receive(self) -> Tuple[ByteStreamReader, FutureReader[Result[None, ErrorCode]]]:
-    """
-    Read data from peer.
-    
-    Returns a `stream` of data sent by the peer. The implementation
-    drops the stream once no more data is available. At that point, the
-    returned `future` resolves to:
-    - `ok` after a graceful shutdown from the peer (i.e. a FIN packet), or
-    - `err` if the socket was closed abnormally.
-    
-    `receive` may be called only once per socket. Subsequent calls return
-    a closed stream and a future resolved to `err(invalid-state)`.
-    
-    If the caller is not expecting to receive any more data from the peer,
-    they should drop the stream. Any data still in the receive queue
-    will be discarded. This is equivalent to calling `shutdown(SHUT_RD)`
-    in POSIX.
-    
-    # Typical errors
-    - `invalid-state`:             The socket is not in the `connected` state. (ENOTCONN)
-    - `invalid-state`:             `receive` has already been called on this socket.
-    - `connection-reset`:          The connection was reset. (ECONNRESET)
-    - `remote-unreachable`:        The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html>
-    - <https://man7.org/linux/man-pages/man2/recv.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recv>
-    - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>
-    """
-    raise NotImplementedError
-
-

Read data from peer.

-

Returns a stream of data sent by the peer. The implementation -drops the stream once no more data is available. At that point, the -returned future resolves to: -- ok after a graceful shutdown from the peer (i.e. a FIN packet), or -- err if the socket was closed abnormally.

-

receive may be called only once per socket. Subsequent calls return -a closed stream and a future resolved to err(invalid-state).

-

If the caller is not expecting to receive any more data from the peer, -they should drop the stream. Any data still in the receive queue -will be discarded. This is equivalent to calling shutdown(SHUT_RD) -in POSIX.

-

Typical errors

-
    -
  • invalid-state: -The socket is not in the connected state. (ENOTCONN)
  • -
  • invalid-state: -receive has already been called on this socket.
  • -
  • connection-reset: -The connection was reset. (ECONNRESET)
  • -
  • remote-unreachable: -The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
-

References

-
-
-
-def send(self, data: componentize_py_async_support.streams.ByteStreamReader) ‑> componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_AccessDenied | ErrorCode_NotSupported | ErrorCode_InvalidArgument | ErrorCode_OutOfMemory | ErrorCode_Timeout | ErrorCode_InvalidState | ErrorCode_AddressNotBindable | ErrorCode_AddressInUse | ErrorCode_RemoteUnreachable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionBroken | ErrorCode_ConnectionReset | ErrorCode_ConnectionAborted | ErrorCode_DatagramTooLarge | ErrorCode_Other]] -
-
-
- -Expand source code - -
def send(self, data: ByteStreamReader) -> FutureReader[Result[None, ErrorCode]]:
-    """
-    Transmit data to peer.
-    
-    The caller should close the stream when it has no more data to send
-    to the peer. Under normal circumstances this will cause a FIN packet
-    to be sent out. Closing the stream is equivalent to calling
-    `shutdown(SHUT_WR)` in POSIX.
-    
-    This function may be called at most once and returns once the full
-    contents of the stream are transmitted or an error is encountered.
-    
-    # Typical errors
-    - `invalid-state`:             The socket is not in the `connected` state. (ENOTCONN)
-    - `invalid-state`:             `send` has already been called on this socket.
-    - `connection-broken`:         The connection is not writable anymore. (EPIPE, ECONNABORTED on Windows)
-    - `connection-reset`:          The connection was reset. (ECONNRESET)
-    - `remote-unreachable`:        The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    
-     # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html>
-    - <https://man7.org/linux/man-pages/man2/send.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>
-    - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
-    """
-    raise NotImplementedError
-
-

Transmit data to peer.

-

The caller should close the stream when it has no more data to send -to the peer. Under normal circumstances this will cause a FIN packet -to be sent out. Closing the stream is equivalent to calling -shutdown(SHUT_WR) in POSIX.

-

This function may be called at most once and returns once the full -contents of the stream are transmitted or an error is encountered.

-

Typical errors

-
    -
  • invalid-state: -The socket is not in the connected state. (ENOTCONN)
  • -
  • invalid-state: -send has already been called on this socket.
  • -
  • connection-broken: -The connection is not writable anymore. (EPIPE, ECONNABORTED on Windows)
  • -
  • connection-reset: -The connection was reset. (ECONNRESET)
  • -
  • remote-unreachable: -The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
-

# References -- https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html -- https://man7.org/linux/man-pages/man2/send.2.html -- https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send -- https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2

-
-
-def set_hop_limit(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_hop_limit(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_keep_alive_count(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_keep_alive_count(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_keep_alive_enabled(self, value: bool) ‑> None -
-
-
- -Expand source code - -
def set_keep_alive_enabled(self, value: bool) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_keep_alive_idle_time(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_keep_alive_idle_time(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_keep_alive_interval(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_keep_alive_interval(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_listen_backlog_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_listen_backlog_size(self, value: int) -> None:
-    """
-    Hints the desired listen queue size. Implementations are free to
-    ignore this.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently
-    clamped and/or rounded.
-    
-    # Typical errors
-    - `not-supported`:        (set) The platform does not support changing the backlog size after the initial listen.
-    - `invalid-argument`:     (set) The provided value was 0.
-    - `invalid-state`:        (set) The socket is in the `connecting` or `connected` state.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Hints the desired listen queue size. Implementations are free to -ignore this.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently -clamped and/or rounded.

-

Typical errors

-
    -
  • not-supported: -(set) The platform does not support changing the backlog size after the initial listen.
  • -
  • invalid-argument: -(set) The provided value was 0.
  • -
  • invalid-state: -(set) The socket is in the connecting or connected state.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_receive_buffer_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_receive_buffer_size(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_send_buffer_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_send_buffer_size(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-class UdpSocket -
-
-
- -Expand source code - -
class UdpSocket:
-    """
-    A UDP socket handle.
-    """
-    
-    @classmethod
-    def create(cls, address_family: IpAddressFamily) -> Self:
-        """
-        Create a new UDP socket.
-        
-        Similar to `socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)`
-        in POSIX. On IPv6 sockets, IPV6_V6ONLY is enabled by default and
-        can't be configured otherwise.
-        
-        Unlike POSIX, WASI sockets have no notion of a socket-level
-        `O_NONBLOCK` flag. Instead they fully rely on the Component Model's
-        async support.
-        
-        # References:
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html>
-        - <https://man7.org/linux/man-pages/man2/socket.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
-        - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def bind(self, local_address: IpSocketAddress) -> None:
-        """
-        Bind the socket to the provided IP address and port.
-        
-        If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is
-        left to the implementation to decide which network interface(s) to
-        bind to. If the port is zero, the socket will be bound to a random
-        free port.
-        
-        # Typical errors
-        - `invalid-argument`:          The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
-        - `invalid-state`:             The socket is already bound. (EINVAL)
-        - `address-in-use`:            No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
-        - `address-in-use`:            Address is already in use. (EADDRINUSE)
-        - `address-not-bindable`:      `local-address` is not an address that can be bound to. (EADDRNOTAVAIL)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
-        - <https://man7.org/linux/man-pages/man2/bind.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
-        - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def connect(self, remote_address: IpSocketAddress) -> None:
-        """
-        Associate this socket with a specific peer address.
-        
-        On success, the `remote-address` of the socket is updated.
-        The `local-address` may be updated as well, based on the best network
-        path to `remote-address`. If the socket was not already explicitly
-        bound, this function will implicitly bind the socket to a random
-        free port.
-        
-        When a UDP socket is "connected", the `send` and `receive` methods
-        are limited to communicating with that peer only:
-        - `send` can only be used to send to this destination.
-        - `receive` will only return datagrams sent from the provided `remote-address`.
-        
-        The name "connect" was kept to align with the existing POSIX
-        terminology. Other than that, this function only changes the local
-        socket configuration and does not generate any network traffic.
-        The peer is not aware of this "connection".
-        
-        This method may be called multiple times on the same socket to change
-        its association, but only the most recent one will be effective.
-        
-        # Typical errors
-        - `invalid-argument`:          The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-        - `invalid-argument`:          The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
-        - `invalid-argument`:          The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
-        - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
-        
-        # Implementors note
-        If the socket is already connected, some platforms (e.g. Linux)
-        require a disconnect before connecting to a different peer address.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-        - <https://man7.org/linux/man-pages/man2/connect.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-        - <https://man.freebsd.org/cgi/man.cgi?connect>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def disconnect(self) -> None:
-        """
-        Dissociate this socket from its peer address.
-        
-        After calling this method, `send` & `receive` are free to communicate
-        with any remote address again.
-        
-        The POSIX equivalent of this is calling `connect` with an `AF_UNSPEC` address.
-        
-        # Typical errors
-        - `invalid-state`:           The socket is not connected.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-        - <https://man7.org/linux/man-pages/man2/connect.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-        - <https://man.freebsd.org/cgi/man.cgi?connect>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def send(self, data: bytes, remote_address: Optional[IpSocketAddress]) -> None:
-        """
-        Send a message on the socket to a particular peer.
-        
-        If the socket is connected, the peer address may be left empty. In
-        that case this is equivalent to `send` in POSIX. Otherwise it is
-        equivalent to `sendto`.
-        
-        Additionally, if the socket is connected, a `remote-address` argument
-        _may_ be provided but then it must be identical to the address
-        passed to `connect`.
-        
-        If the socket has not been explicitly bound, it will be
-        implicitly bound to a random free port.
-        
-        Implementations may trap if the `data` length exceeds 64 KiB.
-        
-        # Typical errors
-        - `invalid-argument`:        The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-        - `invalid-argument`:        The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
-        - `invalid-argument`:        The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
-        - `invalid-argument`:        The socket is in "connected" mode and `remote-address` is `some` value that does not match the address passed to `connect`. (EISCONN)
-        - `invalid-argument`:        The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ)
-        - `remote-unreachable`:      The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        - `connection-refused`:      The connection was refused. (ECONNREFUSED)
-        - `datagram-too-large`:      The datagram is too large. (EMSGSIZE)
-        - `address-in-use`:          Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
-        
-        # Implementors note
-        WASI requires `send` to perform an implicit bind if the socket
-        has not been bound. Not all platforms (notably Windows) exhibit
-        this behavior natively. On such platforms, the WASI implementation
-        should emulate it by performing the bind if the guest has not
-        already done so.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html>
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html>
-        - <https://man7.org/linux/man-pages/man2/send.2.html>
-        - <https://man7.org/linux/man-pages/man2/sendmmsg.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasendmsg>
-        - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    async def receive(self) -> Tuple[bytes, IpSocketAddress]:
-        """
-        Receive a message on the socket.
-        
-        On success, the return value contains a tuple of the received data
-        and the address of the sender. Theoretical maximum length of the
-        data is 64 KiB. Though in practice, it will typically be less than
-        1500 bytes.
-        
-        If the socket is connected, the sender address is guaranteed to
-        match the remote address passed to `connect`.
-        
-        # Typical errors
-        - `invalid-state`:        The socket has not been bound yet.
-        - `remote-unreachable`:   The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        - `connection-refused`:   The connection was refused. (ECONNREFUSED)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html>
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html>
-        - <https://man7.org/linux/man-pages/man2/recv.2.html>
-        - <https://man7.org/linux/man-pages/man2/recvmmsg.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nc-mswsock-lpfn_wsarecvmsg>
-        - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_local_address(self) -> IpSocketAddress:
-        """
-        Get the current bound address.
-        
-        POSIX mentions:
-        > If the socket has not been bound to a local name, the value
-        > stored in the object pointed to by `address` is unspecified.
-        
-        WASI is stricter and requires `get-local-address` to return
-        `invalid-state` when the socket hasn't been bound yet.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not bound to any local address.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
-        - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
-        - <https://man.freebsd.org/cgi/man.cgi?getsockname>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_remote_address(self) -> IpSocketAddress:
-        """
-        Get the address the socket is currently "connected" to.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not "connected" to a specific remote address. (ENOTCONN)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
-        - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
-        - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_address_family(self) -> IpAddressFamily:
-        """
-        Whether this is a IPv4 or IPv6 socket.
-        
-        This is the value passed to the constructor.
-        
-        Equivalent to the SO_DOMAIN socket option.
-        """
-        raise NotImplementedError
-    def get_unicast_hop_limit(self) -> int:
-        """
-        Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The TTL value must be 1 or higher.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_unicast_hop_limit(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_receive_buffer_size(self) -> int:
-        """
-        Kernel buffer space reserved for sending/receiving on this socket.
-        Implementations usually treat this as a cap the buffer can grow to,
-        rather than allocating the full amount immediately.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        All other values are accepted without error, but may be
-        clamped or rounded. As a result, the value read back from
-        this setting may differ from the value that was set.
-        
-        Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_receive_buffer_size(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def get_send_buffer_size(self) -> int:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_send_buffer_size(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A UDP socket handle.

-

Static methods

-
-
-def create(address_family: IpAddressFamily) ‑> Self -
-
-

Create a new UDP socket.

-

Similar to socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP) -in POSIX. On IPv6 sockets, IPV6_V6ONLY is enabled by default and -can't be configured otherwise.

-

Unlike POSIX, WASI sockets have no notion of a socket-level -O_NONBLOCK flag. Instead they fully rely on the Component Model's -async support.

-

References:

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-

Methods

-
-
-def bind(self,
local_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6) ‑> None
-
-
-
- -Expand source code - -
def bind(self, local_address: IpSocketAddress) -> None:
-    """
-    Bind the socket to the provided IP address and port.
-    
-    If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is
-    left to the implementation to decide which network interface(s) to
-    bind to. If the port is zero, the socket will be bound to a random
-    free port.
-    
-    # Typical errors
-    - `invalid-argument`:          The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
-    - `invalid-state`:             The socket is already bound. (EINVAL)
-    - `address-in-use`:            No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
-    - `address-in-use`:            Address is already in use. (EADDRINUSE)
-    - `address-not-bindable`:      `local-address` is not an address that can be bound to. (EADDRNOTAVAIL)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
-    - <https://man7.org/linux/man-pages/man2/bind.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
-    - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Bind the socket to the provided IP address and port.

-

If the IP address is zero (0.0.0.0 in IPv4, :: in IPv6), it is -left to the implementation to decide which network interface(s) to -bind to. If the port is zero, the socket will be bound to a random -free port.

-

Typical errors

-
    -
  • invalid-argument: -The local-address has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
  • -
  • invalid-state: -The socket is already bound. (EINVAL)
  • -
  • address-in-use: -No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
  • -
  • address-in-use: -Address is already in use. (EADDRINUSE)
  • -
  • address-not-bindable: -local-address is not an address that can be bound to. (EADDRNOTAVAIL)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def connect(self,
remote_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6) ‑> None
-
-
-
- -Expand source code - -
def connect(self, remote_address: IpSocketAddress) -> None:
-    """
-    Associate this socket with a specific peer address.
-    
-    On success, the `remote-address` of the socket is updated.
-    The `local-address` may be updated as well, based on the best network
-    path to `remote-address`. If the socket was not already explicitly
-    bound, this function will implicitly bind the socket to a random
-    free port.
-    
-    When a UDP socket is "connected", the `send` and `receive` methods
-    are limited to communicating with that peer only:
-    - `send` can only be used to send to this destination.
-    - `receive` will only return datagrams sent from the provided `remote-address`.
-    
-    The name "connect" was kept to align with the existing POSIX
-    terminology. Other than that, this function only changes the local
-    socket configuration and does not generate any network traffic.
-    The peer is not aware of this "connection".
-    
-    This method may be called multiple times on the same socket to change
-    its association, but only the most recent one will be effective.
-    
-    # Typical errors
-    - `invalid-argument`:          The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-    - `invalid-argument`:          The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
-    - `invalid-argument`:          The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
-    - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
-    
-    # Implementors note
-    If the socket is already connected, some platforms (e.g. Linux)
-    require a disconnect before connecting to a different peer address.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-    - <https://man7.org/linux/man-pages/man2/connect.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-    - <https://man.freebsd.org/cgi/man.cgi?connect>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Associate this socket with a specific peer address.

-

On success, the remote-address of the socket is updated. -The local-address may be updated as well, based on the best network -path to remote-address. If the socket was not already explicitly -bound, this function will implicitly bind the socket to a random -free port.

-

When a UDP socket is "connected", the send and receive methods -are limited to communicating with that peer only: -- send can only be used to send to this destination. -- receive will only return datagrams sent from the provided remote-address.

-

The name "connect" was kept to align with the existing POSIX -terminology. Other than that, this function only changes the local -socket configuration and does not generate any network traffic. -The peer is not aware of this "connection".

-

This method may be called multiple times on the same socket to change -its association, but only the most recent one will be effective.

-

Typical errors

-
    -
  • invalid-argument: -The remote-address has the wrong address family. (EAFNOSUPPORT)
  • -
  • invalid-argument: -The IP address in remote-address is set to INADDR_ANY (0.0.0.0 / ::). (EDESTADDRREQ, EADDRNOTAVAIL)
  • -
  • invalid-argument: -The port in remote-address is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
  • -
  • address-in-use: -Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
  • -
-

Implementors note

-

If the socket is already connected, some platforms (e.g. Linux) -require a disconnect before connecting to a different peer address.

-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def disconnect(self) ‑> None -
-
-
- -Expand source code - -
def disconnect(self) -> None:
-    """
-    Dissociate this socket from its peer address.
-    
-    After calling this method, `send` & `receive` are free to communicate
-    with any remote address again.
-    
-    The POSIX equivalent of this is calling `connect` with an `AF_UNSPEC` address.
-    
-    # Typical errors
-    - `invalid-state`:           The socket is not connected.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-    - <https://man7.org/linux/man-pages/man2/connect.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-    - <https://man.freebsd.org/cgi/man.cgi?connect>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Dissociate this socket from its peer address.

-

After calling this method, send & receive are free to communicate -with any remote address again.

-

The POSIX equivalent of this is calling connect with an AF_UNSPEC address.

-

Typical errors

-
    -
  • invalid-state: -The socket is not connected.
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_address_family(self) ‑> IpAddressFamily -
-
-
- -Expand source code - -
def get_address_family(self) -> IpAddressFamily:
-    """
-    Whether this is a IPv4 or IPv6 socket.
-    
-    This is the value passed to the constructor.
-    
-    Equivalent to the SO_DOMAIN socket option.
-    """
-    raise NotImplementedError
-
-

Whether this is a IPv4 or IPv6 socket.

-

This is the value passed to the constructor.

-

Equivalent to the SO_DOMAIN socket option.

-
-
-def get_local_address(self) ‑> IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 -
-
-
- -Expand source code - -
def get_local_address(self) -> IpSocketAddress:
-    """
-    Get the current bound address.
-    
-    POSIX mentions:
-    > If the socket has not been bound to a local name, the value
-    > stored in the object pointed to by `address` is unspecified.
-    
-    WASI is stricter and requires `get-local-address` to return
-    `invalid-state` when the socket hasn't been bound yet.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not bound to any local address.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
-    - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
-    - <https://man.freebsd.org/cgi/man.cgi?getsockname>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get the current bound address.

-

POSIX mentions:

-
-

If the socket has not been bound to a local name, the value -stored in the object pointed to by address is unspecified.

-
-

WASI is stricter and requires get-local-address to return -invalid-state when the socket hasn't been bound yet.

-

Typical errors

-
    -
  • invalid-state: The socket is not bound to any local address.
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_receive_buffer_size(self) ‑> int -
-
-
- -Expand source code - -
def get_receive_buffer_size(self) -> int:
-    """
-    Kernel buffer space reserved for sending/receiving on this socket.
-    Implementations usually treat this as a cap the buffer can grow to,
-    rather than allocating the full amount immediately.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    All other values are accepted without error, but may be
-    clamped or rounded. As a result, the value read back from
-    this setting may differ from the value that was set.
-    
-    Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Kernel buffer space reserved for sending/receiving on this socket. -Implementations usually treat this as a cap the buffer can grow to, -rather than allocating the full amount immediately.

-

If the provided value is 0, an invalid-argument error is returned. -All other values are accepted without error, but may be -clamped or rounded. As a result, the value read back from -this setting may differ from the value that was set.

-

Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_remote_address(self) ‑> IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 -
-
-
- -Expand source code - -
def get_remote_address(self) -> IpSocketAddress:
-    """
-    Get the address the socket is currently "connected" to.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not "connected" to a specific remote address. (ENOTCONN)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
-    - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
-    - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get the address the socket is currently "connected" to.

-

Typical errors

-
    -
  • invalid-state: The socket is not "connected" to a specific remote address. (ENOTCONN)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_send_buffer_size(self) ‑> int -
-
-
- -Expand source code - -
def get_send_buffer_size(self) -> int:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def get_unicast_hop_limit(self) ‑> int -
-
-
- -Expand source code - -
def get_unicast_hop_limit(self) -> int:
-    """
-    Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The TTL value must be 1 or higher.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.

-

If the provided value is 0, an invalid-argument error is returned.

-

Typical errors

-
    -
  • invalid-argument: -(set) The TTL value must be 1 or higher.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def receive(self) ‑> Tuple[bytes, IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6] -
-
-
- -Expand source code - -
async def receive(self) -> Tuple[bytes, IpSocketAddress]:
-    """
-    Receive a message on the socket.
-    
-    On success, the return value contains a tuple of the received data
-    and the address of the sender. Theoretical maximum length of the
-    data is 64 KiB. Though in practice, it will typically be less than
-    1500 bytes.
-    
-    If the socket is connected, the sender address is guaranteed to
-    match the remote address passed to `connect`.
-    
-    # Typical errors
-    - `invalid-state`:        The socket has not been bound yet.
-    - `remote-unreachable`:   The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    - `connection-refused`:   The connection was refused. (ECONNREFUSED)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html>
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html>
-    - <https://man7.org/linux/man-pages/man2/recv.2.html>
-    - <https://man7.org/linux/man-pages/man2/recvmmsg.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nc-mswsock-lpfn_wsarecvmsg>
-    - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Receive a message on the socket.

-

On success, the return value contains a tuple of the received data -and the address of the sender. Theoretical maximum length of the -data is 64 KiB. Though in practice, it will typically be less than -1500 bytes.

-

If the socket is connected, the sender address is guaranteed to -match the remote address passed to connect.

-

Typical errors

-
    -
  • invalid-state: -The socket has not been bound yet.
  • -
  • remote-unreachable: -The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
  • connection-refused: -The connection was refused. (ECONNREFUSED)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-async def send(self,
data: bytes,
remote_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 | None) ‑> None
-
-
-
- -Expand source code - -
async def send(self, data: bytes, remote_address: Optional[IpSocketAddress]) -> None:
-    """
-    Send a message on the socket to a particular peer.
-    
-    If the socket is connected, the peer address may be left empty. In
-    that case this is equivalent to `send` in POSIX. Otherwise it is
-    equivalent to `sendto`.
-    
-    Additionally, if the socket is connected, a `remote-address` argument
-    _may_ be provided but then it must be identical to the address
-    passed to `connect`.
-    
-    If the socket has not been explicitly bound, it will be
-    implicitly bound to a random free port.
-    
-    Implementations may trap if the `data` length exceeds 64 KiB.
-    
-    # Typical errors
-    - `invalid-argument`:        The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-    - `invalid-argument`:        The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
-    - `invalid-argument`:        The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
-    - `invalid-argument`:        The socket is in "connected" mode and `remote-address` is `some` value that does not match the address passed to `connect`. (EISCONN)
-    - `invalid-argument`:        The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ)
-    - `remote-unreachable`:      The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    - `connection-refused`:      The connection was refused. (ECONNREFUSED)
-    - `datagram-too-large`:      The datagram is too large. (EMSGSIZE)
-    - `address-in-use`:          Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
-    
-    # Implementors note
-    WASI requires `send` to perform an implicit bind if the socket
-    has not been bound. Not all platforms (notably Windows) exhibit
-    this behavior natively. On such platforms, the WASI implementation
-    should emulate it by performing the bind if the guest has not
-    already done so.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html>
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html>
-    - <https://man7.org/linux/man-pages/man2/send.2.html>
-    - <https://man7.org/linux/man-pages/man2/sendmmsg.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasendmsg>
-    - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Send a message on the socket to a particular peer.

-

If the socket is connected, the peer address may be left empty. In -that case this is equivalent to send in POSIX. Otherwise it is -equivalent to sendto.

-

Additionally, if the socket is connected, a remote-address argument -may be provided but then it must be identical to the address -passed to connect.

-

If the socket has not been explicitly bound, it will be -implicitly bound to a random free port.

-

Implementations may trap if the data length exceeds 64 KiB.

-

Typical errors

-
    -
  • invalid-argument: -The remote-address has the wrong address family. (EAFNOSUPPORT)
  • -
  • invalid-argument: -The IP address in remote-address is set to INADDR_ANY (0.0.0.0 / ::). (EDESTADDRREQ, EADDRNOTAVAIL)
  • -
  • invalid-argument: -The port in remote-address is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
  • -
  • invalid-argument: -The socket is in "connected" mode and remote-address is some value that does not match the address passed to connect. (EISCONN)
  • -
  • invalid-argument: -The socket is not "connected" and no value for remote-address was provided. (EDESTADDRREQ)
  • -
  • remote-unreachable: -The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
  • connection-refused: -The connection was refused. (ECONNREFUSED)
  • -
  • datagram-too-large: -The datagram is too large. (EMSGSIZE)
  • -
  • address-in-use: -Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
  • -
-

Implementors note

-

WASI requires send to perform an implicit bind if the socket -has not been bound. Not all platforms (notably Windows) exhibit -this behavior natively. On such platforms, the WASI implementation -should emulate it by performing the bind if the guest has not -already done so.

-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_receive_buffer_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_receive_buffer_size(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_send_buffer_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_send_buffer_size(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_unicast_hop_limit(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_unicast_hop_limit(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_udp_0_2_0.html b/docs/v4/wit/imports/wasi_sockets_udp_0_2_0.html deleted file mode 100644 index 8ee80ab..0000000 --- a/docs/v4/wit/imports/wasi_sockets_udp_0_2_0.html +++ /dev/null @@ -1,1229 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_udp_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_udp_0_2_0

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class IncomingDatagram -(data: bytes,
remote_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6)
-
-
-
- -Expand source code - -
@dataclass
-class IncomingDatagram:
-    """
-    A received datagram.
-    """
-    data: bytes
-    remote_address: wasi_sockets_network_0_2_0.IpSocketAddress
-
-

A received datagram.

-

Instance variables

-
-
var data : bytes
-
-
-
-
var remote_addressIpSocketAddress_Ipv4 | IpSocketAddress_Ipv6
-
-
-
-
-
-
-class IncomingDatagramStream -
-
-
- -Expand source code - -
class IncomingDatagramStream:
-    
-    def receive(self, max_results: int) -> List[IncomingDatagram]:
-        """
-        Receive messages on the socket.
-        
-        This function attempts to receive up to `max-results` datagrams on the socket without blocking.
-        The returned list may contain fewer elements than requested, but never more.
-        
-        This function returns successfully with an empty list when either:
-        - `max-results` is 0, or:
-        - `max-results` is greater than 0, but no results are immediately available.
-        This function never returns `error(would-block)`.
-        
-        # Typical errors
-        - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        - `connection-refused`: The connection was refused. (ECONNREFUSED)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html>
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html>
-        - <https://man7.org/linux/man-pages/man2/recv.2.html>
-        - <https://man7.org/linux/man-pages/man2/recvmmsg.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recv>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom>
-        - <https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms741687(v=vs.85)>
-        - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-        """
-        Create a `pollable` which will resolve once the stream is ready to receive again.
-        
-        Note: this function is here for WASI Preview2 only.
-        It's planned to be removed when `future` is natively supported in Preview3.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Methods

-
-
-def receive(self, max_results: int) ‑> List[IncomingDatagram] -
-
-
- -Expand source code - -
def receive(self, max_results: int) -> List[IncomingDatagram]:
-    """
-    Receive messages on the socket.
-    
-    This function attempts to receive up to `max-results` datagrams on the socket without blocking.
-    The returned list may contain fewer elements than requested, but never more.
-    
-    This function returns successfully with an empty list when either:
-    - `max-results` is 0, or:
-    - `max-results` is greater than 0, but no results are immediately available.
-    This function never returns `error(would-block)`.
-    
-    # Typical errors
-    - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    - `connection-refused`: The connection was refused. (ECONNREFUSED)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html>
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html>
-    - <https://man7.org/linux/man-pages/man2/recv.2.html>
-    - <https://man7.org/linux/man-pages/man2/recvmmsg.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recv>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom>
-    - <https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms741687(v=vs.85)>
-    - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Receive messages on the socket.

-

This function attempts to receive up to max-results datagrams on the socket without blocking. -The returned list may contain fewer elements than requested, but never more.

-

This function returns successfully with an empty list when either: -- max-results is 0, or: -- max-results is greater than 0, but no results are immediately available. -This function never returns error(would-block).

-

Typical errors

-
    -
  • remote-unreachable: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
  • connection-refused: The connection was refused. (ECONNREFUSED)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-    """
-    Create a `pollable` which will resolve once the stream is ready to receive again.
-    
-    Note: this function is here for WASI Preview2 only.
-    It's planned to be removed when `future` is natively supported in Preview3.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the stream is ready to receive again.

-

Note: this function is here for WASI Preview2 only. -It's planned to be removed when future is natively supported in Preview3.

-
-
-
-
-class OutgoingDatagram -(data: bytes,
remote_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 | None)
-
-
-
- -Expand source code - -
@dataclass
-class OutgoingDatagram:
-    """
-    A datagram to be sent out.
-    """
-    data: bytes
-    remote_address: Optional[wasi_sockets_network_0_2_0.IpSocketAddress]
-
-

A datagram to be sent out.

-

Instance variables

-
-
var data : bytes
-
-
-
-
var remote_addressIpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 | None
-
-
-
-
-
-
-class OutgoingDatagramStream -
-
-
- -Expand source code - -
class OutgoingDatagramStream:
-    
-    def check_send(self) -> int:
-        """
-        Check readiness for sending. This function never blocks.
-        
-        Returns the number of datagrams permitted for the next call to `send`,
-        or an error. Calling `send` with more datagrams than this function has
-        permitted will trap.
-        
-        When this function returns ok(0), the `subscribe` pollable will
-        become ready when this function will report at least ok(1), or an
-        error.
-        
-        Never returns `would-block`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def send(self, datagrams: List[OutgoingDatagram]) -> int:
-        """
-        Send messages on the socket.
-        
-        This function attempts to send all provided `datagrams` on the socket without blocking and
-        returns how many messages were actually sent (or queued for sending). This function never
-        returns `error(would-block)`. If none of the datagrams were able to be sent, `ok(0)` is returned.
-        
-        This function semantically behaves the same as iterating the `datagrams` list and sequentially
-        sending each individual datagram until either the end of the list has been reached or the first error occurred.
-        If at least one datagram has been sent successfully, this function never returns an error.
-        
-        If the input list is empty, the function returns `ok(0)`.
-        
-        Each call to `send` must be permitted by a preceding `check-send`. Implementations must trap if
-        either `check-send` was not called or `datagrams` contains more items than `check-send` permitted.
-        
-        # Typical errors
-        - `invalid-argument`:        The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-        - `invalid-argument`:        The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
-        - `invalid-argument`:        The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
-        - `invalid-argument`:        The socket is in "connected" mode and `remote-address` is `some` value that does not match the address passed to `stream`. (EISCONN)
-        - `invalid-argument`:        The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ)
-        - `remote-unreachable`:      The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        - `connection-refused`:      The connection was refused. (ECONNREFUSED)
-        - `datagram-too-large`:      The datagram is too large. (EMSGSIZE)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html>
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html>
-        - <https://man7.org/linux/man-pages/man2/send.2.html>
-        - <https://man7.org/linux/man-pages/man2/sendmmsg.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasendmsg>
-        - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-        """
-        Create a `pollable` which will resolve once the stream is ready to send again.
-        
-        Note: this function is here for WASI Preview2 only.
-        It's planned to be removed when `future` is natively supported in Preview3.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Methods

-
-
-def check_send(self) ‑> int -
-
-
- -Expand source code - -
def check_send(self) -> int:
-    """
-    Check readiness for sending. This function never blocks.
-    
-    Returns the number of datagrams permitted for the next call to `send`,
-    or an error. Calling `send` with more datagrams than this function has
-    permitted will trap.
-    
-    When this function returns ok(0), the `subscribe` pollable will
-    become ready when this function will report at least ok(1), or an
-    error.
-    
-    Never returns `would-block`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Check readiness for sending. This function never blocks.

-

Returns the number of datagrams permitted for the next call to send, -or an error. Calling send with more datagrams than this function has -permitted will trap.

-

When this function returns ok(0), the subscribe pollable will -become ready when this function will report at least ok(1), or an -error.

-

Never returns would-block.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def send(self,
datagrams: List[OutgoingDatagram]) ‑> int
-
-
-
- -Expand source code - -
def send(self, datagrams: List[OutgoingDatagram]) -> int:
-    """
-    Send messages on the socket.
-    
-    This function attempts to send all provided `datagrams` on the socket without blocking and
-    returns how many messages were actually sent (or queued for sending). This function never
-    returns `error(would-block)`. If none of the datagrams were able to be sent, `ok(0)` is returned.
-    
-    This function semantically behaves the same as iterating the `datagrams` list and sequentially
-    sending each individual datagram until either the end of the list has been reached or the first error occurred.
-    If at least one datagram has been sent successfully, this function never returns an error.
-    
-    If the input list is empty, the function returns `ok(0)`.
-    
-    Each call to `send` must be permitted by a preceding `check-send`. Implementations must trap if
-    either `check-send` was not called or `datagrams` contains more items than `check-send` permitted.
-    
-    # Typical errors
-    - `invalid-argument`:        The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-    - `invalid-argument`:        The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
-    - `invalid-argument`:        The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
-    - `invalid-argument`:        The socket is in "connected" mode and `remote-address` is `some` value that does not match the address passed to `stream`. (EISCONN)
-    - `invalid-argument`:        The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ)
-    - `remote-unreachable`:      The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    - `connection-refused`:      The connection was refused. (ECONNREFUSED)
-    - `datagram-too-large`:      The datagram is too large. (EMSGSIZE)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html>
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html>
-    - <https://man7.org/linux/man-pages/man2/send.2.html>
-    - <https://man7.org/linux/man-pages/man2/sendmmsg.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasendmsg>
-    - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Send messages on the socket.

-

This function attempts to send all provided datagrams on the socket without blocking and -returns how many messages were actually sent (or queued for sending). This function never -returns error(would-block). If none of the datagrams were able to be sent, ok(0) is returned.

-

This function semantically behaves the same as iterating the datagrams list and sequentially -sending each individual datagram until either the end of the list has been reached or the first error occurred. -If at least one datagram has been sent successfully, this function never returns an error.

-

If the input list is empty, the function returns ok(0).

-

Each call to send must be permitted by a preceding check-send. Implementations must trap if -either check-send was not called or datagrams contains more items than check-send permitted.

-

Typical errors

-
    -
  • invalid-argument: -The remote-address has the wrong address family. (EAFNOSUPPORT)
  • -
  • invalid-argument: -The IP address in remote-address is set to INADDR_ANY (0.0.0.0 / ::). (EDESTADDRREQ, EADDRNOTAVAIL)
  • -
  • invalid-argument: -The port in remote-address is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
  • -
  • invalid-argument: -The socket is in "connected" mode and remote-address is some value that does not match the address passed to stream. (EISCONN)
  • -
  • invalid-argument: -The socket is not "connected" and no value for remote-address was provided. (EDESTADDRREQ)
  • -
  • remote-unreachable: -The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
  • connection-refused: -The connection was refused. (ECONNREFUSED)
  • -
  • datagram-too-large: -The datagram is too large. (EMSGSIZE)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-    """
-    Create a `pollable` which will resolve once the stream is ready to send again.
-    
-    Note: this function is here for WASI Preview2 only.
-    It's planned to be removed when `future` is natively supported in Preview3.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the stream is ready to send again.

-

Note: this function is here for WASI Preview2 only. -It's planned to be removed when future is natively supported in Preview3.

-
-
-
-
-class UdpSocket -
-
-
- -Expand source code - -
class UdpSocket:
-    """
-    A UDP socket handle.
-    """
-    
-    def start_bind(self, network: wasi_sockets_network_0_2_0.Network, local_address: wasi_sockets_network_0_2_0.IpSocketAddress) -> None:
-        """
-        Bind the socket to a specific network on the provided IP address and port.
-        
-        If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which
-        network interface(s) to bind to.
-        If the port is zero, the socket will be bound to a random free port.
-        
-        # Typical errors
-        - `invalid-argument`:          The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
-        - `invalid-state`:             The socket is already bound. (EINVAL)
-        - `address-in-use`:            No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
-        - `address-in-use`:            Address is already in use. (EADDRINUSE)
-        - `address-not-bindable`:      `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL)
-        - `not-in-progress`:           A `bind` operation is not in progress.
-        - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-        
-        # Implementors note
-        Unlike in POSIX, in WASI the bind operation is async. This enables
-        interactive WASI hosts to inject permission prompts. Runtimes that
-        don't want to make use of this ability can simply call the native
-        `bind` as part of either `start-bind` or `finish-bind`.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
-        - <https://man7.org/linux/man-pages/man2/bind.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
-        - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def finish_bind(self) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def stream(self, remote_address: Optional[wasi_sockets_network_0_2_0.IpSocketAddress]) -> Tuple[IncomingDatagramStream, OutgoingDatagramStream]:
-        """
-        Set up inbound & outbound communication channels, optionally to a specific peer.
-        
-        This function only changes the local socket configuration and does not generate any network traffic.
-        On success, the `remote-address` of the socket is updated. The `local-address` may be updated as well,
-        based on the best network path to `remote-address`.
-        
-        When a `remote-address` is provided, the returned streams are limited to communicating with that specific peer:
-        - `send` can only be used to send to this destination.
-        - `receive` will only return datagrams sent from the provided `remote-address`.
-        
-        This method may be called multiple times on the same socket to change its association, but
-        only the most recently returned pair of streams will be operational. Implementations may trap if
-        the streams returned by a previous invocation haven't been dropped yet before calling `stream` again.
-        
-        The POSIX equivalent in pseudo-code is:
-        ```text
-        if (was previously connected) {
-                connect(s, AF_UNSPEC)
-        }
-        if (remote_address is Some) {
-                connect(s, remote_address)
-        }
-        ```
-        
-        Unlike in POSIX, the socket must already be explicitly bound.
-        
-        # Typical errors
-        - `invalid-argument`:          The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-        - `invalid-argument`:          The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
-        - `invalid-argument`:          The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
-        - `invalid-state`:             The socket is not bound.
-        - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
-        - `remote-unreachable`:        The remote address is not reachable. (ECONNRESET, ENETRESET, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        - `connection-refused`:        The connection was refused. (ECONNREFUSED)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-        - <https://man7.org/linux/man-pages/man2/connect.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-        - <https://man.freebsd.org/cgi/man.cgi?connect>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def local_address(self) -> wasi_sockets_network_0_2_0.IpSocketAddress:
-        """
-        Get the current bound address.
-        
-        POSIX mentions:
-        > If the socket has not been bound to a local name, the value
-        > stored in the object pointed to by `address` is unspecified.
-        
-        WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not bound to any local address.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
-        - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
-        - <https://man.freebsd.org/cgi/man.cgi?getsockname>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def remote_address(self) -> wasi_sockets_network_0_2_0.IpSocketAddress:
-        """
-        Get the address the socket is currently streaming to.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not streaming to a specific remote address. (ENOTCONN)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
-        - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
-        - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def address_family(self) -> wasi_sockets_network_0_2_0.IpAddressFamily:
-        """
-        Whether this is a IPv4 or IPv6 socket.
-        
-        Equivalent to the SO_DOMAIN socket option.
-        """
-        raise NotImplementedError
-    def unicast_hop_limit(self) -> int:
-        """
-        Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The TTL value must be 1 or higher.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_unicast_hop_limit(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def receive_buffer_size(self) -> int:
-        """
-        The kernel buffer space reserved for sends/receives on this socket.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently clamped and/or rounded.
-        I.e. after setting a value, reading the same setting back may return a different value.
-        
-        Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_receive_buffer_size(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def send_buffer_size(self) -> int:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_send_buffer_size(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-        """
-        Create a `pollable` which will resolve once the socket is ready for I/O.
-        
-        Note: this function is here for WASI Preview2 only.
-        It's planned to be removed when `future` is natively supported in Preview3.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A UDP socket handle.

-

Methods

-
-
-def address_family(self) ‑> IpAddressFamily -
-
-
- -Expand source code - -
def address_family(self) -> wasi_sockets_network_0_2_0.IpAddressFamily:
-    """
-    Whether this is a IPv4 or IPv6 socket.
-    
-    Equivalent to the SO_DOMAIN socket option.
-    """
-    raise NotImplementedError
-
-

Whether this is a IPv4 or IPv6 socket.

-

Equivalent to the SO_DOMAIN socket option.

-
-
-def finish_bind(self) ‑> None -
-
-
- -Expand source code - -
def finish_bind(self) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def local_address(self) ‑> IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 -
-
-
- -Expand source code - -
def local_address(self) -> wasi_sockets_network_0_2_0.IpSocketAddress:
-    """
-    Get the current bound address.
-    
-    POSIX mentions:
-    > If the socket has not been bound to a local name, the value
-    > stored in the object pointed to by `address` is unspecified.
-    
-    WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not bound to any local address.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
-    - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
-    - <https://man.freebsd.org/cgi/man.cgi?getsockname>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get the current bound address.

-

POSIX mentions:

-
-

If the socket has not been bound to a local name, the value -stored in the object pointed to by address is unspecified.

-
-

WASI is stricter and requires local-address to return invalid-state when the socket hasn't been bound yet.

-

Typical errors

-
    -
  • invalid-state: The socket is not bound to any local address.
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def receive_buffer_size(self) ‑> int -
-
-
- -Expand source code - -
def receive_buffer_size(self) -> int:
-    """
-    The kernel buffer space reserved for sends/receives on this socket.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently clamped and/or rounded.
-    I.e. after setting a value, reading the same setting back may return a different value.
-    
-    Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

The kernel buffer space reserved for sends/receives on this socket.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently clamped and/or rounded. -I.e. after setting a value, reading the same setting back may return a different value.

-

Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def remote_address(self) ‑> IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 -
-
-
- -Expand source code - -
def remote_address(self) -> wasi_sockets_network_0_2_0.IpSocketAddress:
-    """
-    Get the address the socket is currently streaming to.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not streaming to a specific remote address. (ENOTCONN)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
-    - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
-    - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get the address the socket is currently streaming to.

-

Typical errors

-
    -
  • invalid-state: The socket is not streaming to a specific remote address. (ENOTCONN)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def send_buffer_size(self) ‑> int -
-
-
- -Expand source code - -
def send_buffer_size(self) -> int:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_receive_buffer_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_receive_buffer_size(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_send_buffer_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_send_buffer_size(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_unicast_hop_limit(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_unicast_hop_limit(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def start_bind(self,
network: Network,
local_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6) ‑> None
-
-
-
- -Expand source code - -
def start_bind(self, network: wasi_sockets_network_0_2_0.Network, local_address: wasi_sockets_network_0_2_0.IpSocketAddress) -> None:
-    """
-    Bind the socket to a specific network on the provided IP address and port.
-    
-    If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which
-    network interface(s) to bind to.
-    If the port is zero, the socket will be bound to a random free port.
-    
-    # Typical errors
-    - `invalid-argument`:          The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
-    - `invalid-state`:             The socket is already bound. (EINVAL)
-    - `address-in-use`:            No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
-    - `address-in-use`:            Address is already in use. (EADDRINUSE)
-    - `address-not-bindable`:      `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL)
-    - `not-in-progress`:           A `bind` operation is not in progress.
-    - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-    
-    # Implementors note
-    Unlike in POSIX, in WASI the bind operation is async. This enables
-    interactive WASI hosts to inject permission prompts. Runtimes that
-    don't want to make use of this ability can simply call the native
-    `bind` as part of either `start-bind` or `finish-bind`.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
-    - <https://man7.org/linux/man-pages/man2/bind.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
-    - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Bind the socket to a specific network on the provided IP address and port.

-

If the IP address is zero (0.0.0.0 in IPv4, :: in IPv6), it is left to the implementation to decide which -network interface(s) to bind to. -If the port is zero, the socket will be bound to a random free port.

-

Typical errors

-
    -
  • invalid-argument: -The local-address has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
  • -
  • invalid-state: -The socket is already bound. (EINVAL)
  • -
  • address-in-use: -No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
  • -
  • address-in-use: -Address is already in use. (EADDRINUSE)
  • -
  • address-not-bindable: -local-address is not an address that the network can bind to. (EADDRNOTAVAIL)
  • -
  • not-in-progress: -A bind operation is not in progress.
  • -
  • would-block: -Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
  • -
-

Implementors note

-

Unlike in POSIX, in WASI the bind operation is async. This enables -interactive WASI hosts to inject permission prompts. Runtimes that -don't want to make use of this ability can simply call the native -bind as part of either start-bind or finish-bind.

-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def stream(self,
remote_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 | None) ‑> Tuple[IncomingDatagramStreamOutgoingDatagramStream]
-
-
-
- -Expand source code - -
def stream(self, remote_address: Optional[wasi_sockets_network_0_2_0.IpSocketAddress]) -> Tuple[IncomingDatagramStream, OutgoingDatagramStream]:
-    """
-    Set up inbound & outbound communication channels, optionally to a specific peer.
-    
-    This function only changes the local socket configuration and does not generate any network traffic.
-    On success, the `remote-address` of the socket is updated. The `local-address` may be updated as well,
-    based on the best network path to `remote-address`.
-    
-    When a `remote-address` is provided, the returned streams are limited to communicating with that specific peer:
-    - `send` can only be used to send to this destination.
-    - `receive` will only return datagrams sent from the provided `remote-address`.
-    
-    This method may be called multiple times on the same socket to change its association, but
-    only the most recently returned pair of streams will be operational. Implementations may trap if
-    the streams returned by a previous invocation haven't been dropped yet before calling `stream` again.
-    
-    The POSIX equivalent in pseudo-code is:
-    ```text
-    if (was previously connected) {
-            connect(s, AF_UNSPEC)
-    }
-    if (remote_address is Some) {
-            connect(s, remote_address)
-    }
-    ```
-    
-    Unlike in POSIX, the socket must already be explicitly bound.
-    
-    # Typical errors
-    - `invalid-argument`:          The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-    - `invalid-argument`:          The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
-    - `invalid-argument`:          The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
-    - `invalid-state`:             The socket is not bound.
-    - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
-    - `remote-unreachable`:        The remote address is not reachable. (ECONNRESET, ENETRESET, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    - `connection-refused`:        The connection was refused. (ECONNREFUSED)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-    - <https://man7.org/linux/man-pages/man2/connect.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-    - <https://man.freebsd.org/cgi/man.cgi?connect>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Set up inbound & outbound communication channels, optionally to a specific peer.

-

This function only changes the local socket configuration and does not generate any network traffic. -On success, the remote-address of the socket is updated. The local-address may be updated as well, -based on the best network path to remote-address.

-

When a remote-address is provided, the returned streams are limited to communicating with that specific peer: -- send can only be used to send to this destination. -- receive will only return datagrams sent from the provided remote-address.

-

This method may be called multiple times on the same socket to change its association, but -only the most recently returned pair of streams will be operational. Implementations may trap if -the streams returned by a previous invocation haven't been dropped yet before calling stream again.

-

The POSIX equivalent in pseudo-code is:

-
if (was previously connected) {
-        connect(s, AF_UNSPEC)
-}
-if (remote_address is Some) {
-        connect(s, remote_address)
-}
-
-

Unlike in POSIX, the socket must already be explicitly bound.

-

Typical errors

-
    -
  • invalid-argument: -The remote-address has the wrong address family. (EAFNOSUPPORT)
  • -
  • invalid-argument: -The IP address in remote-address is set to INADDR_ANY (0.0.0.0 / ::). (EDESTADDRREQ, EADDRNOTAVAIL)
  • -
  • invalid-argument: -The port in remote-address is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
  • -
  • invalid-state: -The socket is not bound.
  • -
  • address-in-use: -Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
  • -
  • remote-unreachable: -The remote address is not reachable. (ECONNRESET, ENETRESET, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
  • connection-refused: -The connection was refused. (ECONNREFUSED)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_0.Pollable:
-    """
-    Create a `pollable` which will resolve once the socket is ready for I/O.
-    
-    Note: this function is here for WASI Preview2 only.
-    It's planned to be removed when `future` is natively supported in Preview3.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the socket is ready for I/O.

-

Note: this function is here for WASI Preview2 only. -It's planned to be removed when future is natively supported in Preview3.

-
-
-def unicast_hop_limit(self) ‑> int -
-
-
- -Expand source code - -
def unicast_hop_limit(self) -> int:
-    """
-    Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The TTL value must be 1 or higher.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.

-

If the provided value is 0, an invalid-argument error is returned.

-

Typical errors

-
    -
  • invalid-argument: -(set) The TTL value must be 1 or higher.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_udp_0_2_6.html b/docs/v4/wit/imports/wasi_sockets_udp_0_2_6.html deleted file mode 100644 index b85c736..0000000 --- a/docs/v4/wit/imports/wasi_sockets_udp_0_2_6.html +++ /dev/null @@ -1,1229 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_udp_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_udp_0_2_6

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class IncomingDatagram -(data: bytes,
remote_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6)
-
-
-
- -Expand source code - -
@dataclass
-class IncomingDatagram:
-    """
-    A received datagram.
-    """
-    data: bytes
-    remote_address: wasi_sockets_network_0_2_6.IpSocketAddress
-
-

A received datagram.

-

Instance variables

-
-
var data : bytes
-
-
-
-
var remote_addressIpSocketAddress_Ipv4 | IpSocketAddress_Ipv6
-
-
-
-
-
-
-class IncomingDatagramStream -
-
-
- -Expand source code - -
class IncomingDatagramStream:
-    
-    def receive(self, max_results: int) -> List[IncomingDatagram]:
-        """
-        Receive messages on the socket.
-        
-        This function attempts to receive up to `max-results` datagrams on the socket without blocking.
-        The returned list may contain fewer elements than requested, but never more.
-        
-        This function returns successfully with an empty list when either:
-        - `max-results` is 0, or:
-        - `max-results` is greater than 0, but no results are immediately available.
-        This function never returns `error(would-block)`.
-        
-        # Typical errors
-        - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        - `connection-refused`: The connection was refused. (ECONNREFUSED)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html>
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html>
-        - <https://man7.org/linux/man-pages/man2/recv.2.html>
-        - <https://man7.org/linux/man-pages/man2/recvmmsg.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recv>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom>
-        - <https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms741687(v=vs.85)>
-        - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-        """
-        Create a `pollable` which will resolve once the stream is ready to receive again.
-        
-        Note: this function is here for WASI 0.2 only.
-        It's planned to be removed when `future` is natively supported in Preview3.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Methods

-
-
-def receive(self, max_results: int) ‑> List[IncomingDatagram] -
-
-
- -Expand source code - -
def receive(self, max_results: int) -> List[IncomingDatagram]:
-    """
-    Receive messages on the socket.
-    
-    This function attempts to receive up to `max-results` datagrams on the socket without blocking.
-    The returned list may contain fewer elements than requested, but never more.
-    
-    This function returns successfully with an empty list when either:
-    - `max-results` is 0, or:
-    - `max-results` is greater than 0, but no results are immediately available.
-    This function never returns `error(would-block)`.
-    
-    # Typical errors
-    - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    - `connection-refused`: The connection was refused. (ECONNREFUSED)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html>
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html>
-    - <https://man7.org/linux/man-pages/man2/recv.2.html>
-    - <https://man7.org/linux/man-pages/man2/recvmmsg.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recv>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom>
-    - <https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms741687(v=vs.85)>
-    - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Receive messages on the socket.

-

This function attempts to receive up to max-results datagrams on the socket without blocking. -The returned list may contain fewer elements than requested, but never more.

-

This function returns successfully with an empty list when either: -- max-results is 0, or: -- max-results is greater than 0, but no results are immediately available. -This function never returns error(would-block).

-

Typical errors

-
    -
  • remote-unreachable: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
  • connection-refused: The connection was refused. (ECONNREFUSED)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-    """
-    Create a `pollable` which will resolve once the stream is ready to receive again.
-    
-    Note: this function is here for WASI 0.2 only.
-    It's planned to be removed when `future` is natively supported in Preview3.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the stream is ready to receive again.

-

Note: this function is here for WASI 0.2 only. -It's planned to be removed when future is natively supported in Preview3.

-
-
-
-
-class OutgoingDatagram -(data: bytes,
remote_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 | None)
-
-
-
- -Expand source code - -
@dataclass
-class OutgoingDatagram:
-    """
-    A datagram to be sent out.
-    """
-    data: bytes
-    remote_address: Optional[wasi_sockets_network_0_2_6.IpSocketAddress]
-
-

A datagram to be sent out.

-

Instance variables

-
-
var data : bytes
-
-
-
-
var remote_addressIpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 | None
-
-
-
-
-
-
-class OutgoingDatagramStream -
-
-
- -Expand source code - -
class OutgoingDatagramStream:
-    
-    def check_send(self) -> int:
-        """
-        Check readiness for sending. This function never blocks.
-        
-        Returns the number of datagrams permitted for the next call to `send`,
-        or an error. Calling `send` with more datagrams than this function has
-        permitted will trap.
-        
-        When this function returns ok(0), the `subscribe` pollable will
-        become ready when this function will report at least ok(1), or an
-        error.
-        
-        Never returns `would-block`.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def send(self, datagrams: List[OutgoingDatagram]) -> int:
-        """
-        Send messages on the socket.
-        
-        This function attempts to send all provided `datagrams` on the socket without blocking and
-        returns how many messages were actually sent (or queued for sending). This function never
-        returns `error(would-block)`. If none of the datagrams were able to be sent, `ok(0)` is returned.
-        
-        This function semantically behaves the same as iterating the `datagrams` list and sequentially
-        sending each individual datagram until either the end of the list has been reached or the first error occurred.
-        If at least one datagram has been sent successfully, this function never returns an error.
-        
-        If the input list is empty, the function returns `ok(0)`.
-        
-        Each call to `send` must be permitted by a preceding `check-send`. Implementations must trap if
-        either `check-send` was not called or `datagrams` contains more items than `check-send` permitted.
-        
-        # Typical errors
-        - `invalid-argument`:        The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-        - `invalid-argument`:        The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
-        - `invalid-argument`:        The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
-        - `invalid-argument`:        The socket is in "connected" mode and `remote-address` is `some` value that does not match the address passed to `stream`. (EISCONN)
-        - `invalid-argument`:        The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ)
-        - `remote-unreachable`:      The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        - `connection-refused`:      The connection was refused. (ECONNREFUSED)
-        - `datagram-too-large`:      The datagram is too large. (EMSGSIZE)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html>
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html>
-        - <https://man7.org/linux/man-pages/man2/send.2.html>
-        - <https://man7.org/linux/man-pages/man2/sendmmsg.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasendmsg>
-        - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-        """
-        Create a `pollable` which will resolve once the stream is ready to send again.
-        
-        Note: this function is here for WASI 0.2 only.
-        It's planned to be removed when `future` is natively supported in Preview3.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-

Methods

-
-
-def check_send(self) ‑> int -
-
-
- -Expand source code - -
def check_send(self) -> int:
-    """
-    Check readiness for sending. This function never blocks.
-    
-    Returns the number of datagrams permitted for the next call to `send`,
-    or an error. Calling `send` with more datagrams than this function has
-    permitted will trap.
-    
-    When this function returns ok(0), the `subscribe` pollable will
-    become ready when this function will report at least ok(1), or an
-    error.
-    
-    Never returns `would-block`.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Check readiness for sending. This function never blocks.

-

Returns the number of datagrams permitted for the next call to send, -or an error. Calling send with more datagrams than this function has -permitted will trap.

-

When this function returns ok(0), the subscribe pollable will -become ready when this function will report at least ok(1), or an -error.

-

Never returns would-block.

-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def send(self,
datagrams: List[OutgoingDatagram]) ‑> int
-
-
-
- -Expand source code - -
def send(self, datagrams: List[OutgoingDatagram]) -> int:
-    """
-    Send messages on the socket.
-    
-    This function attempts to send all provided `datagrams` on the socket without blocking and
-    returns how many messages were actually sent (or queued for sending). This function never
-    returns `error(would-block)`. If none of the datagrams were able to be sent, `ok(0)` is returned.
-    
-    This function semantically behaves the same as iterating the `datagrams` list and sequentially
-    sending each individual datagram until either the end of the list has been reached or the first error occurred.
-    If at least one datagram has been sent successfully, this function never returns an error.
-    
-    If the input list is empty, the function returns `ok(0)`.
-    
-    Each call to `send` must be permitted by a preceding `check-send`. Implementations must trap if
-    either `check-send` was not called or `datagrams` contains more items than `check-send` permitted.
-    
-    # Typical errors
-    - `invalid-argument`:        The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-    - `invalid-argument`:        The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
-    - `invalid-argument`:        The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
-    - `invalid-argument`:        The socket is in "connected" mode and `remote-address` is `some` value that does not match the address passed to `stream`. (EISCONN)
-    - `invalid-argument`:        The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ)
-    - `remote-unreachable`:      The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    - `connection-refused`:      The connection was refused. (ECONNREFUSED)
-    - `datagram-too-large`:      The datagram is too large. (EMSGSIZE)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html>
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html>
-    - <https://man7.org/linux/man-pages/man2/send.2.html>
-    - <https://man7.org/linux/man-pages/man2/sendmmsg.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasendmsg>
-    - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Send messages on the socket.

-

This function attempts to send all provided datagrams on the socket without blocking and -returns how many messages were actually sent (or queued for sending). This function never -returns error(would-block). If none of the datagrams were able to be sent, ok(0) is returned.

-

This function semantically behaves the same as iterating the datagrams list and sequentially -sending each individual datagram until either the end of the list has been reached or the first error occurred. -If at least one datagram has been sent successfully, this function never returns an error.

-

If the input list is empty, the function returns ok(0).

-

Each call to send must be permitted by a preceding check-send. Implementations must trap if -either check-send was not called or datagrams contains more items than check-send permitted.

-

Typical errors

-
    -
  • invalid-argument: -The remote-address has the wrong address family. (EAFNOSUPPORT)
  • -
  • invalid-argument: -The IP address in remote-address is set to INADDR_ANY (0.0.0.0 / ::). (EDESTADDRREQ, EADDRNOTAVAIL)
  • -
  • invalid-argument: -The port in remote-address is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
  • -
  • invalid-argument: -The socket is in "connected" mode and remote-address is some value that does not match the address passed to stream. (EISCONN)
  • -
  • invalid-argument: -The socket is not "connected" and no value for remote-address was provided. (EDESTADDRREQ)
  • -
  • remote-unreachable: -The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
  • connection-refused: -The connection was refused. (ECONNREFUSED)
  • -
  • datagram-too-large: -The datagram is too large. (EMSGSIZE)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-    """
-    Create a `pollable` which will resolve once the stream is ready to send again.
-    
-    Note: this function is here for WASI 0.2 only.
-    It's planned to be removed when `future` is natively supported in Preview3.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the stream is ready to send again.

-

Note: this function is here for WASI 0.2 only. -It's planned to be removed when future is natively supported in Preview3.

-
-
-
-
-class UdpSocket -
-
-
- -Expand source code - -
class UdpSocket:
-    """
-    A UDP socket handle.
-    """
-    
-    def start_bind(self, network: wasi_sockets_network_0_2_6.Network, local_address: wasi_sockets_network_0_2_6.IpSocketAddress) -> None:
-        """
-        Bind the socket to a specific network on the provided IP address and port.
-        
-        If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which
-        network interface(s) to bind to.
-        If the port is zero, the socket will be bound to a random free port.
-        
-        # Typical errors
-        - `invalid-argument`:          The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
-        - `invalid-state`:             The socket is already bound. (EINVAL)
-        - `address-in-use`:            No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
-        - `address-in-use`:            Address is already in use. (EADDRINUSE)
-        - `address-not-bindable`:      `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL)
-        - `not-in-progress`:           A `bind` operation is not in progress.
-        - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-        
-        # Implementors note
-        Unlike in POSIX, in WASI the bind operation is async. This enables
-        interactive WASI hosts to inject permission prompts. Runtimes that
-        don't want to make use of this ability can simply call the native
-        `bind` as part of either `start-bind` or `finish-bind`.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
-        - <https://man7.org/linux/man-pages/man2/bind.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
-        - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def finish_bind(self) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def stream(self, remote_address: Optional[wasi_sockets_network_0_2_6.IpSocketAddress]) -> Tuple[IncomingDatagramStream, OutgoingDatagramStream]:
-        """
-        Set up inbound & outbound communication channels, optionally to a specific peer.
-        
-        This function only changes the local socket configuration and does not generate any network traffic.
-        On success, the `remote-address` of the socket is updated. The `local-address` may be updated as well,
-        based on the best network path to `remote-address`.
-        
-        When a `remote-address` is provided, the returned streams are limited to communicating with that specific peer:
-        - `send` can only be used to send to this destination.
-        - `receive` will only return datagrams sent from the provided `remote-address`.
-        
-        This method may be called multiple times on the same socket to change its association, but
-        only the most recently returned pair of streams will be operational. Implementations may trap if
-        the streams returned by a previous invocation haven't been dropped yet before calling `stream` again.
-        
-        The POSIX equivalent in pseudo-code is:
-        ```text
-        if (was previously connected) {
-                connect(s, AF_UNSPEC)
-        }
-        if (remote_address is Some) {
-                connect(s, remote_address)
-        }
-        ```
-        
-        Unlike in POSIX, the socket must already be explicitly bound.
-        
-        # Typical errors
-        - `invalid-argument`:          The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-        - `invalid-argument`:          The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
-        - `invalid-argument`:          The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
-        - `invalid-state`:             The socket is not bound.
-        - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
-        - `remote-unreachable`:        The remote address is not reachable. (ECONNRESET, ENETRESET, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-        - `connection-refused`:        The connection was refused. (ECONNREFUSED)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-        - <https://man7.org/linux/man-pages/man2/connect.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-        - <https://man.freebsd.org/cgi/man.cgi?connect>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def local_address(self) -> wasi_sockets_network_0_2_6.IpSocketAddress:
-        """
-        Get the current bound address.
-        
-        POSIX mentions:
-        > If the socket has not been bound to a local name, the value
-        > stored in the object pointed to by `address` is unspecified.
-        
-        WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not bound to any local address.
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
-        - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
-        - <https://man.freebsd.org/cgi/man.cgi?getsockname>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def remote_address(self) -> wasi_sockets_network_0_2_6.IpSocketAddress:
-        """
-        Get the address the socket is currently streaming to.
-        
-        # Typical errors
-        - `invalid-state`: The socket is not streaming to a specific remote address. (ENOTCONN)
-        
-        # References
-        - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
-        - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
-        - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
-        - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def address_family(self) -> wasi_sockets_network_0_2_6.IpAddressFamily:
-        """
-        Whether this is a IPv4 or IPv6 socket.
-        
-        Equivalent to the SO_DOMAIN socket option.
-        """
-        raise NotImplementedError
-    def unicast_hop_limit(self) -> int:
-        """
-        Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The TTL value must be 1 or higher.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_unicast_hop_limit(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def receive_buffer_size(self) -> int:
-        """
-        The kernel buffer space reserved for sends/receives on this socket.
-        
-        If the provided value is 0, an `invalid-argument` error is returned.
-        Any other value will never cause an error, but it might be silently clamped and/or rounded.
-        I.e. after setting a value, reading the same setting back may return a different value.
-        
-        Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
-        
-        # Typical errors
-        - `invalid-argument`:     (set) The provided value was 0.
-        
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_receive_buffer_size(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def send_buffer_size(self) -> int:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def set_send_buffer_size(self, value: int) -> None:
-        """
-        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-        """
-        raise NotImplementedError
-    def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-        """
-        Create a `pollable` which will resolve once the socket is ready for I/O.
-        
-        Note: this function is here for WASI 0.2 only.
-        It's planned to be removed when `future` is natively supported in Preview3.
-        """
-        raise NotImplementedError
-    def __enter__(self) -> Self:
-        """Returns self"""
-        return self
-                                
-    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

A UDP socket handle.

-

Methods

-
-
-def address_family(self) ‑> IpAddressFamily -
-
-
- -Expand source code - -
def address_family(self) -> wasi_sockets_network_0_2_6.IpAddressFamily:
-    """
-    Whether this is a IPv4 or IPv6 socket.
-    
-    Equivalent to the SO_DOMAIN socket option.
-    """
-    raise NotImplementedError
-
-

Whether this is a IPv4 or IPv6 socket.

-

Equivalent to the SO_DOMAIN socket option.

-
-
-def finish_bind(self) ‑> None -
-
-
- -Expand source code - -
def finish_bind(self) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def local_address(self) ‑> IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 -
-
-
- -Expand source code - -
def local_address(self) -> wasi_sockets_network_0_2_6.IpSocketAddress:
-    """
-    Get the current bound address.
-    
-    POSIX mentions:
-    > If the socket has not been bound to a local name, the value
-    > stored in the object pointed to by `address` is unspecified.
-    
-    WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not bound to any local address.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
-    - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
-    - <https://man.freebsd.org/cgi/man.cgi?getsockname>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get the current bound address.

-

POSIX mentions:

-
-

If the socket has not been bound to a local name, the value -stored in the object pointed to by address is unspecified.

-
-

WASI is stricter and requires local-address to return invalid-state when the socket hasn't been bound yet.

-

Typical errors

-
    -
  • invalid-state: The socket is not bound to any local address.
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def receive_buffer_size(self) ‑> int -
-
-
- -Expand source code - -
def receive_buffer_size(self) -> int:
-    """
-    The kernel buffer space reserved for sends/receives on this socket.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    Any other value will never cause an error, but it might be silently clamped and/or rounded.
-    I.e. after setting a value, reading the same setting back may return a different value.
-    
-    Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The provided value was 0.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

The kernel buffer space reserved for sends/receives on this socket.

-

If the provided value is 0, an invalid-argument error is returned. -Any other value will never cause an error, but it might be silently clamped and/or rounded. -I.e. after setting a value, reading the same setting back may return a different value.

-

Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.

-

Typical errors

-
    -
  • invalid-argument: -(set) The provided value was 0.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def remote_address(self) ‑> IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 -
-
-
- -Expand source code - -
def remote_address(self) -> wasi_sockets_network_0_2_6.IpSocketAddress:
-    """
-    Get the address the socket is currently streaming to.
-    
-    # Typical errors
-    - `invalid-state`: The socket is not streaming to a specific remote address. (ENOTCONN)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
-    - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
-    - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Get the address the socket is currently streaming to.

-

Typical errors

-
    -
  • invalid-state: The socket is not streaming to a specific remote address. (ENOTCONN)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def send_buffer_size(self) ‑> int -
-
-
- -Expand source code - -
def send_buffer_size(self) -> int:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_receive_buffer_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_receive_buffer_size(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_send_buffer_size(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_send_buffer_size(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def set_unicast_hop_limit(self, value: int) ‑> None -
-
-
- -Expand source code - -
def set_unicast_hop_limit(self, value: int) -> None:
-    """
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def start_bind(self,
network: Network,
local_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6) ‑> None
-
-
-
- -Expand source code - -
def start_bind(self, network: wasi_sockets_network_0_2_6.Network, local_address: wasi_sockets_network_0_2_6.IpSocketAddress) -> None:
-    """
-    Bind the socket to a specific network on the provided IP address and port.
-    
-    If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which
-    network interface(s) to bind to.
-    If the port is zero, the socket will be bound to a random free port.
-    
-    # Typical errors
-    - `invalid-argument`:          The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
-    - `invalid-state`:             The socket is already bound. (EINVAL)
-    - `address-in-use`:            No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
-    - `address-in-use`:            Address is already in use. (EADDRINUSE)
-    - `address-not-bindable`:      `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL)
-    - `not-in-progress`:           A `bind` operation is not in progress.
-    - `would-block`:               Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
-    
-    # Implementors note
-    Unlike in POSIX, in WASI the bind operation is async. This enables
-    interactive WASI hosts to inject permission prompts. Runtimes that
-    don't want to make use of this ability can simply call the native
-    `bind` as part of either `start-bind` or `finish-bind`.
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
-    - <https://man7.org/linux/man-pages/man2/bind.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
-    - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Bind the socket to a specific network on the provided IP address and port.

-

If the IP address is zero (0.0.0.0 in IPv4, :: in IPv6), it is left to the implementation to decide which -network interface(s) to bind to. -If the port is zero, the socket will be bound to a random free port.

-

Typical errors

-
    -
  • invalid-argument: -The local-address has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)
  • -
  • invalid-state: -The socket is already bound. (EINVAL)
  • -
  • address-in-use: -No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows)
  • -
  • address-in-use: -Address is already in use. (EADDRINUSE)
  • -
  • address-not-bindable: -local-address is not an address that the network can bind to. (EADDRNOTAVAIL)
  • -
  • not-in-progress: -A bind operation is not in progress.
  • -
  • would-block: -Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
  • -
-

Implementors note

-

Unlike in POSIX, in WASI the bind operation is async. This enables -interactive WASI hosts to inject permission prompts. Runtimes that -don't want to make use of this ability can simply call the native -bind as part of either start-bind or finish-bind.

-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def stream(self,
remote_address: IpSocketAddress_Ipv4 | IpSocketAddress_Ipv6 | None) ‑> Tuple[IncomingDatagramStreamOutgoingDatagramStream]
-
-
-
- -Expand source code - -
def stream(self, remote_address: Optional[wasi_sockets_network_0_2_6.IpSocketAddress]) -> Tuple[IncomingDatagramStream, OutgoingDatagramStream]:
-    """
-    Set up inbound & outbound communication channels, optionally to a specific peer.
-    
-    This function only changes the local socket configuration and does not generate any network traffic.
-    On success, the `remote-address` of the socket is updated. The `local-address` may be updated as well,
-    based on the best network path to `remote-address`.
-    
-    When a `remote-address` is provided, the returned streams are limited to communicating with that specific peer:
-    - `send` can only be used to send to this destination.
-    - `receive` will only return datagrams sent from the provided `remote-address`.
-    
-    This method may be called multiple times on the same socket to change its association, but
-    only the most recently returned pair of streams will be operational. Implementations may trap if
-    the streams returned by a previous invocation haven't been dropped yet before calling `stream` again.
-    
-    The POSIX equivalent in pseudo-code is:
-    ```text
-    if (was previously connected) {
-            connect(s, AF_UNSPEC)
-    }
-    if (remote_address is Some) {
-            connect(s, remote_address)
-    }
-    ```
-    
-    Unlike in POSIX, the socket must already be explicitly bound.
-    
-    # Typical errors
-    - `invalid-argument`:          The `remote-address` has the wrong address family. (EAFNOSUPPORT)
-    - `invalid-argument`:          The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
-    - `invalid-argument`:          The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
-    - `invalid-state`:             The socket is not bound.
-    - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
-    - `remote-unreachable`:        The remote address is not reachable. (ECONNRESET, ENETRESET, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
-    - `connection-refused`:        The connection was refused. (ECONNREFUSED)
-    
-    # References
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
-    - <https://man7.org/linux/man-pages/man2/connect.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
-    - <https://man.freebsd.org/cgi/man.cgi?connect>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Set up inbound & outbound communication channels, optionally to a specific peer.

-

This function only changes the local socket configuration and does not generate any network traffic. -On success, the remote-address of the socket is updated. The local-address may be updated as well, -based on the best network path to remote-address.

-

When a remote-address is provided, the returned streams are limited to communicating with that specific peer: -- send can only be used to send to this destination. -- receive will only return datagrams sent from the provided remote-address.

-

This method may be called multiple times on the same socket to change its association, but -only the most recently returned pair of streams will be operational. Implementations may trap if -the streams returned by a previous invocation haven't been dropped yet before calling stream again.

-

The POSIX equivalent in pseudo-code is:

-
if (was previously connected) {
-        connect(s, AF_UNSPEC)
-}
-if (remote_address is Some) {
-        connect(s, remote_address)
-}
-
-

Unlike in POSIX, the socket must already be explicitly bound.

-

Typical errors

-
    -
  • invalid-argument: -The remote-address has the wrong address family. (EAFNOSUPPORT)
  • -
  • invalid-argument: -The IP address in remote-address is set to INADDR_ANY (0.0.0.0 / ::). (EDESTADDRREQ, EADDRNOTAVAIL)
  • -
  • invalid-argument: -The port in remote-address is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)
  • -
  • invalid-state: -The socket is not bound.
  • -
  • address-in-use: -Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
  • -
  • remote-unreachable: -The remote address is not reachable. (ECONNRESET, ENETRESET, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
  • -
  • connection-refused: -The connection was refused. (ECONNREFUSED)
  • -
-

References

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-def subscribe(self) ‑> Pollable -
-
-
- -Expand source code - -
def subscribe(self) -> wasi_io_poll_0_2_6.Pollable:
-    """
-    Create a `pollable` which will resolve once the socket is ready for I/O.
-    
-    Note: this function is here for WASI 0.2 only.
-    It's planned to be removed when `future` is natively supported in Preview3.
-    """
-    raise NotImplementedError
-
-

Create a pollable which will resolve once the socket is ready for I/O.

-

Note: this function is here for WASI 0.2 only. -It's planned to be removed when future is natively supported in Preview3.

-
-
-def unicast_hop_limit(self) ‑> int -
-
-
- -Expand source code - -
def unicast_hop_limit(self) -> int:
-    """
-    Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
-    
-    If the provided value is 0, an `invalid-argument` error is returned.
-    
-    # Typical errors
-    - `invalid-argument`:     (set) The TTL value must be 1 or higher.
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.

-

If the provided value is 0, an invalid-argument error is returned.

-

Typical errors

-
    -
  • invalid-argument: -(set) The TTL value must be 1 or higher.
  • -
-

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_udp_create_socket_0_2_0.html b/docs/v4/wit/imports/wasi_sockets_udp_create_socket_0_2_0.html deleted file mode 100644 index 0d6d006..0000000 --- a/docs/v4/wit/imports/wasi_sockets_udp_create_socket_0_2_0.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_udp_create_socket_0_2_0 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_udp_create_socket_0_2_0

-
-
-
-
-
-
-
-
-

Functions

-
-
-def create_udp_socket(address_family: IpAddressFamily) ‑> UdpSocket -
-
-
- -Expand source code - -
def create_udp_socket(address_family: wasi_sockets_network_0_2_0.IpAddressFamily) -> wasi_sockets_udp_0_2_0.UdpSocket:
-    """
-    Create a new UDP socket.
-    
-    Similar to `socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)` in POSIX.
-    On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.
-    
-    This function does not require a network capability handle. This is considered to be safe because
-    at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind` is called,
-    the socket is effectively an in-memory configuration object, unable to communicate with the outside world.
-    
-    All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.
-    
-    # Typical errors
-    - `not-supported`:     The specified `address-family` is not supported. (EAFNOSUPPORT)
-    - `new-socket-limit`:  The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
-    
-    # References:
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html>
-    - <https://man7.org/linux/man-pages/man2/socket.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
-    - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_0.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a new UDP socket.

-

Similar to socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP) in POSIX. -On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.

-

This function does not require a network capability handle. This is considered to be safe because -at time of creation, the socket is not bound to any network yet. Up to the moment bind is called, -the socket is effectively an in-memory configuration object, unable to communicate with the outside world.

-

All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.

-

Typical errors

-
    -
  • not-supported: -The specified address-family is not supported. (EAFNOSUPPORT)
  • -
  • new-socket-limit: -The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
  • -
-

References:

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/imports/wasi_sockets_udp_create_socket_0_2_6.html b/docs/v4/wit/imports/wasi_sockets_udp_create_socket_0_2_6.html deleted file mode 100644 index 2f1c477..0000000 --- a/docs/v4/wit/imports/wasi_sockets_udp_create_socket_0_2_6.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - -spin_sdk.wit.imports.wasi_sockets_udp_create_socket_0_2_6 API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.wasi_sockets_udp_create_socket_0_2_6

-
-
-
-
-
-
-
-
-

Functions

-
-
-def create_udp_socket(address_family: IpAddressFamily) ‑> UdpSocket -
-
-
- -Expand source code - -
def create_udp_socket(address_family: wasi_sockets_network_0_2_6.IpAddressFamily) -> wasi_sockets_udp_0_2_6.UdpSocket:
-    """
-    Create a new UDP socket.
-    
-    Similar to `socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)` in POSIX.
-    On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.
-    
-    This function does not require a network capability handle. This is considered to be safe because
-    at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind` is called,
-    the socket is effectively an in-memory configuration object, unable to communicate with the outside world.
-    
-    All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.
-    
-    # Typical errors
-    - `not-supported`:     The specified `address-family` is not supported. (EAFNOSUPPORT)
-    - `new-socket-limit`:  The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
-    
-    # References:
-    - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html>
-    - <https://man7.org/linux/man-pages/man2/socket.2.html>
-    - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
-    - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
-    
-    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_sockets_network_0_2_6.ErrorCode)`
-    """
-    raise NotImplementedError
-
-

Create a new UDP socket.

-

Similar to socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP) in POSIX. -On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.

-

This function does not require a network capability handle. This is considered to be safe because -at time of creation, the socket is not bound to any network yet. Up to the moment bind is called, -the socket is effectively an in-memory configuration object, unable to communicate with the outside world.

-

All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.

-

Typical errors

-
    -
  • not-supported: -The specified address-family is not supported. (EAFNOSUPPORT)
  • -
  • new-socket-limit: -The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
  • -
-

References:

- -

Raises: componentize_py_types.Err(ErrorCode)

-
-
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/index.html b/docs/v4/wit/index.html deleted file mode 100644 index 78fa1d8..0000000 --- a/docs/v4/wit/index.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - -spin_sdk.wit API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit

-
-
-

Module with the bindings generated from the wit by componentize-py

-
-
-

Sub-modules

-
-
spin_sdk.wit.exports
-
-
-
-
spin_sdk.wit.imports
-
-
-
-
spin_sdk.wit.types
-
-
-
-
-
-
-
-
-

Functions

-
-
-def byte_stream() ‑> tuple[componentize_py_async_support.streams.ByteStreamWriter, componentize_py_async_support.streams.ByteStreamReader] -
-
-
- -Expand source code - -
def byte_stream() -> tuple[ByteStreamWriter, ByteStreamReader]:
-    raise NotImplementedError
-
-
-
-
-def list_spin_postgres_postgres_4_2_0_db_value_stream() ‑> tuple[componentize_py_async_support.streams.StreamWriter[typing.List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_Uuid | DbValue_Jsonb | DbValue_Decimal | DbValue_RangeInt32 | DbValue_RangeInt64 | DbValue_RangeDecimal | DbValue_ArrayInt32 | DbValue_ArrayInt64 | DbValue_ArrayDecimal | DbValue_ArrayStr | DbValue_Interval | DbValue_DbNull | DbValue_Unsupported]], componentize_py_async_support.streams.StreamReader[typing.List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_Uuid | DbValue_Jsonb | DbValue_Decimal | DbValue_RangeInt32 | DbValue_RangeInt64 | DbValue_RangeDecimal | DbValue_ArrayInt32 | DbValue_ArrayInt64 | DbValue_ArrayDecimal | DbValue_ArrayStr | DbValue_Interval | DbValue_DbNull | DbValue_Unsupported]]] -
-
-
- -Expand source code - -
def list_spin_postgres_postgres_4_2_0_db_value_stream() -> tuple[StreamWriter[List[spin_postgres_postgres_4_2_0.DbValue]], StreamReader[List[spin_postgres_postgres_4_2_0.DbValue]]]:
-    raise NotImplementedError
-
-
-
-
-def result_option_wasi_http_types_0_3_0_rc_2026_03_15_fields_wasi_http_types_0_3_0_rc_2026_03_15_error_code_future(default: Callable[[], componentize_py_types.Ok[Fields | None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]]) ‑> tuple[componentize_py_async_support.futures.FutureWriter[componentize_py_types.Ok[Fields | None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[Fields | None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]]] -
-
-
- -Expand source code - -
def result_option_wasi_http_types_0_3_0_rc_2026_03_15_fields_wasi_http_types_0_3_0_rc_2026_03_15_error_code_future(default: Callable[[], Result[Optional[wasi_http_types_0_3_0_rc_2026_03_15.Fields], wasi_http_types_0_3_0_rc_2026_03_15.ErrorCode]]) -> tuple[FutureWriter[Result[Optional[wasi_http_types_0_3_0_rc_2026_03_15.Fields], wasi_http_types_0_3_0_rc_2026_03_15.ErrorCode]], FutureReader[Result[Optional[wasi_http_types_0_3_0_rc_2026_03_15.Fields], wasi_http_types_0_3_0_rc_2026_03_15.ErrorCode]]]:
-    raise NotImplementedError
-
-
-
-
-def result_unit_spin_key_value_key_value_3_0_0_error_future(default: Callable[[], componentize_py_types.Ok[None] | componentize_py_types.Err[Error_StoreTableFull | Error_NoSuchStore | Error_AccessDenied | Error_Other]]) ‑> tuple[componentize_py_async_support.futures.FutureWriter[componentize_py_types.Ok[None] | componentize_py_types.Err[Error_StoreTableFull | Error_NoSuchStore | Error_AccessDenied | Error_Other]], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[Error_StoreTableFull | Error_NoSuchStore | Error_AccessDenied | Error_Other]]] -
-
-
- -Expand source code - -
def result_unit_spin_key_value_key_value_3_0_0_error_future(default: Callable[[], Result[None, spin_key_value_key_value_3_0_0.Error]]) -> tuple[FutureWriter[Result[None, spin_key_value_key_value_3_0_0.Error]], FutureReader[Result[None, spin_key_value_key_value_3_0_0.Error]]]:
-    raise NotImplementedError
-
-
-
-
-def result_unit_spin_postgres_postgres_4_2_0_error_future(default: Callable[[], componentize_py_types.Ok[None] | componentize_py_types.Err[Error_ConnectionFailed | Error_BadParameter | Error_QueryFailed | Error_ValueConversionFailed | Error_Other]]) ‑> tuple[componentize_py_async_support.futures.FutureWriter[componentize_py_types.Ok[None] | componentize_py_types.Err[Error_ConnectionFailed | Error_BadParameter | Error_QueryFailed | Error_ValueConversionFailed | Error_Other]], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[Error_ConnectionFailed | Error_BadParameter | Error_QueryFailed | Error_ValueConversionFailed | Error_Other]]] -
-
-
- -Expand source code - -
def result_unit_spin_postgres_postgres_4_2_0_error_future(default: Callable[[], Result[None, spin_postgres_postgres_4_2_0.Error]]) -> tuple[FutureWriter[Result[None, spin_postgres_postgres_4_2_0.Error]], FutureReader[Result[None, spin_postgres_postgres_4_2_0.Error]]]:
-    raise NotImplementedError
-
-
-
-
-def result_unit_spin_sqlite_sqlite_3_1_0_error_future(default: Callable[[], componentize_py_types.Ok[None] | componentize_py_types.Err[Error_NoSuchDatabase | Error_AccessDenied | Error_InvalidConnection | Error_DatabaseFull | Error_Io]]) ‑> tuple[componentize_py_async_support.futures.FutureWriter[componentize_py_types.Ok[None] | componentize_py_types.Err[Error_NoSuchDatabase | Error_AccessDenied | Error_InvalidConnection | Error_DatabaseFull | Error_Io]], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[Error_NoSuchDatabase | Error_AccessDenied | Error_InvalidConnection | Error_DatabaseFull | Error_Io]]] -
-
-
- -Expand source code - -
def result_unit_spin_sqlite_sqlite_3_1_0_error_future(default: Callable[[], Result[None, spin_sqlite_sqlite_3_1_0.Error]]) -> tuple[FutureWriter[Result[None, spin_sqlite_sqlite_3_1_0.Error]], FutureReader[Result[None, spin_sqlite_sqlite_3_1_0.Error]]]:
-    raise NotImplementedError
-
-
-
-
-def result_unit_wasi_cli_types_0_3_0_rc_2026_03_15_error_code_future(default: Callable[[], componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode]]) ‑> tuple[componentize_py_async_support.futures.FutureWriter[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode]], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode]]] -
-
-
- -Expand source code - -
def result_unit_wasi_cli_types_0_3_0_rc_2026_03_15_error_code_future(default: Callable[[], Result[None, wasi_cli_types_0_3_0_rc_2026_03_15.ErrorCode]]) -> tuple[FutureWriter[Result[None, wasi_cli_types_0_3_0_rc_2026_03_15.ErrorCode]], FutureReader[Result[None, wasi_cli_types_0_3_0_rc_2026_03_15.ErrorCode]]]:
-    raise NotImplementedError
-
-
-
-
-def result_unit_wasi_filesystem_types_0_3_0_rc_2026_03_15_error_code_future(default: Callable[[], componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_Access | ErrorCode_Already | ErrorCode_BadDescriptor | ErrorCode_Busy | ErrorCode_Deadlock | ErrorCode_Quota | ErrorCode_Exist | ErrorCode_FileTooLarge | ErrorCode_IllegalByteSequence | ErrorCode_InProgress | ErrorCode_Interrupted | ErrorCode_Invalid | ErrorCode_Io | ErrorCode_IsDirectory | ErrorCode_Loop | ErrorCode_TooManyLinks | ErrorCode_MessageSize | ErrorCode_NameTooLong | ErrorCode_NoDevice | ErrorCode_NoEntry | ErrorCode_NoLock | ErrorCode_InsufficientMemory | ErrorCode_InsufficientSpace | ErrorCode_NotDirectory | ErrorCode_NotEmpty | ErrorCode_NotRecoverable | ErrorCode_Unsupported | ErrorCode_NoTty | ErrorCode_NoSuchDevice | ErrorCode_Overflow | ErrorCode_NotPermitted | ErrorCode_Pipe | ErrorCode_ReadOnly | ErrorCode_InvalidSeek | ErrorCode_TextFileBusy | ErrorCode_CrossDevice | ErrorCode_Other]]) ‑> tuple[componentize_py_async_support.futures.FutureWriter[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_Access | ErrorCode_Already | ErrorCode_BadDescriptor | ErrorCode_Busy | ErrorCode_Deadlock | ErrorCode_Quota | ErrorCode_Exist | ErrorCode_FileTooLarge | ErrorCode_IllegalByteSequence | ErrorCode_InProgress | ErrorCode_Interrupted | ErrorCode_Invalid | ErrorCode_Io | ErrorCode_IsDirectory | ErrorCode_Loop | ErrorCode_TooManyLinks | ErrorCode_MessageSize | ErrorCode_NameTooLong | ErrorCode_NoDevice | ErrorCode_NoEntry | ErrorCode_NoLock | ErrorCode_InsufficientMemory | ErrorCode_InsufficientSpace | ErrorCode_NotDirectory | ErrorCode_NotEmpty | ErrorCode_NotRecoverable | ErrorCode_Unsupported | ErrorCode_NoTty | ErrorCode_NoSuchDevice | ErrorCode_Overflow | ErrorCode_NotPermitted | ErrorCode_Pipe | ErrorCode_ReadOnly | ErrorCode_InvalidSeek | ErrorCode_TextFileBusy | ErrorCode_CrossDevice | ErrorCode_Other]], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_Access | ErrorCode_Already | ErrorCode_BadDescriptor | ErrorCode_Busy | ErrorCode_Deadlock | ErrorCode_Quota | ErrorCode_Exist | ErrorCode_FileTooLarge | ErrorCode_IllegalByteSequence | ErrorCode_InProgress | ErrorCode_Interrupted | ErrorCode_Invalid | ErrorCode_Io | ErrorCode_IsDirectory | ErrorCode_Loop | ErrorCode_TooManyLinks | ErrorCode_MessageSize | ErrorCode_NameTooLong | ErrorCode_NoDevice | ErrorCode_NoEntry | ErrorCode_NoLock | ErrorCode_InsufficientMemory | ErrorCode_InsufficientSpace | ErrorCode_NotDirectory | ErrorCode_NotEmpty | ErrorCode_NotRecoverable | ErrorCode_Unsupported | ErrorCode_NoTty | ErrorCode_NoSuchDevice | ErrorCode_Overflow | ErrorCode_NotPermitted | ErrorCode_Pipe | ErrorCode_ReadOnly | ErrorCode_InvalidSeek | ErrorCode_TextFileBusy | ErrorCode_CrossDevice | ErrorCode_Other]]] -
-
-
- -Expand source code - -
def result_unit_wasi_filesystem_types_0_3_0_rc_2026_03_15_error_code_future(default: Callable[[], Result[None, wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode]]) -> tuple[FutureWriter[Result[None, wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode]], FutureReader[Result[None, wasi_filesystem_types_0_3_0_rc_2026_03_15.ErrorCode]]]:
-    raise NotImplementedError
-
-
-
-
-def result_unit_wasi_http_types_0_3_0_rc_2026_03_15_error_code_future(default: Callable[[], componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]]) ‑> tuple[componentize_py_async_support.futures.FutureWriter[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]]] -
-
-
- -Expand source code - -
def result_unit_wasi_http_types_0_3_0_rc_2026_03_15_error_code_future(default: Callable[[], Result[None, wasi_http_types_0_3_0_rc_2026_03_15.ErrorCode]]) -> tuple[FutureWriter[Result[None, wasi_http_types_0_3_0_rc_2026_03_15.ErrorCode]], FutureReader[Result[None, wasi_http_types_0_3_0_rc_2026_03_15.ErrorCode]]]:
-    raise NotImplementedError
-
-
-
-
-def result_unit_wasi_sockets_types_0_3_0_rc_2026_03_15_error_code_future(default: Callable[[], componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_AccessDenied | ErrorCode_NotSupported | ErrorCode_InvalidArgument | ErrorCode_OutOfMemory | ErrorCode_Timeout | ErrorCode_InvalidState | ErrorCode_AddressNotBindable | ErrorCode_AddressInUse | ErrorCode_RemoteUnreachable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionBroken | ErrorCode_ConnectionReset | ErrorCode_ConnectionAborted | ErrorCode_DatagramTooLarge | ErrorCode_Other]]) ‑> tuple[componentize_py_async_support.futures.FutureWriter[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_AccessDenied | ErrorCode_NotSupported | ErrorCode_InvalidArgument | ErrorCode_OutOfMemory | ErrorCode_Timeout | ErrorCode_InvalidState | ErrorCode_AddressNotBindable | ErrorCode_AddressInUse | ErrorCode_RemoteUnreachable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionBroken | ErrorCode_ConnectionReset | ErrorCode_ConnectionAborted | ErrorCode_DatagramTooLarge | ErrorCode_Other]], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[ErrorCode_AccessDenied | ErrorCode_NotSupported | ErrorCode_InvalidArgument | ErrorCode_OutOfMemory | ErrorCode_Timeout | ErrorCode_InvalidState | ErrorCode_AddressNotBindable | ErrorCode_AddressInUse | ErrorCode_RemoteUnreachable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionBroken | ErrorCode_ConnectionReset | ErrorCode_ConnectionAborted | ErrorCode_DatagramTooLarge | ErrorCode_Other]]] -
-
-
- -Expand source code - -
def result_unit_wasi_sockets_types_0_3_0_rc_2026_03_15_error_code_future(default: Callable[[], Result[None, wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode]]) -> tuple[FutureWriter[Result[None, wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode]], FutureReader[Result[None, wasi_sockets_types_0_3_0_rc_2026_03_15.ErrorCode]]]:
-    raise NotImplementedError
-
-
-
-
-def spin_sqlite_sqlite_3_1_0_row_result_stream() ‑> tuple[componentize_py_async_support.streams.StreamWriter[RowResult], componentize_py_async_support.streams.StreamReader[RowResult]] -
-
-
- -Expand source code - -
def spin_sqlite_sqlite_3_1_0_row_result_stream() -> tuple[StreamWriter[spin_sqlite_sqlite_3_1_0.RowResult], StreamReader[spin_sqlite_sqlite_3_1_0.RowResult]]:
-    raise NotImplementedError
-
-
-
-
-def string_stream() ‑> tuple[componentize_py_async_support.streams.StreamWriter[str], componentize_py_async_support.streams.StreamReader[str]] -
-
-
- -Expand source code - -
def string_stream() -> tuple[StreamWriter[str], StreamReader[str]]:
-    raise NotImplementedError
-
-
-
-
-def wasi_filesystem_types_0_3_0_rc_2026_03_15_directory_entry_stream() ‑> tuple[componentize_py_async_support.streams.StreamWriter[DirectoryEntry], componentize_py_async_support.streams.StreamReader[DirectoryEntry]] -
-
-
- -Expand source code - -
def wasi_filesystem_types_0_3_0_rc_2026_03_15_directory_entry_stream() -> tuple[StreamWriter[wasi_filesystem_types_0_3_0_rc_2026_03_15.DirectoryEntry], StreamReader[wasi_filesystem_types_0_3_0_rc_2026_03_15.DirectoryEntry]]:
-    raise NotImplementedError
-
-
-
-
-def wasi_sockets_types_0_3_0_rc_2026_03_15_tcp_socket_stream() ‑> tuple[componentize_py_async_support.streams.StreamWriter[typing.Any], componentize_py_async_support.streams.StreamReader[typing.Any]] -
-
-
- -Expand source code - -
def wasi_sockets_types_0_3_0_rc_2026_03_15_tcp_socket_stream() -> tuple[StreamWriter[Any], StreamReader[Any]]:
-    raise NotImplementedError
-
-
-
-
-
-
-

Classes

-
-
-class SpinSdkWit -(*args, **kwargs) -
-
-
- -Expand source code - -
class SpinSdkWit(Protocol):
-    pass
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto[T](Protocol):
-    def meth(self) -> T:
-        ...
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-
-
-
-
- -
- - - diff --git a/docs/v4/wit/types.html b/docs/v4/wit/types.html deleted file mode 100644 index be2f196..0000000 --- a/docs/v4/wit/types.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - -spin_sdk.wit.types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.types

-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Err -(value: ~E) -
-
-
- -Expand source code - -
@dataclass(frozen=True)
-class Err(Generic[E], Exception):
-    value: E
-
-

Err(value: ~E)

-

Ancestors

-
    -
  • typing.Generic
  • -
  • builtins.Exception
  • -
  • builtins.BaseException
  • -
-

Instance variables

-
-
var value : ~E
-
-
-
-
-
-
-class Ok -(value: ~T) -
-
-
- -Expand source code - -
@dataclass
-class Ok(Generic[T]):
-    value: T
-
-

Ok(value: ~T)

-

Ancestors

-
    -
  • typing.Generic
  • -
-

Instance variables

-
-
var value : ~T
-
-
-
-
-
-
-class Some -(value: ~S) -
-
-
- -Expand source code - -
@dataclass
-class Some(Generic[S]):
-    value: S
-
-

Some(value: ~S)

-

Ancestors

-
    -
  • typing.Generic
  • -
-

Instance variables

-
-
var value : ~S
-
-
-
-
-
-
-
-
- -
- - - diff --git a/docs/variables.html b/docs/variables.html deleted file mode 100644 index d56c7a4..0000000 --- a/docs/variables.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - -spin_sdk.variables API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.variables

-
-
-

Module for interacting with Spin Variables

-
- -Expand source code - -
"""Module for interacting with Spin Variables"""
-
-from spin_sdk.wit.imports import variables
-
-def get(key: str):
-    """
-    Gets the value of the given key
-    """
-    return variables.get(key)
-
-
-
-
-
-
-
-

Functions

-
-
-def get(key: str) -
-
-

Gets the value of the given key

-
- -Expand source code - -
def get(key: str):
-    """
-    Gets the value of the given key
-    """
-    return variables.get(key)
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/exports/inbound_redis.html b/docs/wit/exports/inbound_redis.html deleted file mode 100644 index 0e600a8..0000000 --- a/docs/wit/exports/inbound_redis.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - -spin_sdk.wit.exports.inbound_redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports.inbound_redis

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/exports/incoming_handler.html b/docs/wit/exports/incoming_handler.html deleted file mode 100644 index 7356a3b..0000000 --- a/docs/wit/exports/incoming_handler.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - -spin_sdk.wit.exports.incoming_handler API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports.incoming_handler

-
-
-

This interface defines a handler of incoming HTTP Requests. It should -be exported by components which can respond to HTTP Requests.

-
- -Expand source code - -
"""
-This interface defines a handler of incoming HTTP Requests. It should
-be exported by components which can respond to HTTP Requests.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/exports/index.html b/docs/wit/exports/index.html deleted file mode 100644 index 4f2b470..0000000 --- a/docs/wit/exports/index.html +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - -spin_sdk.wit.exports API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.exports

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import types
-
-class InboundRedis(Protocol):
-
-    @abstractmethod
-    def handle_message(self, message: bytes) -> None:
-        """
-        The entrypoint for a Redis handler.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)`
-        """
-        raise NotImplementedError
-
-
-class IncomingHandler(Protocol):
-
-    @abstractmethod
-    def handle(self, request: types.IncomingRequest, response_out: types.ResponseOutparam) -> None:
-        """
-        This function is invoked with an incoming HTTP Request, and a resource
-        `response-outparam` which provides the capability to reply with an HTTP
-        Response. The response is sent by calling the `response-outparam.set`
-        method, which allows execution to continue after the response has been
-        sent. This enables both streaming to the response body, and performing other
-        work.
-        
-        The implementor of this function must write a response to the
-        `response-outparam` before returning, or else the caller will respond
-        with an error on its behalf.
-        """
-        raise NotImplementedError
-
-
-
-

Sub-modules

-
-
spin_sdk.wit.exports.inbound_redis
-
-
-
-
spin_sdk.wit.exports.incoming_handler
-
-

This interface defines a handler of incoming HTTP Requests. It should -be exported by components which can respond to HTTP Requests.

-
-
-
-
-
-
-
-
-

Classes

-
-
-class InboundRedis -(*args, **kwargs) -
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto(Protocol[T]):
-    def meth(self) -> T:
-        ...
-
-
- -Expand source code - -
class InboundRedis(Protocol):
-
-    @abstractmethod
-    def handle_message(self, message: bytes) -> None:
-        """
-        The entrypoint for a Redis handler.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)`
-        """
-        raise NotImplementedError
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-

Methods

-
-
-def handle_message(self, message: bytes) ‑> None -
-
-

The entrypoint for a Redis handler.

-

Raises: Err(Error)

-
- -Expand source code - -
@abstractmethod
-def handle_message(self, message: bytes) -> None:
-    """
-    The entrypoint for a Redis handler.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class IncomingHandler -(*args, **kwargs) -
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto(Protocol[T]):
-    def meth(self) -> T:
-        ...
-
-
- -Expand source code - -
class IncomingHandler(Protocol):
-
-    @abstractmethod
-    def handle(self, request: types.IncomingRequest, response_out: types.ResponseOutparam) -> None:
-        """
-        This function is invoked with an incoming HTTP Request, and a resource
-        `response-outparam` which provides the capability to reply with an HTTP
-        Response. The response is sent by calling the `response-outparam.set`
-        method, which allows execution to continue after the response has been
-        sent. This enables both streaming to the response body, and performing other
-        work.
-        
-        The implementor of this function must write a response to the
-        `response-outparam` before returning, or else the caller will respond
-        with an error on its behalf.
-        """
-        raise NotImplementedError
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-

Subclasses

- -

Methods

-
-
-def handle(self, request: IncomingRequest, response_out: ResponseOutparam) ‑> None -
-
-

This function is invoked with an incoming HTTP Request, and a resource -response-outparam which provides the capability to reply with an HTTP -Response. The response is sent by calling the response-outparam.set -method, which allows execution to continue after the response has been -sent. This enables both streaming to the response body, and performing other -work.

-

The implementor of this function must write a response to the -response-outparam before returning, or else the caller will respond -with an error on its behalf.

-
- -Expand source code - -
@abstractmethod
-def handle(self, request: types.IncomingRequest, response_out: types.ResponseOutparam) -> None:
-    """
-    This function is invoked with an incoming HTTP Request, and a resource
-    `response-outparam` which provides the capability to reply with an HTTP
-    Response. The response is sent by calling the `response-outparam.set`
-    method, which allows execution to continue after the response has been
-    sent. This enables both streaming to the response body, and performing other
-    work.
-    
-    The implementor of this function must write a response to the
-    `response-outparam` before returning, or else the caller will respond
-    with an error on its behalf.
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/error.html b/docs/wit/imports/error.html deleted file mode 100644 index c51ae8d..0000000 --- a/docs/wit/imports/error.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - -spin_sdk.wit.imports.error API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.error

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-class Error:
-    """
-    A resource which represents some error information.
-    
-    The only method provided by this resource is `to-debug-string`,
-    which provides some human-readable information about the error.
-    
-    In the `wasi:io` package, this resource is returned through the
-    `wasi:io/streams/stream-error` type.
-    
-    To provide more specific error information, other interfaces may
-    provide functions to further "downcast" this error into more specific
-    error information. For example, `error`s returned in streams derived
-    from filesystem types to be described using the filesystem's own
-    error-code type, using the function
-    `wasi:filesystem/types/filesystem-error-code`, which takes a parameter
-    `borrow<error>` and returns
-    `option<wasi:filesystem/types/error-code>`.
-    
-    The set of functions which can "downcast" an `error` into a more
-    concrete type is open.
-    """
-    
-    def to_debug_string(self) -> str:
-        """
-        Returns a string that is suitable to assist humans in debugging
-        this error.
-        
-        WARNING: The returned string should not be consumed mechanically!
-        It may change across platforms, hosts, or other implementation
-        details. Parsing this string is a major platform-compatibility
-        hazard.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Error -
-
-

A resource which represents some error information.

-

The only method provided by this resource is to-debug-string, -which provides some human-readable information about the error.

-

In the wasi:io package, this resource is returned through the -wasi:io/streams/stream-error type.

-

To provide more specific error information, other interfaces may -provide functions to further "downcast" this error into more specific -error information. For example, errors returned in streams derived -from filesystem types to be described using the filesystem's own -error-code type, using the function -wasi:filesystem/types/filesystem-error-code, which takes a parameter -borrow<error> and returns -option<wasi:filesystem/types/error-code>.

-

The set of functions which can "downcast" an error into a more -concrete type is open.

-
- -Expand source code - -
class Error:
-    """
-    A resource which represents some error information.
-    
-    The only method provided by this resource is `to-debug-string`,
-    which provides some human-readable information about the error.
-    
-    In the `wasi:io` package, this resource is returned through the
-    `wasi:io/streams/stream-error` type.
-    
-    To provide more specific error information, other interfaces may
-    provide functions to further "downcast" this error into more specific
-    error information. For example, `error`s returned in streams derived
-    from filesystem types to be described using the filesystem's own
-    error-code type, using the function
-    `wasi:filesystem/types/filesystem-error-code`, which takes a parameter
-    `borrow<error>` and returns
-    `option<wasi:filesystem/types/error-code>`.
-    
-    The set of functions which can "downcast" an `error` into a more
-    concrete type is open.
-    """
-    
-    def to_debug_string(self) -> str:
-        """
-        Returns a string that is suitable to assist humans in debugging
-        this error.
-        
-        WARNING: The returned string should not be consumed mechanically!
-        It may change across platforms, hosts, or other implementation
-        details. Parsing this string is a major platform-compatibility
-        hazard.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def to_debug_string(self) ‑> str -
-
-

Returns a string that is suitable to assist humans in debugging -this error.

-

WARNING: The returned string should not be consumed mechanically! -It may change across platforms, hosts, or other implementation -details. Parsing this string is a major platform-compatibility -hazard.

-
- -Expand source code - -
def to_debug_string(self) -> str:
-    """
-    Returns a string that is suitable to assist humans in debugging
-    this error.
-    
-    WARNING: The returned string should not be consumed mechanically!
-    It may change across platforms, hosts, or other implementation
-    details. Parsing this string is a major platform-compatibility
-    hazard.
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/index.html b/docs/wit/imports/index.html deleted file mode 100644 index c6a7994..0000000 --- a/docs/wit/imports/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - -spin_sdk.wit.imports API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports

-
-
-
-
-

Sub-modules

-
-
spin_sdk.wit.imports.error
-
-
-
-
spin_sdk.wit.imports.key_value
-
-
-
-
spin_sdk.wit.imports.llm
-
-

A WASI interface dedicated to performing inferencing for Large Language Models.

-
-
spin_sdk.wit.imports.monotonic_clock
-
-

WASI Monotonic Clock is a clock API intended to let users measure elapsed -time …

-
-
spin_sdk.wit.imports.mysql
-
-
-
-
spin_sdk.wit.imports.outgoing_handler
-
-

This interface defines a handler of outgoing HTTP Requests. It should be -imported by components which wish to make HTTP Requests.

-
-
spin_sdk.wit.imports.poll
-
-

A poll API intended to let users wait for I/O events on multiple handles -at once.

-
-
spin_sdk.wit.imports.postgres
-
-
-
-
spin_sdk.wit.imports.rdbms_types
-
-
-
-
spin_sdk.wit.imports.redis
-
-
-
-
spin_sdk.wit.imports.redis_types
-
-
-
-
spin_sdk.wit.imports.sqlite
-
-
-
-
spin_sdk.wit.imports.streams
-
-

WASI I/O is an I/O abstraction API which is currently focused on providing -stream types …

-
-
spin_sdk.wit.imports.types
-
-

This interface defines all of the types and methods for implementing -HTTP Requests and Responses, both incoming and outgoing, as well as -their …

-
-
spin_sdk.wit.imports.variables
-
-
-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/key_value.html b/docs/wit/imports/key_value.html deleted file mode 100644 index 778df1b..0000000 --- a/docs/wit/imports/key_value.html +++ /dev/null @@ -1,489 +0,0 @@ - - - - - - -spin_sdk.wit.imports.key_value API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.key_value

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-@dataclass
-class ErrorStoreTableFull:
-    pass
-
-
-@dataclass
-class ErrorNoSuchStore:
-    pass
-
-
-@dataclass
-class ErrorAccessDenied:
-    pass
-
-
-@dataclass
-class ErrorOther:
-    value: str
-
-
-Error = Union[ErrorStoreTableFull, ErrorNoSuchStore, ErrorAccessDenied, ErrorOther]
-"""
-The set of errors which may be raised by functions in this interface
-"""
-
-
-class Store:
-    """
-    An open key-value store
-    """
-    
-    @classmethod
-    def open(cls, label: str) -> Self:
-        """
-        Open the store with the specified label.
-        
-        `label` must refer to a store allowed in the spin.toml manifest.
-        
-        `error::no-such-store` will be raised if the `label` is not recognized.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value associated with the specified `key`
-        
-        Returns `ok(none)` if the key does not exist.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set the `value` associated with the specified `key` overwriting any existing value.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def delete(self, key: str) -> None:
-        """
-        Delete the tuple with the specified `key`
-        
-        No error is raised if a tuple did not previously exist for `key`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def exists(self, key: str) -> int:
-        """
-        Return whether a tuple exists for the specified `key`
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def get_keys(self) -> List[str]:
-        """
-        Return a list of all the keys
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
-
-
-
-
-

Classes

-
-
-class ErrorAccessDenied -
-
-

ErrorAccessDenied()

-
- -Expand source code - -
@dataclass
-class ErrorAccessDenied:
-    pass
-
-
-
-class ErrorNoSuchStore -
-
-

ErrorNoSuchStore()

-
- -Expand source code - -
@dataclass
-class ErrorNoSuchStore:
-    pass
-
-
-
-class ErrorOther -(value: str) -
-
-

ErrorOther(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorOther:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorStoreTableFull -
-
-

ErrorStoreTableFull()

-
- -Expand source code - -
@dataclass
-class ErrorStoreTableFull:
-    pass
-
-
-
-class Store -
-
-

An open key-value store

-
- -Expand source code - -
class Store:
-    """
-    An open key-value store
-    """
-    
-    @classmethod
-    def open(cls, label: str) -> Self:
-        """
-        Open the store with the specified label.
-        
-        `label` must refer to a store allowed in the spin.toml manifest.
-        
-        `error::no-such-store` will be raised if the `label` is not recognized.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value associated with the specified `key`
-        
-        Returns `ok(none)` if the key does not exist.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set the `value` associated with the specified `key` overwriting any existing value.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def delete(self, key: str) -> None:
-        """
-        Delete the tuple with the specified `key`
-        
-        No error is raised if a tuple did not previously exist for `key`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def exists(self, key: str) -> int:
-        """
-        Return whether a tuple exists for the specified `key`
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def get_keys(self) -> List[str]:
-        """
-        Return a list of all the keys
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def open(label: str) ‑> Self -
-
-

Open the store with the specified label.

-

label must refer to a store allowed in the spin.toml manifest.

-

error::no-such-store will be raised if the label is not recognized.

-

Raises: Err(Error)

-
- -Expand source code - -
@classmethod
-def open(cls, label: str) -> Self:
-    """
-    Open the store with the specified label.
-    
-    `label` must refer to a store allowed in the spin.toml manifest.
-    
-    `error::no-such-store` will be raised if the `label` is not recognized.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def delete(self, key: str) ‑> None -
-
-

Delete the tuple with the specified key

-

No error is raised if a tuple did not previously exist for key.

-

Raises: Err(Error)

-
- -Expand source code - -
def delete(self, key: str) -> None:
-    """
-    Delete the tuple with the specified `key`
-    
-    No error is raised if a tuple did not previously exist for `key`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def exists(self, key: str) ‑> int -
-
-

Return whether a tuple exists for the specified key

-

Raises: Err(Error)

-
- -Expand source code - -
def exists(self, key: str) -> int:
-    """
-    Return whether a tuple exists for the specified `key`
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def get(self, key: str) ‑> Optional[bytes] -
-
-

Get the value associated with the specified key

-

Returns ok(none) if the key does not exist.

-

Raises: Err(Error)

-
- -Expand source code - -
def get(self, key: str) -> Optional[bytes]:
-    """
-    Get the value associated with the specified `key`
-    
-    Returns `ok(none)` if the key does not exist.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def get_keys(self) ‑> List[str] -
-
-

Return a list of all the keys

-

Raises: Err(Error)

-
- -Expand source code - -
def get_keys(self) -> List[str]:
-    """
-    Return a list of all the keys
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def set(self, key: str, value: bytes) ‑> None -
-
-

Set the value associated with the specified key overwriting any existing value.

-

Raises: Err(Error)

-
- -Expand source code - -
def set(self, key: str, value: bytes) -> None:
-    """
-    Set the `value` associated with the specified `key` overwriting any existing value.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/llm.html b/docs/wit/imports/llm.html deleted file mode 100644 index 1578597..0000000 --- a/docs/wit/imports/llm.html +++ /dev/null @@ -1,494 +0,0 @@ - - - - - - -spin_sdk.wit.imports.llm API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.llm

-
-
-

A WASI interface dedicated to performing inferencing for Large Language Models.

-
- -Expand source code - -
"""
-A WASI interface dedicated to performing inferencing for Large Language Models.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-@dataclass
-class InferencingParams:
-    """
-    Inference request parameters
-    """
-    max_tokens: int
-    repeat_penalty: float
-    repeat_penalty_last_n_token_count: int
-    temperature: float
-    top_k: int
-    top_p: float
-
-
-@dataclass
-class ErrorModelNotSupported:
-    pass
-
-
-@dataclass
-class ErrorRuntimeError:
-    value: str
-
-
-@dataclass
-class ErrorInvalidInput:
-    value: str
-
-
-Error = Union[ErrorModelNotSupported, ErrorRuntimeError, ErrorInvalidInput]
-"""
-The set of errors which may be raised by functions in this interface
-"""
-
-
-@dataclass
-class InferencingUsage:
-    """
-    Usage information related to the inferencing result
-    """
-    prompt_token_count: int
-    generated_token_count: int
-
-@dataclass
-class InferencingResult:
-    """
-    An inferencing result
-    """
-    text: str
-    usage: InferencingUsage
-
-@dataclass
-class EmbeddingsUsage:
-    """
-    Usage related to an embeddings generation request
-    """
-    prompt_token_count: int
-
-@dataclass
-class EmbeddingsResult:
-    """
-    Result of generating embeddings
-    """
-    embeddings: List[List[float]]
-    usage: EmbeddingsUsage
-
-
-def infer(model: str, prompt: str, params: Optional[InferencingParams]) -> InferencingResult:
-    """
-    Perform inferencing using the provided model and prompt with the given optional params
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error)`
-    """
-    raise NotImplementedError
-
-def generate_embeddings(model: str, text: List[str]) -> EmbeddingsResult:
-    """
-    Generate embeddings for the supplied list of text
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
-
-
-

Functions

-
-
-def generate_embeddings(model: str, text: List[str]) ‑> EmbeddingsResult -
-
-

Generate embeddings for the supplied list of text

-

Raises: Err(Error)

-
- -Expand source code - -
def generate_embeddings(model: str, text: List[str]) -> EmbeddingsResult:
-    """
-    Generate embeddings for the supplied list of text
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def infer(model: str, prompt: str, params: Optional[InferencingParams]) ‑> InferencingResult -
-
-

Perform inferencing using the provided model and prompt with the given optional params

-

Raises: Err(Error)

-
- -Expand source code - -
def infer(model: str, prompt: str, params: Optional[InferencingParams]) -> InferencingResult:
-    """
-    Perform inferencing using the provided model and prompt with the given optional params
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Classes

-
-
-class EmbeddingsResult -(embeddings: List[List[float]], usage: EmbeddingsUsage) -
-
-

Result of generating embeddings

-
- -Expand source code - -
@dataclass
-class EmbeddingsResult:
-    """
-    Result of generating embeddings
-    """
-    embeddings: List[List[float]]
-    usage: EmbeddingsUsage
-
-

Class variables

-
-
var embeddings : List[List[float]]
-
-
-
-
var usageEmbeddingsUsage
-
-
-
-
-
-
-class EmbeddingsUsage -(prompt_token_count: int) -
-
-

Usage related to an embeddings generation request

-
- -Expand source code - -
@dataclass
-class EmbeddingsUsage:
-    """
-    Usage related to an embeddings generation request
-    """
-    prompt_token_count: int
-
-

Class variables

-
-
var prompt_token_count : int
-
-
-
-
-
-
-class ErrorInvalidInput -(value: str) -
-
-

ErrorInvalidInput(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorInvalidInput:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorModelNotSupported -
-
-

ErrorModelNotSupported()

-
- -Expand source code - -
@dataclass
-class ErrorModelNotSupported:
-    pass
-
-
-
-class ErrorRuntimeError -(value: str) -
-
-

ErrorRuntimeError(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorRuntimeError:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class InferencingParams -(max_tokens: int, repeat_penalty: float, repeat_penalty_last_n_token_count: int, temperature: float, top_k: int, top_p: float) -
-
-

Inference request parameters

-
- -Expand source code - -
@dataclass
-class InferencingParams:
-    """
-    Inference request parameters
-    """
-    max_tokens: int
-    repeat_penalty: float
-    repeat_penalty_last_n_token_count: int
-    temperature: float
-    top_k: int
-    top_p: float
-
-

Class variables

-
-
var max_tokens : int
-
-
-
-
var repeat_penalty : float
-
-
-
-
var repeat_penalty_last_n_token_count : int
-
-
-
-
var temperature : float
-
-
-
-
var top_k : int
-
-
-
-
var top_p : float
-
-
-
-
-
-
-class InferencingResult -(text: str, usage: InferencingUsage) -
-
-

An inferencing result

-
- -Expand source code - -
@dataclass
-class InferencingResult:
-    """
-    An inferencing result
-    """
-    text: str
-    usage: InferencingUsage
-
-

Class variables

-
-
var text : str
-
-
-
-
var usageInferencingUsage
-
-
-
-
-
-
-class InferencingUsage -(prompt_token_count: int, generated_token_count: int) -
-
-

Usage information related to the inferencing result

-
- -Expand source code - -
@dataclass
-class InferencingUsage:
-    """
-    Usage information related to the inferencing result
-    """
-    prompt_token_count: int
-    generated_token_count: int
-
-

Class variables

-
-
var generated_token_count : int
-
-
-
-
var prompt_token_count : int
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/monotonic_clock.html b/docs/wit/imports/monotonic_clock.html deleted file mode 100644 index f551ec8..0000000 --- a/docs/wit/imports/monotonic_clock.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - -spin_sdk.wit.imports.monotonic_clock API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.monotonic_clock

-
-
-

WASI Monotonic Clock is a clock API intended to let users measure elapsed -time.

-

It is intended to be portable at least between Unix-family platforms and -Windows.

-

A monotonic clock is a clock which has an unspecified initial value, and -successive reads of the clock will produce non-decreasing values.

-

It is intended for measuring elapsed time.

-
- -Expand source code - -
"""
-WASI Monotonic Clock is a clock API intended to let users measure elapsed
-time.
-
-It is intended to be portable at least between Unix-family platforms and
-Windows.
-
-A monotonic clock is a clock which has an unspecified initial value, and
-successive reads of the clock will produce non-decreasing values.
-
-It is intended for measuring elapsed time.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import poll
-
-
-def now() -> int:
-    """
-    Read the current value of the clock.
-    
-    The clock is monotonic, therefore calling this function repeatedly will
-    produce a sequence of non-decreasing values.
-    """
-    raise NotImplementedError
-
-def resolution() -> int:
-    """
-    Query the resolution of the clock. Returns the duration of time
-    corresponding to a clock tick.
-    """
-    raise NotImplementedError
-
-def subscribe_instant(when: int) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the specified instant
-    occured.
-    """
-    raise NotImplementedError
-
-def subscribe_duration(when: int) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the given duration has
-    elapsed, starting at the time at which this function was called.
-    occured.
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
-

Functions

-
-
-def now() ‑> int -
-
-

Read the current value of the clock.

-

The clock is monotonic, therefore calling this function repeatedly will -produce a sequence of non-decreasing values.

-
- -Expand source code - -
def now() -> int:
-    """
-    Read the current value of the clock.
-    
-    The clock is monotonic, therefore calling this function repeatedly will
-    produce a sequence of non-decreasing values.
-    """
-    raise NotImplementedError
-
-
-
-def resolution() ‑> int -
-
-

Query the resolution of the clock. Returns the duration of time -corresponding to a clock tick.

-
- -Expand source code - -
def resolution() -> int:
-    """
-    Query the resolution of the clock. Returns the duration of time
-    corresponding to a clock tick.
-    """
-    raise NotImplementedError
-
-
-
-def subscribe_duration(when: int) ‑> Pollable -
-
-

Create a pollable which will resolve once the given duration has -elapsed, starting at the time at which this function was called. -occured.

-
- -Expand source code - -
def subscribe_duration(when: int) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the given duration has
-    elapsed, starting at the time at which this function was called.
-    occured.
-    """
-    raise NotImplementedError
-
-
-
-def subscribe_instant(when: int) ‑> Pollable -
-
-

Create a pollable which will resolve once the specified instant -occured.

-
- -Expand source code - -
def subscribe_instant(when: int) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the specified instant
-    occured.
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/mysql.html b/docs/wit/imports/mysql.html deleted file mode 100644 index c1b3475..0000000 --- a/docs/wit/imports/mysql.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - -spin_sdk.wit.imports.mysql API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.mysql

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import rdbms_types
-
-class Connection:
-    """
-    A connection to a MySQL database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the MySQL instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-        """
-        query the database: select
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> None:
-        """
-        execute command to the database: insert, update, delete
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-

A connection to a MySQL database.

-
- -Expand source code - -
class Connection:
-    """
-    A connection to a MySQL database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the MySQL instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-        """
-        query the database: select
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> None:
-        """
-        execute command to the database: insert, update, delete
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the MySQL instance at address.

-

Raises: Err(Error)

-
- -Expand source code - -
@classmethod
-def open(cls, address: str) -> Self:
-    """
-    Open a connection to the MySQL instance at `address`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def execute(self, statement: str, params: List[Union[ParameterValueBooleanParameterValueInt8ParameterValueInt16ParameterValueInt32ParameterValueInt64ParameterValueUint8ParameterValueUint16ParameterValueUint32ParameterValueUint64ParameterValueFloating32ParameterValueFloating64ParameterValueStrParameterValueBinaryParameterValueDbNull]]) ‑> None -
-
-

execute command to the database: insert, update, delete

-

Raises: Err(Error)

-
- -Expand source code - -
def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> None:
-    """
-    execute command to the database: insert, update, delete
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def query(self, statement: str, params: List[Union[ParameterValueBooleanParameterValueInt8ParameterValueInt16ParameterValueInt32ParameterValueInt64ParameterValueUint8ParameterValueUint16ParameterValueUint32ParameterValueUint64ParameterValueFloating32ParameterValueFloating64ParameterValueStrParameterValueBinaryParameterValueDbNull]]) ‑> RowSet -
-
-

query the database: select

-

Raises: Err(Error)

-
- -Expand source code - -
def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-    """
-    query the database: select
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/outgoing_handler.html b/docs/wit/imports/outgoing_handler.html deleted file mode 100644 index 17f2598..0000000 --- a/docs/wit/imports/outgoing_handler.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - -spin_sdk.wit.imports.outgoing_handler API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.outgoing_handler

-
-
-

This interface defines a handler of outgoing HTTP Requests. It should be -imported by components which wish to make HTTP Requests.

-
- -Expand source code - -
"""
-This interface defines a handler of outgoing HTTP Requests. It should be
-imported by components which wish to make HTTP Requests.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import types
-
-
-def handle(request: types.OutgoingRequest, options: Optional[types.RequestOptions]) -> types.FutureIncomingResponse:
-    """
-    This function is invoked with an outgoing HTTP Request, and it returns
-    a resource `future-incoming-response` which represents an HTTP Response
-    which may arrive in the future.
-    
-    The `options` argument accepts optional parameters for the HTTP
-    protocol's transport layer.
-    
-    This function may return an error if the `outgoing-request` is invalid
-    or not allowed to be made. Otherwise, protocol errors are reported
-    through the `future-incoming-response`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
-

Functions

-
-
-def handle(request: OutgoingRequest, options: Optional[RequestOptions]) ‑> FutureIncomingResponse -
-
-

This function is invoked with an outgoing HTTP Request, and it returns -a resource future-incoming-response which represents an HTTP Response -which may arrive in the future.

-

The options argument accepts optional parameters for the HTTP -protocol's transport layer.

-

This function may return an error if the outgoing-request is invalid -or not allowed to be made. Otherwise, protocol errors are reported -through the future-incoming-response.

-

Raises: Err(ErrorCode)

-
- -Expand source code - -
def handle(request: types.OutgoingRequest, options: Optional[types.RequestOptions]) -> types.FutureIncomingResponse:
-    """
-    This function is invoked with an outgoing HTTP Request, and it returns
-    a resource `future-incoming-response` which represents an HTTP Response
-    which may arrive in the future.
-    
-    The `options` argument accepts optional parameters for the HTTP
-    protocol's transport layer.
-    
-    This function may return an error if the `outgoing-request` is invalid
-    or not allowed to be made. Otherwise, protocol errors are reported
-    through the `future-incoming-response`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/poll.html b/docs/wit/imports/poll.html deleted file mode 100644 index 58a789f..0000000 --- a/docs/wit/imports/poll.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - -spin_sdk.wit.imports.poll API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.poll

-
-
-

A poll API intended to let users wait for I/O events on multiple handles -at once.

-
- -Expand source code - -
"""
-A poll API intended to let users wait for I/O events on multiple handles
-at once.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-class Pollable:
-    """
-    `pollable` represents a single I/O event which may be ready, or not.
-    """
-    
-    def ready(self) -> int:
-        """
-        Return the readiness of a pollable. This function never blocks.
-        
-        Returns `true` when the pollable is ready, and `false` otherwise.
-        """
-        raise NotImplementedError
-
-    def block(self) -> None:
-        """
-        `block` returns immediately if the pollable is ready, and otherwise
-        blocks until ready.
-        
-        This function is equivalent to calling `poll.poll` on a list
-        containing only this pollable.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-def poll(in_: List[Pollable]) -> List[int]:
-    """
-    Poll for completion on a set of pollables.
-    
-    This function takes a list of pollables, which identify I/O sources of
-    interest, and waits until one or more of the events is ready for I/O.
-    
-    The result `list<u32>` contains one or more indices of handles in the
-    argument list that is ready for I/O.
-    
-    If the list contains more elements than can be indexed with a `u32`
-    value, this function traps.
-    
-    A timeout can be implemented by adding a pollable from the
-    wasi-clocks API to the list.
-    
-    This function does not return a `result`; polling in itself does not
-    do any I/O so it doesn't fail. If any of the I/O sources identified by
-    the pollables has an error, it is indicated by marking the source as
-    being reaedy for I/O.
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
-

Functions

-
-
-def poll(in_: List[Pollable]) ‑> List[int] -
-
-

Poll for completion on a set of pollables.

-

This function takes a list of pollables, which identify I/O sources of -interest, and waits until one or more of the events is ready for I/O.

-

The result list<u32> contains one or more indices of handles in the -argument list that is ready for I/O.

-

If the list contains more elements than can be indexed with a u32 -value, this function traps.

-

A timeout can be implemented by adding a pollable from the -wasi-clocks API to the list.

-

This function does not return a result; polling in itself does not -do any I/O so it doesn't fail. If any of the I/O sources identified by -the pollables has an error, it is indicated by marking the source as -being reaedy for I/O.

-
- -Expand source code - -
def poll(in_: List[Pollable]) -> List[int]:
-    """
-    Poll for completion on a set of pollables.
-    
-    This function takes a list of pollables, which identify I/O sources of
-    interest, and waits until one or more of the events is ready for I/O.
-    
-    The result `list<u32>` contains one or more indices of handles in the
-    argument list that is ready for I/O.
-    
-    If the list contains more elements than can be indexed with a `u32`
-    value, this function traps.
-    
-    A timeout can be implemented by adding a pollable from the
-    wasi-clocks API to the list.
-    
-    This function does not return a `result`; polling in itself does not
-    do any I/O so it doesn't fail. If any of the I/O sources identified by
-    the pollables has an error, it is indicated by marking the source as
-    being reaedy for I/O.
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Classes

-
-
-class Pollable -
-
-

pollable represents a single I/O event which may be ready, or not.

-
- -Expand source code - -
class Pollable:
-    """
-    `pollable` represents a single I/O event which may be ready, or not.
-    """
-    
-    def ready(self) -> int:
-        """
-        Return the readiness of a pollable. This function never blocks.
-        
-        Returns `true` when the pollable is ready, and `false` otherwise.
-        """
-        raise NotImplementedError
-
-    def block(self) -> None:
-        """
-        `block` returns immediately if the pollable is ready, and otherwise
-        blocks until ready.
-        
-        This function is equivalent to calling `poll.poll` on a list
-        containing only this pollable.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def block(self) ‑> None -
-
-

block returns immediately if the pollable is ready, and otherwise -blocks until ready.

-

This function is equivalent to calling poll.poll on a list -containing only this pollable.

-
- -Expand source code - -
def block(self) -> None:
-    """
-    `block` returns immediately if the pollable is ready, and otherwise
-    blocks until ready.
-    
-    This function is equivalent to calling `poll.poll` on a list
-    containing only this pollable.
-    """
-    raise NotImplementedError
-
-
-
-def ready(self) ‑> int -
-
-

Return the readiness of a pollable. This function never blocks.

-

Returns true when the pollable is ready, and false otherwise.

-
- -Expand source code - -
def ready(self) -> int:
-    """
-    Return the readiness of a pollable. This function never blocks.
-    
-    Returns `true` when the pollable is ready, and `false` otherwise.
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/postgres.html b/docs/wit/imports/postgres.html deleted file mode 100644 index bb33dee..0000000 --- a/docs/wit/imports/postgres.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - -spin_sdk.wit.imports.postgres API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.postgres

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import rdbms_types
-
-class Connection:
-    """
-    A connection to a postgres database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Postgres instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-        """
-        Query the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> int:
-        """
-        Execute command to the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-

A connection to a postgres database.

-
- -Expand source code - -
class Connection:
-    """
-    A connection to a postgres database.
-    """
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Postgres instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-        """
-        Query the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> int:
-        """
-        Execute command to the database.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the Postgres instance at address.

-

Raises: Err(Error)

-
- -Expand source code - -
@classmethod
-def open(cls, address: str) -> Self:
-    """
-    Open a connection to the Postgres instance at `address`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def execute(self, statement: str, params: List[Union[ParameterValueBooleanParameterValueInt8ParameterValueInt16ParameterValueInt32ParameterValueInt64ParameterValueUint8ParameterValueUint16ParameterValueUint32ParameterValueUint64ParameterValueFloating32ParameterValueFloating64ParameterValueStrParameterValueBinaryParameterValueDbNull]]) ‑> int -
-
-

Execute command to the database.

-

Raises: Err(Error)

-
- -Expand source code - -
def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> int:
-    """
-    Execute command to the database.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def query(self, statement: str, params: List[Union[ParameterValueBooleanParameterValueInt8ParameterValueInt16ParameterValueInt32ParameterValueInt64ParameterValueUint8ParameterValueUint16ParameterValueUint32ParameterValueUint64ParameterValueFloating32ParameterValueFloating64ParameterValueStrParameterValueBinaryParameterValueDbNull]]) ‑> RowSet -
-
-

Query the database.

-

Raises: Err(Error)

-
- -Expand source code - -
def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
-    """
-    Query the database.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/rdbms_types.html b/docs/wit/imports/rdbms_types.html deleted file mode 100644 index 03ef7c3..0000000 --- a/docs/wit/imports/rdbms_types.html +++ /dev/null @@ -1,1426 +0,0 @@ - - - - - - -spin_sdk.wit.imports.rdbms_types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.rdbms_types

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-@dataclass
-class ErrorConnectionFailed:
-    value: str
-
-
-@dataclass
-class ErrorBadParameter:
-    value: str
-
-
-@dataclass
-class ErrorQueryFailed:
-    value: str
-
-
-@dataclass
-class ErrorValueConversionFailed:
-    value: str
-
-
-@dataclass
-class ErrorOther:
-    value: str
-
-
-Error = Union[ErrorConnectionFailed, ErrorBadParameter, ErrorQueryFailed, ErrorValueConversionFailed, ErrorOther]
-"""
-Errors related to interacting with a database.
-"""
-
-
-class DbDataType(Enum):
-    """
-    Data types for a database column
-    """
-    BOOLEAN = 0
-    INT8 = 1
-    INT16 = 2
-    INT32 = 3
-    INT64 = 4
-    UINT8 = 5
-    UINT16 = 6
-    UINT32 = 7
-    UINT64 = 8
-    FLOATING32 = 9
-    FLOATING64 = 10
-    STR = 11
-    BINARY = 12
-    OTHER = 13
-
-
-@dataclass
-class DbValueBoolean:
-    value: int
-
-
-@dataclass
-class DbValueInt8:
-    value: int
-
-
-@dataclass
-class DbValueInt16:
-    value: int
-
-
-@dataclass
-class DbValueInt32:
-    value: int
-
-
-@dataclass
-class DbValueInt64:
-    value: int
-
-
-@dataclass
-class DbValueUint8:
-    value: int
-
-
-@dataclass
-class DbValueUint16:
-    value: int
-
-
-@dataclass
-class DbValueUint32:
-    value: int
-
-
-@dataclass
-class DbValueUint64:
-    value: int
-
-
-@dataclass
-class DbValueFloating32:
-    value: float
-
-
-@dataclass
-class DbValueFloating64:
-    value: float
-
-
-@dataclass
-class DbValueStr:
-    value: str
-
-
-@dataclass
-class DbValueBinary:
-    value: bytes
-
-
-@dataclass
-class DbValueDbNull:
-    pass
-
-
-@dataclass
-class DbValueUnsupported:
-    pass
-
-
-DbValue = Union[DbValueBoolean, DbValueInt8, DbValueInt16, DbValueInt32, DbValueInt64, DbValueUint8, DbValueUint16, DbValueUint32, DbValueUint64, DbValueFloating32, DbValueFloating64, DbValueStr, DbValueBinary, DbValueDbNull, DbValueUnsupported]
-"""
-Database values
-"""
-
-
-
-@dataclass
-class ParameterValueBoolean:
-    value: int
-
-
-@dataclass
-class ParameterValueInt8:
-    value: int
-
-
-@dataclass
-class ParameterValueInt16:
-    value: int
-
-
-@dataclass
-class ParameterValueInt32:
-    value: int
-
-
-@dataclass
-class ParameterValueInt64:
-    value: int
-
-
-@dataclass
-class ParameterValueUint8:
-    value: int
-
-
-@dataclass
-class ParameterValueUint16:
-    value: int
-
-
-@dataclass
-class ParameterValueUint32:
-    value: int
-
-
-@dataclass
-class ParameterValueUint64:
-    value: int
-
-
-@dataclass
-class ParameterValueFloating32:
-    value: float
-
-
-@dataclass
-class ParameterValueFloating64:
-    value: float
-
-
-@dataclass
-class ParameterValueStr:
-    value: str
-
-
-@dataclass
-class ParameterValueBinary:
-    value: bytes
-
-
-@dataclass
-class ParameterValueDbNull:
-    pass
-
-
-ParameterValue = Union[ParameterValueBoolean, ParameterValueInt8, ParameterValueInt16, ParameterValueInt32, ParameterValueInt64, ParameterValueUint8, ParameterValueUint16, ParameterValueUint32, ParameterValueUint64, ParameterValueFloating32, ParameterValueFloating64, ParameterValueStr, ParameterValueBinary, ParameterValueDbNull]
-"""
-Values used in parameterized queries
-"""
-
-
-@dataclass
-class Column:
-    """
-    A database column
-    """
-    name: str
-    data_type: DbDataType
-
-@dataclass
-class RowSet:
-    """
-    A set of database rows
-    """
-    columns: List[Column]
-    rows: List[List[DbValue]]
-
-
-
-
-
-

Global variables

-
-
var DbValue
-
-

Database values

-
-
var Error
-
-

Errors related to interacting with a database.

-
-
var ParameterValue
-
-

Values used in parameterized queries

-
-
-
-
-
-
-

Classes

-
-
-class Column -(name: str, data_type: DbDataType) -
-
-

A database column

-
- -Expand source code - -
@dataclass
-class Column:
-    """
-    A database column
-    """
-    name: str
-    data_type: DbDataType
-
-

Class variables

-
-
var data_typeDbDataType
-
-
-
-
var name : str
-
-
-
-
-
-
-class DbDataType -(*args, **kwds) -
-
-

Data types for a database column

-
- -Expand source code - -
class DbDataType(Enum):
-    """
-    Data types for a database column
-    """
-    BOOLEAN = 0
-    INT8 = 1
-    INT16 = 2
-    INT32 = 3
-    INT64 = 4
-    UINT8 = 5
-    UINT16 = 6
-    UINT32 = 7
-    UINT64 = 8
-    FLOATING32 = 9
-    FLOATING64 = 10
-    STR = 11
-    BINARY = 12
-    OTHER = 13
-
-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var BINARY
-
-
-
-
var BOOLEAN
-
-
-
-
var FLOATING32
-
-
-
-
var FLOATING64
-
-
-
-
var INT16
-
-
-
-
var INT32
-
-
-
-
var INT64
-
-
-
-
var INT8
-
-
-
-
var OTHER
-
-
-
-
var STR
-
-
-
-
var UINT16
-
-
-
-
var UINT32
-
-
-
-
var UINT64
-
-
-
-
var UINT8
-
-
-
-
-
-
-class DbValueBinary -(value: bytes) -
-
-

DbValueBinary(value: bytes)

-
- -Expand source code - -
@dataclass
-class DbValueBinary:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class DbValueBoolean -(value: int) -
-
-

DbValueBoolean(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueBoolean:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueDbNull -
-
-

DbValueDbNull()

-
- -Expand source code - -
@dataclass
-class DbValueDbNull:
-    pass
-
-
-
-class DbValueFloating32 -(value: float) -
-
-

DbValueFloating32(value: float)

-
- -Expand source code - -
@dataclass
-class DbValueFloating32:
-    value: float
-
-

Class variables

-
-
var value : float
-
-
-
-
-
-
-class DbValueFloating64 -(value: float) -
-
-

DbValueFloating64(value: float)

-
- -Expand source code - -
@dataclass
-class DbValueFloating64:
-    value: float
-
-

Class variables

-
-
var value : float
-
-
-
-
-
-
-class DbValueInt16 -(value: int) -
-
-

DbValueInt16(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueInt16:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueInt32 -(value: int) -
-
-

DbValueInt32(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueInt32:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueInt64 -(value: int) -
-
-

DbValueInt64(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueInt64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueInt8 -(value: int) -
-
-

DbValueInt8(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueInt8:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueStr -(value: str) -
-
-

DbValueStr(value: str)

-
- -Expand source code - -
@dataclass
-class DbValueStr:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class DbValueUint16 -(value: int) -
-
-

DbValueUint16(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueUint16:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueUint32 -(value: int) -
-
-

DbValueUint32(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueUint32:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueUint64 -(value: int) -
-
-

DbValueUint64(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueUint64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueUint8 -(value: int) -
-
-

DbValueUint8(value: int)

-
- -Expand source code - -
@dataclass
-class DbValueUint8:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class DbValueUnsupported -
-
-

DbValueUnsupported()

-
- -Expand source code - -
@dataclass
-class DbValueUnsupported:
-    pass
-
-
-
-class ErrorBadParameter -(value: str) -
-
-

ErrorBadParameter(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorBadParameter:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorConnectionFailed -(value: str) -
-
-

ErrorConnectionFailed(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorConnectionFailed:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorOther -(value: str) -
-
-

ErrorOther(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorOther:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorQueryFailed -(value: str) -
-
-

ErrorQueryFailed(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorQueryFailed:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorValueConversionFailed -(value: str) -
-
-

ErrorValueConversionFailed(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorValueConversionFailed:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValueBinary -(value: bytes) -
-
-

ParameterValueBinary(value: bytes)

-
- -Expand source code - -
@dataclass
-class ParameterValueBinary:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class ParameterValueBoolean -(value: int) -
-
-

ParameterValueBoolean(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueBoolean:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueDbNull -
-
-

ParameterValueDbNull()

-
- -Expand source code - -
@dataclass
-class ParameterValueDbNull:
-    pass
-
-
-
-class ParameterValueFloating32 -(value: float) -
-
-

ParameterValueFloating32(value: float)

-
- -Expand source code - -
@dataclass
-class ParameterValueFloating32:
-    value: float
-
-

Class variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValueFloating64 -(value: float) -
-
-

ParameterValueFloating64(value: float)

-
- -Expand source code - -
@dataclass
-class ParameterValueFloating64:
-    value: float
-
-

Class variables

-
-
var value : float
-
-
-
-
-
-
-class ParameterValueInt16 -(value: int) -
-
-

ParameterValueInt16(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueInt16:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueInt32 -(value: int) -
-
-

ParameterValueInt32(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueInt32:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueInt64 -(value: int) -
-
-

ParameterValueInt64(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueInt64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueInt8 -(value: int) -
-
-

ParameterValueInt8(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueInt8:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueStr -(value: str) -
-
-

ParameterValueStr(value: str)

-
- -Expand source code - -
@dataclass
-class ParameterValueStr:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ParameterValueUint16 -(value: int) -
-
-

ParameterValueUint16(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueUint16:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueUint32 -(value: int) -
-
-

ParameterValueUint32(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueUint32:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueUint64 -(value: int) -
-
-

ParameterValueUint64(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueUint64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ParameterValueUint8 -(value: int) -
-
-

ParameterValueUint8(value: int)

-
- -Expand source code - -
@dataclass
-class ParameterValueUint8:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class RowSet -(columns: List[Column], rows: List[List[Union[DbValueBooleanDbValueInt8DbValueInt16DbValueInt32DbValueInt64DbValueUint8DbValueUint16DbValueUint32DbValueUint64DbValueFloating32DbValueFloating64DbValueStrDbValueBinaryDbValueDbNullDbValueUnsupported]]]) -
-
-

A set of database rows

-
- -Expand source code - -
@dataclass
-class RowSet:
-    """
-    A set of database rows
-    """
-    columns: List[Column]
-    rows: List[List[DbValue]]
-
-

Class variables

-
-
var columns : List[Column]
-
-
-
-
var rows : List[List[Union[DbValueBooleanDbValueInt8DbValueInt16DbValueInt32DbValueInt64DbValueUint8DbValueUint16DbValueUint32DbValueUint64DbValueFloating32DbValueFloating64DbValueStrDbValueBinaryDbValueDbNullDbValueUnsupported]]]
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/redis.html b/docs/wit/imports/redis.html deleted file mode 100644 index 640f4ff..0000000 --- a/docs/wit/imports/redis.html +++ /dev/null @@ -1,839 +0,0 @@ - - - - - - -spin_sdk.wit.imports.redis API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.redis

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-@dataclass
-class ErrorInvalidAddress:
-    pass
-
-
-@dataclass
-class ErrorTooManyConnections:
-    pass
-
-
-@dataclass
-class ErrorTypeError:
-    pass
-
-
-@dataclass
-class ErrorOther:
-    value: str
-
-
-Error = Union[ErrorInvalidAddress, ErrorTooManyConnections, ErrorTypeError, ErrorOther]
-"""
-Errors related to interacting with Redis
-"""
-
-
-
-@dataclass
-class RedisParameterInt64:
-    value: int
-
-
-@dataclass
-class RedisParameterBinary:
-    value: bytes
-
-
-RedisParameter = Union[RedisParameterInt64, RedisParameterBinary]
-"""
-A parameter type for the general-purpose `execute` function.
-"""
-
-
-
-@dataclass
-class RedisResultNil:
-    pass
-
-
-@dataclass
-class RedisResultStatus:
-    value: str
-
-
-@dataclass
-class RedisResultInt64:
-    value: int
-
-
-@dataclass
-class RedisResultBinary:
-    value: bytes
-
-
-RedisResult = Union[RedisResultNil, RedisResultStatus, RedisResultInt64, RedisResultBinary]
-"""
-A return type for the general-purpose `execute` function.
-"""
-
-
-class Connection:
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Redis instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def publish(self, channel: str, payload: bytes) -> None:
-        """
-        Publish a Redis message to the specified channel.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value of a key.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set key to value.
-        
-        If key already holds a value, it is overwritten.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def incr(self, key: str) -> int:
-        """
-        Increments the number stored at key by one.
-        
-        If the key does not exist, it is set to 0 before performing the operation.
-        An `error::type-error` is returned if the key contains a value of the wrong type
-        or contains a string that can not be represented as integer.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def del_(self, keys: List[str]) -> int:
-        """
-        Removes the specified keys.
-        
-        A key is ignored if it does not exist. Returns the number of keys deleted.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def sadd(self, key: str, values: List[str]) -> int:
-        """
-        Add the specified `values` to the set named `key`, returning the number of newly-added values.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def smembers(self, key: str) -> List[str]:
-        """
-        Retrieve the contents of the set named `key`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def srem(self, key: str, values: List[str]) -> int:
-        """
-        Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
-        """
-        Execute an arbitrary Redis command and receive the result.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

Errors related to interacting with Redis

-
-
var RedisParameter
-
-

A parameter type for the general-purpose execute function.

-
-
var RedisResult
-
-

A return type for the general-purpose execute function.

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-
-
- -Expand source code - -
class Connection:
-    
-    @classmethod
-    def open(cls, address: str) -> Self:
-        """
-        Open a connection to the Redis instance at `address`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def publish(self, channel: str, payload: bytes) -> None:
-        """
-        Publish a Redis message to the specified channel.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def get(self, key: str) -> Optional[bytes]:
-        """
-        Get the value of a key.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def set(self, key: str, value: bytes) -> None:
-        """
-        Set key to value.
-        
-        If key already holds a value, it is overwritten.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def incr(self, key: str) -> int:
-        """
-        Increments the number stored at key by one.
-        
-        If the key does not exist, it is set to 0 before performing the operation.
-        An `error::type-error` is returned if the key contains a value of the wrong type
-        or contains a string that can not be represented as integer.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def del_(self, keys: List[str]) -> int:
-        """
-        Removes the specified keys.
-        
-        A key is ignored if it does not exist. Returns the number of keys deleted.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def sadd(self, key: str, values: List[str]) -> int:
-        """
-        Add the specified `values` to the set named `key`, returning the number of newly-added values.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def smembers(self, key: str) -> List[str]:
-        """
-        Retrieve the contents of the set named `key`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def srem(self, key: str, values: List[str]) -> int:
-        """
-        Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
-        """
-        Execute an arbitrary Redis command and receive the result.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def open(address: str) ‑> Self -
-
-

Open a connection to the Redis instance at address.

-

Raises: Err(Error)

-
- -Expand source code - -
@classmethod
-def open(cls, address: str) -> Self:
-    """
-    Open a connection to the Redis instance at `address`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def del_(self, keys: List[str]) ‑> int -
-
-

Removes the specified keys.

-

A key is ignored if it does not exist. Returns the number of keys deleted.

-

Raises: Err(Error)

-
- -Expand source code - -
def del_(self, keys: List[str]) -> int:
-    """
-    Removes the specified keys.
-    
-    A key is ignored if it does not exist. Returns the number of keys deleted.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def execute(self, command: str, arguments: List[Union[RedisParameterInt64RedisParameterBinary]]) ‑> List[Union[RedisResultNilRedisResultStatusRedisResultInt64RedisResultBinary]] -
-
-

Execute an arbitrary Redis command and receive the result.

-

Raises: Err(Error)

-
- -Expand source code - -
def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
-    """
-    Execute an arbitrary Redis command and receive the result.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def get(self, key: str) ‑> Optional[bytes] -
-
-

Get the value of a key.

-

Raises: Err(Error)

-
- -Expand source code - -
def get(self, key: str) -> Optional[bytes]:
-    """
-    Get the value of a key.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def incr(self, key: str) ‑> int -
-
-

Increments the number stored at key by one.

-

If the key does not exist, it is set to 0 before performing the operation. -An error::type-error is returned if the key contains a value of the wrong type -or contains a string that can not be represented as integer.

-

Raises: Err(Error)

-
- -Expand source code - -
def incr(self, key: str) -> int:
-    """
-    Increments the number stored at key by one.
-    
-    If the key does not exist, it is set to 0 before performing the operation.
-    An `error::type-error` is returned if the key contains a value of the wrong type
-    or contains a string that can not be represented as integer.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def publish(self, channel: str, payload: bytes) ‑> None -
-
-

Publish a Redis message to the specified channel.

-

Raises: Err(Error)

-
- -Expand source code - -
def publish(self, channel: str, payload: bytes) -> None:
-    """
-    Publish a Redis message to the specified channel.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def sadd(self, key: str, values: List[str]) ‑> int -
-
-

Add the specified values to the set named key, returning the number of newly-added values.

-

Raises: Err(Error)

-
- -Expand source code - -
def sadd(self, key: str, values: List[str]) -> int:
-    """
-    Add the specified `values` to the set named `key`, returning the number of newly-added values.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def set(self, key: str, value: bytes) ‑> None -
-
-

Set key to value.

-

If key already holds a value, it is overwritten.

-

Raises: Err(Error)

-
- -Expand source code - -
def set(self, key: str, value: bytes) -> None:
-    """
-    Set key to value.
-    
-    If key already holds a value, it is overwritten.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def smembers(self, key: str) ‑> List[str] -
-
-

Retrieve the contents of the set named key.

-

Raises: Err(Error)

-
- -Expand source code - -
def smembers(self, key: str) -> List[str]:
-    """
-    Retrieve the contents of the set named `key`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-def srem(self, key: str, values: List[str]) ‑> int -
-
-

Remove the specified values from the set named key, returning the number of newly-removed values.

-

Raises: Err(Error)

-
- -Expand source code - -
def srem(self, key: str, values: List[str]) -> int:
-    """
-    Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class ErrorInvalidAddress -
-
-

ErrorInvalidAddress()

-
- -Expand source code - -
@dataclass
-class ErrorInvalidAddress:
-    pass
-
-
-
-class ErrorOther -(value: str) -
-
-

ErrorOther(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorOther:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorTooManyConnections -
-
-

ErrorTooManyConnections()

-
- -Expand source code - -
@dataclass
-class ErrorTooManyConnections:
-    pass
-
-
-
-class ErrorTypeError -
-
-

ErrorTypeError()

-
- -Expand source code - -
@dataclass
-class ErrorTypeError:
-    pass
-
-
-
-class RedisParameterBinary -(value: bytes) -
-
-

RedisParameterBinary(value: bytes)

-
- -Expand source code - -
@dataclass
-class RedisParameterBinary:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisParameterInt64 -(value: int) -
-
-

RedisParameterInt64(value: int)

-
- -Expand source code - -
@dataclass
-class RedisParameterInt64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResultBinary -(value: bytes) -
-
-

RedisResultBinary(value: bytes)

-
- -Expand source code - -
@dataclass
-class RedisResultBinary:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisResultInt64 -(value: int) -
-
-

RedisResultInt64(value: int)

-
- -Expand source code - -
@dataclass
-class RedisResultInt64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResultNil -
-
-

RedisResultNil()

-
- -Expand source code - -
@dataclass
-class RedisResultNil:
-    pass
-
-
-
-class RedisResultStatus -(value: str) -
-
-

RedisResultStatus(value: str)

-
- -Expand source code - -
@dataclass
-class RedisResultStatus:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/redis_types.html b/docs/wit/imports/redis_types.html deleted file mode 100644 index 7558f05..0000000 --- a/docs/wit/imports/redis_types.html +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - -spin_sdk.wit.imports.redis_types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.redis_types

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-class Error(Enum):
-    """
-    General purpose error.
-    """
-    SUCCESS = 0
-    ERROR = 1
-
-
-@dataclass
-class RedisParameterInt64:
-    value: int
-
-
-@dataclass
-class RedisParameterBinary:
-    value: bytes
-
-
-RedisParameter = Union[RedisParameterInt64, RedisParameterBinary]
-"""
-A parameter type for the general-purpose `execute` function.
-"""
-
-
-
-@dataclass
-class RedisResultNil:
-    pass
-
-
-@dataclass
-class RedisResultStatus:
-    value: str
-
-
-@dataclass
-class RedisResultInt64:
-    value: int
-
-
-@dataclass
-class RedisResultBinary:
-    value: bytes
-
-
-RedisResult = Union[RedisResultNil, RedisResultStatus, RedisResultInt64, RedisResultBinary]
-"""
-A return type for the general-purpose `execute` function.
-"""
-
-
-
-
-
-

Global variables

-
-
var RedisParameter
-
-

A parameter type for the general-purpose execute function.

-
-
var RedisResult
-
-

A return type for the general-purpose execute function.

-
-
-
-
-
-
-

Classes

-
-
-class Error -(*args, **kwds) -
-
-

General purpose error.

-
- -Expand source code - -
class Error(Enum):
-    """
-    General purpose error.
-    """
-    SUCCESS = 0
-    ERROR = 1
-
-

Ancestors

-
    -
  • enum.Enum
  • -
-

Class variables

-
-
var ERROR
-
-
-
-
var SUCCESS
-
-
-
-
-
-
-class RedisParameterBinary -(value: bytes) -
-
-

RedisParameterBinary(value: bytes)

-
- -Expand source code - -
@dataclass
-class RedisParameterBinary:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisParameterInt64 -(value: int) -
-
-

RedisParameterInt64(value: int)

-
- -Expand source code - -
@dataclass
-class RedisParameterInt64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResultBinary -(value: bytes) -
-
-

RedisResultBinary(value: bytes)

-
- -Expand source code - -
@dataclass
-class RedisResultBinary:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class RedisResultInt64 -(value: int) -
-
-

RedisResultInt64(value: int)

-
- -Expand source code - -
@dataclass
-class RedisResultInt64:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class RedisResultNil -
-
-

RedisResultNil()

-
- -Expand source code - -
@dataclass
-class RedisResultNil:
-    pass
-
-
-
-class RedisResultStatus -(value: str) -
-
-

RedisResultStatus(value: str)

-
- -Expand source code - -
@dataclass
-class RedisResultStatus:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/sqlite.html b/docs/wit/imports/sqlite.html deleted file mode 100644 index 39f5ac1..0000000 --- a/docs/wit/imports/sqlite.html +++ /dev/null @@ -1,602 +0,0 @@ - - - - - - -spin_sdk.wit.imports.sqlite API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.sqlite

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-@dataclass
-class ErrorNoSuchDatabase:
-    pass
-
-
-@dataclass
-class ErrorAccessDenied:
-    pass
-
-
-@dataclass
-class ErrorInvalidConnection:
-    pass
-
-
-@dataclass
-class ErrorDatabaseFull:
-    pass
-
-
-@dataclass
-class ErrorIo:
-    value: str
-
-
-Error = Union[ErrorNoSuchDatabase, ErrorAccessDenied, ErrorInvalidConnection, ErrorDatabaseFull, ErrorIo]
-"""
-The set of errors which may be raised by functions in this interface
-"""
-
-
-
-@dataclass
-class ValueInteger:
-    value: int
-
-
-@dataclass
-class ValueReal:
-    value: float
-
-
-@dataclass
-class ValueText:
-    value: str
-
-
-@dataclass
-class ValueBlob:
-    value: bytes
-
-
-@dataclass
-class ValueNull:
-    pass
-
-
-Value = Union[ValueInteger, ValueReal, ValueText, ValueBlob, ValueNull]
-"""
-A single column's result from a database query
-"""
-
-
-@dataclass
-class RowResult:
-    """
-    A set of values for each of the columns in a query-result
-    """
-    values: List[Value]
-
-@dataclass
-class QueryResult:
-    """
-    A result of a query
-    """
-    columns: List[str]
-    rows: List[RowResult]
-
-class Connection:
-    """
-    A handle to an open sqlite instance
-    """
-    
-    @classmethod
-    def open(cls, database: str) -> Self:
-        """
-        Open a connection to a named database instance.
-        
-        If `database` is "default", the default instance is opened.
-        
-        `error::no-such-database` will be raised if the `name` is not recognized.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-        """
-        Execute a statement returning back data if there is any
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface

-
-
var Value
-
-

A single column's result from a database query

-
-
-
-
-
-
-

Classes

-
-
-class Connection -
-
-

A handle to an open sqlite instance

-
- -Expand source code - -
class Connection:
-    """
-    A handle to an open sqlite instance
-    """
-    
-    @classmethod
-    def open(cls, database: str) -> Self:
-        """
-        Open a connection to a named database instance.
-        
-        If `database` is "default", the default instance is opened.
-        
-        `error::no-such-database` will be raised if the `name` is not recognized.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-        """
-        raise NotImplementedError
-
-    def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-        """
-        Execute a statement returning back data if there is any
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def open(database: str) ‑> Self -
-
-

Open a connection to a named database instance.

-

If database is "default", the default instance is opened.

-

error::no-such-database will be raised if the name is not recognized.

-

Raises: Err(Error)

-
- -Expand source code - -
@classmethod
-def open(cls, database: str) -> Self:
-    """
-    Open a connection to a named database instance.
-    
-    If `database` is "default", the default instance is opened.
-    
-    `error::no-such-database` will be raised if the `name` is not recognized.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def execute(self, statement: str, parameters: List[Union[ValueIntegerValueRealValueTextValueBlobValueNull]]) ‑> QueryResult -
-
-

Execute a statement returning back data if there is any

-

Raises: Err(Error)

-
- -Expand source code - -
def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
-    """
-    Execute a statement returning back data if there is any
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class ErrorAccessDenied -
-
-

ErrorAccessDenied()

-
- -Expand source code - -
@dataclass
-class ErrorAccessDenied:
-    pass
-
-
-
-class ErrorDatabaseFull -
-
-

ErrorDatabaseFull()

-
- -Expand source code - -
@dataclass
-class ErrorDatabaseFull:
-    pass
-
-
-
-class ErrorInvalidConnection -
-
-

ErrorInvalidConnection()

-
- -Expand source code - -
@dataclass
-class ErrorInvalidConnection:
-    pass
-
-
-
-class ErrorIo -(value: str) -
-
-

ErrorIo(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorIo:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorNoSuchDatabase -
-
-

ErrorNoSuchDatabase()

-
- -Expand source code - -
@dataclass
-class ErrorNoSuchDatabase:
-    pass
-
-
-
-class QueryResult -(columns: List[str], rows: List[RowResult]) -
-
-

A result of a query

-
- -Expand source code - -
@dataclass
-class QueryResult:
-    """
-    A result of a query
-    """
-    columns: List[str]
-    rows: List[RowResult]
-
-

Class variables

-
-
var columns : List[str]
-
-
-
-
var rows : List[RowResult]
-
-
-
-
-
-
-class RowResult -(values: List[Union[ValueIntegerValueRealValueTextValueBlobValueNull]]) -
-
-

A set of values for each of the columns in a query-result

-
- -Expand source code - -
@dataclass
-class RowResult:
-    """
-    A set of values for each of the columns in a query-result
-    """
-    values: List[Value]
-
-

Class variables

-
-
var values : List[Union[ValueIntegerValueRealValueTextValueBlobValueNull]]
-
-
-
-
-
-
-class ValueBlob -(value: bytes) -
-
-

ValueBlob(value: bytes)

-
- -Expand source code - -
@dataclass
-class ValueBlob:
-    value: bytes
-
-

Class variables

-
-
var value : bytes
-
-
-
-
-
-
-class ValueInteger -(value: int) -
-
-

ValueInteger(value: int)

-
- -Expand source code - -
@dataclass
-class ValueInteger:
-    value: int
-
-

Class variables

-
-
var value : int
-
-
-
-
-
-
-class ValueNull -
-
-

ValueNull()

-
- -Expand source code - -
@dataclass
-class ValueNull:
-    pass
-
-
-
-class ValueReal -(value: float) -
-
-

ValueReal(value: float)

-
- -Expand source code - -
@dataclass
-class ValueReal:
-    value: float
-
-

Class variables

-
-
var value : float
-
-
-
-
-
-
-class ValueText -(value: str) -
-
-

ValueText(value: str)

-
- -Expand source code - -
@dataclass
-class ValueText:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/streams.html b/docs/wit/imports/streams.html deleted file mode 100644 index f4c0572..0000000 --- a/docs/wit/imports/streams.html +++ /dev/null @@ -1,1361 +0,0 @@ - - - - - - -spin_sdk.wit.imports.streams API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.streams

-
-
-

WASI I/O is an I/O abstraction API which is currently focused on providing -stream types.

-

In the future, the component model is expected to add built-in stream types; -when it does, they are expected to subsume this API.

-
- -Expand source code - -
"""
-WASI I/O is an I/O abstraction API which is currently focused on providing
-stream types.
-
-In the future, the component model is expected to add built-in stream types;
-when it does, they are expected to subsume this API.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import poll
-from ..imports import error
-
-
-@dataclass
-class StreamErrorLastOperationFailed:
-    value: error.Error
-
-
-@dataclass
-class StreamErrorClosed:
-    pass
-
-
-StreamError = Union[StreamErrorLastOperationFailed, StreamErrorClosed]
-"""
-An error for input-stream and output-stream operations.
-"""
-
-
-class InputStream:
-    """
-    An input bytestream.
-    
-    `input-stream`s are *non-blocking* to the extent practical on underlying
-    platforms. I/O operations always return promptly; if fewer bytes are
-    promptly available than requested, they return the number of bytes promptly
-    available, which could even be zero. To wait for data to be available,
-    use the `subscribe` function to obtain a `pollable` which can be polled
-    for using `wasi:io/poll`.
-    """
-    
-    def read(self, len: int) -> bytes:
-        """
-        Perform a non-blocking read from the stream.
-        
-        When the source of a `read` is binary data, the bytes from the source
-        are returned verbatim. When the source of a `read` is known to the
-        implementation to be text, bytes containing the UTF-8 encoding of the
-        text are returned.
-        
-        This function returns a list of bytes containing the read data,
-        when successful. The returned list will contain up to `len` bytes;
-        it may return fewer than requested, but not more. The list is
-        empty when no bytes are available for reading at this time. The
-        pollable given by `subscribe` will be ready when more bytes are
-        available.
-        
-        This function fails with a `stream-error` when the operation
-        encounters an error, giving `last-operation-failed`, or when the
-        stream is closed, giving `closed`.
-        
-        When the caller gives a `len` of 0, it represents a request to
-        read 0 bytes. If the stream is still open, this call should
-        succeed and return an empty list, or otherwise fail with `closed`.
-        
-        The `len` parameter is a `u64`, which could represent a list of u8 which
-        is not possible to allocate in wasm32, or not desirable to allocate as
-        as a return value by the callee. The callee may return a list of bytes
-        less than `len` in size while more bytes are available for reading.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_read(self, len: int) -> bytes:
-        """
-        Read bytes from a stream, after blocking until at least one byte can
-        be read. Except for blocking, behavior is identical to `read`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream. Returns number of bytes skipped.
-        
-        Behaves identical to `read`, except instead of returning a list
-        of bytes, returns the number of bytes consumed from the stream.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream, after blocking until at least one byte
-        can be skipped. Except for blocking behavior, identical to `skip`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def subscribe(self) -> poll.Pollable:
-        """
-        Create a `pollable` which will resolve once either the specified stream
-        has bytes available to read or the other end of the stream has been
-        closed.
-        The created `pollable` is a child resource of the `input-stream`.
-        Implementations may trap if the `input-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class OutputStream:
-    """
-    An output bytestream.
-    
-    `output-stream`s are *non-blocking* to the extent practical on
-    underlying platforms. Except where specified otherwise, I/O operations also
-    always return promptly, after the number of bytes that can be written
-    promptly, which could even be zero. To wait for the stream to be ready to
-    accept data, the `subscribe` function to obtain a `pollable` which can be
-    polled for using `wasi:io/poll`.
-    """
-    
-    def check_write(self) -> int:
-        """
-        Check readiness for writing. This function never blocks.
-        
-        Returns the number of bytes permitted for the next call to `write`,
-        or an error. Calling `write` with more bytes than this function has
-        permitted will trap.
-        
-        When this function returns 0 bytes, the `subscribe` pollable will
-        become ready when this function will report at least 1 byte, or an
-        error.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def write(self, contents: bytes) -> None:
-        """
-        Perform a write. This function never blocks.
-        
-        When the destination of a `write` is binary data, the bytes from
-        `contents` are written verbatim. When the destination of a `write` is
-        known to the implementation to be text, the bytes of `contents` are
-        transcoded from UTF-8 into the encoding of the destination and then
-        written.
-        
-        Precondition: check-write gave permit of Ok(n) and contents has a
-        length of less than or equal to n. Otherwise, this function will trap.
-        
-        returns Err(closed) without writing if the stream has closed since
-        the last call to check-write provided a permit.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_write_and_flush(self, contents: bytes) -> None:
-        """
-        Perform a write of up to 4096 bytes, and then flush the stream. Block
-        until all of these operations are complete, or an error occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write`, and `flush`, and is implemented with the
-        following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while !contents.is_empty() {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, contents.len());
-        let (chunk, rest) = contents.split_at(len);
-        this.write(chunk  );            // eliding error handling
-        contents = rest;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def flush(self) -> None:
-        """
-        Request to flush buffered output. This function never blocks.
-        
-        This tells the output-stream that the caller intends any buffered
-        output to be flushed. the output which is expected to be flushed
-        is all that has been passed to `write` prior to this call.
-        
-        Upon calling this function, the `output-stream` will not accept any
-        writes (`check-write` will return `ok(0)`) until the flush has
-        completed. The `subscribe` pollable will become ready when the
-        flush has completed and the stream can accept more writes.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_flush(self) -> None:
-        """
-        Request to flush buffered output, and block until flush completes
-        and stream is ready for writing again.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def subscribe(self) -> poll.Pollable:
-        """
-        Create a `pollable` which will resolve once the output-stream
-        is ready for more writing, or an error has occured. When this
-        pollable is ready, `check-write` will return `ok(n)` with n>0, or an
-        error.
-        
-        If the stream is closed, this pollable is always ready immediately.
-        
-        The created `pollable` is a child resource of the `output-stream`.
-        Implementations may trap if the `output-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-
-    def write_zeroes(self, len: int) -> None:
-        """
-        Write zeroes to a stream.
-        
-        This should be used precisely like `write` with the exact same
-        preconditions (must use check-write first), but instead of
-        passing a list of bytes, you simply pass the number of zero-bytes
-        that should be written.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_write_zeroes_and_flush(self, len: int) -> None:
-        """
-        Perform a write of up to 4096 zeroes, and then flush the stream.
-        Block until all of these operations are complete, or an error
-        occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write-zeroes`, and `flush`, and is implemented with
-        the following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while num_zeroes != 0 {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, num_zeroes);
-        this.write-zeroes(len);         // eliding error handling
-        num_zeroes -= len;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another.
-        
-        The behavior of splice is equivelant to:
-        1. calling `check-write` on the `output-stream`
-        2. calling `read` on the `input-stream` with the smaller of the
-        `check-write` permitted length and the `len` provided to `splice`
-        3. calling `write` on the `output-stream` with that read data.
-        
-        Any error reported by the call to `check-write`, `read`, or
-        `write` ends the splice and reports that error.
-        
-        This function returns the number of bytes transferred; it may be less
-        than `len`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another, with blocking.
-        
-        This is similar to `splice`, except that it blocks until the
-        `output-stream` is ready for writing, and the `input-stream`
-        is ready for reading, before performing the `splice`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var StreamError
-
-

An error for input-stream and output-stream operations.

-
-
-
-
-
-
-

Classes

-
-
-class InputStream -
-
-

An input bytestream.

-

input-streams are non-blocking to the extent practical on underlying -platforms. I/O operations always return promptly; if fewer bytes are -promptly available than requested, they return the number of bytes promptly -available, which could even be zero. To wait for data to be available, -use the subscribe function to obtain a pollable which can be polled -for using wasi:io/poll.

-
- -Expand source code - -
class InputStream:
-    """
-    An input bytestream.
-    
-    `input-stream`s are *non-blocking* to the extent practical on underlying
-    platforms. I/O operations always return promptly; if fewer bytes are
-    promptly available than requested, they return the number of bytes promptly
-    available, which could even be zero. To wait for data to be available,
-    use the `subscribe` function to obtain a `pollable` which can be polled
-    for using `wasi:io/poll`.
-    """
-    
-    def read(self, len: int) -> bytes:
-        """
-        Perform a non-blocking read from the stream.
-        
-        When the source of a `read` is binary data, the bytes from the source
-        are returned verbatim. When the source of a `read` is known to the
-        implementation to be text, bytes containing the UTF-8 encoding of the
-        text are returned.
-        
-        This function returns a list of bytes containing the read data,
-        when successful. The returned list will contain up to `len` bytes;
-        it may return fewer than requested, but not more. The list is
-        empty when no bytes are available for reading at this time. The
-        pollable given by `subscribe` will be ready when more bytes are
-        available.
-        
-        This function fails with a `stream-error` when the operation
-        encounters an error, giving `last-operation-failed`, or when the
-        stream is closed, giving `closed`.
-        
-        When the caller gives a `len` of 0, it represents a request to
-        read 0 bytes. If the stream is still open, this call should
-        succeed and return an empty list, or otherwise fail with `closed`.
-        
-        The `len` parameter is a `u64`, which could represent a list of u8 which
-        is not possible to allocate in wasm32, or not desirable to allocate as
-        as a return value by the callee. The callee may return a list of bytes
-        less than `len` in size while more bytes are available for reading.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_read(self, len: int) -> bytes:
-        """
-        Read bytes from a stream, after blocking until at least one byte can
-        be read. Except for blocking, behavior is identical to `read`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream. Returns number of bytes skipped.
-        
-        Behaves identical to `read`, except instead of returning a list
-        of bytes, returns the number of bytes consumed from the stream.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_skip(self, len: int) -> int:
-        """
-        Skip bytes from a stream, after blocking until at least one byte
-        can be skipped. Except for blocking behavior, identical to `skip`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def subscribe(self) -> poll.Pollable:
-        """
-        Create a `pollable` which will resolve once either the specified stream
-        has bytes available to read or the other end of the stream has been
-        closed.
-        The created `pollable` is a child resource of the `input-stream`.
-        Implementations may trap if the `input-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def blocking_read(self, len: int) ‑> bytes -
-
-

Read bytes from a stream, after blocking until at least one byte can -be read. Except for blocking, behavior is identical to read.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def blocking_read(self, len: int) -> bytes:
-    """
-    Read bytes from a stream, after blocking until at least one byte can
-    be read. Except for blocking, behavior is identical to `read`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def blocking_skip(self, len: int) ‑> int -
-
-

Skip bytes from a stream, after blocking until at least one byte -can be skipped. Except for blocking behavior, identical to skip.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def blocking_skip(self, len: int) -> int:
-    """
-    Skip bytes from a stream, after blocking until at least one byte
-    can be skipped. Except for blocking behavior, identical to `skip`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def read(self, len: int) ‑> bytes -
-
-

Perform a non-blocking read from the stream.

-

When the source of a read is binary data, the bytes from the source -are returned verbatim. When the source of a read is known to the -implementation to be text, bytes containing the UTF-8 encoding of the -text are returned.

-

This function returns a list of bytes containing the read data, -when successful. The returned list will contain up to len bytes; -it may return fewer than requested, but not more. The list is -empty when no bytes are available for reading at this time. The -pollable given by subscribe will be ready when more bytes are -available.

-

This function fails with a stream-error when the operation -encounters an error, giving last-operation-failed, or when the -stream is closed, giving closed.

-

When the caller gives a len of 0, it represents a request to -read 0 bytes. If the stream is still open, this call should -succeed and return an empty list, or otherwise fail with closed.

-

The len parameter is a u64, which could represent a list of u8 which -is not possible to allocate in wasm32, or not desirable to allocate as -as a return value by the callee. The callee may return a list of bytes -less than len in size while more bytes are available for reading.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def read(self, len: int) -> bytes:
-    """
-    Perform a non-blocking read from the stream.
-    
-    When the source of a `read` is binary data, the bytes from the source
-    are returned verbatim. When the source of a `read` is known to the
-    implementation to be text, bytes containing the UTF-8 encoding of the
-    text are returned.
-    
-    This function returns a list of bytes containing the read data,
-    when successful. The returned list will contain up to `len` bytes;
-    it may return fewer than requested, but not more. The list is
-    empty when no bytes are available for reading at this time. The
-    pollable given by `subscribe` will be ready when more bytes are
-    available.
-    
-    This function fails with a `stream-error` when the operation
-    encounters an error, giving `last-operation-failed`, or when the
-    stream is closed, giving `closed`.
-    
-    When the caller gives a `len` of 0, it represents a request to
-    read 0 bytes. If the stream is still open, this call should
-    succeed and return an empty list, or otherwise fail with `closed`.
-    
-    The `len` parameter is a `u64`, which could represent a list of u8 which
-    is not possible to allocate in wasm32, or not desirable to allocate as
-    as a return value by the callee. The callee may return a list of bytes
-    less than `len` in size while more bytes are available for reading.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def skip(self, len: int) ‑> int -
-
-

Skip bytes from a stream. Returns number of bytes skipped.

-

Behaves identical to read, except instead of returning a list -of bytes, returns the number of bytes consumed from the stream.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def skip(self, len: int) -> int:
-    """
-    Skip bytes from a stream. Returns number of bytes skipped.
-    
-    Behaves identical to `read`, except instead of returning a list
-    of bytes, returns the number of bytes consumed from the stream.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def subscribe(self) ‑> Pollable -
-
-

Create a pollable which will resolve once either the specified stream -has bytes available to read or the other end of the stream has been -closed. -The created pollable is a child resource of the input-stream. -Implementations may trap if the input-stream is dropped before -all derived pollables created with this function are dropped.

-
- -Expand source code - -
def subscribe(self) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once either the specified stream
-    has bytes available to read or the other end of the stream has been
-    closed.
-    The created `pollable` is a child resource of the `input-stream`.
-    Implementations may trap if the `input-stream` is dropped before
-    all derived `pollable`s created with this function are dropped.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class OutputStream -
-
-

An output bytestream.

-

output-streams are non-blocking to the extent practical on -underlying platforms. Except where specified otherwise, I/O operations also -always return promptly, after the number of bytes that can be written -promptly, which could even be zero. To wait for the stream to be ready to -accept data, the subscribe function to obtain a pollable which can be -polled for using wasi:io/poll.

-
- -Expand source code - -
class OutputStream:
-    """
-    An output bytestream.
-    
-    `output-stream`s are *non-blocking* to the extent practical on
-    underlying platforms. Except where specified otherwise, I/O operations also
-    always return promptly, after the number of bytes that can be written
-    promptly, which could even be zero. To wait for the stream to be ready to
-    accept data, the `subscribe` function to obtain a `pollable` which can be
-    polled for using `wasi:io/poll`.
-    """
-    
-    def check_write(self) -> int:
-        """
-        Check readiness for writing. This function never blocks.
-        
-        Returns the number of bytes permitted for the next call to `write`,
-        or an error. Calling `write` with more bytes than this function has
-        permitted will trap.
-        
-        When this function returns 0 bytes, the `subscribe` pollable will
-        become ready when this function will report at least 1 byte, or an
-        error.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def write(self, contents: bytes) -> None:
-        """
-        Perform a write. This function never blocks.
-        
-        When the destination of a `write` is binary data, the bytes from
-        `contents` are written verbatim. When the destination of a `write` is
-        known to the implementation to be text, the bytes of `contents` are
-        transcoded from UTF-8 into the encoding of the destination and then
-        written.
-        
-        Precondition: check-write gave permit of Ok(n) and contents has a
-        length of less than or equal to n. Otherwise, this function will trap.
-        
-        returns Err(closed) without writing if the stream has closed since
-        the last call to check-write provided a permit.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_write_and_flush(self, contents: bytes) -> None:
-        """
-        Perform a write of up to 4096 bytes, and then flush the stream. Block
-        until all of these operations are complete, or an error occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write`, and `flush`, and is implemented with the
-        following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while !contents.is_empty() {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, contents.len());
-        let (chunk, rest) = contents.split_at(len);
-        this.write(chunk  );            // eliding error handling
-        contents = rest;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def flush(self) -> None:
-        """
-        Request to flush buffered output. This function never blocks.
-        
-        This tells the output-stream that the caller intends any buffered
-        output to be flushed. the output which is expected to be flushed
-        is all that has been passed to `write` prior to this call.
-        
-        Upon calling this function, the `output-stream` will not accept any
-        writes (`check-write` will return `ok(0)`) until the flush has
-        completed. The `subscribe` pollable will become ready when the
-        flush has completed and the stream can accept more writes.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_flush(self) -> None:
-        """
-        Request to flush buffered output, and block until flush completes
-        and stream is ready for writing again.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def subscribe(self) -> poll.Pollable:
-        """
-        Create a `pollable` which will resolve once the output-stream
-        is ready for more writing, or an error has occured. When this
-        pollable is ready, `check-write` will return `ok(n)` with n>0, or an
-        error.
-        
-        If the stream is closed, this pollable is always ready immediately.
-        
-        The created `pollable` is a child resource of the `output-stream`.
-        Implementations may trap if the `output-stream` is dropped before
-        all derived `pollable`s created with this function are dropped.
-        """
-        raise NotImplementedError
-
-    def write_zeroes(self, len: int) -> None:
-        """
-        Write zeroes to a stream.
-        
-        This should be used precisely like `write` with the exact same
-        preconditions (must use check-write first), but instead of
-        passing a list of bytes, you simply pass the number of zero-bytes
-        that should be written.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_write_zeroes_and_flush(self, len: int) -> None:
-        """
-        Perform a write of up to 4096 zeroes, and then flush the stream.
-        Block until all of these operations are complete, or an error
-        occurs.
-        
-        This is a convenience wrapper around the use of `check-write`,
-        `subscribe`, `write-zeroes`, and `flush`, and is implemented with
-        the following pseudo-code:
-        
-        ```text
-        let pollable = this.subscribe();
-        while num_zeroes != 0 {
-        // Wait for the stream to become writable
-        pollable.block();
-        let Ok(n) = this.check-write(); // eliding error handling
-        let len = min(n, num_zeroes);
-        this.write-zeroes(len);         // eliding error handling
-        num_zeroes -= len;
-        }
-        this.flush();
-        // Wait for completion of `flush`
-        pollable.block();
-        // Check for any errors that arose during `flush`
-        let _ = this.check-write();         // eliding error handling
-        ```
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another.
-        
-        The behavior of splice is equivelant to:
-        1. calling `check-write` on the `output-stream`
-        2. calling `read` on the `input-stream` with the smaller of the
-        `check-write` permitted length and the `len` provided to `splice`
-        3. calling `write` on the `output-stream` with that read data.
-        
-        Any error reported by the call to `check-write`, `read`, or
-        `write` ends the splice and reports that error.
-        
-        This function returns the number of bytes transferred; it may be less
-        than `len`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def blocking_splice(self, src: InputStream, len: int) -> int:
-        """
-        Read from one stream and write to another, with blocking.
-        
-        This is similar to `splice`, except that it blocks until the
-        `output-stream` is ready for writing, and the `input-stream`
-        is ready for reading, before performing the `splice`.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def blocking_flush(self) ‑> None -
-
-

Request to flush buffered output, and block until flush completes -and stream is ready for writing again.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def blocking_flush(self) -> None:
-    """
-    Request to flush buffered output, and block until flush completes
-    and stream is ready for writing again.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def blocking_splice(self, src: InputStream, len: int) ‑> int -
-
-

Read from one stream and write to another, with blocking.

-

This is similar to splice, except that it blocks until the -output-stream is ready for writing, and the input-stream -is ready for reading, before performing the splice.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def blocking_splice(self, src: InputStream, len: int) -> int:
-    """
-    Read from one stream and write to another, with blocking.
-    
-    This is similar to `splice`, except that it blocks until the
-    `output-stream` is ready for writing, and the `input-stream`
-    is ready for reading, before performing the `splice`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def blocking_write_and_flush(self, contents: bytes) ‑> None -
-
-

Perform a write of up to 4096 bytes, and then flush the stream. Block -until all of these operations are complete, or an error occurs.

-

This is a convenience wrapper around the use of check-write, -subscribe, write, and flush, and is implemented with the -following pseudo-code:

-
let pollable = this.subscribe();
-while !contents.is_empty() {
-// Wait for the stream to become writable
-pollable.block();
-let Ok(n) = this.check-write(); // eliding error handling
-let len = min(n, contents.len());
-let (chunk, rest) = contents.split_at(len);
-this.write(chunk  );            // eliding error handling
-contents = rest;
-}
-this.flush();
-// Wait for completion of `flush`
-pollable.block();
-// Check for any errors that arose during `flush`
-let _ = this.check-write();         // eliding error handling
-
-

Raises: Err(StreamError)

-
- -Expand source code - -
def blocking_write_and_flush(self, contents: bytes) -> None:
-    """
-    Perform a write of up to 4096 bytes, and then flush the stream. Block
-    until all of these operations are complete, or an error occurs.
-    
-    This is a convenience wrapper around the use of `check-write`,
-    `subscribe`, `write`, and `flush`, and is implemented with the
-    following pseudo-code:
-    
-    ```text
-    let pollable = this.subscribe();
-    while !contents.is_empty() {
-    // Wait for the stream to become writable
-    pollable.block();
-    let Ok(n) = this.check-write(); // eliding error handling
-    let len = min(n, contents.len());
-    let (chunk, rest) = contents.split_at(len);
-    this.write(chunk  );            // eliding error handling
-    contents = rest;
-    }
-    this.flush();
-    // Wait for completion of `flush`
-    pollable.block();
-    // Check for any errors that arose during `flush`
-    let _ = this.check-write();         // eliding error handling
-    ```
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def blocking_write_zeroes_and_flush(self, len: int) ‑> None -
-
-

Perform a write of up to 4096 zeroes, and then flush the stream. -Block until all of these operations are complete, or an error -occurs.

-

This is a convenience wrapper around the use of check-write, -subscribe, write-zeroes, and flush, and is implemented with -the following pseudo-code:

-
let pollable = this.subscribe();
-while num_zeroes != 0 {
-// Wait for the stream to become writable
-pollable.block();
-let Ok(n) = this.check-write(); // eliding error handling
-let len = min(n, num_zeroes);
-this.write-zeroes(len);         // eliding error handling
-num_zeroes -= len;
-}
-this.flush();
-// Wait for completion of `flush`
-pollable.block();
-// Check for any errors that arose during `flush`
-let _ = this.check-write();         // eliding error handling
-
-

Raises: Err(StreamError)

-
- -Expand source code - -
def blocking_write_zeroes_and_flush(self, len: int) -> None:
-    """
-    Perform a write of up to 4096 zeroes, and then flush the stream.
-    Block until all of these operations are complete, or an error
-    occurs.
-    
-    This is a convenience wrapper around the use of `check-write`,
-    `subscribe`, `write-zeroes`, and `flush`, and is implemented with
-    the following pseudo-code:
-    
-    ```text
-    let pollable = this.subscribe();
-    while num_zeroes != 0 {
-    // Wait for the stream to become writable
-    pollable.block();
-    let Ok(n) = this.check-write(); // eliding error handling
-    let len = min(n, num_zeroes);
-    this.write-zeroes(len);         // eliding error handling
-    num_zeroes -= len;
-    }
-    this.flush();
-    // Wait for completion of `flush`
-    pollable.block();
-    // Check for any errors that arose during `flush`
-    let _ = this.check-write();         // eliding error handling
-    ```
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def check_write(self) ‑> int -
-
-

Check readiness for writing. This function never blocks.

-

Returns the number of bytes permitted for the next call to write, -or an error. Calling write with more bytes than this function has -permitted will trap.

-

When this function returns 0 bytes, the subscribe pollable will -become ready when this function will report at least 1 byte, or an -error.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def check_write(self) -> int:
-    """
-    Check readiness for writing. This function never blocks.
-    
-    Returns the number of bytes permitted for the next call to `write`,
-    or an error. Calling `write` with more bytes than this function has
-    permitted will trap.
-    
-    When this function returns 0 bytes, the `subscribe` pollable will
-    become ready when this function will report at least 1 byte, or an
-    error.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def flush(self) ‑> None -
-
-

Request to flush buffered output. This function never blocks.

-

This tells the output-stream that the caller intends any buffered -output to be flushed. the output which is expected to be flushed -is all that has been passed to write prior to this call.

-

Upon calling this function, the output-stream will not accept any -writes (check-write will return ok(0)) until the flush has -completed. The subscribe pollable will become ready when the -flush has completed and the stream can accept more writes.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def flush(self) -> None:
-    """
-    Request to flush buffered output. This function never blocks.
-    
-    This tells the output-stream that the caller intends any buffered
-    output to be flushed. the output which is expected to be flushed
-    is all that has been passed to `write` prior to this call.
-    
-    Upon calling this function, the `output-stream` will not accept any
-    writes (`check-write` will return `ok(0)`) until the flush has
-    completed. The `subscribe` pollable will become ready when the
-    flush has completed and the stream can accept more writes.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def splice(self, src: InputStream, len: int) ‑> int -
-
-

Read from one stream and write to another.

-

The behavior of splice is equivelant to: -1. calling check-write on the output-stream -2. calling read on the input-stream with the smaller of the -check-write permitted length and the len provided to splice -3. calling write on the output-stream with that read data.

-

Any error reported by the call to check-write, read, or -write ends the splice and reports that error.

-

This function returns the number of bytes transferred; it may be less -than len.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def splice(self, src: InputStream, len: int) -> int:
-    """
-    Read from one stream and write to another.
-    
-    The behavior of splice is equivelant to:
-    1. calling `check-write` on the `output-stream`
-    2. calling `read` on the `input-stream` with the smaller of the
-    `check-write` permitted length and the `len` provided to `splice`
-    3. calling `write` on the `output-stream` with that read data.
-    
-    Any error reported by the call to `check-write`, `read`, or
-    `write` ends the splice and reports that error.
-    
-    This function returns the number of bytes transferred; it may be less
-    than `len`.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def subscribe(self) ‑> Pollable -
-
-

Create a pollable which will resolve once the output-stream -is ready for more writing, or an error has occured. When this -pollable is ready, check-write will return ok(n) with n>0, or an -error.

-

If the stream is closed, this pollable is always ready immediately.

-

The created pollable is a child resource of the output-stream. -Implementations may trap if the output-stream is dropped before -all derived pollables created with this function are dropped.

-
- -Expand source code - -
def subscribe(self) -> poll.Pollable:
-    """
-    Create a `pollable` which will resolve once the output-stream
-    is ready for more writing, or an error has occured. When this
-    pollable is ready, `check-write` will return `ok(n)` with n>0, or an
-    error.
-    
-    If the stream is closed, this pollable is always ready immediately.
-    
-    The created `pollable` is a child resource of the `output-stream`.
-    Implementations may trap if the `output-stream` is dropped before
-    all derived `pollable`s created with this function are dropped.
-    """
-    raise NotImplementedError
-
-
-
-def write(self, contents: bytes) ‑> None -
-
-

Perform a write. This function never blocks.

-

When the destination of a write is binary data, the bytes from -contents are written verbatim. When the destination of a write is -known to the implementation to be text, the bytes of contents are -transcoded from UTF-8 into the encoding of the destination and then -written.

-

Precondition: check-write gave permit of Ok(n) and contents has a -length of less than or equal to n. Otherwise, this function will trap.

-

returns Err(closed) without writing if the stream has closed since -the last call to check-write provided a permit.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def write(self, contents: bytes) -> None:
-    """
-    Perform a write. This function never blocks.
-    
-    When the destination of a `write` is binary data, the bytes from
-    `contents` are written verbatim. When the destination of a `write` is
-    known to the implementation to be text, the bytes of `contents` are
-    transcoded from UTF-8 into the encoding of the destination and then
-    written.
-    
-    Precondition: check-write gave permit of Ok(n) and contents has a
-    length of less than or equal to n. Otherwise, this function will trap.
-    
-    returns Err(closed) without writing if the stream has closed since
-    the last call to check-write provided a permit.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-def write_zeroes(self, len: int) ‑> None -
-
-

Write zeroes to a stream.

-

This should be used precisely like write with the exact same -preconditions (must use check-write first), but instead of -passing a list of bytes, you simply pass the number of zero-bytes -that should be written.

-

Raises: Err(StreamError)

-
- -Expand source code - -
def write_zeroes(self, len: int) -> None:
-    """
-    Write zeroes to a stream.
-    
-    This should be used precisely like `write` with the exact same
-    preconditions (must use check-write first), but instead of
-    passing a list of bytes, you simply pass the number of zero-bytes
-    that should be written.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class StreamErrorClosed -
-
-

StreamErrorClosed()

-
- -Expand source code - -
@dataclass
-class StreamErrorClosed:
-    pass
-
-
-
-class StreamErrorLastOperationFailed -(value: Error) -
-
-

StreamErrorLastOperationFailed(value: spin_sdk.wit.imports.error.Error)

-
- -Expand source code - -
@dataclass
-class StreamErrorLastOperationFailed:
-    value: error.Error
-
-

Class variables

-
-
var valueError
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/types.html b/docs/wit/imports/types.html deleted file mode 100644 index 1cab3b1..0000000 --- a/docs/wit/imports/types.html +++ /dev/null @@ -1,4620 +0,0 @@ - - - - - - -spin_sdk.wit.imports.types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.types

-
-
-

This interface defines all of the types and methods for implementing -HTTP Requests and Responses, both incoming and outgoing, as well as -their headers, trailers, and bodies.

-
- -Expand source code - -
"""
-This interface defines all of the types and methods for implementing
-HTTP Requests and Responses, both incoming and outgoing, as well as
-their headers, trailers, and bodies.
-"""
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-from ..imports import poll
-from ..imports import streams
-from ..imports import error
-
-
-@dataclass
-class MethodGet:
-    pass
-
-
-@dataclass
-class MethodHead:
-    pass
-
-
-@dataclass
-class MethodPost:
-    pass
-
-
-@dataclass
-class MethodPut:
-    pass
-
-
-@dataclass
-class MethodDelete:
-    pass
-
-
-@dataclass
-class MethodConnect:
-    pass
-
-
-@dataclass
-class MethodOptions:
-    pass
-
-
-@dataclass
-class MethodTrace:
-    pass
-
-
-@dataclass
-class MethodPatch:
-    pass
-
-
-@dataclass
-class MethodOther:
-    value: str
-
-
-Method = Union[MethodGet, MethodHead, MethodPost, MethodPut, MethodDelete, MethodConnect, MethodOptions, MethodTrace, MethodPatch, MethodOther]
-"""
-This type corresponds to HTTP standard Methods.
-"""
-
-
-
-@dataclass
-class SchemeHttp:
-    pass
-
-
-@dataclass
-class SchemeHttps:
-    pass
-
-
-@dataclass
-class SchemeOther:
-    value: str
-
-
-Scheme = Union[SchemeHttp, SchemeHttps, SchemeOther]
-"""
-This type corresponds to HTTP standard Related Schemes.
-"""
-
-
-@dataclass
-class DnsErrorPayload:
-    """
-    Defines the case payload type for `DNS-error` above:
-    """
-    rcode: Optional[str]
-    info_code: Optional[int]
-
-@dataclass
-class TlsAlertReceivedPayload:
-    """
-    Defines the case payload type for `TLS-alert-received` above:
-    """
-    alert_id: Optional[int]
-    alert_message: Optional[str]
-
-@dataclass
-class FieldSizePayload:
-    """
-    Defines the case payload type for `HTTP-response-{header,trailer}-size` above:
-    """
-    field_name: Optional[str]
-    field_size: Optional[int]
-
-
-@dataclass
-class ErrorCodeDnsTimeout:
-    pass
-
-
-@dataclass
-class ErrorCodeDnsError:
-    value: DnsErrorPayload
-
-
-@dataclass
-class ErrorCodeDestinationNotFound:
-    pass
-
-
-@dataclass
-class ErrorCodeDestinationUnavailable:
-    pass
-
-
-@dataclass
-class ErrorCodeDestinationIpProhibited:
-    pass
-
-
-@dataclass
-class ErrorCodeDestinationIpUnroutable:
-    pass
-
-
-@dataclass
-class ErrorCodeConnectionRefused:
-    pass
-
-
-@dataclass
-class ErrorCodeConnectionTerminated:
-    pass
-
-
-@dataclass
-class ErrorCodeConnectionTimeout:
-    pass
-
-
-@dataclass
-class ErrorCodeConnectionReadTimeout:
-    pass
-
-
-@dataclass
-class ErrorCodeConnectionWriteTimeout:
-    pass
-
-
-@dataclass
-class ErrorCodeConnectionLimitReached:
-    pass
-
-
-@dataclass
-class ErrorCodeTlsProtocolError:
-    pass
-
-
-@dataclass
-class ErrorCodeTlsCertificateError:
-    pass
-
-
-@dataclass
-class ErrorCodeTlsAlertReceived:
-    value: TlsAlertReceivedPayload
-
-
-@dataclass
-class ErrorCodeHttpRequestDenied:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpRequestLengthRequired:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpRequestBodySize:
-    value: Optional[int]
-
-
-@dataclass
-class ErrorCodeHttpRequestMethodInvalid:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpRequestUriInvalid:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpRequestUriTooLong:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpRequestHeaderSectionSize:
-    value: Optional[int]
-
-
-@dataclass
-class ErrorCodeHttpRequestHeaderSize:
-    value: Optional[FieldSizePayload]
-
-
-@dataclass
-class ErrorCodeHttpRequestTrailerSectionSize:
-    value: Optional[int]
-
-
-@dataclass
-class ErrorCodeHttpRequestTrailerSize:
-    value: FieldSizePayload
-
-
-@dataclass
-class ErrorCodeHttpResponseIncomplete:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpResponseHeaderSectionSize:
-    value: Optional[int]
-
-
-@dataclass
-class ErrorCodeHttpResponseHeaderSize:
-    value: FieldSizePayload
-
-
-@dataclass
-class ErrorCodeHttpResponseBodySize:
-    value: Optional[int]
-
-
-@dataclass
-class ErrorCodeHttpResponseTrailerSectionSize:
-    value: Optional[int]
-
-
-@dataclass
-class ErrorCodeHttpResponseTrailerSize:
-    value: FieldSizePayload
-
-
-@dataclass
-class ErrorCodeHttpResponseTransferCoding:
-    value: Optional[str]
-
-
-@dataclass
-class ErrorCodeHttpResponseContentCoding:
-    value: Optional[str]
-
-
-@dataclass
-class ErrorCodeHttpResponseTimeout:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpUpgradeFailed:
-    pass
-
-
-@dataclass
-class ErrorCodeHttpProtocolError:
-    pass
-
-
-@dataclass
-class ErrorCodeLoopDetected:
-    pass
-
-
-@dataclass
-class ErrorCodeConfigurationError:
-    pass
-
-
-@dataclass
-class ErrorCodeInternalError:
-    value: Optional[str]
-
-
-ErrorCode = Union[ErrorCodeDnsTimeout, ErrorCodeDnsError, ErrorCodeDestinationNotFound, ErrorCodeDestinationUnavailable, ErrorCodeDestinationIpProhibited, ErrorCodeDestinationIpUnroutable, ErrorCodeConnectionRefused, ErrorCodeConnectionTerminated, ErrorCodeConnectionTimeout, ErrorCodeConnectionReadTimeout, ErrorCodeConnectionWriteTimeout, ErrorCodeConnectionLimitReached, ErrorCodeTlsProtocolError, ErrorCodeTlsCertificateError, ErrorCodeTlsAlertReceived, ErrorCodeHttpRequestDenied, ErrorCodeHttpRequestLengthRequired, ErrorCodeHttpRequestBodySize, ErrorCodeHttpRequestMethodInvalid, ErrorCodeHttpRequestUriInvalid, ErrorCodeHttpRequestUriTooLong, ErrorCodeHttpRequestHeaderSectionSize, ErrorCodeHttpRequestHeaderSize, ErrorCodeHttpRequestTrailerSectionSize, ErrorCodeHttpRequestTrailerSize, ErrorCodeHttpResponseIncomplete, ErrorCodeHttpResponseHeaderSectionSize, ErrorCodeHttpResponseHeaderSize, ErrorCodeHttpResponseBodySize, ErrorCodeHttpResponseTrailerSectionSize, ErrorCodeHttpResponseTrailerSize, ErrorCodeHttpResponseTransferCoding, ErrorCodeHttpResponseContentCoding, ErrorCodeHttpResponseTimeout, ErrorCodeHttpUpgradeFailed, ErrorCodeHttpProtocolError, ErrorCodeLoopDetected, ErrorCodeConfigurationError, ErrorCodeInternalError]
-"""
-These cases are inspired by the IANA HTTP Proxy Error Types:
-https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types
-"""
-
-
-
-@dataclass
-class HeaderErrorInvalidSyntax:
-    pass
-
-
-@dataclass
-class HeaderErrorForbidden:
-    pass
-
-
-@dataclass
-class HeaderErrorImmutable:
-    pass
-
-
-HeaderError = Union[HeaderErrorInvalidSyntax, HeaderErrorForbidden, HeaderErrorImmutable]
-"""
-This type enumerates the different kinds of errors that may occur when
-setting or appending to a `fields` resource.
-"""
-
-
-class Fields:
-    """
-    This following block defines the `fields` resource which corresponds to
-    HTTP standard Fields. Fields are a common representation used for both
-    Headers and Trailers.
-    
-    A `fields` may be mutable or immutable. A `fields` created using the
-    constructor, `from-list`, or `clone` will be mutable, but a `fields`
-    resource given by other means (including, but not limited to,
-    `incoming-request.headers`, `outgoing-request.headers`) might be be
-    immutable. In an immutable fields, the `set`, `append`, and `delete`
-    operations will fail with `header-error.immutable`.
-    """
-    
-    def __init__(self):
-        """
-        Construct an empty HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def from_list(cls, entries: List[Tuple[str, bytes]]) -> Self:
-        """
-        Construct an HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        
-        The list represents each key-value pair in the Fields. Keys
-        which have multiple values are represented by multiple entries in this
-        list with the same key.
-        
-        The tuple is a pair of the field key, represented as a string, and
-        Value, represented as a list of bytes. In a valid Fields, all keys
-        and values are valid UTF-8 strings. However, values are not always
-        well-formed, so they are represented as a raw list of bytes.
-        
-        An error result will be returned if any header or value was
-        syntactically invalid, or if a header was forbidden.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def get(self, name: str) -> List[bytes]:
-        """
-        Get all of the values corresponding to a key. If the key is not present
-        in this `fields`, an empty list is returned. However, if the key is
-        present but empty, this is represented by a list with one or more
-        empty field-values present.
-        """
-        raise NotImplementedError
-
-    def has(self, name: str) -> int:
-        """
-        Returns `true` when the key is present in this `fields`. If the key is
-        syntactically invalid, `false` is returned.
-        """
-        raise NotImplementedError
-
-    def set(self, name: str, value: List[bytes]) -> None:
-        """
-        Set all of the values for a key. Clears any existing values for that
-        key, if they have been set.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def delete(self, name: str) -> None:
-        """
-        Delete all values for a key. Does nothing if no values for the key
-        exist.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def append(self, name: str, value: bytes) -> None:
-        """
-        Append a value for a key. Does not change or delete any existing
-        values for that key.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def entries(self) -> List[Tuple[str, bytes]]:
-        """
-        Retrieve the full set of keys and values in the Fields. Like the
-        constructor, the list represents each key-value pair.
-        
-        The outer list represents each key-value pair in the Fields. Keys
-        which have multiple values are represented by multiple entries in this
-        list with the same key.
-        """
-        raise NotImplementedError
-
-    def clone(self) -> Self:
-        """
-        Make a deep copy of the Fields. Equivelant in behavior to calling the
-        `fields` constructor on the return value of `entries`. The resulting
-        `fields` is mutable.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class FutureTrailers:
-    """
-    Represents a future which may eventaully return trailers, or an error.
-    
-    In the case that the incoming HTTP Request or Response did not have any
-    trailers, this future will resolve to the empty set of trailers once the
-    complete Request or Response body has been received.
-    """
-    
-    def subscribe(self) -> poll.Pollable:
-        """
-        Returns a pollable which becomes ready when either the trailers have
-        been received, or an error has occured. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-
-    def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
-        """
-        Returns the contents of the trailers, or an error which occured,
-        once the future is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the trailers or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the HTTP Request or Response
-        body, as well as any trailers, were received successfully, or that an
-        error occured receiving them. The optional `trailers` indicates whether
-        or not trailers were present in the body.
-        
-        When some `trailers` are returned by this method, the `trailers`
-        resource is immutable, and a child. Use of the `set`, `append`, or
-        `delete` methods will return an error, and the resource must be
-        dropped before the parent `future-trailers` is dropped.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class IncomingBody:
-    """
-    Represents an incoming HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, indicating that the full contents of the
-    body have been received. This resource represents the contents as
-    an `input-stream` and the delivery of trailers as a `future-trailers`,
-    and ensures that the user of this interface may only be consuming either
-    the body contents or waiting on trailers at any given time.
-    """
-    
-    def stream(self) -> streams.InputStream:
-        """
-        Returns the contents of the body, as a stream of bytes.
-        
-        Returns success on first call: the stream representing the contents
-        can be retrieved at most once. Subsequent calls will return error.
-        
-        The returned `input-stream` resource is a child: it must be dropped
-        before the parent `incoming-body` is dropped, or consumed by
-        `incoming-body.finish`.
-        
-        This invariant ensures that the implementation can determine whether
-        the user is consuming the contents of the body, waiting on the
-        `future-trailers` to be ready, or neither. This allows for network
-        backpressure is to be applied when the user is consuming the body,
-        and for that backpressure to not inhibit delivery of the trailers if
-        the user does not read the entire body.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def finish(cls, this: Self) -> FutureTrailers:
-        """
-        Takes ownership of `incoming-body`, and returns a `future-trailers`.
-        This function will trap if the `input-stream` child is still alive.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class IncomingRequest:
-    """
-    Represents an incoming HTTP Request.
-    """
-    
-    def method(self) -> Method:
-        """
-        Returns the method of the incoming request.
-        """
-        raise NotImplementedError
-
-    def path_with_query(self) -> Optional[str]:
-        """
-        Returns the path with query parameters from the request, as a string.
-        """
-        raise NotImplementedError
-
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Returns the protocol scheme from the request.
-        """
-        raise NotImplementedError
-
-    def authority(self) -> Optional[str]:
-        """
-        Returns the authority from the request, if it was present.
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Get the `headers` associated with the request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        The `headers` returned are a child resource: it must be dropped before
-        the parent `incoming-request` is dropped. Dropping this
-        `incoming-request` before all children are dropped will trap.
-        """
-        raise NotImplementedError
-
-    def consume(self) -> IncomingBody:
-        """
-        Gives the `incoming-body` associated with this request. Will only
-        return success at most once, and subsequent calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class OutgoingBody:
-    """
-    Represents an outgoing HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, inducating the full contents of the body
-    have been sent. This resource represents the contents as an
-    `output-stream` child resource, and the completion of the body (with
-    optional trailers) with a static function that consumes the
-    `outgoing-body` resource, and ensures that the user of this interface
-    may not write to the body contents after the body has been finished.
-    
-    If the user code drops this resource, as opposed to calling the static
-    method `finish`, the implementation should treat the body as incomplete,
-    and that an error has occured. The implementation should propogate this
-    error to the HTTP protocol by whatever means it has available,
-    including: corrupting the body on the wire, aborting the associated
-    Request, or sending a late status code for the Response.
-    """
-    
-    def write(self) -> streams.OutputStream:
-        """
-        Returns a stream for writing the body contents.
-        
-        The returned `output-stream` is a child resource: it must be dropped
-        before the parent `outgoing-body` resource is dropped (or finished),
-        otherwise the `outgoing-body` drop or `finish` will trap.
-        
-        Returns success on the first call: the `output-stream` resource for
-        this `outgoing-body` may be retrieved at most once. Subsequent calls
-        will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def finish(cls, this: Self, trailers: Optional[Fields]) -> None:
-        """
-        Finalize an outgoing body, optionally providing trailers. This must be
-        called to signal that the response is complete. If the `outgoing-body`
-        is dropped without calling `outgoing-body.finalize`, the implementation
-        should treat the body as corrupted.
-        
-        Fails if the body's `outgoing-request` or `outgoing-response` was
-        constructed with a Content-Length header, and the contents written
-        to the body (via `write`) does not match the value given in the
-        Content-Length.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class OutgoingRequest:
-    """
-    Represents an outgoing HTTP Request.
-    """
-    
-    def __init__(self, headers: Fields):
-        """
-        Construct a new `outgoing-request` with a default `method` of `GET`, and
-        `none` values for `path-with-query`, `scheme`, and `authority`.
-        
-        * `headers` is the HTTP Headers for the Request.
-        
-        It is possible to construct, or manipulate with the accessor functions
-        below, an `outgoing-request` with an invalid combination of `scheme`
-        and `authority`, or `headers` which are not permitted to be sent.
-        It is the obligation of the `outgoing-handler.handle` implementation
-        to reject invalid constructions of `outgoing-request`.
-        """
-        raise NotImplementedError
-
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this
-        Request.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-request` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def method(self) -> Method:
-        """
-        Get the Method for the Request.
-        """
-        raise NotImplementedError
-
-    def set_method(self, method: Method) -> None:
-        """
-        Set the Method for the Request. Fails if the string present in a
-        `method.other` argument is not a syntactically valid method.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def path_with_query(self) -> Optional[str]:
-        """
-        Get the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query.
-        """
-        raise NotImplementedError
-
-    def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-        """
-        Set the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query. Fails is the
-        string given is not a syntactically valid path and query uri component.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Get the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme.
-        """
-        raise NotImplementedError
-
-    def set_scheme(self, scheme: Optional[Scheme]) -> None:
-        """
-        Set the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme. Fails if the
-        string given is not a syntactically valid uri scheme.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def authority(self) -> Optional[str]:
-        """
-        Get the HTTP Authority for the Request. A value of `none` may be used
-        with Related Schemes which do not require an Authority. The HTTP and
-        HTTPS schemes always require an authority.
-        """
-        raise NotImplementedError
-
-    def set_authority(self, authority: Optional[str]) -> None:
-        """
-        Set the HTTP Authority for the Request. A value of `none` may be used
-        with Related Schemes which do not require an Authority. The HTTP and
-        HTTPS schemes always require an authority. Fails if the string given is
-        not a syntactically valid uri authority.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transfered to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class RequestOptions:
-    """
-    Parameters for making an HTTP Request. Each of these parameters is
-    currently an optional timeout applicable to the transport layer of the
-    HTTP protocol.
-    
-    These timeouts are separate from any the user may use to bound a
-    blocking call to `wasi:io/poll.poll`.
-    """
-    
-    def __init__(self):
-        """
-        Construct a default `request-options` value.
-        """
-        raise NotImplementedError
-
-    def connect_timeout(self) -> Optional[int]:
-        """
-        The timeout for the initial connect to the HTTP Server.
-        """
-        raise NotImplementedError
-
-    def set_connect_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for the initial connect to the HTTP Server. An error
-        return value indicates that this timeout is not supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def first_byte_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving the first byte of the Response body.
-        """
-        raise NotImplementedError
-
-    def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving the first byte of the Response body. An
-        error return value indicates that this timeout is not supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def between_bytes_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving subsequent chunks of bytes in the Response
-        body stream.
-        """
-        raise NotImplementedError
-
-    def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving subsequent chunks of bytes in the Response
-        body stream. An error return value indicates that this timeout is not
-        supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class OutgoingResponse:
-    """
-    Represents an outgoing HTTP Response.
-    """
-    
-    def __init__(self, headers: Fields):
-        """
-        Construct an `outgoing-response`, with a default `status-code` of `200`.
-        If a different `status-code` is needed, it must be set via the
-        `set-status-code` method.
-        
-        * `headers` is the HTTP Headers for the Response.
-        """
-        raise NotImplementedError
-
-    def status_code(self) -> int:
-        """
-        Get the HTTP Status Code for the Response.
-        """
-        raise NotImplementedError
-
-    def set_status_code(self, status_code: int) -> None:
-        """
-        Set the HTTP Status Code for the Response. Fails if the status-code
-        given is not a valid http status code.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transfered to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this Response.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-response` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class ResponseOutparam:
-    """
-    Represents the ability to send an HTTP Response.
-    
-    This resource is used by the `wasi:http/incoming-handler` interface to
-    allow a Response to be sent corresponding to the Request provided as the
-    other argument to `incoming-handler.handle`.
-    """
-    
-    @classmethod
-    def set(cls, param: Self, response: Result[OutgoingResponse, ErrorCode]) -> None:
-        """
-        Set the value of the `response-outparam` to either send a response,
-        or indicate an error.
-        
-        This method consumes the `response-outparam` to ensure that it is
-        called at most once. If it is never called, the implementation
-        will respond with an error.
-        
-        The user may provide an `error` to `response` to allow the
-        implementation determine how to respond with an HTTP error response.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class IncomingResponse:
-    """
-    Represents an incoming HTTP Response.
-    """
-    
-    def status(self) -> int:
-        """
-        Returns the status code from the incoming response.
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Returns the headers from the incoming response.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `incoming-response` is dropped.
-        """
-        raise NotImplementedError
-
-    def consume(self) -> IncomingBody:
-        """
-        Returns the incoming body. May be called at most once. Returns error
-        if called additional times.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-class FutureIncomingResponse:
-    """
-    Represents a future which may eventaully return an incoming HTTP
-    Response, or an error.
-    
-    This resource is returned by the `wasi:http/outgoing-handler` interface to
-    provide the HTTP Response corresponding to the sent Request.
-    """
-    
-    def subscribe(self) -> poll.Pollable:
-        """
-        Returns a pollable which becomes ready when either the Response has
-        been received, or an error has occured. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-
-    def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
-        """
-        Returns the incoming HTTP Response, or an error, once one is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the response or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the incoming HTTP Response
-        status and headers have recieved successfully, or that an error
-        occured. Errors may also occur while consuming the response body,
-        but those will be reported by the `incoming-body` and its
-        `output-stream` child.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-
-
-def http_error_code(err: error.Error) -> Optional[ErrorCode]:
-    """
-    Attempts to extract a http-related `error` from the wasi:io `error`
-    provided.
-    
-    Stream operations which return
-    `wasi:io/stream/stream-error::last-operation-failed` have a payload of
-    type `wasi:io/error/error` with more information about the operation
-    that failed. This payload can be passed through to this function to see
-    if there's http-related information about the error to return.
-    
-    Note that this function is fallible because not all io-errors are
-    http-related errors.
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var ErrorCode
-
- -
-
var HeaderError
-
-

This type enumerates the different kinds of errors that may occur when -setting or appending to a fields resource.

-
-
var Method
-
-

This type corresponds to HTTP standard Methods.

-
-
var Scheme
-
-

This type corresponds to HTTP standard Related Schemes.

-
-
-
-
-

Functions

-
-
-def http_error_code(err: Error) ‑> Union[ErrorCodeDnsTimeoutErrorCodeDnsErrorErrorCodeDestinationNotFoundErrorCodeDestinationUnavailableErrorCodeDestinationIpProhibitedErrorCodeDestinationIpUnroutableErrorCodeConnectionRefusedErrorCodeConnectionTerminatedErrorCodeConnectionTimeoutErrorCodeConnectionReadTimeoutErrorCodeConnectionWriteTimeoutErrorCodeConnectionLimitReachedErrorCodeTlsProtocolErrorErrorCodeTlsCertificateErrorErrorCodeTlsAlertReceivedErrorCodeHttpRequestDeniedErrorCodeHttpRequestLengthRequiredErrorCodeHttpRequestBodySizeErrorCodeHttpRequestMethodInvalidErrorCodeHttpRequestUriInvalidErrorCodeHttpRequestUriTooLongErrorCodeHttpRequestHeaderSectionSizeErrorCodeHttpRequestHeaderSizeErrorCodeHttpRequestTrailerSectionSizeErrorCodeHttpRequestTrailerSizeErrorCodeHttpResponseIncompleteErrorCodeHttpResponseHeaderSectionSizeErrorCodeHttpResponseHeaderSizeErrorCodeHttpResponseBodySizeErrorCodeHttpResponseTrailerSectionSizeErrorCodeHttpResponseTrailerSizeErrorCodeHttpResponseTransferCodingErrorCodeHttpResponseContentCodingErrorCodeHttpResponseTimeoutErrorCodeHttpUpgradeFailedErrorCodeHttpProtocolErrorErrorCodeLoopDetectedErrorCodeConfigurationErrorErrorCodeInternalError, ForwardRef(None)] -
-
-

Attempts to extract a http-related error from the wasi:io error -provided.

-

Stream operations which return -wasi:io/stream/stream-error::last-operation-failed have a payload of -type wasi:io/error/error with more information about the operation -that failed. This payload can be passed through to this function to see -if there's http-related information about the error to return.

-

Note that this function is fallible because not all io-errors are -http-related errors.

-
- -Expand source code - -
def http_error_code(err: error.Error) -> Optional[ErrorCode]:
-    """
-    Attempts to extract a http-related `error` from the wasi:io `error`
-    provided.
-    
-    Stream operations which return
-    `wasi:io/stream/stream-error::last-operation-failed` have a payload of
-    type `wasi:io/error/error` with more information about the operation
-    that failed. This payload can be passed through to this function to see
-    if there's http-related information about the error to return.
-    
-    Note that this function is fallible because not all io-errors are
-    http-related errors.
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Classes

-
-
-class DnsErrorPayload -(rcode: Optional[str], info_code: Optional[int]) -
-
-

Defines the case payload type for DNS-error above:

-
- -Expand source code - -
@dataclass
-class DnsErrorPayload:
-    """
-    Defines the case payload type for `DNS-error` above:
-    """
-    rcode: Optional[str]
-    info_code: Optional[int]
-
-

Class variables

-
-
var info_code : Optional[int]
-
-
-
-
var rcode : Optional[str]
-
-
-
-
-
-
-class ErrorCodeConfigurationError -
-
-

ErrorCodeConfigurationError()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConfigurationError:
-    pass
-
-
-
-class ErrorCodeConnectionLimitReached -
-
-

ErrorCodeConnectionLimitReached()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConnectionLimitReached:
-    pass
-
-
-
-class ErrorCodeConnectionReadTimeout -
-
-

ErrorCodeConnectionReadTimeout()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConnectionReadTimeout:
-    pass
-
-
-
-class ErrorCodeConnectionRefused -
-
-

ErrorCodeConnectionRefused()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConnectionRefused:
-    pass
-
-
-
-class ErrorCodeConnectionTerminated -
-
-

ErrorCodeConnectionTerminated()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConnectionTerminated:
-    pass
-
-
-
-class ErrorCodeConnectionTimeout -
-
-

ErrorCodeConnectionTimeout()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConnectionTimeout:
-    pass
-
-
-
-class ErrorCodeConnectionWriteTimeout -
-
-

ErrorCodeConnectionWriteTimeout()

-
- -Expand source code - -
@dataclass
-class ErrorCodeConnectionWriteTimeout:
-    pass
-
-
-
-class ErrorCodeDestinationIpProhibited -
-
-

ErrorCodeDestinationIpProhibited()

-
- -Expand source code - -
@dataclass
-class ErrorCodeDestinationIpProhibited:
-    pass
-
-
-
-class ErrorCodeDestinationIpUnroutable -
-
-

ErrorCodeDestinationIpUnroutable()

-
- -Expand source code - -
@dataclass
-class ErrorCodeDestinationIpUnroutable:
-    pass
-
-
-
-class ErrorCodeDestinationNotFound -
-
-

ErrorCodeDestinationNotFound()

-
- -Expand source code - -
@dataclass
-class ErrorCodeDestinationNotFound:
-    pass
-
-
-
-class ErrorCodeDestinationUnavailable -
-
-

ErrorCodeDestinationUnavailable()

-
- -Expand source code - -
@dataclass
-class ErrorCodeDestinationUnavailable:
-    pass
-
-
-
-class ErrorCodeDnsError -(value: DnsErrorPayload) -
-
-

ErrorCodeDnsError(value: spin_sdk.wit.imports.types.DnsErrorPayload)

-
- -Expand source code - -
@dataclass
-class ErrorCodeDnsError:
-    value: DnsErrorPayload
-
-

Class variables

-
-
var valueDnsErrorPayload
-
-
-
-
-
-
-class ErrorCodeDnsTimeout -
-
-

ErrorCodeDnsTimeout()

-
- -Expand source code - -
@dataclass
-class ErrorCodeDnsTimeout:
-    pass
-
-
-
-class ErrorCodeHttpProtocolError -
-
-

ErrorCodeHttpProtocolError()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpProtocolError:
-    pass
-
-
-
-class ErrorCodeHttpRequestBodySize -(value: Optional[int]) -
-
-

ErrorCodeHttpRequestBodySize(value: Optional[int])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestBodySize:
-    value: Optional[int]
-
-

Class variables

-
-
var value : Optional[int]
-
-
-
-
-
-
-class ErrorCodeHttpRequestDenied -
-
-

ErrorCodeHttpRequestDenied()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestDenied:
-    pass
-
-
-
-class ErrorCodeHttpRequestHeaderSectionSize -(value: Optional[int]) -
-
-

ErrorCodeHttpRequestHeaderSectionSize(value: Optional[int])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestHeaderSectionSize:
-    value: Optional[int]
-
-

Class variables

-
-
var value : Optional[int]
-
-
-
-
-
-
-class ErrorCodeHttpRequestHeaderSize -(value: Optional[FieldSizePayload]) -
-
-

ErrorCodeHttpRequestHeaderSize(value: Optional[spin_sdk.wit.imports.types.FieldSizePayload])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestHeaderSize:
-    value: Optional[FieldSizePayload]
-
-

Class variables

-
-
var value : Optional[FieldSizePayload]
-
-
-
-
-
-
-class ErrorCodeHttpRequestLengthRequired -
-
-

ErrorCodeHttpRequestLengthRequired()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestLengthRequired:
-    pass
-
-
-
-class ErrorCodeHttpRequestMethodInvalid -
-
-

ErrorCodeHttpRequestMethodInvalid()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestMethodInvalid:
-    pass
-
-
-
-class ErrorCodeHttpRequestTrailerSectionSize -(value: Optional[int]) -
-
-

ErrorCodeHttpRequestTrailerSectionSize(value: Optional[int])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestTrailerSectionSize:
-    value: Optional[int]
-
-

Class variables

-
-
var value : Optional[int]
-
-
-
-
-
-
-class ErrorCodeHttpRequestTrailerSize -(value: FieldSizePayload) -
-
-

ErrorCodeHttpRequestTrailerSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestTrailerSize:
-    value: FieldSizePayload
-
-

Class variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCodeHttpRequestUriInvalid -
-
-

ErrorCodeHttpRequestUriInvalid()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestUriInvalid:
-    pass
-
-
-
-class ErrorCodeHttpRequestUriTooLong -
-
-

ErrorCodeHttpRequestUriTooLong()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpRequestUriTooLong:
-    pass
-
-
-
-class ErrorCodeHttpResponseBodySize -(value: Optional[int]) -
-
-

ErrorCodeHttpResponseBodySize(value: Optional[int])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseBodySize:
-    value: Optional[int]
-
-

Class variables

-
-
var value : Optional[int]
-
-
-
-
-
-
-class ErrorCodeHttpResponseContentCoding -(value: Optional[str]) -
-
-

ErrorCodeHttpResponseContentCoding(value: Optional[str])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseContentCoding:
-    value: Optional[str]
-
-

Class variables

-
-
var value : Optional[str]
-
-
-
-
-
-
-class ErrorCodeHttpResponseHeaderSectionSize -(value: Optional[int]) -
-
-

ErrorCodeHttpResponseHeaderSectionSize(value: Optional[int])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseHeaderSectionSize:
-    value: Optional[int]
-
-

Class variables

-
-
var value : Optional[int]
-
-
-
-
-
-
-class ErrorCodeHttpResponseHeaderSize -(value: FieldSizePayload) -
-
-

ErrorCodeHttpResponseHeaderSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseHeaderSize:
-    value: FieldSizePayload
-
-

Class variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCodeHttpResponseIncomplete -
-
-

ErrorCodeHttpResponseIncomplete()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseIncomplete:
-    pass
-
-
-
-class ErrorCodeHttpResponseTimeout -
-
-

ErrorCodeHttpResponseTimeout()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseTimeout:
-    pass
-
-
-
-class ErrorCodeHttpResponseTrailerSectionSize -(value: Optional[int]) -
-
-

ErrorCodeHttpResponseTrailerSectionSize(value: Optional[int])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseTrailerSectionSize:
-    value: Optional[int]
-
-

Class variables

-
-
var value : Optional[int]
-
-
-
-
-
-
-class ErrorCodeHttpResponseTrailerSize -(value: FieldSizePayload) -
-
-

ErrorCodeHttpResponseTrailerSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseTrailerSize:
-    value: FieldSizePayload
-
-

Class variables

-
-
var valueFieldSizePayload
-
-
-
-
-
-
-class ErrorCodeHttpResponseTransferCoding -(value: Optional[str]) -
-
-

ErrorCodeHttpResponseTransferCoding(value: Optional[str])

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpResponseTransferCoding:
-    value: Optional[str]
-
-

Class variables

-
-
var value : Optional[str]
-
-
-
-
-
-
-class ErrorCodeHttpUpgradeFailed -
-
-

ErrorCodeHttpUpgradeFailed()

-
- -Expand source code - -
@dataclass
-class ErrorCodeHttpUpgradeFailed:
-    pass
-
-
-
-class ErrorCodeInternalError -(value: Optional[str]) -
-
-

ErrorCodeInternalError(value: Optional[str])

-
- -Expand source code - -
@dataclass
-class ErrorCodeInternalError:
-    value: Optional[str]
-
-

Class variables

-
-
var value : Optional[str]
-
-
-
-
-
-
-class ErrorCodeLoopDetected -
-
-

ErrorCodeLoopDetected()

-
- -Expand source code - -
@dataclass
-class ErrorCodeLoopDetected:
-    pass
-
-
-
-class ErrorCodeTlsAlertReceived -(value: TlsAlertReceivedPayload) -
-
-

ErrorCodeTlsAlertReceived(value: spin_sdk.wit.imports.types.TlsAlertReceivedPayload)

-
- -Expand source code - -
@dataclass
-class ErrorCodeTlsAlertReceived:
-    value: TlsAlertReceivedPayload
-
-

Class variables

-
-
var valueTlsAlertReceivedPayload
-
-
-
-
-
-
-class ErrorCodeTlsCertificateError -
-
-

ErrorCodeTlsCertificateError()

-
- -Expand source code - -
@dataclass
-class ErrorCodeTlsCertificateError:
-    pass
-
-
-
-class ErrorCodeTlsProtocolError -
-
-

ErrorCodeTlsProtocolError()

-
- -Expand source code - -
@dataclass
-class ErrorCodeTlsProtocolError:
-    pass
-
-
-
-class FieldSizePayload -(field_name: Optional[str], field_size: Optional[int]) -
-
-

Defines the case payload type for HTTP-response-{header,trailer}-size above:

-
- -Expand source code - -
@dataclass
-class FieldSizePayload:
-    """
-    Defines the case payload type for `HTTP-response-{header,trailer}-size` above:
-    """
-    field_name: Optional[str]
-    field_size: Optional[int]
-
-

Class variables

-
-
var field_name : Optional[str]
-
-
-
-
var field_size : Optional[int]
-
-
-
-
-
-
-class Fields -
-
-

This following block defines the fields resource which corresponds to -HTTP standard Fields. Fields are a common representation used for both -Headers and Trailers.

-

A fields may be mutable or immutable. A fields created using the -constructor, from-list, or clone will be mutable, but a fields -resource given by other means (including, but not limited to, -incoming-request.headers, outgoing-request.headers) might be be -immutable. In an immutable fields, the set, append, and delete -operations will fail with header-error.immutable.

-

Construct an empty HTTP Fields.

-

The resulting fields is mutable.

-
- -Expand source code - -
class Fields:
-    """
-    This following block defines the `fields` resource which corresponds to
-    HTTP standard Fields. Fields are a common representation used for both
-    Headers and Trailers.
-    
-    A `fields` may be mutable or immutable. A `fields` created using the
-    constructor, `from-list`, or `clone` will be mutable, but a `fields`
-    resource given by other means (including, but not limited to,
-    `incoming-request.headers`, `outgoing-request.headers`) might be be
-    immutable. In an immutable fields, the `set`, `append`, and `delete`
-    operations will fail with `header-error.immutable`.
-    """
-    
-    def __init__(self):
-        """
-        Construct an empty HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def from_list(cls, entries: List[Tuple[str, bytes]]) -> Self:
-        """
-        Construct an HTTP Fields.
-        
-        The resulting `fields` is mutable.
-        
-        The list represents each key-value pair in the Fields. Keys
-        which have multiple values are represented by multiple entries in this
-        list with the same key.
-        
-        The tuple is a pair of the field key, represented as a string, and
-        Value, represented as a list of bytes. In a valid Fields, all keys
-        and values are valid UTF-8 strings. However, values are not always
-        well-formed, so they are represented as a raw list of bytes.
-        
-        An error result will be returned if any header or value was
-        syntactically invalid, or if a header was forbidden.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def get(self, name: str) -> List[bytes]:
-        """
-        Get all of the values corresponding to a key. If the key is not present
-        in this `fields`, an empty list is returned. However, if the key is
-        present but empty, this is represented by a list with one or more
-        empty field-values present.
-        """
-        raise NotImplementedError
-
-    def has(self, name: str) -> int:
-        """
-        Returns `true` when the key is present in this `fields`. If the key is
-        syntactically invalid, `false` is returned.
-        """
-        raise NotImplementedError
-
-    def set(self, name: str, value: List[bytes]) -> None:
-        """
-        Set all of the values for a key. Clears any existing values for that
-        key, if they have been set.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def delete(self, name: str) -> None:
-        """
-        Delete all values for a key. Does nothing if no values for the key
-        exist.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def append(self, name: str, value: bytes) -> None:
-        """
-        Append a value for a key. Does not change or delete any existing
-        values for that key.
-        
-        Fails with `header-error.immutable` if the `fields` are immutable.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-        """
-        raise NotImplementedError
-
-    def entries(self) -> List[Tuple[str, bytes]]:
-        """
-        Retrieve the full set of keys and values in the Fields. Like the
-        constructor, the list represents each key-value pair.
-        
-        The outer list represents each key-value pair in the Fields. Keys
-        which have multiple values are represented by multiple entries in this
-        list with the same key.
-        """
-        raise NotImplementedError
-
-    def clone(self) -> Self:
-        """
-        Make a deep copy of the Fields. Equivelant in behavior to calling the
-        `fields` constructor on the return value of `entries`. The resulting
-        `fields` is mutable.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def from_list(entries: List[Tuple[str, bytes]]) ‑> Self -
-
-

Construct an HTTP Fields.

-

The resulting fields is mutable.

-

The list represents each key-value pair in the Fields. Keys -which have multiple values are represented by multiple entries in this -list with the same key.

-

The tuple is a pair of the field key, represented as a string, and -Value, represented as a list of bytes. In a valid Fields, all keys -and values are valid UTF-8 strings. However, values are not always -well-formed, so they are represented as a raw list of bytes.

-

An error result will be returned if any header or value was -syntactically invalid, or if a header was forbidden.

-

Raises: Err(HeaderError)

-
- -Expand source code - -
@classmethod
-def from_list(cls, entries: List[Tuple[str, bytes]]) -> Self:
-    """
-    Construct an HTTP Fields.
-    
-    The resulting `fields` is mutable.
-    
-    The list represents each key-value pair in the Fields. Keys
-    which have multiple values are represented by multiple entries in this
-    list with the same key.
-    
-    The tuple is a pair of the field key, represented as a string, and
-    Value, represented as a list of bytes. In a valid Fields, all keys
-    and values are valid UTF-8 strings. However, values are not always
-    well-formed, so they are represented as a raw list of bytes.
-    
-    An error result will be returned if any header or value was
-    syntactically invalid, or if a header was forbidden.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def append(self, name: str, value: bytes) ‑> None -
-
-

Append a value for a key. Does not change or delete any existing -values for that key.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: Err(HeaderError)

-
- -Expand source code - -
def append(self, name: str, value: bytes) -> None:
-    """
-    Append a value for a key. Does not change or delete any existing
-    values for that key.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-    """
-    raise NotImplementedError
-
-
-
-def clone(self) ‑> Self -
-
-

Make a deep copy of the Fields. Equivelant in behavior to calling the -fields constructor on the return value of entries. The resulting -fields is mutable.

-
- -Expand source code - -
def clone(self) -> Self:
-    """
-    Make a deep copy of the Fields. Equivelant in behavior to calling the
-    `fields` constructor on the return value of `entries`. The resulting
-    `fields` is mutable.
-    """
-    raise NotImplementedError
-
-
-
-def delete(self, name: str) ‑> None -
-
-

Delete all values for a key. Does nothing if no values for the key -exist.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: Err(HeaderError)

-
- -Expand source code - -
def delete(self, name: str) -> None:
-    """
-    Delete all values for a key. Does nothing if no values for the key
-    exist.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-    """
-    raise NotImplementedError
-
-
-
-def entries(self) ‑> List[Tuple[str, bytes]] -
-
-

Retrieve the full set of keys and values in the Fields. Like the -constructor, the list represents each key-value pair.

-

The outer list represents each key-value pair in the Fields. Keys -which have multiple values are represented by multiple entries in this -list with the same key.

-
- -Expand source code - -
def entries(self) -> List[Tuple[str, bytes]]:
-    """
-    Retrieve the full set of keys and values in the Fields. Like the
-    constructor, the list represents each key-value pair.
-    
-    The outer list represents each key-value pair in the Fields. Keys
-    which have multiple values are represented by multiple entries in this
-    list with the same key.
-    """
-    raise NotImplementedError
-
-
-
-def get(self, name: str) ‑> List[bytes] -
-
-

Get all of the values corresponding to a key. If the key is not present -in this fields, an empty list is returned. However, if the key is -present but empty, this is represented by a list with one or more -empty field-values present.

-
- -Expand source code - -
def get(self, name: str) -> List[bytes]:
-    """
-    Get all of the values corresponding to a key. If the key is not present
-    in this `fields`, an empty list is returned. However, if the key is
-    present but empty, this is represented by a list with one or more
-    empty field-values present.
-    """
-    raise NotImplementedError
-
-
-
-def has(self, name: str) ‑> int -
-
-

Returns true when the key is present in this fields. If the key is -syntactically invalid, false is returned.

-
- -Expand source code - -
def has(self, name: str) -> int:
-    """
-    Returns `true` when the key is present in this `fields`. If the key is
-    syntactically invalid, `false` is returned.
-    """
-    raise NotImplementedError
-
-
-
-def set(self, name: str, value: List[bytes]) ‑> None -
-
-

Set all of the values for a key. Clears any existing values for that -key, if they have been set.

-

Fails with header-error.immutable if the fields are immutable.

-

Raises: Err(HeaderError)

-
- -Expand source code - -
def set(self, name: str, value: List[bytes]) -> None:
-    """
-    Set all of the values for a key. Clears any existing values for that
-    key, if they have been set.
-    
-    Fails with `header-error.immutable` if the `fields` are immutable.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class FutureIncomingResponse -
-
-

Represents a future which may eventaully return an incoming HTTP -Response, or an error.

-

This resource is returned by the wasi:http/outgoing-handler interface to -provide the HTTP Response corresponding to the sent Request.

-
- -Expand source code - -
class FutureIncomingResponse:
-    """
-    Represents a future which may eventaully return an incoming HTTP
-    Response, or an error.
-    
-    This resource is returned by the `wasi:http/outgoing-handler` interface to
-    provide the HTTP Response corresponding to the sent Request.
-    """
-    
-    def subscribe(self) -> poll.Pollable:
-        """
-        Returns a pollable which becomes ready when either the Response has
-        been received, or an error has occured. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-
-    def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
-        """
-        Returns the incoming HTTP Response, or an error, once one is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the response or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the incoming HTTP Response
-        status and headers have recieved successfully, or that an error
-        occured. Errors may also occur while consuming the response body,
-        but those will be reported by the `incoming-body` and its
-        `output-stream` child.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def get(self) ‑> Union[Ok[Union[Ok[IncomingResponse], Err[Union[ErrorCodeDnsTimeoutErrorCodeDnsErrorErrorCodeDestinationNotFoundErrorCodeDestinationUnavailableErrorCodeDestinationIpProhibitedErrorCodeDestinationIpUnroutableErrorCodeConnectionRefusedErrorCodeConnectionTerminatedErrorCodeConnectionTimeoutErrorCodeConnectionReadTimeoutErrorCodeConnectionWriteTimeoutErrorCodeConnectionLimitReachedErrorCodeTlsProtocolErrorErrorCodeTlsCertificateErrorErrorCodeTlsAlertReceivedErrorCodeHttpRequestDeniedErrorCodeHttpRequestLengthRequiredErrorCodeHttpRequestBodySizeErrorCodeHttpRequestMethodInvalidErrorCodeHttpRequestUriInvalidErrorCodeHttpRequestUriTooLongErrorCodeHttpRequestHeaderSectionSizeErrorCodeHttpRequestHeaderSizeErrorCodeHttpRequestTrailerSectionSizeErrorCodeHttpRequestTrailerSizeErrorCodeHttpResponseIncompleteErrorCodeHttpResponseHeaderSectionSizeErrorCodeHttpResponseHeaderSizeErrorCodeHttpResponseBodySizeErrorCodeHttpResponseTrailerSectionSizeErrorCodeHttpResponseTrailerSizeErrorCodeHttpResponseTransferCodingErrorCodeHttpResponseContentCodingErrorCodeHttpResponseTimeoutErrorCodeHttpUpgradeFailedErrorCodeHttpProtocolErrorErrorCodeLoopDetectedErrorCodeConfigurationErrorErrorCodeInternalError]]]], Err[None], ForwardRef(None)] -
-
-

Returns the incoming HTTP Response, or an error, once one is ready.

-

The outer option represents future readiness. Users can wait on this -option to become some using the subscribe method.

-

The outer result is used to retrieve the response or error at most -once. It will be success on the first call in which the outer option -is some, and error on subsequent calls.

-

The inner result represents that either the incoming HTTP Response -status and headers have recieved successfully, or that an error -occured. Errors may also occur while consuming the response body, -but those will be reported by the incoming-body and its -output-stream child.

-
- -Expand source code - -
def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
-    """
-    Returns the incoming HTTP Response, or an error, once one is ready.
-    
-    The outer `option` represents future readiness. Users can wait on this
-    `option` to become `some` using the `subscribe` method.
-    
-    The outer `result` is used to retrieve the response or error at most
-    once. It will be success on the first call in which the outer option
-    is `some`, and error on subsequent calls.
-    
-    The inner `result` represents that either the incoming HTTP Response
-    status and headers have recieved successfully, or that an error
-    occured. Errors may also occur while consuming the response body,
-    but those will be reported by the `incoming-body` and its
-    `output-stream` child.
-    """
-    raise NotImplementedError
-
-
-
-def subscribe(self) ‑> Pollable -
-
-

Returns a pollable which becomes ready when either the Response has -been received, or an error has occured. When this pollable is ready, -the get method will return some.

-
- -Expand source code - -
def subscribe(self) -> poll.Pollable:
-    """
-    Returns a pollable which becomes ready when either the Response has
-    been received, or an error has occured. When this pollable is ready,
-    the `get` method will return `some`.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class FutureTrailers -
-
-

Represents a future which may eventaully return trailers, or an error.

-

In the case that the incoming HTTP Request or Response did not have any -trailers, this future will resolve to the empty set of trailers once the -complete Request or Response body has been received.

-
- -Expand source code - -
class FutureTrailers:
-    """
-    Represents a future which may eventaully return trailers, or an error.
-    
-    In the case that the incoming HTTP Request or Response did not have any
-    trailers, this future will resolve to the empty set of trailers once the
-    complete Request or Response body has been received.
-    """
-    
-    def subscribe(self) -> poll.Pollable:
-        """
-        Returns a pollable which becomes ready when either the trailers have
-        been received, or an error has occured. When this pollable is ready,
-        the `get` method will return `some`.
-        """
-        raise NotImplementedError
-
-    def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
-        """
-        Returns the contents of the trailers, or an error which occured,
-        once the future is ready.
-        
-        The outer `option` represents future readiness. Users can wait on this
-        `option` to become `some` using the `subscribe` method.
-        
-        The outer `result` is used to retrieve the trailers or error at most
-        once. It will be success on the first call in which the outer option
-        is `some`, and error on subsequent calls.
-        
-        The inner `result` represents that either the HTTP Request or Response
-        body, as well as any trailers, were received successfully, or that an
-        error occured receiving them. The optional `trailers` indicates whether
-        or not trailers were present in the body.
-        
-        When some `trailers` are returned by this method, the `trailers`
-        resource is immutable, and a child. Use of the `set`, `append`, or
-        `delete` methods will return an error, and the resource must be
-        dropped before the parent `future-trailers` is dropped.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def get(self) ‑> Union[Ok[Union[Ok[Optional[Fields]], Err[Union[ErrorCodeDnsTimeoutErrorCodeDnsErrorErrorCodeDestinationNotFoundErrorCodeDestinationUnavailableErrorCodeDestinationIpProhibitedErrorCodeDestinationIpUnroutableErrorCodeConnectionRefusedErrorCodeConnectionTerminatedErrorCodeConnectionTimeoutErrorCodeConnectionReadTimeoutErrorCodeConnectionWriteTimeoutErrorCodeConnectionLimitReachedErrorCodeTlsProtocolErrorErrorCodeTlsCertificateErrorErrorCodeTlsAlertReceivedErrorCodeHttpRequestDeniedErrorCodeHttpRequestLengthRequiredErrorCodeHttpRequestBodySizeErrorCodeHttpRequestMethodInvalidErrorCodeHttpRequestUriInvalidErrorCodeHttpRequestUriTooLongErrorCodeHttpRequestHeaderSectionSizeErrorCodeHttpRequestHeaderSizeErrorCodeHttpRequestTrailerSectionSizeErrorCodeHttpRequestTrailerSizeErrorCodeHttpResponseIncompleteErrorCodeHttpResponseHeaderSectionSizeErrorCodeHttpResponseHeaderSizeErrorCodeHttpResponseBodySizeErrorCodeHttpResponseTrailerSectionSizeErrorCodeHttpResponseTrailerSizeErrorCodeHttpResponseTransferCodingErrorCodeHttpResponseContentCodingErrorCodeHttpResponseTimeoutErrorCodeHttpUpgradeFailedErrorCodeHttpProtocolErrorErrorCodeLoopDetectedErrorCodeConfigurationErrorErrorCodeInternalError]]]], Err[None], ForwardRef(None)] -
-
-

Returns the contents of the trailers, or an error which occured, -once the future is ready.

-

The outer option represents future readiness. Users can wait on this -option to become some using the subscribe method.

-

The outer result is used to retrieve the trailers or error at most -once. It will be success on the first call in which the outer option -is some, and error on subsequent calls.

-

The inner result represents that either the HTTP Request or Response -body, as well as any trailers, were received successfully, or that an -error occured receiving them. The optional trailers indicates whether -or not trailers were present in the body.

-

When some trailers are returned by this method, the trailers -resource is immutable, and a child. Use of the set, append, or -delete methods will return an error, and the resource must be -dropped before the parent future-trailers is dropped.

-
- -Expand source code - -
def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
-    """
-    Returns the contents of the trailers, or an error which occured,
-    once the future is ready.
-    
-    The outer `option` represents future readiness. Users can wait on this
-    `option` to become `some` using the `subscribe` method.
-    
-    The outer `result` is used to retrieve the trailers or error at most
-    once. It will be success on the first call in which the outer option
-    is `some`, and error on subsequent calls.
-    
-    The inner `result` represents that either the HTTP Request or Response
-    body, as well as any trailers, were received successfully, or that an
-    error occured receiving them. The optional `trailers` indicates whether
-    or not trailers were present in the body.
-    
-    When some `trailers` are returned by this method, the `trailers`
-    resource is immutable, and a child. Use of the `set`, `append`, or
-    `delete` methods will return an error, and the resource must be
-    dropped before the parent `future-trailers` is dropped.
-    """
-    raise NotImplementedError
-
-
-
-def subscribe(self) ‑> Pollable -
-
-

Returns a pollable which becomes ready when either the trailers have -been received, or an error has occured. When this pollable is ready, -the get method will return some.

-
- -Expand source code - -
def subscribe(self) -> poll.Pollable:
-    """
-    Returns a pollable which becomes ready when either the trailers have
-    been received, or an error has occured. When this pollable is ready,
-    the `get` method will return `some`.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class HeaderErrorForbidden -
-
-

HeaderErrorForbidden()

-
- -Expand source code - -
@dataclass
-class HeaderErrorForbidden:
-    pass
-
-
-
-class HeaderErrorImmutable -
-
-

HeaderErrorImmutable()

-
- -Expand source code - -
@dataclass
-class HeaderErrorImmutable:
-    pass
-
-
-
-class HeaderErrorInvalidSyntax -
-
-

HeaderErrorInvalidSyntax()

-
- -Expand source code - -
@dataclass
-class HeaderErrorInvalidSyntax:
-    pass
-
-
-
-class IncomingBody -
-
-

Represents an incoming HTTP Request or Response's Body.

-

A body has both its contents - a stream of bytes - and a (possibly -empty) set of trailers, indicating that the full contents of the -body have been received. This resource represents the contents as -an input-stream and the delivery of trailers as a future-trailers, -and ensures that the user of this interface may only be consuming either -the body contents or waiting on trailers at any given time.

-
- -Expand source code - -
class IncomingBody:
-    """
-    Represents an incoming HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, indicating that the full contents of the
-    body have been received. This resource represents the contents as
-    an `input-stream` and the delivery of trailers as a `future-trailers`,
-    and ensures that the user of this interface may only be consuming either
-    the body contents or waiting on trailers at any given time.
-    """
-    
-    def stream(self) -> streams.InputStream:
-        """
-        Returns the contents of the body, as a stream of bytes.
-        
-        Returns success on first call: the stream representing the contents
-        can be retrieved at most once. Subsequent calls will return error.
-        
-        The returned `input-stream` resource is a child: it must be dropped
-        before the parent `incoming-body` is dropped, or consumed by
-        `incoming-body.finish`.
-        
-        This invariant ensures that the implementation can determine whether
-        the user is consuming the contents of the body, waiting on the
-        `future-trailers` to be ready, or neither. This allows for network
-        backpressure is to be applied when the user is consuming the body,
-        and for that backpressure to not inhibit delivery of the trailers if
-        the user does not read the entire body.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def finish(cls, this: Self) -> FutureTrailers:
-        """
-        Takes ownership of `incoming-body`, and returns a `future-trailers`.
-        This function will trap if the `input-stream` child is still alive.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def finish(this: Self) ‑> FutureTrailers -
-
-

Takes ownership of incoming-body, and returns a future-trailers. -This function will trap if the input-stream child is still alive.

-
- -Expand source code - -
@classmethod
-def finish(cls, this: Self) -> FutureTrailers:
-    """
-    Takes ownership of `incoming-body`, and returns a `future-trailers`.
-    This function will trap if the `input-stream` child is still alive.
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def stream(self) ‑> InputStream -
-
-

Returns the contents of the body, as a stream of bytes.

-

Returns success on first call: the stream representing the contents -can be retrieved at most once. Subsequent calls will return error.

-

The returned input-stream resource is a child: it must be dropped -before the parent incoming-body is dropped, or consumed by -incoming-body.finish.

-

This invariant ensures that the implementation can determine whether -the user is consuming the contents of the body, waiting on the -future-trailers to be ready, or neither. This allows for network -backpressure is to be applied when the user is consuming the body, -and for that backpressure to not inhibit delivery of the trailers if -the user does not read the entire body.

-

Raises: Err(None)

-
- -Expand source code - -
def stream(self) -> streams.InputStream:
-    """
-    Returns the contents of the body, as a stream of bytes.
-    
-    Returns success on first call: the stream representing the contents
-    can be retrieved at most once. Subsequent calls will return error.
-    
-    The returned `input-stream` resource is a child: it must be dropped
-    before the parent `incoming-body` is dropped, or consumed by
-    `incoming-body.finish`.
-    
-    This invariant ensures that the implementation can determine whether
-    the user is consuming the contents of the body, waiting on the
-    `future-trailers` to be ready, or neither. This allows for network
-    backpressure is to be applied when the user is consuming the body,
-    and for that backpressure to not inhibit delivery of the trailers if
-    the user does not read the entire body.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class IncomingRequest -
-
-

Represents an incoming HTTP Request.

-
- -Expand source code - -
class IncomingRequest:
-    """
-    Represents an incoming HTTP Request.
-    """
-    
-    def method(self) -> Method:
-        """
-        Returns the method of the incoming request.
-        """
-        raise NotImplementedError
-
-    def path_with_query(self) -> Optional[str]:
-        """
-        Returns the path with query parameters from the request, as a string.
-        """
-        raise NotImplementedError
-
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Returns the protocol scheme from the request.
-        """
-        raise NotImplementedError
-
-    def authority(self) -> Optional[str]:
-        """
-        Returns the authority from the request, if it was present.
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Get the `headers` associated with the request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        The `headers` returned are a child resource: it must be dropped before
-        the parent `incoming-request` is dropped. Dropping this
-        `incoming-request` before all children are dropped will trap.
-        """
-        raise NotImplementedError
-
-    def consume(self) -> IncomingBody:
-        """
-        Gives the `incoming-body` associated with this request. Will only
-        return success at most once, and subsequent calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def authority(self) ‑> Optional[str] -
-
-

Returns the authority from the request, if it was present.

-
- -Expand source code - -
def authority(self) -> Optional[str]:
-    """
-    Returns the authority from the request, if it was present.
-    """
-    raise NotImplementedError
-
-
-
-def consume(self) ‑> IncomingBody -
-
-

Gives the incoming-body associated with this request. Will only -return success at most once, and subsequent calls will return error.

-

Raises: Err(None)

-
- -Expand source code - -
def consume(self) -> IncomingBody:
-    """
-    Gives the `incoming-body` associated with this request. Will only
-    return success at most once, and subsequent calls will return error.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def headers(self) ‑> Fields -
-
-

Get the headers associated with the request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

The headers returned are a child resource: it must be dropped before -the parent incoming-request is dropped. Dropping this -incoming-request before all children are dropped will trap.

-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the `headers` associated with the request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    The `headers` returned are a child resource: it must be dropped before
-    the parent `incoming-request` is dropped. Dropping this
-    `incoming-request` before all children are dropped will trap.
-    """
-    raise NotImplementedError
-
-
-
-def method(self) ‑> Union[MethodGetMethodHeadMethodPostMethodPutMethodDeleteMethodConnectMethodOptionsMethodTraceMethodPatchMethodOther] -
-
-

Returns the method of the incoming request.

-
- -Expand source code - -
def method(self) -> Method:
-    """
-    Returns the method of the incoming request.
-    """
-    raise NotImplementedError
-
-
-
-def path_with_query(self) ‑> Optional[str] -
-
-

Returns the path with query parameters from the request, as a string.

-
- -Expand source code - -
def path_with_query(self) -> Optional[str]:
-    """
-    Returns the path with query parameters from the request, as a string.
-    """
-    raise NotImplementedError
-
-
-
-def scheme(self) ‑> Union[SchemeHttpSchemeHttpsSchemeOther, ForwardRef(None)] -
-
-

Returns the protocol scheme from the request.

-
- -Expand source code - -
def scheme(self) -> Optional[Scheme]:
-    """
-    Returns the protocol scheme from the request.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class IncomingResponse -
-
-

Represents an incoming HTTP Response.

-
- -Expand source code - -
class IncomingResponse:
-    """
-    Represents an incoming HTTP Response.
-    """
-    
-    def status(self) -> int:
-        """
-        Returns the status code from the incoming response.
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Returns the headers from the incoming response.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `incoming-response` is dropped.
-        """
-        raise NotImplementedError
-
-    def consume(self) -> IncomingBody:
-        """
-        Returns the incoming body. May be called at most once. Returns error
-        if called additional times.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def consume(self) ‑> IncomingBody -
-
-

Returns the incoming body. May be called at most once. Returns error -if called additional times.

-

Raises: Err(None)

-
- -Expand source code - -
def consume(self) -> IncomingBody:
-    """
-    Returns the incoming body. May be called at most once. Returns error
-    if called additional times.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def headers(self) ‑> Fields -
-
-

Returns the headers from the incoming response.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -incoming-response is dropped.

-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Returns the headers from the incoming response.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `incoming-response` is dropped.
-    """
-    raise NotImplementedError
-
-
-
-def status(self) ‑> int -
-
-

Returns the status code from the incoming response.

-
- -Expand source code - -
def status(self) -> int:
-    """
-    Returns the status code from the incoming response.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class MethodConnect -
-
-

MethodConnect()

-
- -Expand source code - -
@dataclass
-class MethodConnect:
-    pass
-
-
-
-class MethodDelete -
-
-

MethodDelete()

-
- -Expand source code - -
@dataclass
-class MethodDelete:
-    pass
-
-
-
-class MethodGet -
-
-

MethodGet()

-
- -Expand source code - -
@dataclass
-class MethodGet:
-    pass
-
-
-
-class MethodHead -
-
-

MethodHead()

-
- -Expand source code - -
@dataclass
-class MethodHead:
-    pass
-
-
-
-class MethodOptions -
-
-

MethodOptions()

-
- -Expand source code - -
@dataclass
-class MethodOptions:
-    pass
-
-
-
-class MethodOther -(value: str) -
-
-

MethodOther(value: str)

-
- -Expand source code - -
@dataclass
-class MethodOther:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class MethodPatch -
-
-

MethodPatch()

-
- -Expand source code - -
@dataclass
-class MethodPatch:
-    pass
-
-
-
-class MethodPost -
-
-

MethodPost()

-
- -Expand source code - -
@dataclass
-class MethodPost:
-    pass
-
-
-
-class MethodPut -
-
-

MethodPut()

-
- -Expand source code - -
@dataclass
-class MethodPut:
-    pass
-
-
-
-class MethodTrace -
-
-

MethodTrace()

-
- -Expand source code - -
@dataclass
-class MethodTrace:
-    pass
-
-
-
-class OutgoingBody -
-
-

Represents an outgoing HTTP Request or Response's Body.

-

A body has both its contents - a stream of bytes - and a (possibly -empty) set of trailers, inducating the full contents of the body -have been sent. This resource represents the contents as an -output-stream child resource, and the completion of the body (with -optional trailers) with a static function that consumes the -outgoing-body resource, and ensures that the user of this interface -may not write to the body contents after the body has been finished.

-

If the user code drops this resource, as opposed to calling the static -method finish, the implementation should treat the body as incomplete, -and that an error has occured. The implementation should propogate this -error to the HTTP protocol by whatever means it has available, -including: corrupting the body on the wire, aborting the associated -Request, or sending a late status code for the Response.

-
- -Expand source code - -
class OutgoingBody:
-    """
-    Represents an outgoing HTTP Request or Response's Body.
-    
-    A body has both its contents - a stream of bytes - and a (possibly
-    empty) set of trailers, inducating the full contents of the body
-    have been sent. This resource represents the contents as an
-    `output-stream` child resource, and the completion of the body (with
-    optional trailers) with a static function that consumes the
-    `outgoing-body` resource, and ensures that the user of this interface
-    may not write to the body contents after the body has been finished.
-    
-    If the user code drops this resource, as opposed to calling the static
-    method `finish`, the implementation should treat the body as incomplete,
-    and that an error has occured. The implementation should propogate this
-    error to the HTTP protocol by whatever means it has available,
-    including: corrupting the body on the wire, aborting the associated
-    Request, or sending a late status code for the Response.
-    """
-    
-    def write(self) -> streams.OutputStream:
-        """
-        Returns a stream for writing the body contents.
-        
-        The returned `output-stream` is a child resource: it must be dropped
-        before the parent `outgoing-body` resource is dropped (or finished),
-        otherwise the `outgoing-body` drop or `finish` will trap.
-        
-        Returns success on the first call: the `output-stream` resource for
-        this `outgoing-body` may be retrieved at most once. Subsequent calls
-        will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def finish(cls, this: Self, trailers: Optional[Fields]) -> None:
-        """
-        Finalize an outgoing body, optionally providing trailers. This must be
-        called to signal that the response is complete. If the `outgoing-body`
-        is dropped without calling `outgoing-body.finalize`, the implementation
-        should treat the body as corrupted.
-        
-        Fails if the body's `outgoing-request` or `outgoing-response` was
-        constructed with a Content-Length header, and the contents written
-        to the body (via `write`) does not match the value given in the
-        Content-Length.
-        
-        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def finish(this: Self, trailers: Optional[Fields]) ‑> None -
-
-

Finalize an outgoing body, optionally providing trailers. This must be -called to signal that the response is complete. If the outgoing-body -is dropped without calling outgoing-body.finalize, the implementation -should treat the body as corrupted.

-

Fails if the body's outgoing-request or outgoing-response was -constructed with a Content-Length header, and the contents written -to the body (via write) does not match the value given in the -Content-Length.

-

Raises: Err(ErrorCode)

-
- -Expand source code - -
@classmethod
-def finish(cls, this: Self, trailers: Optional[Fields]) -> None:
-    """
-    Finalize an outgoing body, optionally providing trailers. This must be
-    called to signal that the response is complete. If the `outgoing-body`
-    is dropped without calling `outgoing-body.finalize`, the implementation
-    should treat the body as corrupted.
-    
-    Fails if the body's `outgoing-request` or `outgoing-response` was
-    constructed with a Content-Length header, and the contents written
-    to the body (via `write`) does not match the value given in the
-    Content-Length.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
-    """
-    raise NotImplementedError
-
-
-
-

Methods

-
-
-def write(self) ‑> OutputStream -
-
-

Returns a stream for writing the body contents.

-

The returned output-stream is a child resource: it must be dropped -before the parent outgoing-body resource is dropped (or finished), -otherwise the outgoing-body drop or finish will trap.

-

Returns success on the first call: the output-stream resource for -this outgoing-body may be retrieved at most once. Subsequent calls -will return error.

-

Raises: Err(None)

-
- -Expand source code - -
def write(self) -> streams.OutputStream:
-    """
-    Returns a stream for writing the body contents.
-    
-    The returned `output-stream` is a child resource: it must be dropped
-    before the parent `outgoing-body` resource is dropped (or finished),
-    otherwise the `outgoing-body` drop or `finish` will trap.
-    
-    Returns success on the first call: the `output-stream` resource for
-    this `outgoing-body` may be retrieved at most once. Subsequent calls
-    will return error.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class OutgoingRequest -(headers: Fields) -
-
-

Represents an outgoing HTTP Request.

-

Construct a new outgoing-request with a default method of GET, and -none values for path-with-query, scheme, and authority.

-
    -
  • headers is the HTTP Headers for the Request.
  • -
-

It is possible to construct, or manipulate with the accessor functions -below, an outgoing-request with an invalid combination of scheme -and authority, or headers which are not permitted to be sent. -It is the obligation of the outgoing-handler.handle implementation -to reject invalid constructions of outgoing-request.

-
- -Expand source code - -
class OutgoingRequest:
-    """
-    Represents an outgoing HTTP Request.
-    """
-    
-    def __init__(self, headers: Fields):
-        """
-        Construct a new `outgoing-request` with a default `method` of `GET`, and
-        `none` values for `path-with-query`, `scheme`, and `authority`.
-        
-        * `headers` is the HTTP Headers for the Request.
-        
-        It is possible to construct, or manipulate with the accessor functions
-        below, an `outgoing-request` with an invalid combination of `scheme`
-        and `authority`, or `headers` which are not permitted to be sent.
-        It is the obligation of the `outgoing-handler.handle` implementation
-        to reject invalid constructions of `outgoing-request`.
-        """
-        raise NotImplementedError
-
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this
-        Request.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-request` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def method(self) -> Method:
-        """
-        Get the Method for the Request.
-        """
-        raise NotImplementedError
-
-    def set_method(self, method: Method) -> None:
-        """
-        Set the Method for the Request. Fails if the string present in a
-        `method.other` argument is not a syntactically valid method.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def path_with_query(self) -> Optional[str]:
-        """
-        Get the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query.
-        """
-        raise NotImplementedError
-
-    def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-        """
-        Set the combination of the HTTP Path and Query for the Request.
-        When `none`, this represents an empty Path and empty Query. Fails is the
-        string given is not a syntactically valid path and query uri component.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def scheme(self) -> Optional[Scheme]:
-        """
-        Get the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme.
-        """
-        raise NotImplementedError
-
-    def set_scheme(self, scheme: Optional[Scheme]) -> None:
-        """
-        Set the HTTP Related Scheme for the Request. When `none`, the
-        implementation may choose an appropriate default scheme. Fails if the
-        string given is not a syntactically valid uri scheme.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def authority(self) -> Optional[str]:
-        """
-        Get the HTTP Authority for the Request. A value of `none` may be used
-        with Related Schemes which do not require an Authority. The HTTP and
-        HTTPS schemes always require an authority.
-        """
-        raise NotImplementedError
-
-    def set_authority(self, authority: Optional[str]) -> None:
-        """
-        Set the HTTP Authority for the Request. A value of `none` may be used
-        with Related Schemes which do not require an Authority. The HTTP and
-        HTTPS schemes always require an authority. Fails if the string given is
-        not a syntactically valid uri authority.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transfered to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def authority(self) ‑> Optional[str] -
-
-

Get the HTTP Authority for the Request. A value of none may be used -with Related Schemes which do not require an Authority. The HTTP and -HTTPS schemes always require an authority.

-
- -Expand source code - -
def authority(self) -> Optional[str]:
-    """
-    Get the HTTP Authority for the Request. A value of `none` may be used
-    with Related Schemes which do not require an Authority. The HTTP and
-    HTTPS schemes always require an authority.
-    """
-    raise NotImplementedError
-
-
-
-def body(self) ‑> OutgoingBody -
-
-

Returns the resource corresponding to the outgoing Body for this -Request.

-

Returns success on the first call: the outgoing-body resource for -this outgoing-request can be retrieved at most once. Subsequent -calls will return error.

-

Raises: Err(None)

-
- -Expand source code - -
def body(self) -> OutgoingBody:
-    """
-    Returns the resource corresponding to the outgoing Body for this
-    Request.
-    
-    Returns success on the first call: the `outgoing-body` resource for
-    this `outgoing-request` can be retrieved at most once. Subsequent
-    calls will return error.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def headers(self) ‑> Fields -
-
-

Get the headers associated with the Request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -outgoing-request is dropped, or its ownership is transfered to -another component by e.g. outgoing-handler.handle.

-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the headers associated with the Request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `outgoing-request` is dropped, or its ownership is transfered to
-    another component by e.g. `outgoing-handler.handle`.
-    """
-    raise NotImplementedError
-
-
-
-def method(self) ‑> Union[MethodGetMethodHeadMethodPostMethodPutMethodDeleteMethodConnectMethodOptionsMethodTraceMethodPatchMethodOther] -
-
-

Get the Method for the Request.

-
- -Expand source code - -
def method(self) -> Method:
-    """
-    Get the Method for the Request.
-    """
-    raise NotImplementedError
-
-
-
-def path_with_query(self) ‑> Optional[str] -
-
-

Get the combination of the HTTP Path and Query for the Request. -When none, this represents an empty Path and empty Query.

-
- -Expand source code - -
def path_with_query(self) -> Optional[str]:
-    """
-    Get the combination of the HTTP Path and Query for the Request.
-    When `none`, this represents an empty Path and empty Query.
-    """
-    raise NotImplementedError
-
-
-
-def scheme(self) ‑> Union[SchemeHttpSchemeHttpsSchemeOther, ForwardRef(None)] -
-
-

Get the HTTP Related Scheme for the Request. When none, the -implementation may choose an appropriate default scheme.

-
- -Expand source code - -
def scheme(self) -> Optional[Scheme]:
-    """
-    Get the HTTP Related Scheme for the Request. When `none`, the
-    implementation may choose an appropriate default scheme.
-    """
-    raise NotImplementedError
-
-
-
-def set_authority(self, authority: Optional[str]) ‑> None -
-
-

Set the HTTP Authority for the Request. A value of none may be used -with Related Schemes which do not require an Authority. The HTTP and -HTTPS schemes always require an authority. Fails if the string given is -not a syntactically valid uri authority.

-

Raises: Err(None)

-
- -Expand source code - -
def set_authority(self, authority: Optional[str]) -> None:
-    """
-    Set the HTTP Authority for the Request. A value of `none` may be used
-    with Related Schemes which do not require an Authority. The HTTP and
-    HTTPS schemes always require an authority. Fails if the string given is
-    not a syntactically valid uri authority.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def set_method(self, method: Union[MethodGetMethodHeadMethodPostMethodPutMethodDeleteMethodConnectMethodOptionsMethodTraceMethodPatchMethodOther]) ‑> None -
-
-

Set the Method for the Request. Fails if the string present in a -method.other argument is not a syntactically valid method.

-

Raises: Err(None)

-
- -Expand source code - -
def set_method(self, method: Method) -> None:
-    """
-    Set the Method for the Request. Fails if the string present in a
-    `method.other` argument is not a syntactically valid method.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def set_path_with_query(self, path_with_query: Optional[str]) ‑> None -
-
-

Set the combination of the HTTP Path and Query for the Request. -When none, this represents an empty Path and empty Query. Fails is the -string given is not a syntactically valid path and query uri component.

-

Raises: Err(None)

-
- -Expand source code - -
def set_path_with_query(self, path_with_query: Optional[str]) -> None:
-    """
-    Set the combination of the HTTP Path and Query for the Request.
-    When `none`, this represents an empty Path and empty Query. Fails is the
-    string given is not a syntactically valid path and query uri component.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def set_scheme(self, scheme: Union[SchemeHttpSchemeHttpsSchemeOther, ForwardRef(None)]) ‑> None -
-
-

Set the HTTP Related Scheme for the Request. When none, the -implementation may choose an appropriate default scheme. Fails if the -string given is not a syntactically valid uri scheme.

-

Raises: Err(None)

-
- -Expand source code - -
def set_scheme(self, scheme: Optional[Scheme]) -> None:
-    """
-    Set the HTTP Related Scheme for the Request. When `none`, the
-    implementation may choose an appropriate default scheme. Fails if the
-    string given is not a syntactically valid uri scheme.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class OutgoingResponse -(headers: Fields) -
-
-

Represents an outgoing HTTP Response.

-

Construct an outgoing-response, with a default status-code of 200. -If a different status-code is needed, it must be set via the -set-status-code method.

-
    -
  • headers is the HTTP Headers for the Response.
  • -
-
- -Expand source code - -
class OutgoingResponse:
-    """
-    Represents an outgoing HTTP Response.
-    """
-    
-    def __init__(self, headers: Fields):
-        """
-        Construct an `outgoing-response`, with a default `status-code` of `200`.
-        If a different `status-code` is needed, it must be set via the
-        `set-status-code` method.
-        
-        * `headers` is the HTTP Headers for the Response.
-        """
-        raise NotImplementedError
-
-    def status_code(self) -> int:
-        """
-        Get the HTTP Status Code for the Response.
-        """
-        raise NotImplementedError
-
-    def set_status_code(self, status_code: int) -> None:
-        """
-        Set the HTTP Status Code for the Response. Fails if the status-code
-        given is not a valid http status code.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def headers(self) -> Fields:
-        """
-        Get the headers associated with the Request.
-        
-        The returned `headers` resource is immutable: `set`, `append`, and
-        `delete` operations will fail with `header-error.immutable`.
-        
-        This headers resource is a child: it must be dropped before the parent
-        `outgoing-request` is dropped, or its ownership is transfered to
-        another component by e.g. `outgoing-handler.handle`.
-        """
-        raise NotImplementedError
-
-    def body(self) -> OutgoingBody:
-        """
-        Returns the resource corresponding to the outgoing Body for this Response.
-        
-        Returns success on the first call: the `outgoing-body` resource for
-        this `outgoing-response` can be retrieved at most once. Subsequent
-        calls will return error.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def body(self) ‑> OutgoingBody -
-
-

Returns the resource corresponding to the outgoing Body for this Response.

-

Returns success on the first call: the outgoing-body resource for -this outgoing-response can be retrieved at most once. Subsequent -calls will return error.

-

Raises: Err(None)

-
- -Expand source code - -
def body(self) -> OutgoingBody:
-    """
-    Returns the resource corresponding to the outgoing Body for this Response.
-    
-    Returns success on the first call: the `outgoing-body` resource for
-    this `outgoing-response` can be retrieved at most once. Subsequent
-    calls will return error.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def headers(self) ‑> Fields -
-
-

Get the headers associated with the Request.

-

The returned headers resource is immutable: set, append, and -delete operations will fail with header-error.immutable.

-

This headers resource is a child: it must be dropped before the parent -outgoing-request is dropped, or its ownership is transfered to -another component by e.g. outgoing-handler.handle.

-
- -Expand source code - -
def headers(self) -> Fields:
-    """
-    Get the headers associated with the Request.
-    
-    The returned `headers` resource is immutable: `set`, `append`, and
-    `delete` operations will fail with `header-error.immutable`.
-    
-    This headers resource is a child: it must be dropped before the parent
-    `outgoing-request` is dropped, or its ownership is transfered to
-    another component by e.g. `outgoing-handler.handle`.
-    """
-    raise NotImplementedError
-
-
-
-def set_status_code(self, status_code: int) ‑> None -
-
-

Set the HTTP Status Code for the Response. Fails if the status-code -given is not a valid http status code.

-

Raises: Err(None)

-
- -Expand source code - -
def set_status_code(self, status_code: int) -> None:
-    """
-    Set the HTTP Status Code for the Response. Fails if the status-code
-    given is not a valid http status code.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def status_code(self) ‑> int -
-
-

Get the HTTP Status Code for the Response.

-
- -Expand source code - -
def status_code(self) -> int:
-    """
-    Get the HTTP Status Code for the Response.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class RequestOptions -
-
-

Parameters for making an HTTP Request. Each of these parameters is -currently an optional timeout applicable to the transport layer of the -HTTP protocol.

-

These timeouts are separate from any the user may use to bound a -blocking call to wasi:io/poll.poll.

-

Construct a default request-options value.

-
- -Expand source code - -
class RequestOptions:
-    """
-    Parameters for making an HTTP Request. Each of these parameters is
-    currently an optional timeout applicable to the transport layer of the
-    HTTP protocol.
-    
-    These timeouts are separate from any the user may use to bound a
-    blocking call to `wasi:io/poll.poll`.
-    """
-    
-    def __init__(self):
-        """
-        Construct a default `request-options` value.
-        """
-        raise NotImplementedError
-
-    def connect_timeout(self) -> Optional[int]:
-        """
-        The timeout for the initial connect to the HTTP Server.
-        """
-        raise NotImplementedError
-
-    def set_connect_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for the initial connect to the HTTP Server. An error
-        return value indicates that this timeout is not supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def first_byte_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving the first byte of the Response body.
-        """
-        raise NotImplementedError
-
-    def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving the first byte of the Response body. An
-        error return value indicates that this timeout is not supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def between_bytes_timeout(self) -> Optional[int]:
-        """
-        The timeout for receiving subsequent chunks of bytes in the Response
-        body stream.
-        """
-        raise NotImplementedError
-
-    def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-        """
-        Set the timeout for receiving subsequent chunks of bytes in the Response
-        body stream. An error return value indicates that this timeout is not
-        supported.
-        
-        Raises: `spin_sdk.wit.types.Err(None)`
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Methods

-
-
-def between_bytes_timeout(self) ‑> Optional[int] -
-
-

The timeout for receiving subsequent chunks of bytes in the Response -body stream.

-
- -Expand source code - -
def between_bytes_timeout(self) -> Optional[int]:
-    """
-    The timeout for receiving subsequent chunks of bytes in the Response
-    body stream.
-    """
-    raise NotImplementedError
-
-
-
-def connect_timeout(self) ‑> Optional[int] -
-
-

The timeout for the initial connect to the HTTP Server.

-
- -Expand source code - -
def connect_timeout(self) -> Optional[int]:
-    """
-    The timeout for the initial connect to the HTTP Server.
-    """
-    raise NotImplementedError
-
-
-
-def first_byte_timeout(self) ‑> Optional[int] -
-
-

The timeout for receiving the first byte of the Response body.

-
- -Expand source code - -
def first_byte_timeout(self) -> Optional[int]:
-    """
-    The timeout for receiving the first byte of the Response body.
-    """
-    raise NotImplementedError
-
-
-
-def set_between_bytes_timeout(self, duration: Optional[int]) ‑> None -
-
-

Set the timeout for receiving subsequent chunks of bytes in the Response -body stream. An error return value indicates that this timeout is not -supported.

-

Raises: Err(None)

-
- -Expand source code - -
def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for receiving subsequent chunks of bytes in the Response
-    body stream. An error return value indicates that this timeout is not
-    supported.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def set_connect_timeout(self, duration: Optional[int]) ‑> None -
-
-

Set the timeout for the initial connect to the HTTP Server. An error -return value indicates that this timeout is not supported.

-

Raises: Err(None)

-
- -Expand source code - -
def set_connect_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for the initial connect to the HTTP Server. An error
-    return value indicates that this timeout is not supported.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-def set_first_byte_timeout(self, duration: Optional[int]) ‑> None -
-
-

Set the timeout for receiving the first byte of the Response body. An -error return value indicates that this timeout is not supported.

-

Raises: Err(None)

-
- -Expand source code - -
def set_first_byte_timeout(self, duration: Optional[int]) -> None:
-    """
-    Set the timeout for receiving the first byte of the Response body. An
-    error return value indicates that this timeout is not supported.
-    
-    Raises: `spin_sdk.wit.types.Err(None)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-class ResponseOutparam -
-
-

Represents the ability to send an HTTP Response.

-

This resource is used by the wasi:http/incoming-handler interface to -allow a Response to be sent corresponding to the Request provided as the -other argument to incoming-handler.handle.

-
- -Expand source code - -
class ResponseOutparam:
-    """
-    Represents the ability to send an HTTP Response.
-    
-    This resource is used by the `wasi:http/incoming-handler` interface to
-    allow a Response to be sent corresponding to the Request provided as the
-    other argument to `incoming-handler.handle`.
-    """
-    
-    @classmethod
-    def set(cls, param: Self, response: Result[OutgoingResponse, ErrorCode]) -> None:
-        """
-        Set the value of the `response-outparam` to either send a response,
-        or indicate an error.
-        
-        This method consumes the `response-outparam` to ensure that it is
-        called at most once. If it is never called, the implementation
-        will respond with an error.
-        
-        The user may provide an `error` to `response` to allow the
-        implementation determine how to respond with an HTTP error response.
-        """
-        raise NotImplementedError
-
-    def __enter__(self):
-        """Returns self"""
-        return self
-                                                                    
-    def __exit__(self, *args):
-        """
-        Release this resource.
-        """
-        raise NotImplementedError
-
-

Static methods

-
-
-def set(param: Self, response: Union[Ok[OutgoingResponse], Err[Union[ErrorCodeDnsTimeoutErrorCodeDnsErrorErrorCodeDestinationNotFoundErrorCodeDestinationUnavailableErrorCodeDestinationIpProhibitedErrorCodeDestinationIpUnroutableErrorCodeConnectionRefusedErrorCodeConnectionTerminatedErrorCodeConnectionTimeoutErrorCodeConnectionReadTimeoutErrorCodeConnectionWriteTimeoutErrorCodeConnectionLimitReachedErrorCodeTlsProtocolErrorErrorCodeTlsCertificateErrorErrorCodeTlsAlertReceivedErrorCodeHttpRequestDeniedErrorCodeHttpRequestLengthRequiredErrorCodeHttpRequestBodySizeErrorCodeHttpRequestMethodInvalidErrorCodeHttpRequestUriInvalidErrorCodeHttpRequestUriTooLongErrorCodeHttpRequestHeaderSectionSizeErrorCodeHttpRequestHeaderSizeErrorCodeHttpRequestTrailerSectionSizeErrorCodeHttpRequestTrailerSizeErrorCodeHttpResponseIncompleteErrorCodeHttpResponseHeaderSectionSizeErrorCodeHttpResponseHeaderSizeErrorCodeHttpResponseBodySizeErrorCodeHttpResponseTrailerSectionSizeErrorCodeHttpResponseTrailerSizeErrorCodeHttpResponseTransferCodingErrorCodeHttpResponseContentCodingErrorCodeHttpResponseTimeoutErrorCodeHttpUpgradeFailedErrorCodeHttpProtocolErrorErrorCodeLoopDetectedErrorCodeConfigurationErrorErrorCodeInternalError]]]) ‑> None -
-
-

Set the value of the response-outparam to either send a response, -or indicate an error.

-

This method consumes the response-outparam to ensure that it is -called at most once. If it is never called, the implementation -will respond with an error.

-

The user may provide an error to response to allow the -implementation determine how to respond with an HTTP error response.

-
- -Expand source code - -
@classmethod
-def set(cls, param: Self, response: Result[OutgoingResponse, ErrorCode]) -> None:
-    """
-    Set the value of the `response-outparam` to either send a response,
-    or indicate an error.
-    
-    This method consumes the `response-outparam` to ensure that it is
-    called at most once. If it is never called, the implementation
-    will respond with an error.
-    
-    The user may provide an `error` to `response` to allow the
-    implementation determine how to respond with an HTTP error response.
-    """
-    raise NotImplementedError
-
-
-
-
-
-class SchemeHttp -
-
-

SchemeHttp()

-
- -Expand source code - -
@dataclass
-class SchemeHttp:
-    pass
-
-
-
-class SchemeHttps -
-
-

SchemeHttps()

-
- -Expand source code - -
@dataclass
-class SchemeHttps:
-    pass
-
-
-
-class SchemeOther -(value: str) -
-
-

SchemeOther(value: str)

-
- -Expand source code - -
@dataclass
-class SchemeOther:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class TlsAlertReceivedPayload -(alert_id: Optional[int], alert_message: Optional[str]) -
-
-

Defines the case payload type for TLS-alert-received above:

-
- -Expand source code - -
@dataclass
-class TlsAlertReceivedPayload:
-    """
-    Defines the case payload type for `TLS-alert-received` above:
-    """
-    alert_id: Optional[int]
-    alert_message: Optional[str]
-
-

Class variables

-
-
var alert_id : Optional[int]
-
-
-
-
var alert_message : Optional[str]
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/imports/variables.html b/docs/wit/imports/variables.html deleted file mode 100644 index d07e13d..0000000 --- a/docs/wit/imports/variables.html +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - -spin_sdk.wit.imports.variables API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.imports.variables

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from ..types import Result, Ok, Err, Some
-
-
-
-@dataclass
-class ErrorInvalidName:
-    value: str
-
-
-@dataclass
-class ErrorUndefined:
-    value: str
-
-
-@dataclass
-class ErrorProvider:
-    value: str
-
-
-@dataclass
-class ErrorOther:
-    value: str
-
-
-Error = Union[ErrorInvalidName, ErrorUndefined, ErrorProvider, ErrorOther]
-"""
-The set of errors which may be raised by functions in this interface.
-"""
-
-
-
-def get(name: str) -> str:
-    """
-    Get an application variable value for the current component.
-    
-    The name must match one defined in in the component manifest.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.variables.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Global variables

-
-
var Error
-
-

The set of errors which may be raised by functions in this interface.

-
-
-
-
-

Functions

-
-
-def get(name: str) ‑> str -
-
-

Get an application variable value for the current component.

-

The name must match one defined in in the component manifest.

-

Raises: Err(Error)

-
- -Expand source code - -
def get(name: str) -> str:
-    """
-    Get an application variable value for the current component.
-    
-    The name must match one defined in in the component manifest.
-    
-    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.variables.Error)`
-    """
-    raise NotImplementedError
-
-
-
-
-
-

Classes

-
-
-class ErrorInvalidName -(value: str) -
-
-

ErrorInvalidName(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorInvalidName:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorOther -(value: str) -
-
-

ErrorOther(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorOther:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorProvider -(value: str) -
-
-

ErrorProvider(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorProvider:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-class ErrorUndefined -(value: str) -
-
-

ErrorUndefined(value: str)

-
- -Expand source code - -
@dataclass
-class ErrorUndefined:
-    value: str
-
-

Class variables

-
-
var value : str
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/index.html b/docs/wit/index.html deleted file mode 100644 index 3168b59..0000000 --- a/docs/wit/index.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - -spin_sdk.wit API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit

-
-
-

Module with the bindings generated from the wit by componentize-py

-
- -Expand source code - -
""" Module with the bindings generated from the wit by componentize-py """
-
-from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-from .types import Result, Ok, Err, Some
-
-
-
-class SpinAll(Protocol):
-    pass
-
-
-
-

Sub-modules

-
-
spin_sdk.wit.exports
-
-
-
-
spin_sdk.wit.imports
-
-
-
-
spin_sdk.wit.types
-
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class SpinAll -(*args, **kwargs) -
-
-

Base class for protocol classes.

-

Protocol classes are defined as::

-
class Proto(Protocol):
-    def meth(self) -> int:
-        ...
-
-

Such classes are primarily used with static type checkers that recognize -structural subtyping (static duck-typing).

-

For example::

-
class C:
-    def meth(self) -> int:
-        return 0
-
-def func(x: Proto) -> int:
-    return x.meth()
-
-func(C())  # Passes static type check
-
-

See PEP 544 for details. Protocol classes decorated with -@typing.runtime_checkable act as simple-minded runtime protocols that check -only the presence of given attributes, ignoring their type signatures. -Protocol classes can be generic, they are defined as::

-
class GenProto(Protocol[T]):
-    def meth(self) -> T:
-        ...
-
-
- -Expand source code - -
class SpinAll(Protocol):
-    pass
-
-

Ancestors

-
    -
  • typing.Protocol
  • -
  • typing.Generic
  • -
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/wit/types.html b/docs/wit/types.html deleted file mode 100644 index 407064b..0000000 --- a/docs/wit/types.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - -spin_sdk.wit.types API documentation - - - - - - - - - - - -
-
-
-

Module spin_sdk.wit.types

-
-
-
- -Expand source code - -
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any, Self
-from enum import Flag, Enum, auto
-from dataclasses import dataclass
-from abc import abstractmethod
-import weakref
-
-
-S = TypeVar('S')
-@dataclass
-class Some(Generic[S]):
-    value: S
-
-T = TypeVar('T')
-@dataclass
-class Ok(Generic[T]):
-    value: T
-
-E = TypeVar('E')
-@dataclass(frozen=True)
-class Err(Generic[E], Exception):
-    value: E
-
-Result = Union[Ok[T], Err[E]]
-            
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Err -(value: ~E) -
-
-

Err(value: ~E)

-
- -Expand source code - -
@dataclass(frozen=True)
-class Err(Generic[E], Exception):
-    value: E
-
-

Ancestors

-
    -
  • typing.Generic
  • -
  • builtins.Exception
  • -
  • builtins.BaseException
  • -
-

Class variables

-
-
var value : ~E
-
-
-
-
-
-
-class Ok -(value: ~T) -
-
-

Ok(value: ~T)

-
- -Expand source code - -
@dataclass
-class Ok(Generic[T]):
-    value: T
-
-

Ancestors

-
    -
  • typing.Generic
  • -
-

Class variables

-
-
var value : ~T
-
-
-
-
-
-
-class Some -(value: ~S) -
-
-

Some(value: ~S)

-
- -Expand source code - -
@dataclass
-class Some(Generic[S]):
-    value: S
-
-

Ancestors

-
    -
  • typing.Generic
  • -
-

Class variables

-
-
var value : ~S
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/scripts/generate_docs.py b/scripts/generate_docs.py index bd6da24..429bb1b 100755 --- a/scripts/generate_docs.py +++ b/scripts/generate_docs.py @@ -2,10 +2,13 @@ import os import shutil +import sys -# Get the current script's directory -script_dir = os.path.dirname(os.path.abspath(__file__)) +# Get the version from command line arguments (e.g., 'v4' or 'canary') +# Default to 'canary' if no argument is provided +version_folder = sys.argv[1] if len(sys.argv) > 1 else 'canary' +script_dir = os.path.dirname(os.path.abspath(__file__)) wit_module = os.path.join('src', 'spin_sdk', 'wit', '__init__.py') expected_doc_comment = '""" Module with the bindings generated from the wit by componentize-py """\n\n' @@ -19,17 +22,42 @@ # Change to the root directory of the project os.chdir(os.path.join(script_dir, '..')) -# Remove the 'docs/v4' directory -shutil.rmtree(os.path.join('docs', 'v4'), ignore_errors=True) +# Use the dynamic version_folder for the target directory +target_docs_path = os.path.join('docs', version_folder) + +# Clean existing folder for this specific version +shutil.rmtree(target_docs_path, ignore_errors=True) # Change directory to 'src' and generate HTML documentation using pdoc os.chdir('src') os.system('pdoc --html spin_sdk') -# Move the generated documentation to the 'docs' directory -shutil.move('html/spin_sdk', os.path.join('..', 'docs', 'v4')) +# Move the generated documentation to the versioned directory +shutil.move('html/spin_sdk', os.path.join('..', target_docs_path)) # Remove the 'src/html' directory os.rmdir('html') - os.chdir('..') + +# Generate a redirect index.html at the root of the docs folder +root_index_path = os.path.join(script_dir, '..', 'docs', 'index.html') + +redirect_content = f""" + + + + + Redirecting... + + +

If you are not redirected, click here.

+ + +""" + +# Only update the root redirect if we are building a major version (not canary) +if version_folder.startswith('v'): + with open(root_index_path, 'w') as f: + f.write(redirect_content)