Skip to content

Commit

Permalink
Replace uint64_t type with SchemaValidationMode in validate methods
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltabacaru committed Sep 14, 2022
1 parent 491a8ac commit ac5dc4d
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/realm/object-store/c_api/schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ RLM_API uint64_t realm_get_schema_version(const realm_t* realm)
RLM_API bool realm_schema_validate(const realm_schema_t* schema, uint64_t validation_mode)
{
return wrap_err([&]() {
schema->ptr->validate(validation_mode);
schema->ptr->validate(static_cast<SchemaValidationMode>(validation_mode));
return true;
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/realm/object-store/object_schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static void validate_property(Schema const& schema, ObjectSchema const& parent_o
}

void ObjectSchema::validate(Schema const& schema, std::vector<ObjectSchemaValidationException>& exceptions,
uint64_t validation_mode) const
SchemaValidationMode validation_mode) const
{
std::vector<StringData> public_property_names;
std::vector<StringData> internal_property_names;
Expand Down
3 changes: 2 additions & 1 deletion src/realm/object-store/object_schema.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Table;
enum class PropertyType : unsigned short;
struct ObjectSchemaValidationException;
struct Property;
enum SchemaValidationMode : uint64_t;

class ObjectSchema {
public:
Expand Down Expand Up @@ -80,7 +81,7 @@ class ObjectSchema {
bool property_is_computed(Property const& property) const noexcept;

void validate(Schema const& schema, std::vector<ObjectSchemaValidationException>& exceptions,
uint64_t validation_mode) const;
SchemaValidationMode validation_mode) const;

friend bool operator==(ObjectSchema const& a, ObjectSchema const& b) noexcept;

Expand Down
2 changes: 1 addition & 1 deletion src/realm/object-store/schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ std::unordered_set<std::string> get_embedded_object_orphans(const Schema& schema

} // end anonymous namespace

void Schema::validate(uint64_t validation_mode) const
void Schema::validate(SchemaValidationMode validation_mode) const
{
std::vector<ObjectSchemaValidationException> exceptions;

Expand Down
2 changes: 1 addition & 1 deletion src/realm/object-store/schema.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class Schema : private std::vector<ObjectSchema> {

// Verify that this schema is internally consistent (i.e. all properties are
// valid, links link to types that actually exist, etc.)
void validate(uint64_t validation_mode = SchemaValidationMode::Basic) const;
void validate(SchemaValidationMode validation_mode = SchemaValidationMode::Basic) const;

// Get the changes which must be applied to this schema to produce the passed-in schema
std::vector<SchemaChange> compare(Schema const&, SchemaMode = SchemaMode::Automatic,
Expand Down
2 changes: 1 addition & 1 deletion src/realm/object-store/shared_realm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ void Realm::update_schema(Schema schema, uint64_t version, MigrationFunction mig
validation_mode |= SchemaValidationMode::RejectEmbeddedOrphans;
}

schema.validate(validation_mode);
schema.validate(static_cast<SchemaValidationMode>(validation_mode));

bool was_in_read_transaction = is_in_read_transaction();
Schema actual_schema = get_full_schema();
Expand Down

0 comments on commit ac5dc4d

Please sign in to comment.