mirror of
https://git.telodendria.io/Telodendria/Cytoplasm.git
synced 2025-04-25 10:26:03 +00:00
[ADD/WIP] Start rolling in intents
This commit is contained in:
parent
20bb7a20ad
commit
3df1e4ab7b
5 changed files with 86 additions and 24 deletions
|
@ -48,6 +48,17 @@
|
|||
*/
|
||||
typedef struct Db Db;
|
||||
|
||||
/**
|
||||
* Some "hints" for the database backend for operations.
|
||||
* Hints are a way for the program to declare what to except of it
|
||||
* (and the program MUST adhere to these hints, but the backend
|
||||
* MAY adhere).
|
||||
*/
|
||||
typedef enum DbHint {
|
||||
DB_HINT_READONLY, /* The database reference is treated as read-only */
|
||||
DB_HINT_WRITE /* The database reference is treated as read/write */
|
||||
} DbHint;
|
||||
|
||||
/**
|
||||
* When an object is locked, a reference is returned. This reference
|
||||
* is owned by the current thread, and the database is inaccessible to
|
||||
|
@ -118,6 +129,15 @@ extern DbRef * DbCreate(Db *, size_t,...);
|
|||
*/
|
||||
extern DbRef * DbLock(Db *, size_t,...);
|
||||
|
||||
/**
|
||||
* Behaves like
|
||||
* .Fn DbLock ,
|
||||
* but with hints on the reference itself, as
|
||||
* .Fn DbLock
|
||||
* itself is read/write.
|
||||
*/
|
||||
extern DbRef * DbLockIntent(Db *, DbHint, size_t,...);
|
||||
|
||||
/**
|
||||
* Immediately and permanently remove an object from the database.
|
||||
* This function assumes the object is not locked, otherwise undefined
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue