Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XD-1195 propagated read-only mode flag to the store #253

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ class YTDBPersistentEntityStore(
override fun getOEntityId(entityId: PersistentEntityId): YTDBEntityId {
return requireActiveTransaction().getOEntityId(entityId)
}

override fun isReadOnly(): Boolean {
return this.databaseProvider.readOnly
}
}

internal fun YTDBEntityStore.requireOEntityId(id: EntityId): YTDBEntityId {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,11 @@ class OPersistentStoreTest : OTestMixin {
}
}
}

@Test
fun `read-only mode flag is propagated to the store`() {
youTrackDb.provider.readOnly = true
assertEquals(true, youTrackDb.store.isReadOnly)
youTrackDb.provider.readOnly = false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,7 @@ void registerCustomPropertyType(@NotNull final StoreTransaction txn,

@NotNull
StoreTransaction getAndCheckCurrentTransaction();

@NotNull
Boolean isReadOnly();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2660,4 +2660,10 @@ private Pair<Long, Long> newNext() {
}
}
}

@NotNull
@Override
public Boolean isReadOnly() {
return this.environment.isReadOnly();
}
}
Loading