@@ -57,7 +57,7 @@ public final class FlatStoreOptions extends Table {
57
57
* e.g. caused by programming error.
58
58
* If your app runs into errors like "db full", you may consider to raise the limit.
59
59
*/
60
- public long maxDbSizeInKByte () { int o = __offset (8 ); return o != 0 ? bb .getLong (o + bb_pos ) : 0L ; }
60
+ public long maxDbSizeInKbyte () { int o = __offset (8 ); return o != 0 ? bb .getLong (o + bb_pos ) : 0L ; }
61
61
/**
62
62
* File permissions given in Unix style octal bit flags (e.g. 0644). Ignored on Windows.
63
63
* Note: directories become searchable if the "read" or "write" permission is set (e.g. 0640 becomes 0750).
@@ -135,11 +135,19 @@ public final class FlatStoreOptions extends Table {
135
135
* corner cases with e.g. transactions, which may not be fully tested at the moment.
136
136
*/
137
137
public boolean noReaderThreadLocals () { int o = __offset (30 ); return o != 0 ? 0 !=bb .get (o + bb_pos ) : false ; }
138
+ /**
139
+ * Data size tracking is more involved than DB size tracking, e.g. it stores an internal counter.
140
+ * Thus only use it if a stricter, more accurate limit is required.
141
+ * It tracks the size of actual data bytes of objects (system and metadata is not considered).
142
+ * On the upside, reaching the data limit still allows data to be removed (assuming DB limit is not reached).
143
+ * Max data and DB sizes can be combined; data size must be below the DB size.
144
+ */
145
+ public long maxDataSizeInKbyte () { int o = __offset (32 ); return o != 0 ? bb .getLong (o + bb_pos ) : 0L ; }
138
146
139
147
public static int createFlatStoreOptions (FlatBufferBuilder builder ,
140
148
int directoryPathOffset ,
141
149
int modelBytesOffset ,
142
- long maxDbSizeInKByte ,
150
+ long maxDbSizeInKbyte ,
143
151
long fileMode ,
144
152
long maxReaders ,
145
153
int validateOnOpen ,
@@ -150,10 +158,12 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
150
158
boolean usePreviousCommitOnValidationFailure ,
151
159
boolean readOnly ,
152
160
long debugFlags ,
153
- boolean noReaderThreadLocals ) {
154
- builder .startTable (14 );
161
+ boolean noReaderThreadLocals ,
162
+ long maxDataSizeInKbyte ) {
163
+ builder .startTable (15 );
164
+ FlatStoreOptions .addMaxDataSizeInKbyte (builder , maxDataSizeInKbyte );
155
165
FlatStoreOptions .addValidateOnOpenPageLimit (builder , validateOnOpenPageLimit );
156
- FlatStoreOptions .addMaxDbSizeInKByte (builder , maxDbSizeInKByte );
166
+ FlatStoreOptions .addMaxDbSizeInKbyte (builder , maxDbSizeInKbyte );
157
167
FlatStoreOptions .addDebugFlags (builder , debugFlags );
158
168
FlatStoreOptions .addMaxReaders (builder , maxReaders );
159
169
FlatStoreOptions .addFileMode (builder , fileMode );
@@ -169,13 +179,13 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
169
179
return FlatStoreOptions .endFlatStoreOptions (builder );
170
180
}
171
181
172
- public static void startFlatStoreOptions (FlatBufferBuilder builder ) { builder .startTable (14 ); }
182
+ public static void startFlatStoreOptions (FlatBufferBuilder builder ) { builder .startTable (15 ); }
173
183
public static void addDirectoryPath (FlatBufferBuilder builder , int directoryPathOffset ) { builder .addOffset (0 , directoryPathOffset , 0 ); }
174
184
public static void addModelBytes (FlatBufferBuilder builder , int modelBytesOffset ) { builder .addOffset (1 , modelBytesOffset , 0 ); }
175
185
public static int createModelBytesVector (FlatBufferBuilder builder , byte [] data ) { return builder .createByteVector (data ); }
176
186
public static int createModelBytesVector (FlatBufferBuilder builder , ByteBuffer data ) { return builder .createByteVector (data ); }
177
187
public static void startModelBytesVector (FlatBufferBuilder builder , int numElems ) { builder .startVector (1 , numElems , 1 ); }
178
- public static void addMaxDbSizeInKByte (FlatBufferBuilder builder , long maxDbSizeInKByte ) { builder .addLong (2 , maxDbSizeInKByte , 0L ); }
188
+ public static void addMaxDbSizeInKbyte (FlatBufferBuilder builder , long maxDbSizeInKbyte ) { builder .addLong (2 , maxDbSizeInKbyte , 0L ); }
179
189
public static void addFileMode (FlatBufferBuilder builder , long fileMode ) { builder .addInt (3 , (int ) fileMode , (int ) 0L ); }
180
190
public static void addMaxReaders (FlatBufferBuilder builder , long maxReaders ) { builder .addInt (4 , (int ) maxReaders , (int ) 0L ); }
181
191
public static void addValidateOnOpen (FlatBufferBuilder builder , int validateOnOpen ) { builder .addShort (5 , (short ) validateOnOpen , (short ) 0 ); }
@@ -187,6 +197,7 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
187
197
public static void addReadOnly (FlatBufferBuilder builder , boolean readOnly ) { builder .addBoolean (11 , readOnly , false ); }
188
198
public static void addDebugFlags (FlatBufferBuilder builder , long debugFlags ) { builder .addInt (12 , (int ) debugFlags , (int ) 0L ); }
189
199
public static void addNoReaderThreadLocals (FlatBufferBuilder builder , boolean noReaderThreadLocals ) { builder .addBoolean (13 , noReaderThreadLocals , false ); }
200
+ public static void addMaxDataSizeInKbyte (FlatBufferBuilder builder , long maxDataSizeInKbyte ) { builder .addLong (14 , maxDataSizeInKbyte , 0L ); }
190
201
public static int endFlatStoreOptions (FlatBufferBuilder builder ) {
191
202
int o = builder .endTable ();
192
203
return o ;
0 commit comments