@@ -160,6 +160,26 @@ public final class FlatStoreOptions extends Table {
160160 * This enum is used to enable validation checks on a key/value level.
161161 */
162162 public int validateOnOpenKv () { int o = __offset (34 ); return o != 0 ? bb .getShort (o + bb_pos ) & 0xFFFF : 0 ; }
163+ /**
164+ * Restores the database content from the given backup file (note: backup is a server-only feature).
165+ * By default, actually restoring the backup is only performed if no database already exists
166+ * (database does not contain data).
167+ * This behavior can be adjusted with backupRestoreFlags, e.g., to overwrite all existing data in the database.
168+ *
169+ * \note Backup files are created from an existing database using ObjectBox API.
170+ *
171+ * \note The following error types can occur for different error scenarios:
172+ * * IO error: the backup file doesn't exist, couldn't be read or has an unexpected size,
173+ * * format error: the backup-file is malformed
174+ * * integrity error: the backup file failed integrity checks
175+ */
176+ public String backupFile () { int o = __offset (36 ); return o != 0 ? __string (o + bb_pos ) : null ; }
177+ public ByteBuffer backupFileAsByteBuffer () { return __vector_as_bytebuffer (36 , 1 ); }
178+ public ByteBuffer backupFileInByteBuffer (ByteBuffer _bb ) { return __vector_in_bytebuffer (_bb , 36 , 1 ); }
179+ /**
180+ * Flags to change the default behavior for restoring backups, e.g. what should happen to existing data.
181+ */
182+ public long backupRestoreFlags () { int o = __offset (38 ); return o != 0 ? (long )bb .getInt (o + bb_pos ) & 0xFFFFFFFFL : 0L ; }
163183
164184 public static int createFlatStoreOptions (FlatBufferBuilder builder ,
165185 int directoryPathOffset ,
@@ -177,11 +197,15 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
177197 long debugFlags ,
178198 boolean noReaderThreadLocals ,
179199 long maxDataSizeInKbyte ,
180- int validateOnOpenKv ) {
181- builder .startTable (16 );
200+ int validateOnOpenKv ,
201+ int backupFileOffset ,
202+ long backupRestoreFlags ) {
203+ builder .startTable (18 );
182204 FlatStoreOptions .addMaxDataSizeInKbyte (builder , maxDataSizeInKbyte );
183205 FlatStoreOptions .addValidateOnOpenPageLimit (builder , validateOnOpenPageLimit );
184206 FlatStoreOptions .addMaxDbSizeInKbyte (builder , maxDbSizeInKbyte );
207+ FlatStoreOptions .addBackupRestoreFlags (builder , backupRestoreFlags );
208+ FlatStoreOptions .addBackupFile (builder , backupFileOffset );
185209 FlatStoreOptions .addDebugFlags (builder , debugFlags );
186210 FlatStoreOptions .addMaxReaders (builder , maxReaders );
187211 FlatStoreOptions .addFileMode (builder , fileMode );
@@ -198,7 +222,7 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
198222 return FlatStoreOptions .endFlatStoreOptions (builder );
199223 }
200224
201- public static void startFlatStoreOptions (FlatBufferBuilder builder ) { builder .startTable (16 ); }
225+ public static void startFlatStoreOptions (FlatBufferBuilder builder ) { builder .startTable (18 ); }
202226 public static void addDirectoryPath (FlatBufferBuilder builder , int directoryPathOffset ) { builder .addOffset (0 , directoryPathOffset , 0 ); }
203227 public static void addModelBytes (FlatBufferBuilder builder , int modelBytesOffset ) { builder .addOffset (1 , modelBytesOffset , 0 ); }
204228 public static int createModelBytesVector (FlatBufferBuilder builder , byte [] data ) { return builder .createByteVector (data ); }
@@ -218,6 +242,8 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
218242 public static void addNoReaderThreadLocals (FlatBufferBuilder builder , boolean noReaderThreadLocals ) { builder .addBoolean (13 , noReaderThreadLocals , false ); }
219243 public static void addMaxDataSizeInKbyte (FlatBufferBuilder builder , long maxDataSizeInKbyte ) { builder .addLong (14 , maxDataSizeInKbyte , 0L ); }
220244 public static void addValidateOnOpenKv (FlatBufferBuilder builder , int validateOnOpenKv ) { builder .addShort (15 , (short ) validateOnOpenKv , (short ) 0 ); }
245+ public static void addBackupFile (FlatBufferBuilder builder , int backupFileOffset ) { builder .addOffset (16 , backupFileOffset , 0 ); }
246+ public static void addBackupRestoreFlags (FlatBufferBuilder builder , long backupRestoreFlags ) { builder .addInt (17 , (int ) backupRestoreFlags , (int ) 0L ); }
221247 public static int endFlatStoreOptions (FlatBufferBuilder builder ) {
222248 int o = builder .endTable ();
223249 return o ;
0 commit comments