Skip to content

Commit 7894db0

Browse files
edanielsrozza
authored andcommitted
Reference the MongoDB embedded v1 ABI symbols
1 parent 2470fea commit 7894db0

File tree

2 files changed

+43
-43
lines changed

2 files changed

+43
-43
lines changed

driver-embedded/src/main/com/mongodb/embedded/client/MongoDBCAPI.java

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,112 +31,112 @@ interface MongoDBCAPI extends Library {
3131
*
3232
* @return the status pointer from which to get an associated status code / error information.
3333
*/
34-
Pointer libmongodbcapi_status_create();
34+
Pointer mongo_embedded_v1_status_create();
3535

3636
/**
3737
* Destroys a valid status pointer object.
3838
*
39-
* @param status the `libmongodbcapi_status` pointer to release.
39+
* @param status the `mongo_embedded_v1_status` pointer to release.
4040
*/
4141

42-
void libmongodbcapi_status_destroy(Pointer status);
42+
void mongo_embedded_v1_status_destroy(Pointer status);
4343

4444
/**
4545
* Gets an error code from a status pointer.
4646
*
47-
* @param status the `libmongodbcapi_status` pointer from which to get an associated status code.
47+
* @param status the `mongo_embedded_v1_status` pointer from which to get an associated status code.
4848
* @return The error code associated with the `status` parameter or 0 if successful.
4949
*
5050
*/
51-
int libmongodbcapi_status_get_error(Pointer status);
51+
int mongo_embedded_v1_status_get_error(Pointer status);
5252

5353
/**
5454
* Gets a descriptive error message from a status pointer.
5555
*
56-
* @param status the `libmongodbcapi_status` pointer from which to get an associated error message.
56+
* @param status the `mongo_embedded_v1_status` pointer from which to get an associated error message.
5757
*
5858
* @return A null-terminated string containing an error message.
5959
*/
60-
String libmongodbcapi_status_get_explanation(Pointer status);
60+
String mongo_embedded_v1_status_get_explanation(Pointer status);
6161

6262
/**
6363
* Gets a status code from a status pointer.
6464
*
65-
* @param status the `libmongodbcapi_status` pointer from which to get an associated status code.
65+
* @param status the `mongo_embedded_v1_status` pointer from which to get an associated status code.
6666
* @return A numeric status code associated with the `status` parameter which indicates a
6767
* sub-category of failure.
6868
*/
69-
int libmongodbcapi_status_get_code(Pointer status);
69+
int mongo_embedded_v1_status_get_code(Pointer status);
7070

7171
/**
7272
* Initializes the mongodbcapi library, required before any other call.
7373
*
74-
* <p>Cannot be called again without {@link #libmongodbcapi_lib_fini(Pointer, Pointer)} being called first.</p>
74+
* <p>Cannot be called again without {@link #mongo_embedded_v1_lib_fini(Pointer, Pointer)} being called first.</p>
7575
*
7676
* @param initParams the embedded mongod initialization parameters.
77-
* @param status the `libmongodbcapi_status` pointer from which to get an associated status code.
77+
* @param status the `mongo_embedded_v1_status` pointer from which to get an associated status code.
7878
* @return the lib pointer or null if there was a failure. Modifies the status on failure.
7979
*/
80-
Pointer libmongodbcapi_lib_init(Structure initParams, Pointer status);
80+
Pointer mongo_embedded_v1_lib_init(Structure initParams, Pointer status);
8181

8282
/**
8383
* Tears down the state of the library, all databases must be closed before calling this.
8484
*
85-
* @param lib the `libmongodbcapi_lib` pointer
86-
* @param status the `libmongodbcapi_status` pointer from which to get an associated status code.
85+
* @param lib the `mongo_embedded_v1_lib` pointer
86+
* @param status the `mongo_embedded_v1_status` pointer from which to get an associated status code.
8787
* @return the error code or 0 if successful. Modifies the status on failure.
8888
*/
89-
int libmongodbcapi_lib_fini(Pointer lib, Pointer status);
89+
int mongo_embedded_v1_lib_fini(Pointer lib, Pointer status);
9090

9191
/**
9292
* Creates an embedded MongoDB instance and returns a handle with the service context.
9393
*
94-
* @param lib the `libmongodbcapi_lib` pointer
94+
* @param lib the `mongo_embedded_v1_lib` pointer
9595
* @param yamlConfig null-terminated YAML formatted MongoDB configuration string
96-
* @param status the `libmongodbcapi_status` pointer from which to get an associated status code.
96+
* @param status the `mongo_embedded_v1_status` pointer from which to get an associated status code.
9797
* @return the instance pointer or null if there was a failure. Modifies the status on failure.
9898
*/
99-
Pointer libmongodbcapi_instance_create(Pointer lib, String yamlConfig, Pointer status);
99+
Pointer mongo_embedded_v1_instance_create(Pointer lib, String yamlConfig, Pointer status);
100100

101101
/**
102102
* Shuts down an embedded MongoDB instance.
103103
*
104-
* @param instance the `libmongodbcapi_instance` pointer to be destroyed.
105-
* @param status the `libmongodbcapi_status` pointer from which to get an associated status code.
104+
* @param instance the `mongo_embedded_v1_instance` pointer to be destroyed.
105+
* @param status the `mongo_embedded_v1_status` pointer from which to get an associated status code.
106106
* @return the error code or 0 if successful. Modifies the status on failure.
107107
*/
108-
int libmongodbcapi_instance_destroy(Pointer instance, Pointer status);
108+
int mongo_embedded_v1_instance_destroy(Pointer instance, Pointer status);
109109

110110
/**
111111
* Create a new embedded client instance.
112112
*
113-
* @param instance the `libmongodbcapi_instance` pointer.
114-
* @param status the `libmongodbcapi_status` pointer from which to get an associated status code.
113+
* @param instance the `mongo_embedded_v1_instance` pointer.
114+
* @param status the `mongo_embedded_v1_status` pointer from which to get an associated status code.
115115
* @return the client pointer or null if there was a failure. Modifies the status on failure.
116116
*/
117-
Pointer libmongodbcapi_client_create(Pointer instance, Pointer status);
117+
Pointer mongo_embedded_v1_client_create(Pointer instance, Pointer status);
118118

119119
/**
120120
* Destroys an embedded client instance.
121121
*
122-
* @param client the `libmongodbcapi_client` pointer.
123-
* @param status the `libmongodbcapi_status` pointer from which to get an associated status code.
122+
* @param client the `mongo_embedded_v1_client` pointer.
123+
* @param status the `mongo_embedded_v1_status` pointer from which to get an associated status code.
124124
* @return the error code or 0 if successful. Modifies the status on failure.
125125
*/
126-
int libmongodbcapi_client_destroy(Pointer client, Pointer status);
126+
int mongo_embedded_v1_client_destroy(Pointer client, Pointer status);
127127

128128
/**
129129
* Make an RPC call. Not clear yet on whether this is the correct signature.
130130
*
131-
* @param client the `libmongodbcapi_client` pointer
131+
* @param client the `mongo_embedded_v1_client` pointer
132132
* @param input the RPC input
133133
* @param inputSize the RPC input size
134134
* @param output the RPC output
135135
* @param outputSize the RPC output size
136-
* @param status status the `libmongodbcapi_status` pointer from which to get an associated status code.
136+
* @param status status the `mongo_embedded_v1_status` pointer from which to get an associated status code.
137137
* @return the error code or 0 if successful. Modifies the status on failure.
138138
*/
139-
int libmongodbcapi_client_invoke(Pointer client, byte[] input, int inputSize, PointerByReference output, IntByReference outputSize,
139+
int mongo_embedded_v1_client_invoke(Pointer client, byte[] input, int inputSize, PointerByReference output, IntByReference outputSize,
140140
Pointer status);
141141

142142

driver-embedded/src/main/com/mongodb/embedded/client/MongoDBCAPIHelper.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static synchronized void init(final MongoEmbeddedSettings mongoEmbeddedSettings)
6666
+ "%n", NATIVE_LIBRARY_NAME, e.getMessage()), e);
6767
}
6868
libraryStatusPointer = createStatusPointer();
69-
libraryPointer = mongoDBCAPI.libmongodbcapi_lib_init(new MongoDBCAPIInitParams(mongoEmbeddedSettings), libraryStatusPointer);
69+
libraryPointer = mongoDBCAPI.mongo_embedded_v1_lib_init(new MongoDBCAPIInitParams(mongoEmbeddedSettings), libraryStatusPointer);
7070
if (libraryPointer == null) {
7171
createErrorFromStatus(libraryStatusPointer);
7272
}
@@ -75,7 +75,7 @@ static synchronized void init(final MongoEmbeddedSettings mongoEmbeddedSettings)
7575
static synchronized void fini() {
7676
checkInitialized();
7777
try {
78-
validateErrorCode(libraryStatusPointer, mongoDBCAPI.libmongodbcapi_lib_fini(libraryPointer, libraryStatusPointer));
78+
validateErrorCode(libraryStatusPointer, mongoDBCAPI.mongo_embedded_v1_lib_fini(libraryPointer, libraryStatusPointer));
7979
libraryPointer = null;
8080
} catch (Throwable t) {
8181
throw createError("fini", t);
@@ -88,7 +88,7 @@ static synchronized void fini() {
8888
static Pointer instance_create(final String yamlConfig, final Pointer instanceStatusPointer) {
8989
checkInitialized();
9090
try {
91-
return validatePointerCreated(instanceStatusPointer, mongoDBCAPI.libmongodbcapi_instance_create(libraryPointer, yamlConfig,
91+
return validatePointerCreated(instanceStatusPointer, mongoDBCAPI.mongo_embedded_v1_instance_create(libraryPointer, yamlConfig,
9292
instanceStatusPointer)
9393
);
9494
} catch (Throwable t) {
@@ -99,7 +99,7 @@ static Pointer instance_create(final String yamlConfig, final Pointer instanceSt
9999
static void instance_destroy(final Pointer instance, final Pointer instanceStatusPointer) {
100100
checkInitialized();
101101
try {
102-
validateErrorCode(instanceStatusPointer, mongoDBCAPI.libmongodbcapi_instance_destroy(instance, instanceStatusPointer));
102+
validateErrorCode(instanceStatusPointer, mongoDBCAPI.mongo_embedded_v1_instance_destroy(instance, instanceStatusPointer));
103103
} catch (Throwable t) {
104104
throw createError("instance_destroy", t);
105105
}
@@ -108,7 +108,7 @@ static void instance_destroy(final Pointer instance, final Pointer instanceStatu
108108
static Pointer create_client(final Pointer instance, final Pointer clientStatusPointer) {
109109
checkInitialized();
110110
try {
111-
return validatePointerCreated(clientStatusPointer, mongoDBCAPI.libmongodbcapi_client_create(instance, clientStatusPointer));
111+
return validatePointerCreated(clientStatusPointer, mongoDBCAPI.mongo_embedded_v1_client_create(instance, clientStatusPointer));
112112
} catch (Throwable t) {
113113
throw createError("client_create", t);
114114
}
@@ -117,7 +117,7 @@ static Pointer create_client(final Pointer instance, final Pointer clientStatusP
117117
static void client_destroy(final Pointer client, final Pointer clientStatusPointer) {
118118
checkInitialized();
119119
try {
120-
validateErrorCode(clientStatusPointer, mongoDBCAPI.libmongodbcapi_client_destroy(client, clientStatusPointer));
120+
validateErrorCode(clientStatusPointer, mongoDBCAPI.mongo_embedded_v1_client_destroy(client, clientStatusPointer));
121121
} catch (Throwable t) {
122122
throw createError("client_destroy", t);
123123
}
@@ -127,7 +127,7 @@ static void client_invoke(final Pointer client, final byte[] input, final Pointe
127127
final Pointer clientStatusPointer) {
128128
checkInitialized();
129129
try {
130-
validateErrorCode(clientStatusPointer, mongoDBCAPI.libmongodbcapi_client_invoke(client, input, input.length, output,
130+
validateErrorCode(clientStatusPointer, mongoDBCAPI.mongo_embedded_v1_client_invoke(client, input, input.length, output,
131131
outputSize, clientStatusPointer)
132132
);
133133
} catch (Throwable t) {
@@ -137,15 +137,15 @@ static void client_invoke(final Pointer client, final byte[] input, final Pointe
137137

138138
static Pointer createStatusPointer() {
139139
try {
140-
return mongoDBCAPI.libmongodbcapi_status_create();
140+
return mongoDBCAPI.mongo_embedded_v1_status_create();
141141
} catch (Throwable t) {
142142
throw createError("status_create", t);
143143
}
144144
}
145145

146146
static void destroyStatusPointer(final Pointer statusPointer) {
147147
try {
148-
mongoDBCAPI.libmongodbcapi_status_destroy(statusPointer);
148+
mongoDBCAPI.mongo_embedded_v1_status_destroy(statusPointer);
149149
} catch (Throwable t) {
150150
throw createError("status_destroy", t);
151151
}
@@ -159,13 +159,13 @@ private static MongoClientEmbeddedException createError(final String methodName,
159159
}
160160

161161
private static void createErrorFromStatus(final Pointer statusPointer) {
162-
createErrorFromStatus(statusPointer, mongoDBCAPI.libmongodbcapi_status_get_error(statusPointer));
162+
createErrorFromStatus(statusPointer, mongoDBCAPI.mongo_embedded_v1_status_get_error(statusPointer));
163163
}
164164

165165
private static void createErrorFromStatus(final Pointer statusPointer, final int errorCode) {
166166
throw new MongoClientEmbeddedException(errorCode,
167-
mongoDBCAPI.libmongodbcapi_status_get_code(statusPointer),
168-
mongoDBCAPI.libmongodbcapi_status_get_explanation(statusPointer));
167+
mongoDBCAPI.mongo_embedded_v1_status_get_code(statusPointer),
168+
mongoDBCAPI.mongo_embedded_v1_status_get_explanation(statusPointer));
169169
}
170170

171171
private static Pointer validatePointerCreated(final Pointer statusPointer, final Pointer pointer) {
@@ -191,7 +191,7 @@ private MongoDBCAPIHelper() {
191191
}
192192

193193
/**
194-
* Represents libmongodbcapi_init_params
194+
* Represents mongo_embedded_v1_init_params
195195
*/
196196
public static class MongoDBCAPIInitParams extends Structure {
197197
// CHECKSTYLE.OFF: VisibilityModifier

0 commit comments

Comments
 (0)