Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

RFieldStorage

Enum defining storage backend options for RField values.

RFieldStorage determines where and how a field's value is persisted when a Resource is saved, and how it is retrieved when the Resource is loaded.

Attributes: DATABASE: Store field value in the relational database. - Pros: Searchable, queryable, indexed for fast lookups - Cons: Limited to small data sizes, slower for large values - Use for: Metadata, identifiers, small structured data - Example: count=5, name="result", is_valid=True

KV_STORE: Store field value in a key-value store.
    - Pros: Handles larger data, efficient storage and retrieval
    - Cons: Not directly searchable, lazy-loaded when accessed
    - Use for: Large strings, serialized data, binary blobs
    - Example: Large text content, JSON data, file contents

NONE: Do not persist the field value.
    - Only use when you know what you are doing
    - Note: Values can be provided via ResourceFactory.create_resource(additional_data=...)

Example: ```python class MyResource(Resource): # Small searchable metadata - stored in database item_count = IntRField(storage=RFieldStorage.DATABASE)

    # Large content - stored in KV store
    description = StrRField(storage=RFieldStorage.KV_STORE)

    # Temporary computed value - not persisted
    is_processed = BoolRField(storage=RFieldStorage.NONE)
```
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.