Key-Value Store
What's Key-Value Storage?
Installation
# you can use a Conda environment
pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/ gllm-datastore# you can use a Conda environment
pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/ "gllm-datastore"# you can use a Conda environment
FOR /F "tokens=*" %T IN ('gcloud auth print-access-token') DO pip install --extra-index-url "https://oauth2accesstoken:%T@glsdk.gdplabs.id/gen-ai-internal/simple/" gllm-datastoreQuick Start
from gllm_datastore.key_value_store.openbao_key_value_store import OpenBaoKeyValueStore
# Initialize the key-value store
kv_store = OpenBaoKeyValueStore(
base_url="https://openbao.example.com",
token="your-auth-token",
mount_point="secret",
)
# Write a secret (creates version 1)
kv_store.write(
path="myapp/database",
data={
"username": "admin",
"password": "secure_password",
"host": "db.example.com",
},
)
# Read the secret
secret = kv_store.read("myapp/database")
print(secret.data) # {"username": "admin", "password": "secure_password", ...}
print(secret.metadata.version) # 1Core Operations
Reading Secrets
Writing Secrets
Partial Updates
Listing Keys
Version Management
Soft-Delete
Restore Deleted Versions
Permanent Destruction
Advanced Patterns
Atomic Updates with Retry
Version History Tracking
Namespace Organization
Configuration Options
Constructor Parameters
Parameter
Type
Required
Description
Read Options
Parameter
Type
Description
Write Options
Parameter
Type
Description
Error Handling
Takeaways
API Reference
Last updated
Was this helpful?