Skip to content

Commit

Permalink
Merge branch 'master' into ni/flx-sync
Browse files Browse the repository at this point in the history
* master:
  Update CHANGELOG.md (#2767)
  Fix `TraverseSort` to support properties declared by interfaces (#2750)
  Added fallback path (#2766)
  Use lowercase "pr" for prerelease packages (#2765)
  Update README.md (#2764)
  • Loading branch information
nirinchev committed Jan 13, 2022
2 parents 39c8224 + 9ee4bb5 commit c519060
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/templates/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -469,14 +469,14 @@ jobs:
- #@ template.replace(checkoutCode())
- name: Set version suffix
id: set-version-suffix
#! Build suffix is PR-1234.5 for PR builds or alpha.123 for branch builds.
#! Build suffix is pr-1234.5 for pr builds or alpha.123 for branch builds.
run: |
$suffix = ""
if ($env:GITHUB_EVENT_NAME -eq "pull_request")
{
if (-Not "${{ github.head_ref }}".Contains("release"))
{
$suffix = "PR-${{ github.event.number }}.$env:GITHUB_RUN_NUMBER"
$suffix = "pr-${{ github.event.number }}.$env:GITHUB_RUN_NUMBER"
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ jobs:
{
if (-Not "${{ github.head_ref }}".Contains("release"))
{
$suffix = "PR-${{ github.event.number }}.$env:GITHUB_RUN_NUMBER"
$suffix = "pr-${{ github.event.number }}.$env:GITHUB_RUN_NUMBER"
}
}
else
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
## vNext (TBD)

### Enhancements
* None
* Added the `RealmConfigurationBase.FallbackPipePath` property. In the majority of cases this property can be left null, but it should be used when a realm is opened on a filesystem where named pipes cannot be created, such as external storage on Android that uses FAT32. In this case the path needs to point to a location on another filesystem where named pipes can be created. (PR [#2766](https://github.com/realm/realm-dotnet/pull/2766))

### Fixed
* Fixed a race condition that could result in `Sharing violation on path ...` error when opening a Unity project on macOS. (Issue [#2720](https://github.com/realm/realm-dotnet/issues/2720), fix by [@tomkrikorian](https://github.com/tomkrikorian))
* Fixed an error being thrown when `Realm.GetInstance` is called multiple times on a readonly Realm. (Issue [#2731](https://github.com/realm/realm-dotnet/pull/2731))
* Fixed a bug that would result in the `LIMIT` clause being ignored when `Count()` is invoked on a `IQueryable` - e.g. expressions like `realm.All<Foo>().Filter("Bar > 5 LIMIT(1)).Count()` would ignore the limit in the string-based predicate and return the count of all matches. (Issue [#2755](https://github.com/realm/realm-dotnet/issues/2755))
* Fixed the logic in `RealmResultsVisitor.TraverseSort` to allow sorting on interface properties. (Issue [#1373](https://github.com/realm/realm-dotnet/issues/1373), contribution by @daawaan)

### Compatibility
* Realm Studio: 11.0.0 or later.

### Internal
* Using Core x.y.z.
* Updated naming of prerelease packages to use lowercase "pr" - e.g. `10.7.1-pr-2695.1703` instead of `10.7.1-PR-2695.1703`. (PR [#2765](https://github.com/realm/realm-dotnet/pull/2765))

## 10.7.1 (2021-11-19)

Expand Down
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,8 @@ The API reference is located at [docs.mongodb.com/realm-sdks/dotnet/latest/](htt
## Nightly builds

If you want to test recent bugfixes or features that have not been packaged in an official release yet, you can use the preview releases published after every
commit to the [GitHub packages](https://github.com/realm/realm-dotnet/packages) NuGet feed. To consume the packages, you have two options:
1. Refer to [this guide](https://www.visualstudio.com/en-us/docs/package/nuget/consume) for instructions on adding custom sources to the NuGet Package Manager.
- The source URL you need to specify is `https://nuget.pkg.github.com/realm/index.json`.
- For `username`, specify your GitHub username
- For password, specify an access token with the `read:packages` scope.

There is an [ongoing thread](https://git.luolix.topmunity/t/download-from-github-package-registry-without-authentication/) with the GitHub team to
streamline this by not requiring authentication for public packages, but as of Sept. 2020, this is still needed.
1. Download the package locally and [install it](https://stackoverflow.com/questions/10240029/how-do-i-install-a-nuget-package-nupkg-file-locally).
commit to our private NuGet feed. The source URL you need to specify for our feed is `https://s3.amazonaws.com/realm.nugetpackages/index.json`.
Refer to [this guide](https://www.visualstudio.com/en-us/docs/package/nuget/consume) for instructions on adding custom sources to the NuGet Package Manager.

## Building Realm

Expand Down
12 changes: 12 additions & 0 deletions Realm/Realm/Configurations/RealmConfigurationBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ public abstract class RealmConfigurationBase
/// <value>The absolute path to the Realm.</value>
public string DatabasePath { get; protected set; }

/// <summary>
/// Gets or sets the path where the named pipes used by Realm can be placed.
/// </summary>
/// <remarks>
/// In the vast majority of cases this value should be left null.
/// It needs to be set if the Realm is opened on a filesystem where a named pipe cannot be created, such as external storage on Android that uses FAT32.
/// In this case the path should point to a location on a filesystem where the pipes can be created.
/// </remarks>
/// <value>The path where named pipes can be created.</value>
public string FallbackPipePath { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the Realm will be open in dynamic mode. If opened in dynamic mode,
/// the schema will be read from the file on disk.
Expand Down Expand Up @@ -198,6 +209,7 @@ internal Native.Configuration CreateNativeConfiguration()
return new Native.Configuration
{
Path = DatabasePath,
FallbackPipePath = FallbackPipePath,
schema_version = SchemaVersion,
enable_cache = EnableCache,
max_number_of_active_versions = MaxNumberOfActiveVersions
Expand Down
2 changes: 1 addition & 1 deletion Realm/Realm/Linq/RealmResultsVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private IntPtr[] TraverseSort(MemberExpression expression)

while (expression != null)
{
var type = expression.Member.DeclaringType;
var type = expression.Expression.Type;
var typeName = type.GetMappedOrOriginalName();
if (!_realm.Metadata.TryGetValue(typeName, out var metadata))
{
Expand Down
13 changes: 13 additions & 0 deletions Realm/Realm/Native/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ internal string Path
}
}

[MarshalAs(UnmanagedType.LPWStr)]
private string fallback_path;
private IntPtr fallback_path_len;

internal string FallbackPipePath
{
set
{
fallback_path = value;
fallback_path_len = value.IntPtrLength();
}
}

[MarshalAs(UnmanagedType.U1)]
internal bool read_only;
[MarshalAs(UnmanagedType.U1)]
Expand Down
11 changes: 9 additions & 2 deletions wrappers/src/shared_realm_cs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ Realm::Config get_shared_realm_config(Configuration configuration, SyncConfigura
config.sync_config->stop_policy = sync_configuration.session_stop_policy;
config.path = Utf16StringAccessor(configuration.path, configuration.path_len);

if (configuration.fallback_path) {
config.fifo_files_fallback_path = Utf16StringAccessor(configuration.fallback_path, configuration.fallback_path_len);
}

// by definition the key is only allowed to be 64 bytes long, enforced by C# code
if (encryption_key) {
auto& key = *reinterpret_cast<std::array<char, 64>*>(encryption_key);
Expand Down Expand Up @@ -177,13 +181,16 @@ REALM_EXPORT void shared_realm_install_callbacks(
REALM_EXPORT SharedRealm* shared_realm_open(Configuration configuration, SchemaObject* objects, int objects_length, SchemaProperty* properties, uint8_t* encryption_key, NativeException::Marshallable& ex)
{
return handle_errors(ex, [&]() {
Utf16StringAccessor pathStr(configuration.path, configuration.path_len);

Realm::Config config;
config.path = pathStr.to_string();
config.path = Utf16StringAccessor(configuration.path, configuration.path_len);
config.in_memory = configuration.in_memory;
config.max_number_of_active_versions = configuration.max_number_of_active_versions;

if (configuration.fallback_path) {
config.fifo_files_fallback_path = Utf16StringAccessor(configuration.fallback_path, configuration.fallback_path_len);
}

// by definition the key is only allowed to be 64 bytes long, enforced by C# code
if (encryption_key )
config.encryption_key = std::vector<char>(encryption_key, encryption_key+64);
Expand Down
3 changes: 3 additions & 0 deletions wrappers/src/shared_realm_cs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ struct Configuration
uint16_t* path;
size_t path_len;

uint16_t* fallback_path;
size_t fallback_path_len;

bool read_only;

bool in_memory;
Expand Down

0 comments on commit c519060

Please sign in to comment.