@@ -57,7 +57,7 @@ public final class FlatStoreOptions extends Table {
5757 * e.g. caused by programming error.
5858 * If your app runs into errors like "db full", you may consider to raise the limit.
5959 */
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 ; }
6161 /**
6262 * File permissions given in Unix style octal bit flags (e.g. 0644). Ignored on Windows.
6363 * 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 {
135135 * corner cases with e.g. transactions, which may not be fully tested at the moment.
136136 */
137137 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 ; }
138146
139147 public static int createFlatStoreOptions (FlatBufferBuilder builder ,
140148 int directoryPathOffset ,
141149 int modelBytesOffset ,
142- long maxDbSizeInKByte ,
150+ long maxDbSizeInKbyte ,
143151 long fileMode ,
144152 long maxReaders ,
145153 int validateOnOpen ,
@@ -150,10 +158,12 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
150158 boolean usePreviousCommitOnValidationFailure ,
151159 boolean readOnly ,
152160 long debugFlags ,
153- boolean noReaderThreadLocals ) {
154- builder .startTable (14 );
161+ boolean noReaderThreadLocals ,
162+ long maxDataSizeInKbyte ) {
163+ builder .startTable (15 );
164+ FlatStoreOptions .addMaxDataSizeInKbyte (builder , maxDataSizeInKbyte );
155165 FlatStoreOptions .addValidateOnOpenPageLimit (builder , validateOnOpenPageLimit );
156- FlatStoreOptions .addMaxDbSizeInKByte (builder , maxDbSizeInKByte );
166+ FlatStoreOptions .addMaxDbSizeInKbyte (builder , maxDbSizeInKbyte );
157167 FlatStoreOptions .addDebugFlags (builder , debugFlags );
158168 FlatStoreOptions .addMaxReaders (builder , maxReaders );
159169 FlatStoreOptions .addFileMode (builder , fileMode );
@@ -169,13 +179,13 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
169179 return FlatStoreOptions .endFlatStoreOptions (builder );
170180 }
171181
172- public static void startFlatStoreOptions (FlatBufferBuilder builder ) { builder .startTable (14 ); }
182+ public static void startFlatStoreOptions (FlatBufferBuilder builder ) { builder .startTable (15 ); }
173183 public static void addDirectoryPath (FlatBufferBuilder builder , int directoryPathOffset ) { builder .addOffset (0 , directoryPathOffset , 0 ); }
174184 public static void addModelBytes (FlatBufferBuilder builder , int modelBytesOffset ) { builder .addOffset (1 , modelBytesOffset , 0 ); }
175185 public static int createModelBytesVector (FlatBufferBuilder builder , byte [] data ) { return builder .createByteVector (data ); }
176186 public static int createModelBytesVector (FlatBufferBuilder builder , ByteBuffer data ) { return builder .createByteVector (data ); }
177187 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 ); }
179189 public static void addFileMode (FlatBufferBuilder builder , long fileMode ) { builder .addInt (3 , (int ) fileMode , (int ) 0L ); }
180190 public static void addMaxReaders (FlatBufferBuilder builder , long maxReaders ) { builder .addInt (4 , (int ) maxReaders , (int ) 0L ); }
181191 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,
187197 public static void addReadOnly (FlatBufferBuilder builder , boolean readOnly ) { builder .addBoolean (11 , readOnly , false ); }
188198 public static void addDebugFlags (FlatBufferBuilder builder , long debugFlags ) { builder .addInt (12 , (int ) debugFlags , (int ) 0L ); }
189199 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 ); }
190201 public static int endFlatStoreOptions (FlatBufferBuilder builder ) {
191202 int o = builder .endTable ();
192203 return o ;
0 commit comments