@@ -51,7 +51,7 @@ extern "C" {
51
51
/// obx_version() or obx_version_is_at_least().
52
52
#define OBX_VERSION_MAJOR 0
53
53
#define OBX_VERSION_MINOR 15
54
- #define OBX_VERSION_PATCH 1 // values >= 100 are reserved for dev releases leading to the next minor/major increase
54
+ #define OBX_VERSION_PATCH 2 // values >= 100 are reserved for dev releases leading to the next minor/major increase
55
55
56
56
//----------------------------------------------
57
57
// Common types
@@ -693,9 +693,11 @@ OBX_C_API OBX_store* obx_store_open(OBX_store_options* opt);
693
693
OBX_C_API bool obx_store_is_open (const char * path );
694
694
695
695
/// Attach to a previously opened store matching the path of the DB directory, which was used for opening the store.
696
- /// The returned store is a new instance (e.g. different pointer value) with its own lifetime and must also be closed.
696
+ /// The returned store is a new instance (e.g. different pointer value) with its own lifetime and must also be closed
697
+ /// via obx_store_close().
697
698
/// The actual underlying store is only closed when the last store OBX_store instance is closed.
698
699
/// @returns nullptr if no open store was found (i.e. not opened before or already closed)
700
+ /// @see obx_store_clone() for "attaching" to a available store instance.
699
701
OBX_C_API OBX_store * obx_store_attach (const char * path );
700
702
701
703
/// Combines the functionality of obx_store_attach() and obx_store_open() in a thread-safe way.
@@ -706,6 +708,16 @@ OBX_C_API OBX_store* obx_store_attach(const char* path);
706
708
/// store (true) or a new store was created (false).
707
709
OBX_C_API OBX_store * obx_store_attach_or_open (OBX_store_options * opt , bool check_matching_options , bool * out_attached );
708
710
711
+ /// Clone a previously opened store; while a store instance is usable from multiple threads, situations may exist
712
+ /// in which cloning a store simplifies the overall lifecycle.
713
+ /// E.g. when a store is used for multiple threads and it may only be fully released once the last thread completes.
714
+ /// The returned store is a new instance (e.g. different pointer value) with its own lifetime and must also be closed
715
+ /// via obx_store_close().
716
+ /// The actual underlying store is only closed when the last store OBX_store instance is closed.
717
+ /// @returns nullptr if the store could not be cloned
718
+ /// @see obx_store_attach() for "cloning" using the store's path.
719
+ OBX_C_API OBX_store * obx_store_clone (OBX_store * store );
720
+
709
721
/// For stores created outside of this C API, e.g. via C++ or Java, this is how you can use it via C too.
710
722
/// Like this, it is OK to use the same store instance (same database) from multiple languages in parallel.
711
723
/// Note: the store's life time will still be managed outside of the C API;
@@ -968,7 +980,7 @@ OBX_C_API obx_err obx_box_contains_many(OBX_box* box, const OBX_id_array* ids, b
968
980
/// \attention The exposed data is only valid as long as the (top) transaction is still active and no write
969
981
/// \attention operation (e.g. put/remove) was executed. Accessing data after this is undefined behavior.
970
982
/// @returns OBX_ERROR_ILLEGAL_STATE if not inside of an active transaction (see obx_txn_read() and obx_txn_write())
971
- OBX_C_API obx_err obx_box_get (OBX_box * box , obx_id id , uint8_t * * data , size_t * size );
983
+ OBX_C_API obx_err obx_box_get (OBX_box * box , obx_id id , const uint8_t * * data , size_t * size );
972
984
973
985
/// Fetch multiple objects for the given IDs from the box; must be called inside a (reentrant) transaction.
974
986
/// \attention See obx_box_get() for important notes on the limited lifetime of the exposed data.
0 commit comments