Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
from abc import ABC, abstractmethod
class ClientStatePersistenceABC(ABC):
"""
Base class for client persistence implementations.
This class defines the interface for persisting client data per user.
"""
@abstractmethod
def set_by_key(self, user_id: str, key: str, value: str) -> str:
"""
Set a key-value pair for the client.
Args:
user_id (str): The user ID to set state for.
key (str): The key to set.
value (str): The value to set for the key.
Returns:
str: The value that was set.
"""
pass
@abstractmethod
def get_by_key(self, user_id: str, key: str) -> str | None:
"""
Get the value for a specific key of the client.
Args:
user_id (str): The user ID to get state for.
key (str): The key to retrieve the value for.
Returns:
str | None: The value associated with the key, or None if the key does not exist.
"""
pass
@abstractmethod
def get_keys_by_prefix(self, user_id: str, prefix: str) -> list[str]:
"""
Get all keys matching a prefix for a user.
Args:
user_id (str): The user ID to get keys for.
prefix (str): The prefix to filter keys by.
Returns:
list[str]: A list of keys matching the prefix.
"""
pass
@abstractmethod
def delete_by_key(self, user_id: str, key: str) -> None:
"""
Delete a specific key-value pair for a user.
Args:
user_id (str): The user ID to delete state for.
key (str): The key to delete.
"""
pass
@abstractmethod
def delete(self, user_id: str) -> None:
"""
Delete all client state for a user.
Args:
user_id (str): The user ID to delete state for.
"""
pass