gecko-dev/toolkit/components/kvstore/nsIKeyValue.idl
Myk Melez 3a0aa679dd Bug 1525392 - update rkv (and LMDB) to their latest stable versions r=froydnj
Changes to rkv and LMDB crates:

rkv 0.7.0 -> 0.9.1
lmdb-rkv 0.9.0 -> 0.11.2
lmdb-sys 0.8.0 -> lmdb-rkv-sys 0.8.2

Update to the LMDB C library:

LMDB 0.9.21 -> 0.9.23 (+ backported patch for Mozilla build issue)

Other crate dependency update:

lazy_static 1.0.1 -> 1.2.0

This also removes the workaround for bug 1525219 and updates the kvstore in-tree crate (and nsIKeyValueService XPCOM API) for the rkv changes.

Differential Revision: https://phabricator.services.mozilla.com/D19094

--HG--
rename : third_party/rust/lmdb-rkv/Cargo.toml => third_party/rust/lmdb-rkv-sys/Cargo.toml
rename : third_party/rust/lmdb-sys/build.rs => third_party/rust/lmdb-rkv-sys/build.rs
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/CHANGES => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/CHANGES
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/COPYRIGHT => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/COPYRIGHT
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/Doxyfile => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/Doxyfile
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/LICENSE => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/LICENSE
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/Makefile => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/Makefile
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/intro.doc => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/intro.doc
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/lmdb.h => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/lmdb.h
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mdb.c => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb.c
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mdb_copy.1 => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb_copy.1
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mdb_copy.c => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb_copy.c
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mdb_dump.1 => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb_dump.1
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mdb_dump.c => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb_dump.c
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mdb_load.1 => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb_load.1
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mdb_load.c => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb_load.c
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mdb_stat.1 => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb_stat.1
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mdb_stat.c => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb_stat.c
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/midl.c => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/midl.c
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/midl.h => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/midl.h
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mtest.c => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mtest.c
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mtest2.c => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mtest2.c
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mtest3.c => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mtest3.c
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mtest4.c => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mtest4.c
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mtest5.c => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mtest5.c
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/mtest6.c => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mtest6.c
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/sample-bdb.txt => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/sample-bdb.txt
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/sample-mdb.txt => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/sample-mdb.txt
rename : third_party/rust/lmdb-sys/lmdb/libraries/liblmdb/tooltag => third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/tooltag
rename : third_party/rust/lmdb-sys/src/constants.rs => third_party/rust/lmdb-rkv-sys/src/constants.rs
rename : third_party/rust/lmdb-sys/src/ffi.rs => third_party/rust/lmdb-rkv-sys/src/ffi.rs
rename : third_party/rust/lmdb-sys/src/lib.rs => third_party/rust/lmdb-rkv-sys/src/lib.rs
extra : moz-landing-system : lando
2019-02-11 19:53:28 +00:00

194 lines
6.8 KiB
Plaintext

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "nsIVariant.idl"
interface nsIKeyValueDatabaseCallback;
interface nsIKeyValueEnumeratorCallback;
interface nsIKeyValuePairCallback;
interface nsIKeyValueVariantCallback;
interface nsIKeyValueVoidCallback;
/**
* The nsIKeyValue* interfaces provide a simple, asynchronous API to a key/value
* storage engine. Basic put/get/has/delete operations are supported, as is
* enumeration of key/value pairs and the use of multiple named databases within
* a single storage file. Operations have ACID semantics.
*
* This API does not (yet) support transactions, so it will not be appropriate
* for all use cases. Extension of this API to support transactions is tracked
* by bug 1499238.
*
* The kvstore.jsm module wraps this API in a more idiomatic, Promise-based
* JS API that supports async/await. In most cases, you're better off using
* that API from JS rather than using this one directly. Bug 1512319 tracks
* native support for Promise in Rust-implemented XPCOM methods.
*/
/**
* The key/value service. Enables retrieval of handles to key/value databases.
*/
[scriptable, uuid(46c893dd-4c14-4de0-b33d-a1be18c6d062)]
interface nsIKeyValueService : nsISupports {
/**
* Get a handle to an existing database or a newly-created one
* at the specified path and with the given name.
*
* The service supports multiple named databases at the same path
* (i.e. within the same storage file), so you can call this method
* multiple times with the same path and different names to retrieve
* multiple databases stored in the same location on disk.
*/
void getOrCreate(
in nsIKeyValueDatabaseCallback callback,
in AUTF8String path,
in AUTF8String name);
};
/**
* A key/value database.
*
* All methods are asynchronous and take a callback as their first argument.
* The types of the callbacks vary, but they can all be implemented in JS
* via an object literal with the relevant methods.
*/
[scriptable, uuid(c449398e-174c-425b-8195-da6aa0ccd9a5)]
interface nsIKeyValueDatabase : nsISupports {
/**
* Write the specified key/value pair to the database.
*/
void put(
in nsIKeyValueVoidCallback callback,
in AUTF8String key,
in nsIVariant value);
/**
* Retrieve the value of the specified key from the database.
*
* If the key/value pair doesn't exist in the database, and you specify
* a default value, then the default value will be returned. Otherwise,
* the callback's resolve() method will be called with a variant
* of type VTYPE_EMPTY, which translates to the JS `null` value.
*/
void get(
in nsIKeyValueVariantCallback callback,
in AUTF8String key,
[optional] in nsIVariant defaultValue);
/**
* Determine whether or not the key exists in the database.
*/
void has(
in nsIKeyValueVariantCallback callback,
in AUTF8String key);
/**
* Remove the key/value pair with the given key from the database.
*
* If the given key doesn't exist in the database, this operation doesn't
* fail; or rather, it fails silently, calling the resolve() method
* of its callback rather than reject(). If you want to know whether
* or not a key exists when deleting it, call the has() method first.
*/
void delete(
in nsIKeyValueVoidCallback callback,
in AUTF8String key);
/**
* Enumerate key/value pairs, starting with the first key equal to
* or greater than the "from" key (inclusive) and ending with the last key
* less than the "to" key (exclusive) sorted lexicographically.
*
* If either key is omitted, the range extends to the first and/or last key
* in the database.
*/
void enumerate(
in nsIKeyValueEnumeratorCallback callback,
[optional] in AUTF8String fromKey,
[optional] in AUTF8String toKey);
};
/**
* A key/value pair. Returned by nsIKeyValueEnumerator.getNext().
*/
[scriptable, uuid(bc37b06a-23b5-4b32-8281-4b8479601c7e)]
interface nsIKeyValuePair : nsISupports {
readonly attribute AUTF8String key;
readonly attribute nsIVariant value;
};
/**
* An enumerator of key/value pairs. Although its methods are similar
* to those of nsISimpleEnumerator, this interface's getNext() method returns
* an nsIKeyValuePair rather than an nsISupports, so consumers don't need
* to QI it to that interface; but this interface doesn't implement the JS
* iteration protocol (because the Rust-XPCOM bindings don't yet support it),
* which is another reason why you should use the kvstore.jsm module from JS
* instead of accessing this API directly.
*/
[scriptable, uuid(b9ba7116-b7ff-4717-9a28-a08e6879b199)]
interface nsIKeyValueEnumerator : nsISupports {
bool hasMoreElements();
nsIKeyValuePair getNext();
};
/**
* A callback for the nsIKeyValueService.getOrCreate() method.
*
* The result is an nsIKeyValueDatabase.
*/
[scriptable, uuid(2becc1f8-2d80-4b63-92a8-24ee8f79ee45)]
interface nsIKeyValueDatabaseCallback : nsISupports {
void resolve(in nsIKeyValueDatabase database);
void reject(in AUTF8String message);
};
/**
* A callback for the nsIKeyValueDatabase.enumerate() method.
*
* The result is an nsIKeyValueEnumerator.
*/
[scriptable, uuid(b7ea2183-880b-4424-ab24-5aa1555b775d)]
interface nsIKeyValueEnumeratorCallback : nsISupports {
void resolve(in nsIKeyValueEnumerator enumerator);
void reject(in AUTF8String message);
};
/**
* A callback for the nsIKeyValueEnumerator.getNext() method.
*
* The result is the next key/value pair, expressed as separate key and value
* parameters.
*/
[scriptable, uuid(50f65485-ec1e-4307-812b-b8a15e1f382e)]
interface nsIKeyValuePairCallback : nsISupports {
void resolve(in nsIKeyValuePair pair);
void reject(in AUTF8String message);
};
/**
* A callback for the nsIKeyValueDatabase.has() and .get() methods.
*
* The result is an nsIVariant, which is always a boolean for the has() method
* and can be any supported data type for the get() method.
*/
[scriptable, uuid(174ebfa1-74ea-42a7-aa90-85bbaf1da4bf)]
interface nsIKeyValueVariantCallback : nsISupports {
void resolve(in nsIVariant result);
void reject(in AUTF8String message);
};
/**
* A callback for the nsIKeyValueDatabase.put() and .delete() methods.
*
* There is no result, but the resolve() method is still called when those
* async operations complete, to notify consumers of completion.
*/
[scriptable, uuid(0c17497a-ccf8-451a-838d-9dfa7f846379)]
interface nsIKeyValueVoidCallback : nsISupports {
void resolve();
void reject(in AUTF8String message);
};