Attachments¶
Attachments connect values to documents via keys. They are the fundamental mechanism for associating typed data with document instances.
When to use: Use attachments to store and retrieve values associated with
document keys. The AttachmentGetting interface provides read access,
while AttachmentMutating extends it with write operations.
Quick Start¶
from dsviper import CommitDatabase, CommitMutableState
db = CommitDatabase.open("model.cdb")
db.definitions().inject()
# Read via AttachmentGetting
state = db.state(db.last_commit_id())
getting = state.attachment_getting()
value = getting.get(MYAPP_A_USER, user_key)
# Write via AttachmentMutating
mutable = CommitMutableState(state)
mutating = mutable.attachment_mutating()
mutating.set(MYAPP_A_USER, user_key, document)
Core Classes¶
A class used to represent an attachment. |
Attachment Interfaces¶
These interfaces provide read (getting) and write (mutating) access to attached values.
An interface used to retreive a value (aka document) state. |
|
An interface used to express fine-grained mutations of a value. |
Attachment Functions¶
User-defined functions that operate on attached values, defined via DSM.
A class used to call a C++ function. |
|
A class used to call a mutable function. |
|
A class used to register and retrieve C++ attachment function. |
|
A class used to represent the functions of a pool. |