Skip to content

Commit 72dc25d

Browse files
FlatStoreOptions: re-generate to include WAL options
1 parent f36c5ea commit 72dc25d

File tree

3 files changed

+134
-4
lines changed

3 files changed

+134
-4
lines changed

objectbox-java/src/main/java/io/objectbox/config/FlatStoreOptions.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2025 ObjectBox Ltd.
2+
* Copyright 2026 ObjectBox Ltd. <https://objectbox.io>
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -180,6 +180,11 @@ public final class FlatStoreOptions extends Table {
180180
* Flags to change the default behavior for restoring backups, e.g. what should happen to existing data.
181181
*/
182182
public long backupRestoreFlags() { int o = __offset(38); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; }
183+
/**
184+
* Options for write-ahead logging (WAL)
185+
*/
186+
public WalOptions walOptions() { return walOptions(new WalOptions()); }
187+
public WalOptions walOptions(WalOptions obj) { int o = __offset(40); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
183188

184189
public static int createFlatStoreOptions(FlatBufferBuilder builder,
185190
int directoryPathOffset,
@@ -199,11 +204,13 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
199204
long maxDataSizeInKbyte,
200205
int validateOnOpenKv,
201206
int backupFileOffset,
202-
long backupRestoreFlags) {
203-
builder.startTable(18);
207+
long backupRestoreFlags,
208+
int walOptionsOffset) {
209+
builder.startTable(19);
204210
FlatStoreOptions.addMaxDataSizeInKbyte(builder, maxDataSizeInKbyte);
205211
FlatStoreOptions.addValidateOnOpenPageLimit(builder, validateOnOpenPageLimit);
206212
FlatStoreOptions.addMaxDbSizeInKbyte(builder, maxDbSizeInKbyte);
213+
FlatStoreOptions.addWalOptions(builder, walOptionsOffset);
207214
FlatStoreOptions.addBackupRestoreFlags(builder, backupRestoreFlags);
208215
FlatStoreOptions.addBackupFile(builder, backupFileOffset);
209216
FlatStoreOptions.addDebugFlags(builder, debugFlags);
@@ -222,7 +229,7 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
222229
return FlatStoreOptions.endFlatStoreOptions(builder);
223230
}
224231

225-
public static void startFlatStoreOptions(FlatBufferBuilder builder) { builder.startTable(18); }
232+
public static void startFlatStoreOptions(FlatBufferBuilder builder) { builder.startTable(19); }
226233
public static void addDirectoryPath(FlatBufferBuilder builder, int directoryPathOffset) { builder.addOffset(0, directoryPathOffset, 0); }
227234
public static void addModelBytes(FlatBufferBuilder builder, int modelBytesOffset) { builder.addOffset(1, modelBytesOffset, 0); }
228235
public static int createModelBytesVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
@@ -244,6 +251,7 @@ public static int createFlatStoreOptions(FlatBufferBuilder builder,
244251
public static void addValidateOnOpenKv(FlatBufferBuilder builder, int validateOnOpenKv) { builder.addShort(15, (short) validateOnOpenKv, (short) 0); }
245252
public static void addBackupFile(FlatBufferBuilder builder, int backupFileOffset) { builder.addOffset(16, backupFileOffset, 0); }
246253
public static void addBackupRestoreFlags(FlatBufferBuilder builder, long backupRestoreFlags) { builder.addInt(17, (int) backupRestoreFlags, (int) 0L); }
254+
public static void addWalOptions(FlatBufferBuilder builder, int walOptionsOffset) { builder.addOffset(18, walOptionsOffset, 0); }
247255
public static int endFlatStoreOptions(FlatBufferBuilder builder) {
248256
int o = builder.endTable();
249257
return o;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright © 2026 ObjectBox Ltd. <https://objectbox.io>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// automatically generated by the FlatBuffers compiler, do not modify
18+
19+
package io.objectbox.config;
20+
21+
/**
22+
* WAL flags control how the store handles WAL files.
23+
*/
24+
@SuppressWarnings("unused")
25+
public final class WalFlags {
26+
private WalFlags() { }
27+
/**
28+
* Enable WAL
29+
*/
30+
public static final int EnableWal = 1;
31+
/**
32+
* Does not wait for the disk to acknowledge
33+
*/
34+
public static final int NoFileSync = 2;
35+
}
36+
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* Copyright © 2026 ObjectBox Ltd. <https://objectbox.io>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// automatically generated by the FlatBuffers compiler, do not modify
18+
19+
package io.objectbox.config;
20+
21+
import java.nio.ByteBuffer;
22+
import java.nio.ByteOrder;
23+
24+
import io.objectbox.flatbuffers.BaseVector;
25+
import io.objectbox.flatbuffers.Constants;
26+
import io.objectbox.flatbuffers.FlatBufferBuilder;
27+
import io.objectbox.flatbuffers.Table;
28+
29+
/**
30+
* Options to enable and configure WAL.
31+
*/
32+
@SuppressWarnings("unused")
33+
public final class WalOptions extends Table {
34+
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); }
35+
public static WalOptions getRootAsWalOptions(ByteBuffer _bb) { return getRootAsWalOptions(_bb, new WalOptions()); }
36+
public static WalOptions getRootAsWalOptions(ByteBuffer _bb, WalOptions obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
37+
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
38+
public WalOptions __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
39+
40+
/**
41+
* Flags to enable and change default WAL behavior, e.g. no sync to disk option.
42+
*/
43+
public long walFlags() { int o = __offset(4); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; }
44+
/**
45+
* The WAL file gets consolidated when it reached this size limit when opening the database.
46+
* This setting is meant for applications that prefer to consolidate on startup,
47+
* which may avoid consolidations on commits while the application is running.
48+
* The default is 4096 (4 MB).
49+
*/
50+
public long maxWalFileSizeOnOpenInKbyte() { int o = __offset(6); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
51+
/**
52+
* The WAL file gets consolidated when it reaches this size limit after a commit.
53+
* As consolidation takes some time, it is a trade-off between accumulating enough data
54+
* and the time the consolidation takes (longer with more data).
55+
* The default is 16384 (16 MB).
56+
*/
57+
public long maxWalFileSizeInKbyte() { int o = __offset(8); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
58+
59+
public static int createWalOptions(FlatBufferBuilder builder,
60+
long walFlags,
61+
long maxWalFileSizeOnOpenInKbyte,
62+
long maxWalFileSizeInKbyte) {
63+
builder.startTable(3);
64+
WalOptions.addMaxWalFileSizeInKbyte(builder, maxWalFileSizeInKbyte);
65+
WalOptions.addMaxWalFileSizeOnOpenInKbyte(builder, maxWalFileSizeOnOpenInKbyte);
66+
WalOptions.addWalFlags(builder, walFlags);
67+
return WalOptions.endWalOptions(builder);
68+
}
69+
70+
public static void startWalOptions(FlatBufferBuilder builder) { builder.startTable(3); }
71+
public static void addWalFlags(FlatBufferBuilder builder, long walFlags) { builder.addInt(0, (int) walFlags, (int) 0L); }
72+
public static void addMaxWalFileSizeOnOpenInKbyte(FlatBufferBuilder builder, long maxWalFileSizeOnOpenInKbyte) { builder.addLong(1, maxWalFileSizeOnOpenInKbyte, 0L); }
73+
public static void addMaxWalFileSizeInKbyte(FlatBufferBuilder builder, long maxWalFileSizeInKbyte) { builder.addLong(2, maxWalFileSizeInKbyte, 0L); }
74+
public static int endWalOptions(FlatBufferBuilder builder) {
75+
int o = builder.endTable();
76+
return o;
77+
}
78+
79+
public static final class Vector extends BaseVector {
80+
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
81+
82+
public WalOptions get(int j) { return get(new WalOptions(), j); }
83+
public WalOptions get(WalOptions obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
84+
}
85+
}
86+

0 commit comments

Comments
 (0)