Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor places connection management #718

merged 16 commits into from Mar 5, 2019
Changes from 12 commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -48,11 +48,18 @@ internal interface LibPlacesFFI : Library {
// String will work but either force us to leak them, or cause us to corrupt the heap (when we
// free them).

/** Create a new places connection */
fun places_connection_new(
/** Create a new places api */
fun places_api_new(
db_path: String,
encryption_key: String?,
out_err: RustError.ByReference
): PlacesApiHandle

/** Create a new places connection */
fun places_connection_new(
handle: PlacesApiHandle,
conn_type: Int,
out_err: RustError.ByReference
): PlacesConnectionHandle

fun places_note_observation(
@@ -166,16 +173,24 @@ internal interface LibPlacesFFI : Library {
/** Destroy strings returned from libplaces_ffi calls. */
fun places_destroy_string(s: Pointer)

/** Destroy connection created using `places_connection_new` */
fun places_api_return_write_conn(apiHandle: PlacesApiHandle,
writeHandle: PlacesConnectionHandle,
err: RustError.ByReference)

/** Destroy connection created using `places_connection_new` */
fun places_connection_destroy(handle: PlacesConnectionHandle, out_err: RustError.ByReference)

/** Destroy api created using `places_api_new` */
fun places_api_destroy(handle: PlacesApiHandle, out_err: RustError.ByReference)

/** Destroy handle created using `places_new_interrupt_handle` */
fun places_interrupt_handle_destroy(obj: RawPlacesInterruptHandle)

fun places_destroy_bytebuffer(bb: RustBuffer.ByValue)

internal typealias PlacesConnectionHandle = Long;
internal typealias PlacesApiHandle = Long;

// This doesn't use a handle to avoid unnecessary locking and
// because the type is panic safe, sync, and send.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.