Skip to content

Commit 06d10fc

Browse files
committed
BoxStoreBuilder: switch file mode to int, clarify some docs
1 parent 869bcd6 commit 06d10fc

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

objectbox-java/src/main/java/io/objectbox/BoxStoreBuilder.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,9 @@ public class BoxStoreBuilder {
6666

6767
final byte[] model;
6868

69-
/** BoxStore uses this */
69+
/** BoxStore uses this (not baseDirectory/name) */
7070
File directory;
7171

72-
/** On Android used for native library loading. */
73-
@Nullable Object context;
74-
@Nullable Object relinker;
75-
7672
/** Ignored by BoxStore */
7773
private File baseDirectory;
7874

@@ -82,6 +78,10 @@ public class BoxStoreBuilder {
8278
/** Defaults to {@link #DEFAULT_MAX_DB_SIZE_KBYTE}. */
8379
long maxSizeInKByte = DEFAULT_MAX_DB_SIZE_KBYTE;
8480

81+
/** On Android used for native library loading. */
82+
@Nullable Object context;
83+
@Nullable Object relinker;
84+
8585
ModelUpdate modelUpdate;
8686

8787
int debugFlags;
@@ -90,7 +90,7 @@ public class BoxStoreBuilder {
9090

9191
boolean debugRelations;
9292

93-
long fileMode;
93+
int fileMode;
9494

9595
int maxReaders;
9696

@@ -279,10 +279,11 @@ private static File getAndroidFilesDir(Object context) {
279279
/**
280280
* Specify
281281
* <a href="https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation">unix-style file permissions</a>
282-
* to use for the database directory and files.
283-
* E.g. for {@code rw-rw-rw-} (owner, group, other) pass the octal code {@code 666}.
282+
* for database files. E.g. for {@code -rw-r----} (owner, group, other) pass the octal code {@code 0640}.
283+
* Any newly generated directory additionally gets searchable (01) for groups with read or write permissions.
284+
* It's not allowed to pass in an executable flag.
284285
*/
285-
public BoxStoreBuilder fileMode(long mode) {
286+
public BoxStoreBuilder fileMode(int mode) {
286287
this.fileMode = mode;
287288
return this;
288289
}
@@ -327,9 +328,7 @@ public BoxStoreBuilder maxSizeInKByte(long maxSizeInKByte) {
327328
}
328329

329330
/**
330-
* Open the store in read-only mode: no schema update, no write transactions.
331-
* <p>
332-
* It is recommended to use this with {@link #usePreviousCommit()} to ensure no data is lost.
331+
* Open the store in read-only mode: no schema update, no write transactions are allowed (would throw).
333332
*/
334333
public BoxStoreBuilder readOnly() {
335334
this.readOnly = true;
@@ -341,7 +340,8 @@ public BoxStoreBuilder readOnly() {
341340
* When used with care (e.g. backup the DB files first), this option may also recover data removed by the latest
342341
* transaction.
343342
* <p>
344-
* It is recommended to use this with {@link #readOnly()} to ensure no data is lost.
343+
* To ensure no data is lost accidentally, it is recommended to use this in combination with {@link #readOnly()}
344+
* to examine and validate the database first.
345345
*/
346346
public BoxStoreBuilder usePreviousCommit() {
347347
this.usePreviousCommit = true;

0 commit comments

Comments
 (0)