26
26
/**
27
27
* Options to open a store with. Set only the values you want; defaults are used otherwise.
28
28
* Reminder: enable "force defaults" in the FlatBuffers builder, e.g. to pass in booleans with value "false".
29
+ * NOTE: some setting are for "advanced" purposes that you can typically ignore for regular usage.
30
+ * When using advanced setting, you should know exactly what you are doing.
29
31
*/
30
32
@ SuppressWarnings ("unused" )
31
33
public final class FlatStoreOptions extends Table {
@@ -35,16 +37,31 @@ public final class FlatStoreOptions extends Table {
35
37
public void __init (int _i , ByteBuffer _bb ) { __reset (_i , _bb ); }
36
38
public FlatStoreOptions __assign (int _i , ByteBuffer _bb ) { __init (_i , _bb ); return this ; }
37
39
40
+ /**
41
+ * Location of the database on disk; this will be a directory containing files.
42
+ */
38
43
public String directoryPath () { int o = __offset (4 ); return o != 0 ? __string (o + bb_pos ) : null ; }
39
44
public ByteBuffer directoryPathAsByteBuffer () { return __vector_as_bytebuffer (4 , 1 ); }
40
45
public ByteBuffer directoryPathInByteBuffer (ByteBuffer _bb ) { return __vector_in_bytebuffer (_bb , 4 , 1 ); }
46
+ /**
47
+ * Provide a data model, e.g. to initialize or update the schema.
48
+ */
41
49
public int modelBytes (int j ) { int o = __offset (6 ); return o != 0 ? bb .get (__vector (o ) + j * 1 ) & 0xFF : 0 ; }
42
50
public int modelBytesLength () { int o = __offset (6 ); return o != 0 ? __vector_len (o ) : 0 ; }
43
51
public ByteVector modelBytesVector () { return modelBytesVector (new ByteVector ()); }
44
52
public ByteVector modelBytesVector (ByteVector obj ) { int o = __offset (6 ); return o != 0 ? obj .__assign (__vector (o ), bb ) : null ; }
45
53
public ByteBuffer modelBytesAsByteBuffer () { return __vector_as_bytebuffer (6 , 1 ); }
46
54
public ByteBuffer modelBytesInByteBuffer (ByteBuffer _bb ) { return __vector_in_bytebuffer (_bb , 6 , 1 ); }
55
+ /**
56
+ * This maximum size setting is meant to prevent your database from growing to unexpected sizes,
57
+ * e.g. caused by programming error.
58
+ * If your app runs into errors like "db full", you may consider to raise the limit.
59
+ */
47
60
public long maxDbSizeInKByte () { int o = __offset (8 ); return o != 0 ? bb .getLong (o + bb_pos ) : 0L ; }
61
+ /**
62
+ * File permissions given in Unix style octal bit flags (e.g. 0644). Ignored on Windows.
63
+ * Note: directories become searchable if the "read" or "write" permission is set (e.g. 0640 becomes 0750).
64
+ */
48
65
public long fileMode () { int o = __offset (10 ); return o != 0 ? (long )bb .getInt (o + bb_pos ) & 0xFFFFFFFFL : 0L ; }
49
66
/**
50
67
* The maximum number of readers.
@@ -72,16 +89,25 @@ public final class FlatStoreOptions extends Table {
72
89
* This is only to be used with ValidateOnOpenMode "Regular" and "WithLeaves".
73
90
*/
74
91
public long validateOnOpenPageLimit () { int o = __offset (16 ); return o != 0 ? bb .getLong (o + bb_pos ) : 0L ; }
92
+ /**
93
+ * Don't touch unless you know exactly what you are doing:
94
+ * Advanced setting typically meant for language bindings (not end users). See PutPaddingMode description.
95
+ */
75
96
public int putPaddingMode () { int o = __offset (18 ); return o != 0 ? bb .getShort (o + bb_pos ) & 0xFFFF : 0 ; }
76
- public boolean readSchema () { int o = __offset (20 ); return o != 0 ? 0 !=bb .get (o + bb_pos ) : false ; }
77
97
/**
78
- * Recommended to be used together with read-only mode to ensure no data is lost.
98
+ * Advanced setting meant only for special scenarios: opens the database in a limited, schema-less mode.
99
+ * If you don't know what this means exactly: ignore this flag.
100
+ */
101
+ public boolean skipReadSchema () { int o = __offset (20 ); return o != 0 ? 0 !=bb .get (o + bb_pos ) : false ; }
102
+ /**
103
+ * Advanced setting recommended to be used together with read-only mode to ensure no data is lost.
79
104
* Ignores the latest data snapshot (committed transaction state) and uses the previous snapshot instead.
80
105
* When used with care (e.g. backup the DB files first), this option may also recover data removed by the latest
81
106
* transaction.
82
107
*/
83
108
public boolean usePreviousCommit () { int o = __offset (22 ); return o != 0 ? 0 !=bb .get (o + bb_pos ) : false ; }
84
109
/**
110
+ * NOT IMPLEMENTED YET. Placeholder for a future version only.
85
111
* If consistency checks fail during opening the DB (see also the pagesToValidateOnOpen setting), ObjectBox
86
112
* automatically switches to the previous commit (see also usePreviousCommit). This way, this constitutes
87
113
* an auto-recover mode from severe failures. HOWEVER, keep in mind that any consistency failure
@@ -93,6 +119,9 @@ public final class FlatStoreOptions extends Table {
93
119
* Open store in read-only mode: no schema update, no write transactions.
94
120
*/
95
121
public boolean readOnly () { int o = __offset (26 ); return o != 0 ? 0 !=bb .get (o + bb_pos ) : false ; }
122
+ /**
123
+ * For debugging purposes you may want enable specific logging.
124
+ */
96
125
public long debugFlags () { int o = __offset (28 ); return o != 0 ? (long )bb .getInt (o + bb_pos ) & 0xFFFFFFFFL : 0L ; }
97
126
98
127
public static int createFlatStoreOptions (FlatBufferBuilder builder ,
@@ -104,7 +133,7 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
104
133
int validateOnOpen ,
105
134
long validateOnOpenPageLimit ,
106
135
int putPaddingMode ,
107
- boolean readSchema ,
136
+ boolean skipReadSchema ,
108
137
boolean usePreviousCommit ,
109
138
boolean usePreviousCommitOnValidationFailure ,
110
139
boolean readOnly ,
@@ -122,7 +151,7 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
122
151
FlatStoreOptions .addReadOnly (builder , readOnly );
123
152
FlatStoreOptions .addUsePreviousCommitOnValidationFailure (builder , usePreviousCommitOnValidationFailure );
124
153
FlatStoreOptions .addUsePreviousCommit (builder , usePreviousCommit );
125
- FlatStoreOptions .addReadSchema (builder , readSchema );
154
+ FlatStoreOptions .addSkipReadSchema (builder , skipReadSchema );
126
155
return FlatStoreOptions .endFlatStoreOptions (builder );
127
156
}
128
157
@@ -138,7 +167,7 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
138
167
public static void addValidateOnOpen (FlatBufferBuilder builder , int validateOnOpen ) { builder .addShort (5 , (short )validateOnOpen , (short )0 ); }
139
168
public static void addValidateOnOpenPageLimit (FlatBufferBuilder builder , long validateOnOpenPageLimit ) { builder .addLong (6 , validateOnOpenPageLimit , 0L ); }
140
169
public static void addPutPaddingMode (FlatBufferBuilder builder , int putPaddingMode ) { builder .addShort (7 , (short )putPaddingMode , (short )0 ); }
141
- public static void addReadSchema (FlatBufferBuilder builder , boolean readSchema ) { builder .addBoolean (8 , readSchema , false ); }
170
+ public static void addSkipReadSchema (FlatBufferBuilder builder , boolean skipReadSchema ) { builder .addBoolean (8 , skipReadSchema , false ); }
142
171
public static void addUsePreviousCommit (FlatBufferBuilder builder , boolean usePreviousCommit ) { builder .addBoolean (9 , usePreviousCommit , false ); }
143
172
public static void addUsePreviousCommitOnValidationFailure (FlatBufferBuilder builder , boolean usePreviousCommitOnValidationFailure ) { builder .addBoolean (10 , usePreviousCommitOnValidationFailure , false ); }
144
173
public static void addReadOnly (FlatBufferBuilder builder , boolean readOnly ) { builder .addBoolean (11 , readOnly , false ); }
0 commit comments