Skip to content

Commit 72d1acf

Browse files
Server options: add generated config files
1 parent b1aa898 commit 72d1acf

File tree

6 files changed

+510
-0
lines changed

6 files changed

+510
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*
2+
* Copyright 2024 ObjectBox Ltd. All rights reserved.
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.sync;
20+
21+
import io.objectbox.flatbuffers.BaseVector;
22+
import io.objectbox.flatbuffers.BooleanVector;
23+
import io.objectbox.flatbuffers.ByteVector;
24+
import io.objectbox.flatbuffers.Constants;
25+
import io.objectbox.flatbuffers.DoubleVector;
26+
import io.objectbox.flatbuffers.FlatBufferBuilder;
27+
import io.objectbox.flatbuffers.FloatVector;
28+
import io.objectbox.flatbuffers.IntVector;
29+
import io.objectbox.flatbuffers.LongVector;
30+
import io.objectbox.flatbuffers.ShortVector;
31+
import io.objectbox.flatbuffers.StringVector;
32+
import io.objectbox.flatbuffers.Struct;
33+
import io.objectbox.flatbuffers.Table;
34+
import io.objectbox.flatbuffers.UnionVector;
35+
import java.nio.ByteBuffer;
36+
import java.nio.ByteOrder;
37+
38+
/**
39+
* Credentials consist of a type and the credentials data to perform authentication checks.
40+
* The data is either provided as plain-bytes, or as a list of strings.
41+
* Credentials can be used from the client and server side.
42+
* This depends on the type however:
43+
* for example, shared secrets are configured at both sides, but username/password is only provided at the client.
44+
*/
45+
@SuppressWarnings("unused")
46+
public final class Credentials extends Table {
47+
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); }
48+
public static Credentials getRootAsCredentials(ByteBuffer _bb) { return getRootAsCredentials(_bb, new Credentials()); }
49+
public static Credentials getRootAsCredentials(ByteBuffer _bb, Credentials obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
50+
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
51+
public Credentials __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
52+
53+
public long type() { int o = __offset(4); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; }
54+
/**
55+
* Credentials provided by plain bytes.
56+
* This is used for shared secrets (client & server).
57+
*/
58+
public int bytes(int j) { int o = __offset(6); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; }
59+
public int bytesLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; }
60+
public ByteVector bytesVector() { return bytesVector(new ByteVector()); }
61+
public ByteVector bytesVector(ByteVector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
62+
public ByteBuffer bytesAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
63+
public ByteBuffer bytesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
64+
/**
65+
* Credentials provided by a string array.
66+
* For username/password (client-only), provide the username in strings[0] and the password in strings[1].
67+
* For GoogleAuth, you can provide a list of accepted IDs (server-only).
68+
*/
69+
public String strings(int j) { int o = __offset(8); return o != 0 ? __string(__vector(o) + j * 4) : null; }
70+
public int stringsLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; }
71+
public StringVector stringsVector() { return stringsVector(new StringVector()); }
72+
public StringVector stringsVector(StringVector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
73+
74+
public static int createCredentials(FlatBufferBuilder builder,
75+
long type,
76+
int bytesOffset,
77+
int stringsOffset) {
78+
builder.startTable(3);
79+
Credentials.addStrings(builder, stringsOffset);
80+
Credentials.addBytes(builder, bytesOffset);
81+
Credentials.addType(builder, type);
82+
return Credentials.endCredentials(builder);
83+
}
84+
85+
public static void startCredentials(FlatBufferBuilder builder) { builder.startTable(3); }
86+
public static void addType(FlatBufferBuilder builder, long type) { builder.addInt(0, (int) type, (int) 0L); }
87+
public static void addBytes(FlatBufferBuilder builder, int bytesOffset) { builder.addOffset(1, bytesOffset, 0); }
88+
public static int createBytesVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
89+
public static int createBytesVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
90+
public static void startBytesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
91+
public static void addStrings(FlatBufferBuilder builder, int stringsOffset) { builder.addOffset(2, stringsOffset, 0); }
92+
public static int createStringsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
93+
public static void startStringsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
94+
public static int endCredentials(FlatBufferBuilder builder) {
95+
int o = builder.endTable();
96+
return o;
97+
}
98+
99+
public static final class Vector extends BaseVector {
100+
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
101+
102+
public Credentials get(int j) { return get(new Credentials(), j); }
103+
public Credentials get(Credentials obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
104+
}
105+
}
106+
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2024 ObjectBox Ltd. All rights reserved.
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.sync;
20+
21+
/**
22+
* Credentials types for login at a sync server.
23+
*/
24+
@SuppressWarnings("unused")
25+
public final class CredentialsType {
26+
private CredentialsType() { }
27+
/**
28+
* Used to indicate an uninitialized variable. Should never be sent/received in a message.
29+
*/
30+
public static final int Invalid = 0;
31+
/**
32+
* No credentials required; do not use for public/production servers.
33+
* This is useful for testing and during development.
34+
*/
35+
public static final int None = 1;
36+
/**
37+
* Deprecated, replaced by SHARED_SECRET_SIPPED
38+
*/
39+
public static final int SharedSecret = 2;
40+
/**
41+
* Google Auth ID token
42+
*/
43+
public static final int GoogleAuth = 3;
44+
/**
45+
* Use shared secret to create a SipHash and make attacks harder than just copy&paste.
46+
* (At some point we may want to switch to crypto & challenge/response.)
47+
*/
48+
public static final int SharedSecretSipped = 4;
49+
/**
50+
* Use ObjectBox Admin users for Sync authentication.
51+
*/
52+
public static final int ObxAdminUser = 5;
53+
/**
54+
* Generic credential type suitable for ObjectBox admin (and possibly others in the future)
55+
*/
56+
public static final int UserPassword = 6;
57+
}
58+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2024 ObjectBox Ltd. All rights reserved.
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.sync.server;
20+
21+
/**
22+
* Special bit flags used in cluster mode only.
23+
*/
24+
@SuppressWarnings("unused")
25+
public final class ClusterFlags {
26+
private ClusterFlags() { }
27+
/**
28+
* Indicates that this cluster always stays in the "follower" cluster role.
29+
* Thus, it does not participate in leader elections.
30+
* This is useful e.g. for weaker cluster nodes that should not become leaders.
31+
*/
32+
public static final int FixedFollower = 1;
33+
}
34+
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright 2024 ObjectBox Ltd. All rights reserved.
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.sync.server;
20+
21+
import io.objectbox.flatbuffers.BaseVector;
22+
import io.objectbox.flatbuffers.BooleanVector;
23+
import io.objectbox.flatbuffers.ByteVector;
24+
import io.objectbox.flatbuffers.Constants;
25+
import io.objectbox.flatbuffers.DoubleVector;
26+
import io.objectbox.flatbuffers.FlatBufferBuilder;
27+
import io.objectbox.flatbuffers.FloatVector;
28+
import io.objectbox.flatbuffers.IntVector;
29+
import io.objectbox.flatbuffers.LongVector;
30+
import io.objectbox.flatbuffers.ShortVector;
31+
import io.objectbox.flatbuffers.StringVector;
32+
import io.objectbox.flatbuffers.Struct;
33+
import io.objectbox.flatbuffers.Table;
34+
import io.objectbox.flatbuffers.UnionVector;
35+
import java.nio.ByteBuffer;
36+
import java.nio.ByteOrder;
37+
38+
/**
39+
* Configuration to connect to another (remote) cluster peer.
40+
* If this server is started in cluster mode, it connects to other cluster peers.
41+
*/
42+
@SuppressWarnings("unused")
43+
public final class ClusterPeerConfig extends Table {
44+
public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); }
45+
public static ClusterPeerConfig getRootAsClusterPeerConfig(ByteBuffer _bb) { return getRootAsClusterPeerConfig(_bb, new ClusterPeerConfig()); }
46+
public static ClusterPeerConfig getRootAsClusterPeerConfig(ByteBuffer _bb, ClusterPeerConfig obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
47+
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
48+
public ClusterPeerConfig __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
49+
50+
public String url() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
51+
public ByteBuffer urlAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
52+
public ByteBuffer urlInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); }
53+
public io.objectbox.sync.Credentials credentials() { return credentials(new io.objectbox.sync.Credentials()); }
54+
public io.objectbox.sync.Credentials credentials(io.objectbox.sync.Credentials obj) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
55+
56+
public static int createClusterPeerConfig(FlatBufferBuilder builder,
57+
int urlOffset,
58+
int credentialsOffset) {
59+
builder.startTable(2);
60+
ClusterPeerConfig.addCredentials(builder, credentialsOffset);
61+
ClusterPeerConfig.addUrl(builder, urlOffset);
62+
return ClusterPeerConfig.endClusterPeerConfig(builder);
63+
}
64+
65+
public static void startClusterPeerConfig(FlatBufferBuilder builder) { builder.startTable(2); }
66+
public static void addUrl(FlatBufferBuilder builder, int urlOffset) { builder.addOffset(0, urlOffset, 0); }
67+
public static void addCredentials(FlatBufferBuilder builder, int credentialsOffset) { builder.addOffset(1, credentialsOffset, 0); }
68+
public static int endClusterPeerConfig(FlatBufferBuilder builder) {
69+
int o = builder.endTable();
70+
return o;
71+
}
72+
73+
public static final class Vector extends BaseVector {
74+
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
75+
76+
public ClusterPeerConfig get(int j) { return get(new ClusterPeerConfig(), j); }
77+
public ClusterPeerConfig get(ClusterPeerConfig obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
78+
}
79+
}
80+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2024 ObjectBox Ltd. All rights reserved.
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.sync.server;
20+
21+
/**
22+
* Bit flags to configure the Sync Server.
23+
*/
24+
@SuppressWarnings("unused")
25+
public final class SyncServerFlags {
26+
private SyncServerFlags() { }
27+
/**
28+
* By default, if the Sync Server allows logins without credentials, it logs a warning message.
29+
* If this flag is set, the message is logged only as "info".
30+
*/
31+
public static final int AuthenticationNoneLogInfo = 1;
32+
/**
33+
* By default, the Admin server is enabled; this flag disables it.
34+
*/
35+
public static final int AdminDisabled = 2;
36+
/**
37+
* By default, the Sync Server logs messages when it starts and stops; this flag disables it.
38+
*/
39+
public static final int LogStartStopDisabled = 4;
40+
}
41+

0 commit comments

Comments
 (0)