• This repository has been archived on 08/Nov/2021
  • Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    C++
  • License
    Other
  • Created over 9 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cross-platform abstractions used within Realm products

DEPRECATED

This project has been merged into https://github.com/realm/realm-core


Realm Object Store

The object store contains cross-platform abstractions used in Realm products. It is not intended to be used directly.

The object store consists of the following components:

  • object_store/schema/object_schema/property - contains the structures and logic used to setup and modify Realm files and their schema.
  • shared_realm - wraps the object_store APIs to provide transactions, notifications, Realm caching, migrations, and other higher level functionality.
  • object_accessor/results/list - accessor classes, object creation/update pipeline, and helpers for creating platform specific property getters and setters.

Each Realm product may use only a subset of the provided components depending on its needs.

Reporting Bugs

Please report bugs against the Realm product that you're using:

Supported Platforms

The object store's CMake build system currently only supports building for OS X, Linux, and Android.

The object store code supports being built for all Apple platforms, Linux and Android when used along with the relevant Realm product's build system.

Building

  1. Download dependencies:

    git submodule update --init
    
  2. Install CMake. You can download an installer for OS X from the CMake download page, or install via Homebrew:

    brew install cmake
    
  3. Generate build files:

    cmake .
    

    If building for Android, the path for the Android NDK must be specified. For example, if it was installed with homebrew:

    cmake -DREALM_PLATFORM=Android -DANDROID_NDK=/usr/local/Cellar/android-ndk-r10e/r10e/ .
    

    If you want to use XCode as your editor, you can generate a XCode project with:

    cmake -G Xcode .
    
  4. Build:

    make
    

Building With Sync Support

If you wish to build with sync enabled, invoke cmake like so:

cmake -DREALM_ENABLE_SYNC=1

Building Against a Local Version of Core

If you wish to build against a local version of core you can invoke cmake like so:

cmake -DREALM_CORE_PREFIX=/path/to/realm-core

The given core tree will be built as part of the object store build.

Building Against a Local Version of Sync

Specify the path to realm-core and realm-sync when invoking cmake:

cmake -DREALM_ENABLE_SYNC=1 -DREALM_CORE_PREFIX=/path/to/realm-core -DREALM_SYNC_PREFIX=/path/to/realm-sync

Prebuilt sync binaries are currently not supported.

Building with Sanitizers

The object store can be built using ASan, TSan and/or UBSan by specifying -DSANITIZE_ADDRESS=1, -DSANITIZE_THREAD=1, or -DSANITIZE_UNDEFINED=1 when invoking CMake. Building with ASan requires specifying a path to core with -DREALM_CORE_PREFIX as core needs to also be built with ASan enabled.

On OS X, the Xcode-provided copy of Clang only comes with ASan, and using TSan or UBSan requires a custom build of Clang. If you have installed Clang as an external Xcode toolchain (using the install-xcode-toolchain when building LLVM), note that you'll have to specify -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ when running cmake to stop cmake from being too clever.

Testing

make run-tests

Android

It requires a root device or an emulator:

make
adb push tests/tests /data/local/tmp
adb shell /data/local/tmp/tests

Using Docker

The Dockerfile included in this repo will provision a Docker image suitable for building and running tests for both the Linux and Android platforms.

# Build Docker image from Dockerfile
docker build -t "objectstore" .
# Run bash interactively from the built Docker image,
# mounting the current directory
docker run --rm -it -v $(pwd):/tmp -w /tmp objectstore bash
# Build the object store for Linux and run tests
> cmake .
> make
> make run-tests

Refer to the rest of this document for instructions to build/test in other configurations.

Running [app] tests against a local MongoDB Stitch

Stitch images are published to our private Github CI. Follow the steps here to set up authorization from docker to your Github account https://github.com/realm/ci/tree/master/realm/docker/mongodb-realm Once authorized, run the following docker command from the top directory to start a local instance:

docker run --rm -v $(pwd)/tests/mongodb:/apps/os-integration-tests -p 9090:9090 -it docker.pkg.github.com/realm/ci/mongodb-realm-test-server:latest

This will make the stitch UI available in your browser at localhost:9090 where you can login with "[email protected]" and "password". Once logged in, you can make changes to the integration-tests app and those changes will be persisted to your disk, because the docker image has a mapped volume to the tests/mongodb directory.

To run the [app] tests against the local image, you need to configure a build with some cmake options to tell the tests where to point to.

mkdir build.sync.ninja
sh "cmake -B build.sync.ninja -G Ninja -DREALM_ENABLE_SYNC=1 -DREALM_ENABLE_AUTH_TESTS=1 -DREALM_MONGODB_ENDPOINT=\"http://localhost:9090\" -DREALM_STITCH_CONFIG=\"./tests/mongodb/stitch.json\"
sh "cmake --build build.sync.ninja --target tests"
sh "./build.sync.ninja/tests/tests -d=1

Visual Studio Code

The .vscode folder contains workspace configuration files for Visual Studio Code, which will be picked up by VSCode when it opens this folder. .vscode/extensions.json contains a list of recommended IDE extensions - namely C++, CMake, and Catch2 support. Make sure to accept installing the recommended extensions the first time you open this repo in VSCode.

Building

From the command palette execute CMake: Select Variant and choose one of the predefined build variants, such as Debug + Enable Sync + Download Core. Then, execute CMake: Configure and CMake: Build. Refer to the CMake Tools for Visual Studio Code guide for more details.

Testing

The Catch2 and Google Test Explorer extension enables exploring, running, and debugging individual test cases. Simply build the tests target and execute the Test: Focus on Test Explorer View VSCode command or manually switch to the Test Explorer view in the sidebar to get started.

Developing inside a container

The .devcontainer folders contains configuration for the Visual Stuio Code Remote - Containers extension, which allows you to develop inside the same Docker container that CI runs in, which is especially useful because it also sets up the MongoDB Realm Test Server container. Make sure you have the Remote - Containers extension installed (it's part of the recommended extensions list for this repository) and run the Remote-Containers: Reopen in Container (or Rebuild and Reopen in Container) command. VSCode will build the image described in Dockerfile, spin up a container group using Docker Compose, and reopen the workspace from inside the container.

ssh-agent forwarding

The dev container needs your SSH key to clone the realm-sync repository during build. Make sure your agent is running and configured as described here.

Docker resources

Assign more memory and CPU to Docker for faster builds. The link step may fail inside the container if there's not enough memory, too.

License

Realm Object Store is published under the Apache 2.0 license. The underlying core is also published under the Apache 2.0 license.

This product is not being made available to any person located in Cuba, Iran, North Korea, Sudan, Syria or the Crimea region, or to any other person that is not eligible to receive the product under U.S. law.

More Repositories

1

SwiftLint

A tool to enforce Swift style and conventions.
Swift
18,607
star
2

realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
Objective-C
16,280
star
3

realm-java

Realm is a mobile database: a replacement for SQLite & ORMs
Java
11,451
star
4

jazzy

Soulful docs for Swift & Objective-C
Ruby
7,341
star
5

realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
TypeScript
5,758
star
6

realm-dotnet

Realm is a mobile database: a replacement for SQLite & ORMs
C#
1,243
star
7

realm-core

Core database component for the Realm Mobile Database SDKs
C++
1,016
star
8

realm-kotlin

Kotlin Multiplatform and Android SDK for the Realm Mobile Database: Build Better Apps Faster.
Kotlin
942
star
9

realm-dart

Realm is a mobile database: a replacement for SQLite & ORMs.
Dart
758
star
10

SwiftCov

A tool to generate test code coverage information for Swift.
Swift
562
star
11

realm-browser-osx

DEPRECATED - Realm Browser for Mac OS X has been replaced by realm-studio which is cross platform.
Objective-C
501
star
12

realm-android-adapters

Adapters for combining Realm Java with Android UI components and framework classes
Java
414
star
13

realm-tasks

To Do app built with Realm, inspired by Clear for iOS
Swift
369
star
14

summer-of-swift

An ephemeral contest to learn Swift by doing
308
star
15

realm-studio

Realm Studio
TypeScript
300
star
16

realm-object-server

Tracking of issues related to the Realm Object Server and other general issues not related to the specific SDK's
Shell
293
star
17

RealmContent

Light Realm-powered content management system
Swift
238
star
18

realm-cocoa-converter

A library that provides the ability to import/export Realm files from a variety of data container formats.
Swift
219
star
19

realm-draw

The official Realm Draw app used in promotional videos
C#
163
star
20

github-gantt

Generate Gantt Charts From Github Issues!
JavaScript
156
star
21

realm-kotlin-samples

Samples demonstrating the usage of Realm-Kotlin SDK
Kotlin
91
star
22

RChat

Swift
88
star
23

realm-graphql

GraphQL client for Realm Object Server
TypeScript
80
star
24

realm-loginkit

A generic interface for logging in to Realm Mobile Platform apps
Swift
74
star
25

realm-cpp

Realm C++
C++
73
star
26

realm-dart-samples

Samples for Realm Flutter and Realm Dart SDKs
C++
68
star
27

EventKit

A template conference app, featuring real-time schedule and data changes & running on Realm 🚀
Swift
63
star
28

realm-scanner

A scanning app that can analyze and report on any photos it is given
Java
54
star
29

react-realm-context

Components that simplifies using Realm with React
TypeScript
50
star
30

realm-graphql-service

GraphQL service for Realm Object Server
TypeScript
43
star
31

RealmPop

Java
39
star
32

my-first-realm-app

ToDo demo app using Realm and Realm Object Server to synchronize tasks.
Java
38
star
33

task-tracker-swiftui

Simple task manager using Realm and SwiftUI
Swift
36
star
34

realm-dvdrental

Demo inventory application which synchronizes data originating in Postgres via the Realm Postgres data connector.
Swift
36
star
35

realm-android-user-store

Java
35
star
36

realm-inventory

An sample inventory app demonstrating safe counters via Lists and Realm Counters
Swift
32
star
37

unity-examples

C#
30
star
38

realm-teamwork-MR

A Realm demo app showing an idealized version of a field-service type application using multiple Realms, permissions, etc
Swift
26
star
39

FindOurDevices

A React Native + MongoDB Realm application for allowing users to see location and movement of their own devices or those of people in the same private group.
JavaScript
25
star
40

node-template-project

A template for your Node and TypeScript Project with Visual Studio Code Debugging!
TypeScript
23
star
41

realm-flipper-plugin

A Flipper plugin to debug React Native applications using a Realm database.
TypeScript
20
star
42

realm-java-benchmarks

Kotlin
18
star
43

realm-drawkit

A modular drawing library that uses RMP for collaboration
Swift
17
star
44

aws-devicefarm

Github action for triggering runs on AWS devicefarm
JavaScript
17
star
45

Scrumdinger

Showing how the app from Apple's SwiftUI tutorial can be enhanced by adding Realm
Swift
16
star
46

awesome-realm

A curated list of awesome Realm resources, libraries, tools and applications
15
star
47

roc-ios

Swift
14
star
48

realm-search

An example implementation of synchronizing specific objects from a massive global Realm.
Swift
13
star
49

roc-ios-controller

A Chat Controller powered by Realm and Chatto
Swift
13
star
50

realm-puzzle

A small collaborative game where players work to complete a jigsaw puzzle.
Objective-C
12
star
51

realm-sync-demos

Demo apps for MongoDB Realm Sync
Kotlin
11
star
52

RCurrency

Swift
10
star
53

jazzy-integration-specs

Integration specs for https://github.com/realm/jazzy
HTML
10
star
54

realm-MultiUserTasksTutorial

Walk-though of constructing a multi-user example using Realm Tasks
Swift
9
star
55

charts

A Collection of Helm Charts
Smarty
9
star
56

realm-surveys

A reactive survey application powered by Realm
Swift
9
star
57

realm-connectors

Realm Object Server Data Connectors
8
star
58

realm-cloud-functions-demo

Realm & IBM Cloud Functions demo
JavaScript
8
star
59

realm-dotnet-groupedcollection

C#
8
star
60

realm-dotnet-lfs

C#
8
star
61

electron-react-samples

TypeScript
7
star
62

Realm-Sweeper

Swift
7
star
63

FindOurDevices-backend

A backend MongoDB Realm application for allowing users to see location and movement of their own devices or those of people in the same private group.
JavaScript
7
star
64

Realm-Drawing

Swift
6
star
65

feedback-manager

A simple Realm-powered feedback app that employs the Azure Text Analytics API to extract sentiment and key phrases from tickets
C#
5
star
66

BarCodes-Demo

A small demo app to show how to scan barcode and place into into a Realm
Swift
5
star
67

realm-qna

question and answer app
Swift
4
star
68

realm-dotnet-samples

C#
4
star
69

realm-swift-samples

Sample applications for realm-swift database
Swift
4
star
70

realm-tools

Various tools for testing Realm
TypeScript
3
star
71

ci-actions

A repository for commonly used GitHub Actions inside the various realm repositories
TypeScript
3
star
72

xamarin-examples-architecture

Test
C#
3
star
73

realm-flexible-sync-test-api

Sample App for A/B testing two version of the Flexible Sync API
Swift
3
star
74

realm-SharedTasks

Swift
2
star
75

unity-examples-3d-chess

Examples and tutorials for the Realm Unity SDK.
2
star
76

global-notifier-design-patterns

C++
2
star
77

realm.github.io

HTML
2
star
78

realm-object-server-cognito-auth

Cognito authentication provider for Realm Object Server
TypeScript
2
star
79

aws-devicefarm-sample-data

Sample data to use with the AWS devicefarm action
Java
1
star
80

realm-lua-bootcamp

Teaching the basics of building a Realm SDK
C++
1
star
81

realm-crowdcircle

A collaborative experimental game, played between 6 teams
Swift
1
star
82

realm-js-playground

JavaScript
1
star