Skip to content

Commit 888d119

Browse files
committed
Version 4.2.0
1 parent 69237cb commit 888d119

File tree

12 files changed

+127
-16
lines changed

12 files changed

+127
-16
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
ObjectBox C and C++ API Changelog
22
=================================
33

4+
4.2.0 (2025-03-04)
5+
------------------
6+
* Extended the model by external names and types:
7+
allows defining a different name for an external database, which ObjectBox syncs with.
8+
9+
This prepares upcoming features for our [MongoDB Sync Connector](https://sync.objectbox.io/mongodb-sync-connector).
10+
411
4.1.0 (2025-01-28)
512
------------------
613
* New query conditions for map properties (via flex properties):

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ else ()
4949

5050
function(defineObjectBoxLib VARIANT)
5151
# Configuration updated for each release
52-
set(DL_VERSION 4.1.0)
52+
set(DL_VERSION 4.2.0)
5353

5454
# Platform detection and other setup
5555
set(DL_URL https://github.com/objectbox/objectbox-c/releases/download)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ box.put({.text = "Buy milk"});
1818
1919
See [ObjectBox C and C++ docs](https://cpp.objectbox.io/) for API details.
2020
21-
**Latest version: 4.1.0** (2025-01-28).
21+
**Latest version: 4.2.0** (2025-03-04).
2222
See [changelog](CHANGELOG.md) for more details.
2323
2424
## Table of Contents:

download.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ tty -s || quiet=true
4444

4545
# Note: optional arguments like "--quiet" shifts argument positions in the case block above
4646

47-
version=${1:-4.1.0}
47+
version=${1:-4.2.0}
4848
os=${2:-$(uname)}
4949
arch=${3:-$(uname -m)}
5050
echo "Base config: OS ${os} and architecture ${arch}"

doxygen/Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
ObjectBox C and C++ API Changelog
44
=================================
55

6+
4.2.0 (2025-03-04)
7+
------------------
8+
* Extended the model by external names and types:
9+
allows defining a different name for an external database, which ObjectBox syncs with.
10+
11+
This prepares upcoming features for our [MongoDB Sync Connector](https://sync.objectbox.io/mongodb-sync-connector).
12+
613
4.1.0 (2025-01-28)
714
------------------
815
* New query conditions for map properties (via flex properties):

doxygen/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "ObjectBox C and C++ API"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = "4.1.0"
41+
PROJECT_NUMBER = "4.2.0"
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

examples/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ add_subdirectory(c-gen)
33
add_subdirectory(cpp-gen)
44
add_subdirectory(cpp-gen-sync)
55

6-
find_package(ObjectBoxGenerator 4.0.0)
6+
# Since core project is also using this CMakeLists.txt and it did not fetch the ObjectBoxGenerator, find it quietly.
7+
find_package(ObjectBoxGenerator 4.0.0 QUIET)
78
# Some platforms such as Linux ARM(64) and Windows ARM(64) are not supported.
89
# We exclude this example for these cases where the generator was not found.
910
if (ObjectBoxGenerator_FOUND)
1011
add_subdirectory(cpp-autogen)
1112
else ()
12-
message(WARNING "Did not add all examples, as the ObjectBoxGenerator CMake was not found")
13+
message(STATUS "Did not add all examples, as the ObjectBoxGenerator CMake was not found")
1314
endif ()
1415
add_subdirectory(vectorsearch-cities)

examples/cpp-autogen/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ add_executable(${PROJECT_NAME}
55
main.cpp
66
)
77

8-
# add_obx_schema provided by ObjectBoxGenerator package.
8+
# add_obx_schema provided by ObjectBoxGenerator package, which is fetched in one of the parent CMakeLists.txt files.
99
add_obx_schema(TARGET ${PROJECT_NAME} SCHEMA_FILES tasklist.fbs INSOURCE)
1010

1111
set_target_properties(${PROJECT_NAME} PROPERTIES

include/objectbox-sync.h

Lines changed: 1 addition & 1 deletion
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 == 4 && OBX_VERSION_MINOR == 1 && OBX_VERSION_PATCH == 0, // NOLINT
37+
static_assert(OBX_VERSION_MAJOR == 4 && OBX_VERSION_MINOR == 2 && OBX_VERSION_PATCH == 0, // NOLINT
3838
"Versions of objectbox.h and objectbox-sync.h files do not match, please update");
3939
#endif
4040

include/objectbox-sync.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "objectbox-sync.h"
2020
#include "objectbox.hpp"
2121

22-
static_assert(OBX_VERSION_MAJOR == 4 && OBX_VERSION_MINOR == 1 && OBX_VERSION_PATCH == 0, // NOLINT
22+
static_assert(OBX_VERSION_MAJOR == 4 && OBX_VERSION_MINOR == 2 && OBX_VERSION_PATCH == 0, // NOLINT
2323
"Versions of objectbox.h and objectbox-sync.hpp files do not match, please update");
2424

2525
namespace obx {

include/objectbox.h

Lines changed: 102 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ extern "C" {
5252
/// When using ObjectBox as a dynamic library, you should verify that a compatible version was linked using
5353
/// obx_version() or obx_version_is_at_least().
5454
#define OBX_VERSION_MAJOR 4
55-
#define OBX_VERSION_MINOR 1
55+
#define OBX_VERSION_MINOR 2
5656
#define OBX_VERSION_PATCH 0 // values >= 100 are reserved for dev releases leading to the next minor/major increase
5757

5858
//----------------------------------------------
@@ -615,6 +615,76 @@ typedef enum {
615615
OBXPropertyFlags_EXPIRATION_TIME = 65536,
616616
} OBXPropertyFlags;
617617

618+
/// A property type of an external system (e.g. another database) that has no default mapping to an ObjectBox type.
619+
/// External property types numeric values start at 100 to avoid overlaps with ObjectBox's PropertyType.
620+
/// (And if we ever support one of these as a primary type, we could share the numeric value?)
621+
typedef enum {
622+
/// Not a real type: represents uninitialized state and can be used for forward compatibility.
623+
OBXExternalPropertyType_Unknown = 0,
624+
/// Representing type: ByteVector
625+
/// Encoding: 1:1 binary representation, little endian (16 bytes)
626+
OBXExternalPropertyType_Int128 = 100,
627+
// OBXExternalPropertyType_Reserved1 = 101,
628+
/// Representing type: ByteVector
629+
/// Encoding: 1:1 binary representation (16 bytes)
630+
OBXExternalPropertyType_Uuid = 102,
631+
/// IEEE 754 decimal128 type, e.g. supported by MongoDB
632+
/// Representing type: ByteVector
633+
/// Encoding: 1:1 binary representation (16 bytes)
634+
OBXExternalPropertyType_Decimal128 = 103,
635+
// OBXExternalPropertyType_Reserved2 = 104,
636+
// OBXExternalPropertyType_Reserved3 = 105,
637+
// OBXExternalPropertyType_Reserved4 = 106,
638+
/// A key/value map; e.g. corresponds to a JSON object or a MongoDB document (although not keeping the key order).
639+
/// Unlike the Flex type, this must contain a map value (e.g. not a vector or a scalar).
640+
/// Representing type: Flex
641+
/// Encoding: Flex
642+
OBXExternalPropertyType_FlexMap = 107,
643+
/// A vector (aka list or array) of flexible elements; e.g. corresponds to a JSON array or a MongoDB array.
644+
/// Unlike the Flex type, this must contain a vector value (e.g. not a map or a scalar).
645+
/// Representing type: Flex
646+
/// Encoding: Flex
647+
OBXExternalPropertyType_FlexVector = 108,
648+
/// Placeholder (not yet used) for a JSON document.
649+
/// Representing type: String
650+
OBXExternalPropertyType_Json = 109,
651+
/// Placeholder (not yet used) for a BSON document.
652+
/// Representing type: ByteVector
653+
OBXExternalPropertyType_Bson = 110,
654+
/// JavaScript source code
655+
/// Representing type: String
656+
OBXExternalPropertyType_JavaScript = 111,
657+
// OBXExternalPropertyType_Reserved5 = 112,
658+
// OBXExternalPropertyType_Reserved6 = 113,
659+
// OBXExternalPropertyType_Reserved7 = 114,
660+
// OBXExternalPropertyType_Reserved8 = 115,
661+
/// A vector (array) of Int128 values
662+
OBXExternalPropertyType_Int128Vector = 116,
663+
// OBXExternalPropertyType_Reserved9 = 117,
664+
/// A vector (array) of Int128 values
665+
OBXExternalPropertyType_UuidVector = 118,
666+
// OBXExternalPropertyType_Reserved10 = 119,
667+
// OBXExternalPropertyType_Reserved11 = 120,
668+
// OBXExternalPropertyType_Reserved12 = 121,
669+
// OBXExternalPropertyType_Reserved13 = 122,
670+
/// The 12-byte ObjectId type in MongoDB
671+
/// Representing type: ByteVector
672+
/// Encoding: 1:1 binary representation (12 bytes)
673+
OBXExternalPropertyType_MongoId = 123,
674+
/// A vector (array) of MongoId values
675+
OBXExternalPropertyType_MongoIdVector = 124,
676+
/// Representing type: Long
677+
/// Encoding: Two unsigned 32-bit integers merged into a 64-bit integer.
678+
OBXExternalPropertyType_MongoTimestamp = 125,
679+
/// Representing type: ByteVector
680+
/// Encoding: 3 zero bytes (reserved, functions as padding), fourth byte is the sub-type,
681+
/// followed by the binary data.
682+
OBXExternalPropertyType_MongoBinary = 126,
683+
/// Representing type: string vector with 2 elements (index 0: pattern, index 1: options)
684+
/// Encoding: 1:1 string representation
685+
OBXExternalPropertyType_MongoRegex = 127,
686+
} OBXExternalPropertyType;
687+
618688
struct OBX_model; // doxygen (only) picks up the typedef struct below
619689

620690
/// Model represents a database schema and must be provided when opening the store.
@@ -657,6 +727,14 @@ OBX_C_API obx_err obx_model_entity(OBX_model* model, const char* name, obx_schem
657727
/// @param flags See OBXEntityFlags for values (use bitwise OR to combine multiple flags)
658728
OBX_C_API obx_err obx_model_entity_flags(OBX_model* model, uint32_t flags);
659729

730+
/// Set the highest ever known property id in the entity. Should always be equal to or higher than the
731+
/// last property id of the previous version of the entity.
732+
OBX_C_API obx_err obx_model_entity_last_property_id(OBX_model* model, obx_schema_id property_id, obx_uid property_uid);
733+
734+
/// Refine the definition of the entity declared by the most recent obx_model_entity() call: set the external name.
735+
/// This is an optional name used in an external system, e.g. another database that ObjectBox syncs with.
736+
OBX_C_API obx_err obx_model_entity_external_name(OBX_model* model, const char* external_name);
737+
660738
/// Starts the definition of a new property for the entity type of the last obx_model_entity() call.
661739
/// @param name A human readable name for the property. Must be unique within the entity
662740
/// @param type The type of property required
@@ -682,6 +760,19 @@ OBX_C_API obx_err obx_model_property_relation(OBX_model* model, const char* targ
682760
/// @param index_uid Used to identify relations between versions of the model. Must be globally unique.
683761
OBX_C_API obx_err obx_model_property_index_id(OBX_model* model, obx_schema_id index_id, obx_uid index_uid);
684762

763+
/// Refine the definition of the property declared by the most recent obx_model_property() call: set the external name.
764+
/// This is an optional name used in an external system, e.g. another database that ObjectBox syncs with.
765+
/// @param index_id Must be unique within this version of the model
766+
/// @param index_uid Used to identify relations between versions of the model. Must be globally unique.
767+
OBX_C_API obx_err obx_model_property_external_name(OBX_model* model, const char* external_name);
768+
769+
/// Refine the definition of the property declared by the most recent obx_model_property() call: set the external type.
770+
/// This is an optional type used in an external system, e.g. another database that ObjectBox syncs with.
771+
/// Note that the supported mappings from ObjectBox types to external types are limited.
772+
/// @param index_id Must be unique within this version of the model
773+
/// @param index_uid Used to identify relations between versions of the model. Must be globally unique.
774+
OBX_C_API obx_err obx_model_property_external_type(OBX_model* model, OBXExternalPropertyType external_type);
775+
685776
/// Sets the vector dimensionality for the HNSW index of the latest property (must be of a supported vector type).
686777
/// This a mandatory option for all HNSW indexes.
687778
/// Note 1: vectors with higher dimensions than this value are also indexed (ignoring the higher elements).
@@ -702,7 +793,7 @@ OBX_C_API obx_err obx_model_property_index_hnsw_neighbors_per_node(OBX_model* mo
702793
/// If indexing time is not a major concern, a value of at least 200 is recommended to improve search quality.
703794
OBX_C_API obx_err obx_model_property_index_hnsw_indexing_search_count(OBX_model* model, uint32_t value);
704795

705-
/// Sets flags for the HNSW index of the latest property ().
796+
/// Sets flags for the HNSW index of the latest property.
706797
/// For details see OBXHnswFlags and its individual values.
707798
/// @param flags See OBXHnswFlags for values (use bitwise OR to combine multiple flags)
708799
OBX_C_API obx_err obx_model_property_index_hnsw_flags(OBX_model* model, uint32_t flags);
@@ -728,6 +819,15 @@ OBX_C_API obx_err obx_model_property_index_hnsw_vector_cache_hint_size_kb(OBX_mo
728819
OBX_C_API obx_err obx_model_relation(OBX_model* model, obx_schema_id relation_id, obx_uid relation_uid,
729820
obx_schema_id target_id, obx_uid target_uid);
730821

822+
/// Augments the previously defined relation with a name
823+
OBX_C_API obx_err obx_model_relation_name(OBX_model* model, const char* name);
824+
825+
/// Augments the previously defined relation with an external name (used outside of ObjectBox)
826+
OBX_C_API obx_err obx_model_relation_external_name(OBX_model* model, const char* external_name);
827+
828+
/// Augments the previously defined relation with an external type (used outside of ObjectBox)
829+
OBX_C_API obx_err obx_model_relation_external_type(OBX_model* model, OBXExternalPropertyType external_type);
830+
731831
/// Set the highest ever known entity id in the model. Should always be equal to or higher than the
732832
/// last entity id of the previous version of the model
733833
OBX_C_API void obx_model_last_entity_id(OBX_model*, obx_schema_id entity_id, obx_uid entity_uid);
@@ -740,10 +840,6 @@ OBX_C_API void obx_model_last_index_id(OBX_model* model, obx_schema_id index_id,
740840
/// last relation id of the previous version of the model.
741841
OBX_C_API void obx_model_last_relation_id(OBX_model* model, obx_schema_id relation_id, obx_uid relation_uid);
742842

743-
/// Set the highest ever known property id in the entity. Should always be equal to or higher than the
744-
/// last property id of the previous version of the entity.
745-
OBX_C_API obx_err obx_model_entity_last_property_id(OBX_model* model, obx_schema_id property_id, obx_uid property_uid);
746-
747843
//----------------------------------------------
748844
// Store
749845
//----------------------------------------------

include/objectbox.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <optional>
3737
#endif
3838

39-
static_assert(OBX_VERSION_MAJOR == 4 && OBX_VERSION_MINOR == 1 && OBX_VERSION_PATCH == 0, // NOLINT
39+
static_assert(OBX_VERSION_MAJOR == 4 && OBX_VERSION_MINOR == 2 && OBX_VERSION_PATCH == 0, // NOLINT
4040
"Versions of objectbox.h and objectbox.hpp files do not match, please update");
4141

4242
#ifdef __clang__

0 commit comments

Comments
 (0)