---
title: stores | CodeWeaver Docs
description: API reference for codeweaver.core.stores
url: "https://docs.knitli.com/api/core/stores"
type: static
generatedAt: "2026-04-17T17:21:08.091Z"
---

# stores
       [Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fstores%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fstores%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[View in Markdown](/codeweaver/api/core/stores.md)       [Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fstores%2F)[Share on X](https://x.com/intent/tweet?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fstores%2F&text=stores)[Share on Threads](https://threads.net/intent/post?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fstores%2F&text=stores)[Share on Bluesky](https://bsky.app/intent/compose?text=stores%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fstores%2F)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fstores%2F)[Share on Reddit](https://reddit.com/submit?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fstores%2F&title=stores)[Share on Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fstores%2F&t=stores)[Share on Email](mailto:?subject=stores&body=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fstores%2F)[Share on WhatsApp](https://wa.me/?text=stores%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fstores%2F)[Share on Telegram](https://t.me/share/url?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fstores%2F&text=stores)
# `codeweaver.core.stores`
[Section titled “codeweaver.core.stores”](#codeweavercorestores)
A foundational enum class for the CodeWeaver project for common functionality.

## Class: `BlakeStore`
[Section titled “Class: BlakeStore”](#class-blakestore)
Typed store specialized for Blake3-hash keys.

Used primarily for deduplication scenarios. Note that BlakeStore does not maintain a trash heap, at least with how we use it internally. If you need one, it’s still there — just pass a weakref dict to the constructor during initialization (and in that case, don’t use `make_blake_store`).

BlakeStore is designed to map Blake3 hash keys to values, making it ideal for scenarios where deduplication is essential. It leverages the efficiency of Blake3 hashing to ensure that identical inputs yield the same key, allowing for effective storage and retrieval of unique data entries.

Example:


**

```
# Create a BlakeStore for storing stringsfrom codeweaver.core.stores import make_blake_store
str_blake_store = make_blake_store[str](    value_type=str, size_limit=5 * 1024 * 1024)  # 5 MB limit
# Add a string to the storeinput_string = "Hello, CodeWeaver!"blake_key = str_blake_store.add(input_string.encode("utf-8"))print(f"Blake3 Key: &#123;blake_key.hexdigest()&#125;")# prints: '9ef97bd4f3bfa743877f024bad519269ae6f9757a81540475781e6f79e895dff'
```

## Class: `StoreDict`
[Section titled “Class: StoreDict”](#class-storedict)
Dictionary representation of a _SimpleTypedStore.

Use make_uuid_store() or make_blake_store() factory functions instead.

## Class: `UUIDStore`
[Section titled “Class: UUIDStore”](#class-uuidstore)
Typed store specialized for UUID keys.

UUIDStore is designed to map UUID7 keys to values, making it suitable for general-purpose storage scenarios where unique identifiers are required. It leverages the uniqueness and temporal ordering of UUID7 to ensure that each entry in the store can be reliably identified and retrieved.

Example:


**

```
# Create a UUIDStore for storing integersfrom codeweaver.core.stores import make_uuid_store
int_uuid_store = make_uuid_store[int](    value_type=int, size_limit=5 * 1024 * 1024)  # 5 MB limit
# Add an integer to the storeuuid_key = int_uuid_store.add(42)print(f"UUID Key: &#123;uuid_key&#125;")# prints something like: '0690f9b6-c5e5-7534-8000-7b873c2eed02'
# Retrieve the integer from the storeretrieved_value = int_uuid_store.get(uuid_key)print(f"Retrieved Value: &#123;retrieved_value&#125;")# prints: '42'
```

## Function: `make_blake_store`
[Section titled “Function: make_blake_store”](#function-make_blake_store)

**

```
make_blake_store()
```

Create a BlakeStore with the specified value type.

## Function: `make_uuid_store`
[Section titled “Function: make_uuid_store”](#function-make_uuid_store)

**

```
make_uuid_store()
```

Create a UUIDStore with the specified value type.

## Function: `to_uuid`
[Section titled “Function: to_uuid”](#function-to_uuid)

**

```
to_uuid()
```

Generate a new UUID7.