"""
This type stub file was generated by pyright.
"""

import io
from dataclasses import dataclass
from typing import List, Optional, TYPE_CHECKING, Union
from nats.js import JetStreamContext, api

VALID_BUCKET_RE = ...
VALID_KEY_RE = ...
if TYPE_CHECKING:
    ...
OBJ_STREAM_TEMPLATE = ...
OBJ_ALL_CHUNKS_PRE_TEMPLATE = ...
OBJ_ALL_META_PRE_TEMPLATE = ...
OBJ_CHUNKS_PRE_TEMPLATE = ...
OBJ_META_PRE_TEMPLATE = ...
OBJ_NO_PENDING = ...
OBJ_DEFAULT_CHUNK_SIZE = ...
OBJ_DIGEST_TYPE = ...
OBJ_DIGEST_TEMPLATE = ...
class ObjectStore:
    """
    ObjectStore uses the JetStream ObjectStore functionality.

    .. note::
       This functionality is EXPERIMENTAL and may be changed in later releases.

    ::
    """
    @dataclass
    class ObjectResult:
        """
        ObjectResult is the result returned from the ObjectStore in JetStream.
        """
        info: api.ObjectInfo
        data: Optional[bytes] = ...
    
    
    @dataclass(frozen=True)
    class ObjectStoreStatus:
        """
        ObjectStoreStatus is the status of a ObjectStore bucket.
        """
        stream_info: api.StreamInfo
        bucket: str
        @property
        def description(self) -> Optional[str]:
            """
            description is the description supplied when creating the bucket.
            """
            ...
        
        @property
        def ttl(self) -> Optional[float]:
            """
            ttl returns the max age in seconds.
            """
            ...
        
        @property
        def storage_type(self) -> Optional[api.StorageType]:
            """
            storage indicates the underlying JetStream storage technology used to store data.
            """
            ...
        
        @property
        def replicas(self) -> Optional[int]:
            """
            replicas indicates how many storage replicas are kept for the data in the bucket.
            """
            ...
        
        @property
        def sealed(self) -> bool:
            """
            sealed indicates the stream is sealed and cannot be modified in any way.
            """
            ...
        
        @property
        def size(self) -> int:
            """
            size is the combined size of all data in the bucket including metadata, in bytes.
            """
            ...
        
    
    
    def __init__(self, name: str, stream: str, js: JetStreamContext) -> None:
        ...
    
    async def get_info(self, name: str, show_deleted: Optional[bool] = ...) -> api.ObjectInfo:
        """
        get_info will retrieve the current information for the object.
        """
        ...
    
    async def get(self, name: str, writeinto: Optional[io.BufferedIOBase] = ..., show_deleted: Optional[bool] = ...) -> ObjectResult:
        """
        get will pull the object from the underlying stream.
        """
        ...
    
    async def put(self, name: str, data: Union[str, bytes, io.BufferedIOBase], meta: Optional[api.ObjectMeta] = ...) -> api.ObjectInfo:
        """
        put will place the contents from the reader into this object-store.
        """
        ...
    
    async def status(self) -> ObjectStoreStatus:
        """
        status retrieves runtime status about a bucket.
        """
        ...
    
    async def seal(self): # -> None:
        """
        seal will seal the object store, no further modifications will be allowed.
        """
        ...
    
    async def update_meta(self, name: str, meta: api.ObjectMeta): # -> None:
        """
        update_meta will place the contents from the reader into this object-store.
        """
        ...
    
    class ObjectWatcher:
        def __init__(self, js) -> None:
            ...
        
        async def stop(self): # -> None:
            """
            stop will stop this watcher.
            """
            ...
        
        async def updates(self, timeout=...):
            """
            updates fetches the next update from a watcher.
            """
            ...
        
        def __aiter__(self): # -> Self:
            ...
        
        async def __anext__(self):
            ...
        
    
    
    async def watch(self, ignore_deletes=..., include_history=..., meta_only=...) -> ObjectWatcher:
        """
        watch for changes in the underlying store and receive meta information updates.
        """
        ...
    
    async def delete(self, name: str) -> ObjectResult:
        """
        delete will delete the object.
        """
        ...
    
    async def list(self, ignore_deletes=...) -> List[api.ObjectInfo]:
        """
        list will list all the objects in this store.
        """
        ...
    


