Skip to content

Commit 55cdfe6

Browse files
greenrobotgreenrobot-team
authored andcommitted
Update C-API [0.15.1 -> 0.15.2]
1 parent 525108c commit 55cdfe6

File tree

11 files changed

+29
-11
lines changed

11 files changed

+29
-11
lines changed

dev-doc/updating-c-library.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Dart won't error on C function signature mismatch, leading to obscure memory bug
99
Update `flutter_libs` and `sync_flutter_libs` with **compatible library versions**:
1010

1111
- Linux and Windows
12-
- Shortcut: search and replace e.g. `set(OBJECTBOX_VERSION 0.15.1)` in `CMakeLists.txt`.
12+
- Shortcut: search and replace e.g. `set(OBJECTBOX_VERSION 0.15.2)` in `CMakeLists.txt`.
1313
- [flutter_libs Linux](../flutter_libs/linux/CMakeLists.txt)
1414
- [flutter_libs Windows](../flutter_libs/windows/CMakeLists.txt)
1515
- [sync_flutter_libs Linux](../sync_flutter_libs/linux/CMakeLists.txt)

flutter_libs/linux/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ set(objectbox_flutter_libs_bundled_libraries
2626

2727
# ----------------------------------------------------------------------
2828

29-
set(OBJECTBOX_VERSION 0.15.1)
29+
set(OBJECTBOX_VERSION 0.15.2)
3030

3131
set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
3232
if (${OBJECTBOX_ARCH} MATCHES "x86_64")

flutter_libs/windows/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ set(objectbox_flutter_libs_bundled_libraries
2525

2626
# ----------------------------------------------------------------------
2727

28-
set(OBJECTBOX_VERSION 0.15.1)
28+
set(OBJECTBOX_VERSION 0.15.2)
2929

3030
set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
3131
if (${OBJECTBOX_ARCH} MATCHES "AMD64")

install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eu
55
# It's important that the generated dart bindings and the c-api library version match. Dart won't error on C function
66
# signature mismatch, leading to obscure memory bugs.
77
# For how to upgrade the version see dev-doc/updating-c-library.md
8-
cLibVersion=0.15.1
8+
cLibVersion=0.15.2
99
os=$(uname)
1010
cLibArgs="$*"
1111

objectbox/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## latest
22

33
* Add an option to change code-generator's `output_dir` in `pubspec.yaml`. #341
4+
* Update: [objectbox-c 0.15.2](https://github.com/objectbox/objectbox-c/releases/tag/v0.15.0).
5+
* Update: [objectbox-android 3.1.2](https://github.com/objectbox/objectbox-java/releases/tag/V3.1.0).
6+
* Update: [objectbox-swift 1.7.0](https://github.com/objectbox/objectbox-swift/releases/tag/v1.7.0).
47

58
## 1.3.0 (2021-11-22)
69

objectbox/lib/src/native/bindings/objectbox-sync.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "objectbox.h"
3535

3636
#if defined(static_assert) || defined(__cplusplus)
37-
static_assert(OBX_VERSION_MAJOR == 0 && OBX_VERSION_MINOR == 15 && OBX_VERSION_PATCH == 1,
37+
static_assert(OBX_VERSION_MAJOR == 0 && OBX_VERSION_MINOR == 15 && OBX_VERSION_PATCH == 2,
3838
"Versions of objectbox.h and objectbox-sync.h files do not match, please update");
3939
#endif
4040

objectbox/lib/src/native/bindings/objectbox.h

+15-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern "C" {
5151
/// obx_version() or obx_version_is_at_least().
5252
#define OBX_VERSION_MAJOR 0
5353
#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
5555

5656
//----------------------------------------------
5757
// Common types
@@ -693,9 +693,11 @@ OBX_C_API OBX_store* obx_store_open(OBX_store_options* opt);
693693
OBX_C_API bool obx_store_is_open(const char* path);
694694

695695
/// 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().
697698
/// The actual underlying store is only closed when the last store OBX_store instance is closed.
698699
/// @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.
699701
OBX_C_API OBX_store* obx_store_attach(const char* path);
700702

701703
/// 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);
706708
/// store (true) or a new store was created (false).
707709
OBX_C_API OBX_store* obx_store_attach_or_open(OBX_store_options* opt, bool check_matching_options, bool* out_attached);
708710

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+
709721
/// For stores created outside of this C API, e.g. via C++ or Java, this is how you can use it via C too.
710722
/// Like this, it is OK to use the same store instance (same database) from multiple languages in parallel.
711723
/// 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
968980
/// \attention The exposed data is only valid as long as the (top) transaction is still active and no write
969981
/// \attention operation (e.g. put/remove) was executed. Accessing data after this is undefined behavior.
970982
/// @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);
972984

973985
/// Fetch multiple objects for the given IDs from the box; must be called inside a (reentrant) transaction.
974986
/// \attention See obx_box_get() for important notes on the limited lifetime of the exposed data.

objectbox/lib/src/native/bindings/objectbox_c.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -7001,7 +7001,7 @@ const int OBX_VERSION_MAJOR = 0;
70017001

70027002
const int OBX_VERSION_MINOR = 15;
70037003

7004-
const int OBX_VERSION_PATCH = 1;
7004+
const int OBX_VERSION_PATCH = 2;
70057005

70067006
const int OBX_ID_NEW = -1;
70077007

objectbox/test/basics_test.dart

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'dart:io';
44
import 'package:objectbox/internal.dart';
55
import 'package:objectbox/src/native/bindings/bindings.dart';
66
import 'package:objectbox/src/native/bindings/helpers.dart';
7+
import 'package:objectbox/src/native/version.dart';
78
import 'package:objectbox/src/store.dart';
89
import 'package:test/test.dart';
910

@@ -12,6 +13,8 @@ import 'objectbox.g.dart';
1213
import 'test_env.dart';
1314

1415
void main() {
16+
print("Testing basics of ObjectBox using C lib V${libraryVersion()}");
17+
1518
// Prior to Dart 2.6, the exception wasn't accessible and may have crashed.
1619
// Similarly, this occured in Fluter for Linux (desktop).
1720
// https://github.com/dart-lang/sdk/issues/38141

sync_flutter_libs/linux/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ set(objectbox_sync_flutter_libs_bundled_libraries
2626

2727
# ----------------------------------------------------------------------
2828

29-
set(OBJECTBOX_VERSION 0.15.1)
29+
set(OBJECTBOX_VERSION 0.15.2)
3030

3131
set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
3232
if (${OBJECTBOX_ARCH} MATCHES "x86_64")

sync_flutter_libs/windows/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ set(objectbox_sync_flutter_libs_bundled_libraries
2525

2626
# ----------------------------------------------------------------------
2727

28-
set(OBJECTBOX_VERSION 0.15.1)
28+
set(OBJECTBOX_VERSION 0.15.2)
2929

3030
set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
3131
if (${OBJECTBOX_ARCH} MATCHES "AMD64")

0 commit comments

Comments
 (0)