Enable a building on the iOS platform (#653)

master
Friedel Ziegelmayer 2 years ago committed by GitHub
parent 0af1f8e645
commit 64c19df614
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      librocksdb-sys/build.rs
  2. 8
      src/db.rs

@ -147,7 +147,18 @@ fn build_rocksdb() {
lib_sources.push("util/crc32c_arm64.cc") lib_sources.push("util/crc32c_arm64.cc")
} }
if target.contains("darwin") { if target.contains("apple-ios") {
config.define("OS_MACOSX", None);
config.define("IOS_CROSS_COMPILE", None);
config.define("PLATFORM", "IOS");
config.define("NIOSTATS_CONTEXT", None);
config.define("NPERF_CONTEXT", None);
config.define("ROCKSDB_PLATFORM_POSIX", None);
config.define("ROCKSDB_LIB_IO_POSIX", None);
env::set_var("IPHONEOS_DEPLOYMENT_TARGET", "11.0");
} else if target.contains("darwin") {
config.define("OS_MACOSX", None); config.define("OS_MACOSX", None);
config.define("ROCKSDB_PLATFORM_POSIX", None); config.define("ROCKSDB_PLATFORM_POSIX", None);
config.define("ROCKSDB_LIB_IO_POSIX", None); config.define("ROCKSDB_LIB_IO_POSIX", None);

@ -992,20 +992,20 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
} }
/// Return the values associated with the given keys and column families. /// Return the values associated with the given keys and column families.
pub fn multi_get_cf<'a, 'b: 'a, K, I, W: 'b>( pub fn multi_get_cf<'a, 'b: 'a, K, I, W>(
&'a self, &'a self,
keys: I, keys: I,
) -> Vec<Result<Option<Vec<u8>>, Error>> ) -> Vec<Result<Option<Vec<u8>>, Error>>
where where
K: AsRef<[u8]>, K: AsRef<[u8]>,
I: IntoIterator<Item = (&'b W, K)>, I: IntoIterator<Item = (&'b W, K)>,
W: AsColumnFamilyRef, W: 'b + AsColumnFamilyRef,
{ {
self.multi_get_cf_opt(keys, &ReadOptions::default()) self.multi_get_cf_opt(keys, &ReadOptions::default())
} }
/// Return the values associated with the given keys and column families using read options. /// Return the values associated with the given keys and column families using read options.
pub fn multi_get_cf_opt<'a, 'b: 'a, K, I, W: 'b>( pub fn multi_get_cf_opt<'a, 'b: 'a, K, I, W>(
&'a self, &'a self,
keys: I, keys: I,
readopts: &ReadOptions, readopts: &ReadOptions,
@ -1013,7 +1013,7 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
where where
K: AsRef<[u8]>, K: AsRef<[u8]>,
I: IntoIterator<Item = (&'b W, K)>, I: IntoIterator<Item = (&'b W, K)>,
W: AsColumnFamilyRef, W: 'b + AsColumnFamilyRef,
{ {
let (cfs_and_keys, keys_sizes): (Vec<(_, Box<[u8]>)>, Vec<_>) = keys let (cfs_and_keys, keys_sizes): (Vec<(_, Box<[u8]>)>, Vec<_>) = keys
.into_iter() .into_iter()

Loading…
Cancel
Save