зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1907898 - Vendor in application-services, r=nanj
Differential Revision: https://phabricator.services.mozilla.com/D216571
This commit is contained in:
Родитель
5ccc321d7a
Коммит
bad6ef31e2
|
@ -60,9 +60,9 @@ git = "https://github.com/mozilla-spidermonkey/jsparagus"
|
|||
rev = "61f399c53a641ebd3077c1f39f054f6d396a633c"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"]
|
||||
[source."git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72"]
|
||||
git = "https://github.com/mozilla/application-services"
|
||||
rev = "46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
rev = "8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla/audioipc?rev=3495905752a4263827f5d43737f9ca3ed0243ce0"]
|
||||
|
|
|
@ -1715,7 +1715,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "error-support"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"error-support-macros",
|
||||
"lazy_static",
|
||||
|
@ -1727,7 +1727,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "error-support-macros"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3048,7 +3048,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "interrupt-support"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"parking_lot",
|
||||
|
@ -4246,7 +4246,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "nss_build_common"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
|
||||
[[package]]
|
||||
name = "nsstring"
|
||||
|
@ -4456,6 +4456,16 @@ version = "1.0.11"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba"
|
||||
|
||||
[[package]]
|
||||
name = "payload-support"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peek-poke"
|
||||
version = "0.3.0"
|
||||
|
@ -4921,7 +4931,7 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
|
|||
[[package]]
|
||||
name = "relevancy"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.21.3",
|
||||
|
@ -4944,7 +4954,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "remote_settings"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"parking_lot",
|
||||
"serde",
|
||||
|
@ -5479,7 +5489,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "sql-support"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"ffi-support",
|
||||
"interrupt-support",
|
||||
|
@ -5661,7 +5671,7 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
|||
[[package]]
|
||||
name = "suggest"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
|
@ -5712,7 +5722,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "sync-guid"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"base64 0.21.3",
|
||||
"rand",
|
||||
|
@ -5723,7 +5733,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "sync15"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"error-support",
|
||||
|
@ -5731,6 +5741,7 @@ dependencies = [
|
|||
"interrupt-support",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"payload-support",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
|
@ -5754,13 +5765,14 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "tabs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"error-support",
|
||||
"interrupt-support",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"payload-support",
|
||||
"rusqlite",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
|
@ -6081,7 +6093,7 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
|||
[[package]]
|
||||
name = "types"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"rusqlite",
|
||||
"serde",
|
||||
|
@ -6448,7 +6460,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
|||
[[package]]
|
||||
name = "viaduct"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"ffi-support",
|
||||
"log",
|
||||
|
@ -6596,7 +6608,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webext-storage"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151#46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=8fd08c6f2f8acd38579bd3142fecda9272957b72#8fd08c6f2f8acd38579bd3142fecda9272957b72"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"error-support",
|
||||
|
|
16
Cargo.toml
16
Cargo.toml
|
@ -217,14 +217,14 @@ warp = { git = "https://github.com/seanmonstar/warp", rev = "9d081461ae1167eb321
|
|||
malloc_size_of_derive = { path = "xpcom/rust/malloc_size_of_derive" }
|
||||
|
||||
# application-services overrides to make updating them all simpler.
|
||||
interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151" }
|
||||
relevancy = { git = "https://github.com/mozilla/application-services", rev = "46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151" }
|
||||
sql-support = { git = "https://github.com/mozilla/application-services", rev = "46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151" }
|
||||
suggest = { git = "https://github.com/mozilla/application-services", rev = "46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151" }
|
||||
sync15 = { git = "https://github.com/mozilla/application-services", rev = "46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151" }
|
||||
tabs = { git = "https://github.com/mozilla/application-services", rev = "46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151" }
|
||||
viaduct = { git = "https://github.com/mozilla/application-services", rev = "46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151" }
|
||||
webext-storage = { git = "https://github.com/mozilla/application-services", rev = "46acbeb2cee2fb7f024b6ff5943bdfdb6cc53151" }
|
||||
interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "8fd08c6f2f8acd38579bd3142fecda9272957b72" }
|
||||
relevancy = { git = "https://github.com/mozilla/application-services", rev = "8fd08c6f2f8acd38579bd3142fecda9272957b72" }
|
||||
sql-support = { git = "https://github.com/mozilla/application-services", rev = "8fd08c6f2f8acd38579bd3142fecda9272957b72" }
|
||||
suggest = { git = "https://github.com/mozilla/application-services", rev = "8fd08c6f2f8acd38579bd3142fecda9272957b72" }
|
||||
sync15 = { git = "https://github.com/mozilla/application-services", rev = "8fd08c6f2f8acd38579bd3142fecda9272957b72" }
|
||||
tabs = { git = "https://github.com/mozilla/application-services", rev = "8fd08c6f2f8acd38579bd3142fecda9272957b72" }
|
||||
viaduct = { git = "https://github.com/mozilla/application-services", rev = "8fd08c6f2f8acd38579bd3142fecda9272957b72" }
|
||||
webext-storage = { git = "https://github.com/mozilla/application-services", rev = "8fd08c6f2f8acd38579bd3142fecda9272957b72" }
|
||||
|
||||
# Patch mio 0.8.8 to use windows-sys 0.52 (backport https://github.com/tokio-rs/mio/commit/eea9e3e0c469480e5c59c01e6c3c7e5fd88f0848)
|
||||
mio_0_8 = { package = "mio", git = "https://github.com/glandium/mio", rev = "9a2ef335c366044ffe73b1c4acabe50a1daefe05" }
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{"files":{"Cargo.toml":"93e4aa75876fdbc1bb2e3db74a7723e5bdedcf55a11501105dae1ceb3b644b11","src/lib.rs":"79dc9e049ea9a09ab811869dcca06b396ffd6c349f6d3f726811ffda58070c5e"},"package":null}
|
|
@ -0,0 +1,22 @@
|
|||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you are reading this file be aware that the original Cargo.toml
|
||||
# will likely look very different (and much more reasonable).
|
||||
# See Cargo.toml.orig for the original contents.
|
||||
|
||||
[package]
|
||||
edition = "2021"
|
||||
name = "payload-support"
|
||||
version = "0.1.0"
|
||||
authors = ["Sync Team <sync-team@mozilla.com>"]
|
||||
license = "MPL-2.0"
|
||||
|
||||
[dependencies]
|
||||
serde = "1"
|
||||
serde_derive = "1"
|
||||
serde_json = "1"
|
|
@ -0,0 +1,173 @@
|
|||
/* 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/. */
|
||||
|
||||
use serde::Serialize;
|
||||
use std::{
|
||||
io::{self, Write},
|
||||
num::NonZeroUsize,
|
||||
};
|
||||
|
||||
/// A quantity of items that can fit into a payload, accounting for
|
||||
/// serialization, encryption, and Base64-encoding overhead.
|
||||
pub enum Fit {
|
||||
/// All items can fit into the payload.
|
||||
All,
|
||||
|
||||
/// Some, but not all, items can fit into the payload without
|
||||
/// exceeding the maximum payload size.
|
||||
Some(NonZeroUsize),
|
||||
|
||||
/// The maximum payload size is too small to hold any items.
|
||||
None,
|
||||
|
||||
/// The serialized size of the items couldn't be determined because of
|
||||
/// a serialization error.
|
||||
Err(serde_json::Error),
|
||||
}
|
||||
|
||||
impl Fit {
|
||||
/// If `self` is [`Fit::Some`], returns the number of items that can fit
|
||||
/// into the payload without exceeding its maximum size. Otherwise,
|
||||
/// returns `None`.
|
||||
#[inline]
|
||||
pub fn as_some(&self) -> Option<NonZeroUsize> {
|
||||
match self {
|
||||
Fit::Some(count) => Some(*count),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A writer that counts the number of bytes it's asked to write, and discards
|
||||
/// the data. Used to compute the serialized size of an item.
|
||||
#[derive(Clone, Copy, Default)]
|
||||
struct ByteCountWriter(usize);
|
||||
|
||||
impl ByteCountWriter {
|
||||
#[inline]
|
||||
pub fn count(self) -> usize {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Write for ByteCountWriter {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
self.0 += buf.len();
|
||||
Ok(buf.len())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the size of the given value, in bytes, when serialized to JSON.
|
||||
pub fn compute_serialized_size<T: Serialize + ?Sized>(value: &T) -> serde_json::Result<usize> {
|
||||
let mut w = ByteCountWriter::default();
|
||||
serde_json::to_writer(&mut w, value)?;
|
||||
Ok(w.count())
|
||||
}
|
||||
|
||||
/// Calculates the maximum number of items that can fit within
|
||||
/// `max_payload_size` when serialized to JSON.
|
||||
pub fn try_fit_items<T: Serialize>(items: &[T], max_payload_size: usize) -> Fit {
|
||||
let size = match compute_serialized_size(&items) {
|
||||
Ok(size) => size,
|
||||
Err(e) => return Fit::Err(e),
|
||||
};
|
||||
// See bug 535326 comment 8 for an explanation of the estimation
|
||||
let max_serialized_size = match ((max_payload_size / 4) * 3).checked_sub(1500) {
|
||||
Some(max_serialized_size) => max_serialized_size,
|
||||
None => return Fit::None,
|
||||
};
|
||||
if size > max_serialized_size {
|
||||
// Estimate a little more than the direct fraction to maximize packing
|
||||
let mut cutoff = (items.len() * max_serialized_size - 1) / size + 1;
|
||||
// Keep dropping off the last entry until the data fits.
|
||||
while cutoff > 0 {
|
||||
let size = match compute_serialized_size(&items[..cutoff]) {
|
||||
Ok(size) => size,
|
||||
Err(e) => return Fit::Err(e),
|
||||
};
|
||||
if size <= max_serialized_size {
|
||||
break;
|
||||
}
|
||||
cutoff -= 1;
|
||||
}
|
||||
match NonZeroUsize::new(cutoff) {
|
||||
Some(count) => Fit::Some(count),
|
||||
None => Fit::None,
|
||||
}
|
||||
} else {
|
||||
Fit::All
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use serde_derive::Serialize;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct CommandRecord {
|
||||
#[serde(rename = "command")]
|
||||
name: &'static str,
|
||||
#[serde(default)]
|
||||
args: &'static [Option<&'static str>],
|
||||
#[serde(default, rename = "flowID", skip_serializing_if = "Option::is_none")]
|
||||
flow_id: Option<&'static str>,
|
||||
}
|
||||
|
||||
const COMMANDS: &[CommandRecord] = &[
|
||||
CommandRecord {
|
||||
name: "wipeEngine",
|
||||
args: &[Some("bookmarks")],
|
||||
flow_id: Some("flow"),
|
||||
},
|
||||
CommandRecord {
|
||||
name: "resetEngine",
|
||||
args: &[Some("history")],
|
||||
flow_id: Some("flow"),
|
||||
},
|
||||
CommandRecord {
|
||||
name: "logout",
|
||||
args: &[],
|
||||
flow_id: None,
|
||||
},
|
||||
];
|
||||
|
||||
#[test]
|
||||
fn test_compute_serialized_size() {
|
||||
assert_eq!(compute_serialized_size(&1).unwrap(), 1);
|
||||
assert_eq!(compute_serialized_size(&"hi").unwrap(), 4);
|
||||
assert_eq!(
|
||||
compute_serialized_size(&["hi", "hello", "bye"]).unwrap(),
|
||||
20
|
||||
);
|
||||
|
||||
let sizes = COMMANDS
|
||||
.iter()
|
||||
.map(|c| compute_serialized_size(c).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(sizes, &[61, 60, 30]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_try_fit_items() {
|
||||
// 4096 bytes is enough to fit all three commands.
|
||||
assert!(matches!(try_fit_items(COMMANDS, 4096), Fit::All));
|
||||
|
||||
// `logout` won't fit within 2168 bytes.
|
||||
assert_eq!(try_fit_items(COMMANDS, 2168).as_some().unwrap().get(), 2);
|
||||
|
||||
// `resetEngine` won't fit within 2084 bytes.
|
||||
assert_eq!(try_fit_items(COMMANDS, 2084).as_some().unwrap().get(), 1);
|
||||
|
||||
// `wipeEngine` won't fit at all.
|
||||
assert!(matches!(try_fit_items(COMMANDS, 1024), Fit::None));
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"970c64cc4ed32fddac6b8cc2a83e7eb4e57aa249b8034d2d67cb56efa8475522","build.rs":"a562bfe527d21c4e8a1a44b892defa83cdff141ec5dd51ed6f3862330e50ddd7","src/bin/generate-test-data.rs":"7f1c9dc445418c7627f89d1f2aa8e550d0f85b3d1f05edb7c378ab9441714f1f","src/db.rs":"84fa47dc54f113769ce9ec6f827c8813abed61d5e5fc82404816266703a5c668","src/error.rs":"bda332098f9759e4250c725b09d82704ba03c9ad87dc761414fa21f40220acf5","src/ingest.rs":"58bb3ed984aa5a9becb405793832e578586be744d3c4a1c411fdfb7ff48c55dd","src/interest.rs":"73baa578b40b96d13899016b14087c9ac37b754c1311e2798b1d09c719447751","src/lib.rs":"214fdbeb25e0753ef132245e6892d77cad0ddd87c96d9bdd7f3427bc5d11091e","src/relevancy.udl":"9f463bbc2a7ef28358ffbfe832e62ddd6127888c484576466c759b127a55c4b2","src/rs.rs":"5803bf8deac969b2e1fc3ea0faeb592604b5e90524a2f4469565702b30c49da6","src/schema.rs":"919f4d1d3654bad966c5ce93ac157dc17cac2f35e7b8c2efc471b9af562555db","src/url_hash.rs":"2e908316fb70923644d1990dbf470d69ce2f5e99b0c5c3d95ec691590be8ffa5","test-data":"1ef2cd092d59e7e126cd4a514af983d449ed9f9c98708702fd237464a76c2b5e"},"package":null}
|
||||
{"files":{"Cargo.toml":"970c64cc4ed32fddac6b8cc2a83e7eb4e57aa249b8034d2d67cb56efa8475522","build.rs":"a562bfe527d21c4e8a1a44b892defa83cdff141ec5dd51ed6f3862330e50ddd7","src/bin/generate-test-data.rs":"7f1c9dc445418c7627f89d1f2aa8e550d0f85b3d1f05edb7c378ab9441714f1f","src/db.rs":"84fa47dc54f113769ce9ec6f827c8813abed61d5e5fc82404816266703a5c668","src/error.rs":"bda332098f9759e4250c725b09d82704ba03c9ad87dc761414fa21f40220acf5","src/ingest.rs":"58bb3ed984aa5a9becb405793832e578586be744d3c4a1c411fdfb7ff48c55dd","src/interest.rs":"73baa578b40b96d13899016b14087c9ac37b754c1311e2798b1d09c719447751","src/lib.rs":"214fdbeb25e0753ef132245e6892d77cad0ddd87c96d9bdd7f3427bc5d11091e","src/relevancy.udl":"9f463bbc2a7ef28358ffbfe832e62ddd6127888c484576466c759b127a55c4b2","src/rs.rs":"cff2351c9e1b45bb67ee945650fd74b45ed48815851e58b8dbf39e66a30c10a3","src/schema.rs":"919f4d1d3654bad966c5ce93ac157dc17cac2f35e7b8c2efc471b9af562555db","src/url_hash.rs":"2e908316fb70923644d1990dbf470d69ce2f5e99b0c5c3d95ec691590be8ffa5","test-data":"1ef2cd092d59e7e126cd4a514af983d449ed9f9c98708702fd237464a76c2b5e"},"package":null}
|
|
@ -34,6 +34,7 @@ impl RelevancyRemoteSettingsClient for remote_settings::Client {
|
|||
/// A record in the Relevancy Remote Settings collection.
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct RelevancyRecord {
|
||||
#[allow(dead_code)]
|
||||
#[serde(rename = "type")]
|
||||
pub record_type: String,
|
||||
pub record_custom_details: RecordCustomDetails,
|
||||
|
@ -48,7 +49,9 @@ pub struct RecordCustomDetails {
|
|||
/// Category information related to the record.
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct CategoryToDomains {
|
||||
#[allow(dead_code)]
|
||||
pub version: i32,
|
||||
#[allow(dead_code)]
|
||||
pub category: String,
|
||||
pub category_code: i32,
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"6765229acc1f06326b3ede93379d78d119aa78679567baf0bf7bdb5ec310522f","src/conn_ext.rs":"d4eddf906ecf5d45b8cf9e858751cc22e644e652f04560237f8de748a33d56f6","src/debug_tools.rs":"bece2bc3d35379b81ea2f942a0a3e909e0ab0553656505904745548eacaf402a","src/each_chunk.rs":"e900a4ebadad31b0a87cb8d7c3ed5aeb7325d4d380ae1d9174eff62c78facdcc","src/lazy.rs":"a96b4f4ec572538b49cdfa8fee981dcf5143a5f51163fb8a573d3ac128df70f9","src/lib.rs":"b2c120db4928c3e4abdd96405fd4c1016255699bdbc38c8cd60dbd3431fc0a12","src/maybe_cached.rs":"0b18425595055883a98807fbd62ff27a79c18af34e7cb3439f8c3438463ef2dd","src/open_database.rs":"c8e46d682da499e1b9ab0fd7f8a21f6140d1f9520b40b21cb7bd3f542e3d5f3e","src/repeat.rs":"b4c5ff5d083afba7f9f153f54aba2e6859b78b85c82d48dbd6bd58f67da9e6b9"},"package":null}
|
||||
{"files":{"Cargo.toml":"6765229acc1f06326b3ede93379d78d119aa78679567baf0bf7bdb5ec310522f","src/conn_ext.rs":"7c4ea787532733772cc840ecab47153d14533279351d9aa16cb5becec8b2345b","src/debug_tools.rs":"bece2bc3d35379b81ea2f942a0a3e909e0ab0553656505904745548eacaf402a","src/each_chunk.rs":"e900a4ebadad31b0a87cb8d7c3ed5aeb7325d4d380ae1d9174eff62c78facdcc","src/lazy.rs":"a96b4f4ec572538b49cdfa8fee981dcf5143a5f51163fb8a573d3ac128df70f9","src/lib.rs":"b2c120db4928c3e4abdd96405fd4c1016255699bdbc38c8cd60dbd3431fc0a12","src/maybe_cached.rs":"0b18425595055883a98807fbd62ff27a79c18af34e7cb3439f8c3438463ef2dd","src/open_database.rs":"b0f748ae88739db9e706a1f7f3d5b02769e689df59ff8ef2e894f2b503f80c70","src/repeat.rs":"b4c5ff5d083afba7f9f153f54aba2e6859b78b85c82d48dbd6bd58f67da9e6b9"},"package":null}
|
|
@ -13,8 +13,6 @@ use std::time::Instant;
|
|||
|
||||
use crate::maybe_cached::MaybeCached;
|
||||
|
||||
pub struct Conn(rusqlite::Connection);
|
||||
|
||||
/// This trait exists so that we can use these helpers on `rusqlite::{Transaction, Connection}`.
|
||||
/// Note that you must import ConnExt in order to call these methods on anything.
|
||||
pub trait ConnExt {
|
||||
|
|
|
@ -243,7 +243,11 @@ fn set_schema_version(conn: &Connection, version: u32) -> Result<()> {
|
|||
// our other crates.
|
||||
pub mod test_utils {
|
||||
use super::*;
|
||||
use std::{cell::RefCell, collections::HashSet, path::PathBuf};
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
collections::{HashMap, HashSet},
|
||||
path::PathBuf,
|
||||
};
|
||||
use tempfile::TempDir;
|
||||
|
||||
pub struct TestConnectionInitializer {
|
||||
|
@ -424,41 +428,13 @@ pub mod test_utils {
|
|||
let db = self.open();
|
||||
let new_db = open_memory_database(&self.connection_initializer).unwrap();
|
||||
|
||||
let table_names = get_table_names(&db);
|
||||
let new_db_table_names = get_table_names(&new_db);
|
||||
let extra_tables = Vec::from_iter(table_names.difference(&new_db_table_names));
|
||||
if !extra_tables.is_empty() {
|
||||
panic!("Extra tables not present in new database: {extra_tables:?}");
|
||||
}
|
||||
let new_db_extra_tables = Vec::from_iter(new_db_table_names.difference(&table_names));
|
||||
if !new_db_extra_tables.is_empty() {
|
||||
panic!("Extra tables only present in new database: {new_db_extra_tables:?}");
|
||||
}
|
||||
for table_name in table_names {
|
||||
assert_eq!(
|
||||
get_table_sql(&db, &table_name),
|
||||
get_table_sql(&new_db, &table_name),
|
||||
"sql differs for table: {table_name}",
|
||||
);
|
||||
}
|
||||
|
||||
let index_names = get_index_names(&db);
|
||||
let new_db_index_names = get_index_names(&new_db);
|
||||
let extra_index = Vec::from_iter(index_names.difference(&new_db_index_names));
|
||||
if !extra_index.is_empty() {
|
||||
panic!("Extra indexes not present in new database: {extra_index:?}");
|
||||
}
|
||||
let new_db_extra_index = Vec::from_iter(new_db_index_names.difference(&index_names));
|
||||
if !new_db_extra_index.is_empty() {
|
||||
panic!("Extra indexes only present in new database: {new_db_extra_index:?}");
|
||||
}
|
||||
for index_name in index_names {
|
||||
assert_eq!(
|
||||
get_index_sql(&db, &index_name),
|
||||
get_index_sql(&new_db, &index_name),
|
||||
"sql differs for index: {index_name}",
|
||||
);
|
||||
}
|
||||
compare_sql_maps("table", get_sql(&db, "table"), get_sql(&new_db, "table"));
|
||||
compare_sql_maps("index", get_sql(&db, "index"), get_sql(&new_db, "index"));
|
||||
compare_sql_maps(
|
||||
"trigger",
|
||||
get_sql(&db, "trigger"),
|
||||
get_sql(&new_db, "trigger"),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn open(&self) -> Connection {
|
||||
|
@ -466,44 +442,40 @@ pub mod test_utils {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_table_names(conn: &Connection) -> HashSet<String> {
|
||||
fn get_sql(conn: &Connection, type_: &str) -> HashMap<String, String> {
|
||||
conn.query_rows_and_then(
|
||||
"SELECT name FROM sqlite_master WHERE type='table'",
|
||||
(),
|
||||
|row| row.get(0),
|
||||
"SELECT name, sql FROM sqlite_master WHERE type=?",
|
||||
(type_,),
|
||||
|row| -> rusqlite::Result<(String, String)> { Ok((row.get(0)?, row.get(1)?)) },
|
||||
)
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn get_table_sql(conn: &Connection, table_name: &str) -> String {
|
||||
conn.query_row_and_then(
|
||||
"SELECT sql FROM sqlite_master WHERE name = ? AND type='table'",
|
||||
(&table_name,),
|
||||
|row| row.get::<_, String>(0),
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
fn compare_sql_maps(
|
||||
type_: &str,
|
||||
old_items: HashMap<String, String>,
|
||||
new_items: HashMap<String, String>,
|
||||
) {
|
||||
let old_db_keys: HashSet<&String> = old_items.keys().collect();
|
||||
let new_db_keys: HashSet<&String> = new_items.keys().collect();
|
||||
|
||||
fn get_index_names(conn: &Connection) -> HashSet<String> {
|
||||
conn.query_rows_and_then(
|
||||
"SELECT name FROM sqlite_master WHERE type='index'",
|
||||
(),
|
||||
|row| row.get(0),
|
||||
)
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn get_index_sql(conn: &Connection, index_name: &str) -> String {
|
||||
conn.query_row_and_then(
|
||||
"SELECT sql FROM sqlite_master WHERE name = ? AND type='index'",
|
||||
(&index_name,),
|
||||
|row| row.get::<_, String>(0),
|
||||
)
|
||||
.unwrap()
|
||||
let old_db_extra_keys = Vec::from_iter(old_db_keys.difference(&new_db_keys));
|
||||
if !old_db_extra_keys.is_empty() {
|
||||
panic!("Extra keys not present in new database for {type_}: {old_db_extra_keys:?}");
|
||||
}
|
||||
let new_db_extra_keys = Vec::from_iter(new_db_keys.difference(&old_db_keys));
|
||||
if !new_db_extra_keys.is_empty() {
|
||||
panic!("Extra keys only present in new database for {type_}: {new_db_extra_keys:?}");
|
||||
}
|
||||
for key in old_db_keys {
|
||||
assert_eq!(
|
||||
old_items.get(key).unwrap(),
|
||||
new_items.get(key).unwrap(),
|
||||
"sql differs for {type_} {key}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"2279f807917db93aa1cb91d7ff1b44e28fe43c160d83eed9a231a8e1b11f913f","README.md":"dd0c0d3fc180f2021d81ea5804895f661cb4fe45b87fe5b1ebf8aa756988e867","benches/benchmark_all.rs":"dd15df10d2561e7fdd669e86ef4343c04153682ee5a3943d1de0a54ccf577ac8","build.rs":"78780c5cccfe22c3ff4198624b9e188559c437c3e6fa1c8bb66548eee6aa66bf","src/benchmarks/README.md":"ccee8dbddba8762d0453fa855bd6984137b224b8c019f3dd8e86a3c303f51d71","src/benchmarks/client.rs":"b65f3d53323c827ca55cc02442b63a137c783530cc93225a90b02bc4e9790d0f","src/benchmarks/ingest.rs":"dbaf687213eb28ba9c10a30082fbce823375a91efa215db6d01ac26004478876","src/benchmarks/mod.rs":"fe1898ba4d783213525da10d92858ee84cebfd22749bad7aeb461d338fe5504a","src/bin/debug_ingestion_sizes.rs":"ce6e810be7b3fc19e826d75b622b82cfab5a1a99397a6d0833c2c4eebff2d364","src/config.rs":"d40c6e83d8b5faa32c66110803ca9e78611d43507e9d3f1e191a93a7773c37b3","src/db.rs":"455691edb2e3af8c0a7ca05e3bf4f974b6ba49a362247348d3754ad99da358d3","src/error.rs":"5209d1d6d0fd3b155e2198813db47f12e9217978c4a28086b9fe93fc738b64af","src/keyword.rs":"988d0ab021c0df19cfd3c519df7d37f606bf984cd14d0efca4e5a7aff88344dd","src/lib.rs":"73887af023e223188f874d43ddf601784c93e9388a7adece79818d559a3366a1","src/pocket.rs":"1316668840ec9b4ea886223921dc9d3b5a1731d1a5206c0b1089f2a6c45c1b7b","src/provider.rs":"92eb1a9fa7d6814efe47fc3e7447e46bf6c0320d6fbef0d9170c46eab0e272ab","src/query.rs":"1084548b9dc0587322f08741e07db9413e9fa231166593bdbf47e562d31799a3","src/rs.rs":"0eabd6108fd1316265def15f9d232b2f70a72126019891bf4f52f5a8c6f72d1a","src/schema.rs":"8c963db3e047828c81619128430c47a4beee3a48fd5b72700f364e90dc2e96d1","src/store.rs":"36c461c7091314f336c59ea8d5f2132c21cdad44637dd7e6039b0245090ee511","src/suggest.udl":"f47c0f1021ed78118950a6830e943c9c16be22189b982a747ced930f0aec7b3a","src/suggestion.rs":"f31227779d13d1b03a622e08a417ceba4afb161885a01c2bc87a6a652b5e8be5","src/testing/client.rs":"855c14a2a5c5d9a33521c44dbb0d89f5ff531c5d125fb62d6491190c4c887df0","src/testing/data.rs":"dcd24d24997fe4f8c472f5b754a9a2b90b83e2632b4f13a77499e23441a6dea1","src/testing/mod.rs":"308c9e0f479b3d8ca6c206853842e42ce07721161f3dcc23b7018a7e4d687b03","src/yelp.rs":"bc036ff71b438d53ce8811acd8d650d83ef03faeea476f5b659b403c1e64ff2b","uniffi.toml":"f26317442ddb5b3281245bef6e60ffcb78bb95d29fe4a351a56dbb88d4ec8aab"},"package":null}
|
||||
{"files":{"Cargo.toml":"b0b1de7601bdddcd829040bb40fa686fa2f08466a30685adef380937265ff260","README.md":"5e28baf874b643d756228bdab345e287bf107d3182dfe6a18aafadcc4b9a3fc9","benches/benchmark_all.rs":"dd15df10d2561e7fdd669e86ef4343c04153682ee5a3943d1de0a54ccf577ac8","build.rs":"78780c5cccfe22c3ff4198624b9e188559c437c3e6fa1c8bb66548eee6aa66bf","src/benchmarks/README.md":"ccee8dbddba8762d0453fa855bd6984137b224b8c019f3dd8e86a3c303f51d71","src/benchmarks/client.rs":"a42eadc20572aa5c0917288971c13f73b076260c8a9ee4ca8cb94a0d7bebe5a2","src/benchmarks/ingest.rs":"6d7eaa3758de5b2c1ca3c6b20484e09c489aef14b0c101415b4f61f92259055b","src/benchmarks/mod.rs":"fe1898ba4d783213525da10d92858ee84cebfd22749bad7aeb461d338fe5504a","src/bin/debug_ingestion_sizes.rs":"ce6e810be7b3fc19e826d75b622b82cfab5a1a99397a6d0833c2c4eebff2d364","src/config.rs":"d40c6e83d8b5faa32c66110803ca9e78611d43507e9d3f1e191a93a7773c37b3","src/db.rs":"8a15aa8bd45c8a7e0a3ba664a96683060979285594ae92f6e97e9cd6ea10fdad","src/error.rs":"5209d1d6d0fd3b155e2198813db47f12e9217978c4a28086b9fe93fc738b64af","src/keyword.rs":"988d0ab021c0df19cfd3c519df7d37f606bf984cd14d0efca4e5a7aff88344dd","src/lib.rs":"73887af023e223188f874d43ddf601784c93e9388a7adece79818d559a3366a1","src/pocket.rs":"1316668840ec9b4ea886223921dc9d3b5a1731d1a5206c0b1089f2a6c45c1b7b","src/provider.rs":"b843e63f7593c9f760be1cfdcb2ccd00f31c3ec7a1c47c46dac65e8ae5f9eccc","src/query.rs":"dd492d2458349036e87236944cf887f4453ab0d225b0b99568d409e6b65036ff","src/rs.rs":"dc4eda420b848f95a0123b73c7766afa0de1a4f99b2be01748f1e2cde9c389dc","src/schema.rs":"3155c9d2092c0e50f25e153508a489c6ee0e37da50efb7bddc5c00b85df2221e","src/store.rs":"a1ac06b23349db7fe3995d8779d07c6decc7ccbccd12cbc8127e221726e09b5a","src/suggest.udl":"57465b28c5756847178189672f0090692c990841ade03e24349eb7a487775935","src/suggestion.rs":"6e3926587b08b006408d399ad2117b6b27d0ecff3668e1da2db93c089831866f","src/testing/client.rs":"ab2eb24c6e7c09847e4df5287adc00d3fe9afc68cd15a47df66c0ed4b9a389ae","src/testing/data.rs":"29e27e7cec0d28f5c53755b2defc22ebfe4c2a4e3be1b337e3532e314964c56e","src/testing/mod.rs":"03663df6a04060e7d18e5a1451cea4edba03d86e0ee7e04741f2b55f64350f06","src/yelp.rs":"bc036ff71b438d53ce8811acd8d650d83ef03faeea476f5b659b403c1e64ff2b","uniffi.toml":"f26317442ddb5b3281245bef6e60ffcb78bb95d29fe4a351a56dbb88d4ec8aab"},"package":null}
|
|
@ -55,6 +55,7 @@ version = "0.31.0"
|
|||
features = [
|
||||
"functions",
|
||||
"bundled",
|
||||
"load_extension",
|
||||
]
|
||||
|
||||
[dependencies.serde]
|
||||
|
|
|
@ -66,6 +66,11 @@ cargo doc --document-private-items --open
|
|||
|
||||
Please help us keep our documentation useful for everyone, and feel free to file bugs for anything that looks unclear or out-of-date!
|
||||
|
||||
## CLI
|
||||
|
||||
`cargo suggest` providers a simple CLI for testing the suggest code. Run `cargo suggest help` for
|
||||
usage instructions. The code that implements it is located in `examples/suggest-cli`.
|
||||
|
||||
## Tests
|
||||
|
||||
We use a technique called ["snapshot testing"](https://notlaura.com/what-is-a-snapshot-test/) with the [`expect-test`](https://docs.rs/expect-test/latest/expect_test/) crate for the Suggest component's tests. This technique makes it easier to compare and update all the expected outputs when adding, removing, and changing suggestion types.
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
use crate::{rs, Result};
|
||||
use parking_lot::Mutex;
|
||||
use remote_settings::{Client, RemoteSettingsConfig};
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// Remotes settings client that runs during the benchmark warm-up phase.
|
||||
|
@ -13,20 +12,14 @@ use std::collections::HashMap;
|
|||
/// Then it can be converted into a [RemoteSettingsBenchmarkClient], which allows benchmark code to exclude the network request time.
|
||||
/// [RemoteSettingsBenchmarkClient] implements [rs::Client] by getting data from a HashMap rather than hitting the network.
|
||||
pub struct RemoteSettingsWarmUpClient {
|
||||
client: Client,
|
||||
client: rs::RemoteSettingsClient,
|
||||
pub get_records_responses: Mutex<HashMap<rs::RecordRequest, Vec<rs::Record>>>,
|
||||
}
|
||||
|
||||
impl RemoteSettingsWarmUpClient {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
client: Client::new(RemoteSettingsConfig {
|
||||
server: None,
|
||||
server_url: None,
|
||||
bucket_name: None,
|
||||
collection_name: crate::rs::REMOTE_SETTINGS_COLLECTION.into(),
|
||||
})
|
||||
.unwrap(),
|
||||
client: rs::RemoteSettingsClient::new(None, None, None).unwrap(),
|
||||
get_records_responses: Mutex::new(HashMap::new()),
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +33,7 @@ impl Default for RemoteSettingsWarmUpClient {
|
|||
|
||||
impl rs::Client for RemoteSettingsWarmUpClient {
|
||||
fn get_records(&self, request: rs::RecordRequest) -> Result<Vec<rs::Record>> {
|
||||
let response = <Client as rs::Client>::get_records(&self.client, request.clone())?;
|
||||
let response = self.client.get_records(request.clone())?;
|
||||
self.get_records_responses
|
||||
.lock()
|
||||
.insert(request, response.clone());
|
||||
|
|
|
@ -27,6 +27,7 @@ impl IngestBenchmark {
|
|||
let temp_dir = tempfile::tempdir().unwrap();
|
||||
let store = SuggestStoreInner::new(
|
||||
temp_dir.path().join("warmup.sqlite"),
|
||||
vec![],
|
||||
RemoteSettingsWarmUpClient::new(),
|
||||
);
|
||||
store.benchmark_ingest_records_by_type(record_type);
|
||||
|
@ -52,7 +53,7 @@ impl BenchmarkWithInput for IngestBenchmark {
|
|||
"db{}.sqlite",
|
||||
DB_FILE_COUNTER.fetch_add(1, Ordering::Relaxed)
|
||||
));
|
||||
let store = SuggestStoreInner::new(data_path, self.client.clone());
|
||||
let store = SuggestStoreInner::new(data_path, vec![], self.client.clone());
|
||||
store.ensure_db_initialized();
|
||||
if self.reingest {
|
||||
store.force_reingest(self.record_type);
|
||||
|
@ -148,6 +149,7 @@ pub fn print_debug_ingestion_sizes() {
|
|||
viaduct_reqwest::use_reqwest_backend();
|
||||
let store = SuggestStoreInner::new(
|
||||
"file:debug_ingestion_sizes?mode=memory&cache=shared",
|
||||
vec![],
|
||||
RemoteSettingsWarmUpClient::new(),
|
||||
);
|
||||
store
|
||||
|
|
|
@ -22,8 +22,8 @@ use crate::{
|
|||
provider::SuggestionProvider,
|
||||
rs::{
|
||||
DownloadedAmoSuggestion, DownloadedAmpSuggestion, DownloadedAmpWikipediaSuggestion,
|
||||
DownloadedMdnSuggestion, DownloadedPocketSuggestion, DownloadedWeatherData,
|
||||
DownloadedWikipediaSuggestion, Record, SuggestRecordId,
|
||||
DownloadedFakespotSuggestion, DownloadedMdnSuggestion, DownloadedPocketSuggestion,
|
||||
DownloadedWeatherData, DownloadedWikipediaSuggestion, Record, SuggestRecordId,
|
||||
},
|
||||
schema::{clear_database, SuggestConnectionInitializer},
|
||||
suggestion::{cook_raw_suggestion_url, AmpSuggestionType, Suggestion},
|
||||
|
@ -66,6 +66,12 @@ impl From<ConnectionType> for OpenFlags {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
pub struct Sqlite3Extension {
|
||||
pub library: String,
|
||||
pub entry_point: Option<String>,
|
||||
}
|
||||
|
||||
/// A thread-safe wrapper around an SQLite connection to the Suggest database,
|
||||
/// and its interrupt handle.
|
||||
pub(crate) struct SuggestDb {
|
||||
|
@ -82,8 +88,16 @@ pub(crate) struct SuggestDb {
|
|||
impl SuggestDb {
|
||||
/// Opens a read-only or read-write connection to a Suggest database at the
|
||||
/// given path.
|
||||
pub fn open(path: impl AsRef<Path>, type_: ConnectionType) -> Result<Self> {
|
||||
let conn = open_database_with_flags(path, type_.into(), &SuggestConnectionInitializer)?;
|
||||
pub fn open(
|
||||
path: impl AsRef<Path>,
|
||||
extensions_to_load: &[Sqlite3Extension],
|
||||
type_: ConnectionType,
|
||||
) -> Result<Self> {
|
||||
let conn = open_database_with_flags(
|
||||
path,
|
||||
type_.into(),
|
||||
&SuggestConnectionInitializer::new(extensions_to_load),
|
||||
)?;
|
||||
Ok(Self::with_connection(conn))
|
||||
}
|
||||
|
||||
|
@ -169,22 +183,14 @@ impl<'a> SuggestDao<'a> {
|
|||
//
|
||||
// These methods combine several low-level calls into one logical operation.
|
||||
|
||||
pub fn handle_ingested_record(&mut self, last_ingest_key: &str, record: &Record) -> Result<()> {
|
||||
// Advance the last fetch time, so that we can resume
|
||||
// fetching after this record if we're interrupted.
|
||||
self.put_last_ingest_if_newer(last_ingest_key, record.last_modified)
|
||||
}
|
||||
|
||||
pub fn handle_deleted_record(&mut self, last_ingest_key: &str, record: &Record) -> Result<()> {
|
||||
pub fn delete_record_data(&mut self, record: &Record) -> Result<()> {
|
||||
let record_id = SuggestRecordId::from(&record.id);
|
||||
// Drop either the icon or suggestions, records only contain one or the other
|
||||
match record_id.as_icon_id() {
|
||||
Some(icon_id) => self.drop_icon(icon_id)?,
|
||||
None => self.drop_suggestions(&record_id)?,
|
||||
};
|
||||
// Advance the last fetch time, so that we can resume
|
||||
// fetching after this record if we're interrupted.
|
||||
self.put_last_ingest_if_newer(last_ingest_key, record.last_modified)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// =============== Low level API ===============
|
||||
|
@ -216,6 +222,7 @@ impl<'a> SuggestDao<'a> {
|
|||
SuggestionProvider::Yelp => self.fetch_yelp_suggestions(query),
|
||||
SuggestionProvider::Mdn => self.fetch_mdn_suggestions(query),
|
||||
SuggestionProvider::Weather => self.fetch_weather_suggestions(query),
|
||||
SuggestionProvider::Fakespot => self.fetch_fakespot_suggestions(query),
|
||||
}?;
|
||||
acc.extend(suggestions);
|
||||
Ok(acc)
|
||||
|
@ -672,6 +679,53 @@ impl<'a> SuggestDao<'a> {
|
|||
Ok(suggestions)
|
||||
}
|
||||
|
||||
/// Fetches fakespot suggestions
|
||||
pub fn fetch_fakespot_suggestions(&self, query: &SuggestionQuery) -> Result<Vec<Suggestion>> {
|
||||
self.conn.query_rows_and_then_cached(
|
||||
r#"
|
||||
SELECT
|
||||
s.title,
|
||||
s.url,
|
||||
s.score,
|
||||
f.fakespot_grade,
|
||||
f.product_id,
|
||||
f.rating,
|
||||
f.total_reviews,
|
||||
i.data,
|
||||
i.mimetype
|
||||
FROM
|
||||
suggestions s
|
||||
JOIN
|
||||
fakespot_fts fts
|
||||
ON fts.rowid = s.id
|
||||
JOIN
|
||||
fakespot_custom_details f
|
||||
ON f.suggestion_id = s.id
|
||||
LEFT JOIN
|
||||
icons i
|
||||
ON i.id = f.icon_id
|
||||
WHERE
|
||||
fakespot_fts MATCH ?
|
||||
ORDER BY
|
||||
s.score DESC
|
||||
"#,
|
||||
(&query.fts_query(),),
|
||||
|row| {
|
||||
Ok(Suggestion::Fakespot {
|
||||
title: row.get(0)?,
|
||||
url: row.get(1)?,
|
||||
score: row.get(2)?,
|
||||
fakespot_grade: row.get(3)?,
|
||||
product_id: row.get(4)?,
|
||||
rating: row.get(5)?,
|
||||
total_reviews: row.get(6)?,
|
||||
icon: row.get(7)?,
|
||||
icon_mimetype: row.get(8)?,
|
||||
})
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
/// Inserts all suggestions from a downloaded AMO attachment into
|
||||
/// the database.
|
||||
pub fn insert_amo_suggestions(
|
||||
|
@ -878,6 +932,27 @@ impl<'a> SuggestDao<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Inserts all suggestions from a downloaded Fakespot attachment into the database.
|
||||
pub fn insert_fakespot_suggestions(
|
||||
&mut self,
|
||||
record_id: &SuggestRecordId,
|
||||
suggestions: &[DownloadedFakespotSuggestion],
|
||||
) -> Result<()> {
|
||||
let mut suggestion_insert = SuggestionInsertStatement::new(self.conn)?;
|
||||
let mut fakespot_insert = FakespotInsertStatement::new(self.conn)?;
|
||||
for suggestion in suggestions {
|
||||
let suggestion_id = suggestion_insert.execute(
|
||||
record_id,
|
||||
&suggestion.title,
|
||||
&suggestion.url,
|
||||
suggestion.score,
|
||||
SuggestionProvider::Fakespot,
|
||||
)?;
|
||||
fakespot_insert.execute(suggestion_id, suggestion)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Inserts weather record data into the database.
|
||||
pub fn insert_weather_data(
|
||||
&mut self,
|
||||
|
@ -945,34 +1020,53 @@ impl<'a> SuggestDao<'a> {
|
|||
/// Deletes all suggestions associated with a Remote Settings record from
|
||||
/// the database.
|
||||
pub fn drop_suggestions(&mut self, record_id: &SuggestRecordId) -> Result<()> {
|
||||
// Call `err_if_interrupted` before each statement since these have historically taken a
|
||||
// long time and caused shutdown hangs.
|
||||
|
||||
self.scope.err_if_interrupted()?;
|
||||
self.conn.execute_cached(
|
||||
"DELETE FROM keywords WHERE suggestion_id IN (SELECT id from suggestions WHERE record_id = :record_id)",
|
||||
named_params! { ":record_id": record_id.as_str() },
|
||||
)?;
|
||||
self.scope.err_if_interrupted()?;
|
||||
self.conn.execute_cached(
|
||||
"DELETE FROM full_keywords WHERE suggestion_id IN (SELECT id from suggestions WHERE record_id = :record_id)",
|
||||
named_params! { ":record_id": record_id.as_str() },
|
||||
)?;
|
||||
self.scope.err_if_interrupted()?;
|
||||
self.conn.execute_cached(
|
||||
"DELETE FROM prefix_keywords WHERE suggestion_id IN (SELECT id from suggestions WHERE record_id = :record_id)",
|
||||
named_params! { ":record_id": record_id.as_str() },
|
||||
)?;
|
||||
self.scope.err_if_interrupted()?;
|
||||
self.conn.execute_cached(
|
||||
"
|
||||
DELETE FROM fakespot_fts
|
||||
WHERE rowid IN (SELECT id from suggestions WHERE record_id = :record_id)
|
||||
",
|
||||
named_params! { ":record_id": record_id.as_str() },
|
||||
)?;
|
||||
self.scope.err_if_interrupted()?;
|
||||
self.conn.execute_cached(
|
||||
"DELETE FROM suggestions WHERE record_id = :record_id",
|
||||
named_params! { ":record_id": record_id.as_str() },
|
||||
)?;
|
||||
self.scope.err_if_interrupted()?;
|
||||
self.conn.execute_cached(
|
||||
"DELETE FROM yelp_subjects WHERE record_id = :record_id",
|
||||
named_params! { ":record_id": record_id.as_str() },
|
||||
)?;
|
||||
self.scope.err_if_interrupted()?;
|
||||
self.conn.execute_cached(
|
||||
"DELETE FROM yelp_modifiers WHERE record_id = :record_id",
|
||||
named_params! { ":record_id": record_id.as_str() },
|
||||
)?;
|
||||
self.scope.err_if_interrupted()?;
|
||||
self.conn.execute_cached(
|
||||
"DELETE FROM yelp_location_signs WHERE record_id = :record_id",
|
||||
named_params! { ":record_id": record_id.as_str() },
|
||||
)?;
|
||||
self.scope.err_if_interrupted()?;
|
||||
self.conn.execute_cached(
|
||||
"DELETE FROM yelp_custom_details WHERE record_id = :record_id",
|
||||
named_params! { ":record_id": record_id.as_str() },
|
||||
|
@ -1288,6 +1382,47 @@ impl<'conn> MdnInsertStatement<'conn> {
|
|||
}
|
||||
}
|
||||
|
||||
struct FakespotInsertStatement<'conn>(rusqlite::Statement<'conn>);
|
||||
|
||||
impl<'conn> FakespotInsertStatement<'conn> {
|
||||
fn new(conn: &'conn Connection) -> Result<Self> {
|
||||
Ok(Self(conn.prepare(
|
||||
"INSERT INTO fakespot_custom_details(
|
||||
suggestion_id,
|
||||
fakespot_grade,
|
||||
product_id,
|
||||
rating,
|
||||
total_reviews,
|
||||
icon_id
|
||||
)
|
||||
VALUES(?, ?, ?, ?, ?, ?)
|
||||
",
|
||||
)?))
|
||||
}
|
||||
|
||||
fn execute(
|
||||
&mut self,
|
||||
suggestion_id: i64,
|
||||
fakespot: &DownloadedFakespotSuggestion,
|
||||
) -> Result<()> {
|
||||
let icon_id = fakespot
|
||||
.product_id
|
||||
.split_once('-')
|
||||
.map(|(vendor, _)| format!("fakespot-{vendor}"));
|
||||
self.0
|
||||
.execute((
|
||||
suggestion_id,
|
||||
&fakespot.fakespot_grade,
|
||||
&fakespot.product_id,
|
||||
fakespot.rating,
|
||||
fakespot.total_reviews,
|
||||
icon_id,
|
||||
))
|
||||
.with_context("fakespot insert")?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
struct KeywordInsertStatement<'conn>(rusqlite::Statement<'conn>);
|
||||
|
||||
impl<'conn> KeywordInsertStatement<'conn> {
|
||||
|
|
|
@ -22,6 +22,7 @@ pub enum SuggestionProvider {
|
|||
Mdn = 6,
|
||||
Weather = 7,
|
||||
AmpMobile = 8,
|
||||
Fakespot = 9,
|
||||
}
|
||||
|
||||
impl FromSql for SuggestionProvider {
|
||||
|
@ -35,7 +36,7 @@ impl FromSql for SuggestionProvider {
|
|||
}
|
||||
|
||||
impl SuggestionProvider {
|
||||
pub fn all() -> [Self; 8] {
|
||||
pub fn all() -> [Self; 9] {
|
||||
[
|
||||
Self::Amp,
|
||||
Self::Wikipedia,
|
||||
|
@ -45,6 +46,7 @@ impl SuggestionProvider {
|
|||
Self::Mdn,
|
||||
Self::Weather,
|
||||
Self::AmpMobile,
|
||||
Self::Fakespot,
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -58,6 +60,8 @@ impl SuggestionProvider {
|
|||
5 => Some(SuggestionProvider::Yelp),
|
||||
6 => Some(SuggestionProvider::Mdn),
|
||||
7 => Some(SuggestionProvider::Weather),
|
||||
8 => Some(SuggestionProvider::AmpMobile),
|
||||
9 => Some(SuggestionProvider::Fakespot),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +109,9 @@ impl SuggestionProvider {
|
|||
SuggestRecordType::GlobalConfig,
|
||||
]
|
||||
}
|
||||
SuggestionProvider::Fakespot => {
|
||||
vec![SuggestRecordType::Fakespot]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ pub struct SuggestionQuery {
|
|||
}
|
||||
|
||||
impl SuggestionQuery {
|
||||
// Builder style methods for creating queries (mostly used by the test code)
|
||||
|
||||
pub fn all_providers(keyword: &str) -> Self {
|
||||
Self {
|
||||
keyword: keyword.to_string(),
|
||||
|
@ -95,6 +97,14 @@ impl SuggestionQuery {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn fakespot(keyword: &str) -> Self {
|
||||
Self {
|
||||
keyword: keyword.into(),
|
||||
providers: vec![SuggestionProvider::Fakespot],
|
||||
limit: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn weather(keyword: &str) -> Self {
|
||||
Self {
|
||||
keyword: keyword.into(),
|
||||
|
@ -109,4 +119,96 @@ impl SuggestionQuery {
|
|||
..self
|
||||
}
|
||||
}
|
||||
|
||||
// Other Functionality
|
||||
|
||||
/// Parse the `keyword` field into a set of keywords.
|
||||
///
|
||||
/// This is used when passing the keywords into an FTS search. It:
|
||||
/// - Strips out any `():^*"` chars. These are typically used for advanced searches, which
|
||||
/// we don't support and it would be weird to only support for FTS searches, which
|
||||
/// currently means Fakespot searches.
|
||||
/// - Splits on whitespace to get a list of individual keywords
|
||||
///
|
||||
pub(crate) fn parse_keywords(&self) -> Vec<&str> {
|
||||
self.keyword
|
||||
.split([' ', '(', ')', ':', '^', '*', '"'])
|
||||
.filter(|s| !s.is_empty())
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Create an FTS query term for our keyword(s)
|
||||
pub(crate) fn fts_query(&self) -> String {
|
||||
let keywords = self.parse_keywords();
|
||||
if keywords.is_empty() {
|
||||
return String::from(r#""""#);
|
||||
}
|
||||
// Quote each term from `query` and join them together
|
||||
let mut fts_query = keywords
|
||||
.iter()
|
||||
.map(|keyword| format!(r#""{keyword}""#))
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
// If the input is > 3 characters, and there's no whitespace at the end.
|
||||
// We want to append a `*` char to the end to do a prefix match on it.
|
||||
let total_chars = keywords.iter().fold(0, |count, s| count + s.len());
|
||||
let query_ends_in_whitespace = self.keyword.ends_with(' ');
|
||||
if (total_chars > 3) && !query_ends_in_whitespace {
|
||||
fts_query.push('*');
|
||||
}
|
||||
fts_query
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
fn check_parse_keywords(input: &str, expected: Vec<&str>) {
|
||||
let query = SuggestionQuery::all_providers(input);
|
||||
assert_eq!(query.parse_keywords(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_quote() {
|
||||
check_parse_keywords("foo", vec!["foo"]);
|
||||
check_parse_keywords("foo bar", vec!["foo", "bar"]);
|
||||
// Special chars should be stripped
|
||||
check_parse_keywords("\"foo()* ^bar:\"", vec!["foo", "bar"]);
|
||||
// test some corner cases
|
||||
check_parse_keywords("", vec![]);
|
||||
check_parse_keywords(" ", vec![]);
|
||||
check_parse_keywords(" foo bar ", vec!["foo", "bar"]);
|
||||
check_parse_keywords("foo:bar", vec!["foo", "bar"]);
|
||||
}
|
||||
|
||||
fn check_fts_query(input: &str, expected: &str) {
|
||||
let query = SuggestionQuery::all_providers(input);
|
||||
assert_eq!(query.fts_query(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_fts_query() {
|
||||
// String with < 3 chars shouldn't get a prefix query
|
||||
check_fts_query("r", r#""r""#);
|
||||
check_fts_query("ru", r#""ru""#);
|
||||
check_fts_query("run", r#""run""#);
|
||||
// After 3 chars, we should append `*` to the last term to make it a prefix query
|
||||
check_fts_query("runn", r#""runn"*"#);
|
||||
check_fts_query("running", r#""running"*"#);
|
||||
// The total number of chars is counted, not the number of chars in the last term
|
||||
check_fts_query("running s", r#""running" "s"*"#);
|
||||
// if the input ends in whitespace, then don't do a prefix query
|
||||
check_fts_query("running ", r#""running""#);
|
||||
// Special chars are filtered out
|
||||
check_fts_query("running*\"()^: s", r#""running" "s"*"#);
|
||||
check_fts_query("running *\"()^: s", r#""running" "s"*"#);
|
||||
// Special chars shouldn't count towards the input size when deciding whether to do a
|
||||
// prefix query or not
|
||||
check_fts_query("r():", r#""r""#);
|
||||
// Test empty strings
|
||||
check_fts_query("", r#""""#);
|
||||
check_fts_query(" ", r#""""#);
|
||||
check_fts_query("()", r#""""#);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,9 +38,6 @@ use serde::{Deserialize, Deserializer};
|
|||
|
||||
use crate::{error::Error, provider::SuggestionProvider, Result};
|
||||
|
||||
/// The Suggest Remote Settings collection name.
|
||||
pub(crate) const REMOTE_SETTINGS_COLLECTION: &str = "quicksuggest";
|
||||
|
||||
/// The maximum number of suggestions in a Suggest record's attachment.
|
||||
///
|
||||
/// This should be the same as the `BUCKET_SIZE` constant in the
|
||||
|
@ -48,7 +45,9 @@ pub(crate) const REMOTE_SETTINGS_COLLECTION: &str = "quicksuggest";
|
|||
pub(crate) const SUGGESTIONS_PER_ATTACHMENT: u64 = 200;
|
||||
|
||||
/// A list of default record types to download if nothing is specified.
|
||||
/// This currently defaults to all of the record types.
|
||||
/// This defaults to all record types available as-of Fx128.
|
||||
/// Consumers should specify provider types in `SuggestIngestionConstraints` if they want a
|
||||
/// different set.
|
||||
pub(crate) const DEFAULT_RECORDS_TYPES: [SuggestRecordType; 9] = [
|
||||
SuggestRecordType::Icon,
|
||||
SuggestRecordType::AmpWikipedia,
|
||||
|
@ -69,17 +68,58 @@ pub(crate) trait Client {
|
|||
fn get_records(&self, request: RecordRequest) -> Result<Vec<Record>>;
|
||||
}
|
||||
|
||||
impl Client for remote_settings::Client {
|
||||
/// Implements the [Client] trait using a real remote settings client
|
||||
pub struct RemoteSettingsClient {
|
||||
// Create a separate client for each collection name
|
||||
quicksuggest_client: remote_settings::Client,
|
||||
fakespot_client: remote_settings::Client,
|
||||
}
|
||||
|
||||
impl RemoteSettingsClient {
|
||||
pub fn new(
|
||||
server: Option<remote_settings::RemoteSettingsServer>,
|
||||
bucket_name: Option<String>,
|
||||
server_url: Option<String>,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
quicksuggest_client: remote_settings::Client::new(
|
||||
remote_settings::RemoteSettingsConfig {
|
||||
server: server.clone(),
|
||||
bucket_name: bucket_name.clone(),
|
||||
collection_name: "quicksuggest".to_owned(),
|
||||
server_url: server_url.clone(),
|
||||
},
|
||||
)?,
|
||||
fakespot_client: remote_settings::Client::new(remote_settings::RemoteSettingsConfig {
|
||||
server,
|
||||
bucket_name,
|
||||
collection_name: "fakespot-suggest-products".to_owned(),
|
||||
server_url,
|
||||
})?,
|
||||
})
|
||||
}
|
||||
|
||||
fn client_for_record_type(&self, record_type: &str) -> &remote_settings::Client {
|
||||
match record_type {
|
||||
"fakespot-suggestions" => &self.fakespot_client,
|
||||
_ => &self.quicksuggest_client,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Client for RemoteSettingsClient {
|
||||
fn get_records(&self, request: RecordRequest) -> Result<Vec<Record>> {
|
||||
let client = self.client_for_record_type(request.record_type.as_str());
|
||||
let options = request.into();
|
||||
self.get_records_with_options(&options)?
|
||||
client
|
||||
.get_records_with_options(&options)?
|
||||
.records
|
||||
.into_iter()
|
||||
.map(|record| {
|
||||
let attachment_data = record
|
||||
.attachment
|
||||
.as_ref()
|
||||
.map(|a| self.get_attachment(&a.location))
|
||||
.map(|a| client.get_attachment(&a.location))
|
||||
.transpose()?;
|
||||
Ok(Record::new(record, attachment_data))
|
||||
})
|
||||
|
@ -89,7 +129,7 @@ impl Client for remote_settings::Client {
|
|||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub struct RecordRequest {
|
||||
pub record_type: Option<String>,
|
||||
pub record_type: String,
|
||||
pub last_modified: Option<u64>,
|
||||
pub limit: Option<u64>,
|
||||
}
|
||||
|
@ -103,9 +143,7 @@ impl From<RecordRequest> for GetItemsOptions {
|
|||
// so that we can eventually resume downloading where we left off.
|
||||
options.sort("last_modified", SortOrder::Ascending);
|
||||
|
||||
if let Some(record_type) = value.record_type {
|
||||
options.filter_eq("type", record_type);
|
||||
}
|
||||
options.filter_eq("type", value.record_type);
|
||||
|
||||
if let Some(last_modified) = value.last_modified {
|
||||
options.filter_gt("last_modified", last_modified.to_string());
|
||||
|
@ -180,6 +218,8 @@ pub(crate) enum SuggestRecord {
|
|||
GlobalConfig(DownloadedGlobalConfig),
|
||||
#[serde(rename = "amp-mobile-suggestions")]
|
||||
AmpMobile,
|
||||
#[serde(rename = "fakespot-suggestions")]
|
||||
Fakespot,
|
||||
}
|
||||
|
||||
/// Enum for the different record types that can be consumed.
|
||||
|
@ -196,6 +236,7 @@ pub enum SuggestRecordType {
|
|||
Weather,
|
||||
GlobalConfig,
|
||||
AmpMobile,
|
||||
Fakespot,
|
||||
}
|
||||
|
||||
impl From<SuggestRecord> for SuggestRecordType {
|
||||
|
@ -210,6 +251,7 @@ impl From<SuggestRecord> for SuggestRecordType {
|
|||
SuggestRecord::Yelp => Self::Yelp,
|
||||
SuggestRecord::GlobalConfig(_) => Self::GlobalConfig,
|
||||
SuggestRecord::AmpMobile => Self::AmpMobile,
|
||||
SuggestRecord::Fakespot => Self::Fakespot,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,6 +268,7 @@ impl fmt::Display for SuggestRecordType {
|
|||
Self::Weather => write!(f, "weather"),
|
||||
Self::GlobalConfig => write!(f, "configuration"),
|
||||
Self::AmpMobile => write!(f, "amp-mobile-suggestions"),
|
||||
Self::Fakespot => write!(f, "fakespot-suggestions"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -476,6 +519,18 @@ pub(crate) struct DownloadedMdnSuggestion {
|
|||
pub score: f64,
|
||||
}
|
||||
|
||||
/// A Fakespot suggestion to ingest from an attachment
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub(crate) struct DownloadedFakespotSuggestion {
|
||||
pub fakespot_grade: String,
|
||||
pub product_id: String,
|
||||
pub rating: f64,
|
||||
pub score: f64,
|
||||
pub title: String,
|
||||
pub total_reviews: i64,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
/// Weather data to ingest from a weather record
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub(crate) struct DownloadedWeatherData {
|
||||
|
|
|
@ -3,8 +3,12 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
use crate::db::Sqlite3Extension;
|
||||
use rusqlite::{Connection, Transaction};
|
||||
use sql_support::open_database::{self, ConnectionInitializer};
|
||||
use sql_support::{
|
||||
open_database::{self, ConnectionInitializer},
|
||||
ConnExt,
|
||||
};
|
||||
|
||||
/// The current database schema version.
|
||||
///
|
||||
|
@ -15,7 +19,7 @@ use sql_support::open_database::{self, ConnectionInitializer};
|
|||
/// [`SuggestConnectionInitializer::upgrade_from`].
|
||||
/// a. If suggestions should be re-ingested after the migration, call `clear_database()` inside
|
||||
/// the migration.
|
||||
pub const VERSION: u32 = 20;
|
||||
pub const VERSION: u32 = 22;
|
||||
|
||||
/// The current Suggest database schema.
|
||||
pub const SQL: &str = "
|
||||
|
@ -85,6 +89,36 @@ CREATE TABLE amo_custom_details(
|
|||
FOREIGN KEY(suggestion_id) REFERENCES suggestions(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE fakespot_custom_details(
|
||||
suggestion_id INTEGER PRIMARY KEY,
|
||||
fakespot_grade TEXT NOT NULL,
|
||||
product_id TEXT NOT NULL,
|
||||
rating REAL NOT NULL,
|
||||
total_reviews INTEGER NOT NULL,
|
||||
icon_id TEXT,
|
||||
FOREIGN KEY(suggestion_id) REFERENCES suggestions(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE VIRTUAL TABLE IF NOT EXISTS fakespot_fts USING FTS5(
|
||||
title,
|
||||
prefix='4 5 6 7 8 9 10 11',
|
||||
content='',
|
||||
contentless_delete=1,
|
||||
tokenize=\"porter unicode61 remove_diacritics 2 tokenchars '''-'\"
|
||||
);
|
||||
|
||||
CREATE TRIGGER fakespot_ai AFTER INSERT ON fakespot_custom_details BEGIN
|
||||
INSERT INTO fakespot_fts(rowid, title)
|
||||
SELECT id, title
|
||||
FROM suggestions
|
||||
WHERE id = new.suggestion_id;
|
||||
END;
|
||||
|
||||
-- DELETE/UPDATE triggers are difficult to implement, since the FTS contents are split between the fakespot_custom_details and suggestions tables.
|
||||
-- If you use an AFTER trigger, then the data from the other table has already been deleted.
|
||||
-- BEFORE triggers are discouraged by the SQLite docs.
|
||||
-- Instead, the drop_suggestions function handles updating the FTS data.
|
||||
|
||||
CREATE INDEX suggestions_record_id ON suggestions(record_id);
|
||||
|
||||
CREATE TABLE icons(
|
||||
|
@ -130,13 +164,35 @@ CREATE TABLE dismissed_suggestions (
|
|||
|
||||
/// Initializes an SQLite connection to the Suggest database, performing
|
||||
/// migrations as needed.
|
||||
pub struct SuggestConnectionInitializer;
|
||||
#[derive(Default)]
|
||||
pub struct SuggestConnectionInitializer<'a> {
|
||||
extensions_to_load: &'a [Sqlite3Extension],
|
||||
}
|
||||
|
||||
impl ConnectionInitializer for SuggestConnectionInitializer {
|
||||
impl<'a> SuggestConnectionInitializer<'a> {
|
||||
pub fn new(extensions_to_load: &'a [Sqlite3Extension]) -> Self {
|
||||
Self { extensions_to_load }
|
||||
}
|
||||
|
||||
pub fn load_extensions(&self, conn: &Connection) -> open_database::Result<()> {
|
||||
// Safety: this relies on the extensions we're loading to operate correctly, for the
|
||||
// entry point to be correct, etc.
|
||||
unsafe {
|
||||
let _guard = rusqlite::LoadExtensionGuard::new(conn)?;
|
||||
for ext in self.extensions_to_load {
|
||||
conn.load_extension(&ext.library, ext.entry_point.as_deref())?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl ConnectionInitializer for SuggestConnectionInitializer<'_> {
|
||||
const NAME: &'static str = "suggest db";
|
||||
const END_VERSION: u32 = VERSION;
|
||||
|
||||
fn prepare(&self, conn: &Connection, _db_empty: bool) -> open_database::Result<()> {
|
||||
self.load_extensions(conn)?;
|
||||
let initial_pragmas = "
|
||||
-- Use in-memory storage for TEMP tables.
|
||||
PRAGMA temp_store = 2;
|
||||
|
@ -151,7 +207,8 @@ impl ConnectionInitializer for SuggestConnectionInitializer {
|
|||
}
|
||||
|
||||
fn init(&self, db: &Transaction<'_>) -> open_database::Result<()> {
|
||||
Ok(db.execute_batch(SQL)?)
|
||||
db.execute_batch(SQL)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn upgrade_from(&self, tx: &Transaction<'_>, version: u32) -> open_database::Result<()> {
|
||||
|
@ -227,6 +284,68 @@ CREATE UNIQUE INDEX keywords_suggestion_id_rank ON keywords(suggestion_id, rank)
|
|||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Migration for the fakespot data. This is not currently active for any users, it's
|
||||
// only used for the tests. It's safe to alter the fakespot_custom_detail schema and
|
||||
// update this migration as the project moves forward.
|
||||
//
|
||||
// Note: if we want to add a regular migration while the fakespot code is still behind
|
||||
// a feature flag, insert it before this one and make fakespot the last migration.
|
||||
20 => {
|
||||
tx.execute_batch(
|
||||
"
|
||||
CREATE TABLE fakespot_custom_details(
|
||||
suggestion_id INTEGER PRIMARY KEY,
|
||||
fakespot_grade TEXT NOT NULL,
|
||||
product_id TEXT NOT NULL,
|
||||
rating REAL NOT NULL,
|
||||
total_reviews INTEGER NOT NULL,
|
||||
FOREIGN KEY(suggestion_id) REFERENCES suggestions(id) ON DELETE CASCADE
|
||||
);
|
||||
-- Create the Fakespot FTS table.
|
||||
-- The `tokenize` param is hard to read. The effect is that dashes and apostrophes are
|
||||
-- considered valid tokens in a word, rather than separators.
|
||||
CREATE VIRTUAL TABLE IF NOT EXISTS fakespot_fts USING FTS5(
|
||||
title,
|
||||
prefix='4 5 6 7 8 9 10 11',
|
||||
content='',
|
||||
contentless_delete=1,
|
||||
tokenize=\"porter unicode61 remove_diacritics 2 tokenchars '''-'\"
|
||||
);
|
||||
CREATE TRIGGER fakespot_ai AFTER INSERT ON fakespot_custom_details BEGIN
|
||||
INSERT INTO fakespot_fts(rowid, title)
|
||||
SELECT id, title
|
||||
FROM suggestions
|
||||
WHERE id = new.suggestion_id;
|
||||
END;
|
||||
",
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
21 => {
|
||||
// Drop and re-create the fakespot_custom_details to add the icon_id column.
|
||||
tx.execute_batch(
|
||||
"
|
||||
DROP TABLE fakespot_custom_details;
|
||||
CREATE TABLE fakespot_custom_details(
|
||||
suggestion_id INTEGER PRIMARY KEY,
|
||||
fakespot_grade TEXT NOT NULL,
|
||||
product_id TEXT NOT NULL,
|
||||
rating REAL NOT NULL,
|
||||
total_reviews INTEGER NOT NULL,
|
||||
icon_id TEXT,
|
||||
FOREIGN KEY(suggestion_id) REFERENCES suggestions(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE TRIGGER fakespot_ai AFTER INSERT ON fakespot_custom_details BEGIN
|
||||
INSERT INTO fakespot_fts(rowid, title)
|
||||
SELECT id, title
|
||||
FROM suggestions
|
||||
WHERE id = new.suggestion_id;
|
||||
END;
|
||||
",
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
_ => Err(open_database::Error::IncompatibleVersion(version)),
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +366,13 @@ pub fn clear_database(db: &Connection) -> rusqlite::Result<()> {
|
|||
DELETE FROM yelp_location_signs;
|
||||
DELETE FROM yelp_custom_details;
|
||||
",
|
||||
)
|
||||
)?;
|
||||
let table_exists: bool =
|
||||
db.query_one("SELECT EXISTS (SELECT 1 FROM sqlite_master WHERE name = 'fakespot_fts')")?;
|
||||
if table_exists {
|
||||
db.execute("DELETE FROM fakespot_fts", ())?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -372,7 +497,8 @@ PRAGMA user_version=16;
|
|||
/// If an upgrade fails, then this test will fail with a panic.
|
||||
#[test]
|
||||
fn test_all_upgrades() {
|
||||
let db_file = MigratedDatabaseFile::new(SuggestConnectionInitializer, V16_SCHEMA);
|
||||
let db_file =
|
||||
MigratedDatabaseFile::new(SuggestConnectionInitializer::default(), V16_SCHEMA);
|
||||
db_file.run_all_upgrades();
|
||||
db_file.assert_schema_matches_new_database();
|
||||
}
|
||||
|
|
|
@ -18,12 +18,12 @@ use serde::de::DeserializeOwned;
|
|||
|
||||
use crate::{
|
||||
config::{SuggestGlobalConfig, SuggestProviderConfig},
|
||||
db::{ConnectionType, SuggestDao, SuggestDb},
|
||||
db::{ConnectionType, Sqlite3Extension, SuggestDao, SuggestDb},
|
||||
error::Error,
|
||||
provider::SuggestionProvider,
|
||||
rs::{
|
||||
Client, Record, RecordRequest, SuggestAttachment, SuggestRecord, SuggestRecordId,
|
||||
SuggestRecordType, DEFAULT_RECORDS_TYPES, REMOTE_SETTINGS_COLLECTION,
|
||||
Client, Record, RecordRequest, RemoteSettingsClient, SuggestAttachment, SuggestRecord,
|
||||
SuggestRecordId, SuggestRecordType, DEFAULT_RECORDS_TYPES,
|
||||
},
|
||||
Result, SuggestApiResult, Suggestion, SuggestionQuery,
|
||||
};
|
||||
|
@ -39,6 +39,7 @@ struct SuggestStoreBuilderInner {
|
|||
data_path: Option<String>,
|
||||
remote_settings_server: Option<RemoteSettingsServer>,
|
||||
remote_settings_bucket_name: Option<String>,
|
||||
extensions_to_load: Vec<Sqlite3Extension>,
|
||||
}
|
||||
|
||||
impl Default for SuggestStoreBuilder {
|
||||
|
@ -72,23 +73,35 @@ impl SuggestStoreBuilder {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn load_extension(
|
||||
self: Arc<Self>,
|
||||
library: String,
|
||||
entry_point: Option<String>,
|
||||
) -> Arc<Self> {
|
||||
self.0.lock().extensions_to_load.push(Sqlite3Extension {
|
||||
library,
|
||||
entry_point,
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[handle_error(Error)]
|
||||
pub fn build(&self) -> SuggestApiResult<Arc<SuggestStore>> {
|
||||
let inner = self.0.lock();
|
||||
let extensions_to_load = inner.extensions_to_load.clone();
|
||||
let data_path = inner
|
||||
.data_path
|
||||
.clone()
|
||||
.ok_or_else(|| Error::SuggestStoreBuilder("data_path not specified".to_owned()))?;
|
||||
|
||||
let remote_settings_config = RemoteSettingsConfig {
|
||||
server: inner.remote_settings_server.clone(),
|
||||
bucket_name: inner.remote_settings_bucket_name.clone(),
|
||||
server_url: None,
|
||||
collection_name: REMOTE_SETTINGS_COLLECTION.into(),
|
||||
};
|
||||
let settings_client = remote_settings::Client::new(remote_settings_config)?;
|
||||
let client = RemoteSettingsClient::new(
|
||||
inner.remote_settings_server.clone(),
|
||||
inner.remote_settings_bucket_name.clone(),
|
||||
None,
|
||||
)?;
|
||||
|
||||
Ok(Arc::new(SuggestStore {
|
||||
inner: SuggestStoreInner::new(data_path, settings_client),
|
||||
inner: SuggestStoreInner::new(data_path, extensions_to_load, client),
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +147,7 @@ pub enum InterruptKind {
|
|||
/// later, while a desktop on a fast link might download the entire dataset
|
||||
/// on the first launch.
|
||||
pub struct SuggestStore {
|
||||
inner: SuggestStoreInner<remote_settings::Client>,
|
||||
inner: SuggestStoreInner<RemoteSettingsClient>,
|
||||
}
|
||||
|
||||
impl SuggestStore {
|
||||
|
@ -144,18 +157,20 @@ impl SuggestStore {
|
|||
path: &str,
|
||||
settings_config: Option<RemoteSettingsConfig>,
|
||||
) -> SuggestApiResult<Self> {
|
||||
let settings_client = || -> Result<_> {
|
||||
Ok(remote_settings::Client::new(
|
||||
settings_config.unwrap_or_else(|| RemoteSettingsConfig {
|
||||
server: None,
|
||||
server_url: None,
|
||||
bucket_name: None,
|
||||
collection_name: REMOTE_SETTINGS_COLLECTION.into(),
|
||||
}),
|
||||
)?)
|
||||
}()?;
|
||||
let client = match settings_config {
|
||||
Some(settings_config) => RemoteSettingsClient::new(
|
||||
settings_config.server,
|
||||
settings_config.bucket_name,
|
||||
settings_config.server_url,
|
||||
// Note: collection name is ignored, since we fetch from multiple collections
|
||||
// (fakespot-suggest-products and quicksuggest). No consumer sets it to a
|
||||
// non-default value anyways.
|
||||
)?,
|
||||
None => RemoteSettingsClient::new(None, None, None)?,
|
||||
};
|
||||
|
||||
Ok(Self {
|
||||
inner: SuggestStoreInner::new(path.to_owned(), settings_client),
|
||||
inner: SuggestStoreInner::new(path.to_owned(), vec![], client),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -232,6 +247,25 @@ pub struct SuggestIngestionConstraints {
|
|||
pub empty_only: bool,
|
||||
}
|
||||
|
||||
impl SuggestIngestionConstraints {
|
||||
pub fn all_providers() -> Self {
|
||||
Self {
|
||||
providers: Some(vec![
|
||||
SuggestionProvider::Amp,
|
||||
SuggestionProvider::Wikipedia,
|
||||
SuggestionProvider::Amo,
|
||||
SuggestionProvider::Pocket,
|
||||
SuggestionProvider::Yelp,
|
||||
SuggestionProvider::Mdn,
|
||||
SuggestionProvider::Weather,
|
||||
SuggestionProvider::AmpMobile,
|
||||
SuggestionProvider::Fakespot,
|
||||
]),
|
||||
..Self::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The implementation of the store. This is generic over the Remote Settings
|
||||
/// client, and is split out from the concrete [`SuggestStore`] for testing
|
||||
/// with a mock client.
|
||||
|
@ -243,13 +277,19 @@ pub(crate) struct SuggestStoreInner<S> {
|
|||
#[allow(unused)]
|
||||
data_path: PathBuf,
|
||||
dbs: OnceCell<SuggestStoreDbs>,
|
||||
extensions_to_load: Vec<Sqlite3Extension>,
|
||||
settings_client: S,
|
||||
}
|
||||
|
||||
impl<S> SuggestStoreInner<S> {
|
||||
pub fn new(data_path: impl Into<PathBuf>, settings_client: S) -> Self {
|
||||
pub fn new(
|
||||
data_path: impl Into<PathBuf>,
|
||||
extensions_to_load: Vec<Sqlite3Extension>,
|
||||
settings_client: S,
|
||||
) -> Self {
|
||||
Self {
|
||||
data_path: data_path.into(),
|
||||
extensions_to_load,
|
||||
dbs: OnceCell::new(),
|
||||
settings_client,
|
||||
}
|
||||
|
@ -259,7 +299,7 @@ impl<S> SuggestStoreInner<S> {
|
|||
/// they're not already open.
|
||||
fn dbs(&self) -> Result<&SuggestStoreDbs> {
|
||||
self.dbs
|
||||
.get_or_try_init(|| SuggestStoreDbs::open(&self.data_path))
|
||||
.get_or_try_init(|| SuggestStoreDbs::open(&self.data_path, &self.extensions_to_load))
|
||||
}
|
||||
|
||||
fn query(&self, query: SuggestionQuery) -> Result<Vec<Suggestion>> {
|
||||
|
@ -357,32 +397,35 @@ where
|
|||
dao: &mut SuggestDao,
|
||||
constraints: &SuggestIngestionConstraints,
|
||||
) -> Result<()> {
|
||||
let last_ingest_key = ingest_record_type.last_ingest_meta_key();
|
||||
let request = RecordRequest {
|
||||
record_type: Some(ingest_record_type.to_string()),
|
||||
last_modified: dao
|
||||
.get_meta::<u64>(ingest_record_type.last_ingest_meta_key().as_str())?,
|
||||
record_type: ingest_record_type.to_string(),
|
||||
last_modified: dao.get_meta::<u64>(&last_ingest_key)?,
|
||||
limit: constraints.max_suggestions,
|
||||
};
|
||||
|
||||
let records = self.settings_client.get_records(request)?;
|
||||
self.ingest_records(&ingest_record_type.last_ingest_meta_key(), dao, &records)?;
|
||||
for record in &records {
|
||||
// Drop any data that we previously ingested from this record.
|
||||
// Suggestions in particular don't have a stable identifier, and
|
||||
// determining which suggestions in the record actually changed is
|
||||
// more complicated than dropping and re-ingesting all of them.
|
||||
dao.delete_record_data(record)?;
|
||||
}
|
||||
self.ingest_records(dao, &records)?;
|
||||
if let Some(max_last_modified) = records.iter().map(|r| r.last_modified).max() {
|
||||
dao.put_last_ingest_if_newer(&last_ingest_key, max_last_modified)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn ingest_records(
|
||||
&self,
|
||||
last_ingest_key: &str,
|
||||
dao: &mut SuggestDao,
|
||||
records: &[Record],
|
||||
) -> Result<()> {
|
||||
fn ingest_records(&self, dao: &mut SuggestDao, records: &[Record]) -> Result<()> {
|
||||
for record in records {
|
||||
let record_id = SuggestRecordId::from(&record.id);
|
||||
if record.deleted {
|
||||
// If the entire record was deleted, drop all its suggestions
|
||||
// and advance the last ingest time.
|
||||
dao.handle_deleted_record(last_ingest_key, record)?;
|
||||
continue;
|
||||
}
|
||||
|
||||
let record_id = SuggestRecordId::from(&record.id);
|
||||
let Ok(fields) =
|
||||
serde_json::from_value(serde_json::Value::Object(record.fields.clone()))
|
||||
else {
|
||||
|
@ -393,27 +436,14 @@ where
|
|||
|
||||
match fields {
|
||||
SuggestRecord::AmpWikipedia => {
|
||||
self.ingest_attachment(
|
||||
// TODO: Currently re-creating the last_ingest_key because using last_ingest_meta
|
||||
// breaks the tests (particularly the unparsable functionality). So, keeping
|
||||
// a direct reference until we remove the "unparsable" functionality.
|
||||
&SuggestRecordType::AmpWikipedia.last_ingest_meta_key(),
|
||||
dao,
|
||||
record,
|
||||
|dao, record_id, suggestions| {
|
||||
dao.insert_amp_wikipedia_suggestions(record_id, suggestions)
|
||||
},
|
||||
)?;
|
||||
self.ingest_attachment(dao, record, |dao, record_id, suggestions| {
|
||||
dao.insert_amp_wikipedia_suggestions(record_id, suggestions)
|
||||
})?;
|
||||
}
|
||||
SuggestRecord::AmpMobile => {
|
||||
self.ingest_attachment(
|
||||
&SuggestRecordType::AmpMobile.last_ingest_meta_key(),
|
||||
dao,
|
||||
record,
|
||||
|dao, record_id, suggestions| {
|
||||
dao.insert_amp_mobile_suggestions(record_id, suggestions)
|
||||
},
|
||||
)?;
|
||||
self.ingest_attachment(dao, record, |dao, record_id, suggestions| {
|
||||
dao.insert_amp_mobile_suggestions(record_id, suggestions)
|
||||
})?;
|
||||
}
|
||||
SuggestRecord::Icon => {
|
||||
let (Some(icon_id), Some(attachment)) =
|
||||
|
@ -422,105 +452,50 @@ where
|
|||
// An icon record should have an icon ID and an
|
||||
// attachment. Icons that don't have these are
|
||||
// malformed, so skip to the next record.
|
||||
dao.put_last_ingest_if_newer(
|
||||
&SuggestRecordType::Icon.last_ingest_meta_key(),
|
||||
record.last_modified,
|
||||
)?;
|
||||
continue;
|
||||
};
|
||||
let data = record.require_attachment_data()?;
|
||||
dao.put_icon(icon_id, data, &attachment.mimetype)?;
|
||||
dao.handle_ingested_record(
|
||||
&SuggestRecordType::Icon.last_ingest_meta_key(),
|
||||
record,
|
||||
)?;
|
||||
}
|
||||
SuggestRecord::Amo => {
|
||||
self.ingest_attachment(
|
||||
&SuggestRecordType::Amo.last_ingest_meta_key(),
|
||||
dao,
|
||||
record,
|
||||
|dao, record_id, suggestions| {
|
||||
dao.insert_amo_suggestions(record_id, suggestions)
|
||||
},
|
||||
)?;
|
||||
self.ingest_attachment(dao, record, |dao, record_id, suggestions| {
|
||||
dao.insert_amo_suggestions(record_id, suggestions)
|
||||
})?;
|
||||
}
|
||||
SuggestRecord::Pocket => {
|
||||
self.ingest_attachment(
|
||||
&SuggestRecordType::Pocket.last_ingest_meta_key(),
|
||||
dao,
|
||||
record,
|
||||
|dao, record_id, suggestions| {
|
||||
dao.insert_pocket_suggestions(record_id, suggestions)
|
||||
},
|
||||
)?;
|
||||
self.ingest_attachment(dao, record, |dao, record_id, suggestions| {
|
||||
dao.insert_pocket_suggestions(record_id, suggestions)
|
||||
})?;
|
||||
}
|
||||
SuggestRecord::Yelp => {
|
||||
self.ingest_attachment(
|
||||
&SuggestRecordType::Yelp.last_ingest_meta_key(),
|
||||
dao,
|
||||
record,
|
||||
|dao, record_id, suggestions| match suggestions.first() {
|
||||
self.ingest_attachment(dao, record, |dao, record_id, suggestions| {
|
||||
match suggestions.first() {
|
||||
Some(suggestion) => dao.insert_yelp_suggestions(record_id, suggestion),
|
||||
None => Ok(()),
|
||||
},
|
||||
)?;
|
||||
}
|
||||
})?;
|
||||
}
|
||||
SuggestRecord::Mdn => {
|
||||
self.ingest_attachment(
|
||||
&SuggestRecordType::Mdn.last_ingest_meta_key(),
|
||||
dao,
|
||||
record,
|
||||
|dao, record_id, suggestions| {
|
||||
dao.insert_mdn_suggestions(record_id, suggestions)
|
||||
},
|
||||
)?;
|
||||
}
|
||||
SuggestRecord::Weather(data) => {
|
||||
self.ingest_record(
|
||||
&SuggestRecordType::Weather.last_ingest_meta_key(),
|
||||
dao,
|
||||
record,
|
||||
|dao, record_id| dao.insert_weather_data(record_id, &data),
|
||||
)?;
|
||||
self.ingest_attachment(dao, record, |dao, record_id, suggestions| {
|
||||
dao.insert_mdn_suggestions(record_id, suggestions)
|
||||
})?;
|
||||
}
|
||||
SuggestRecord::Weather(data) => dao.insert_weather_data(&record_id, &data)?,
|
||||
SuggestRecord::GlobalConfig(config) => {
|
||||
self.ingest_record(
|
||||
&SuggestRecordType::GlobalConfig.last_ingest_meta_key(),
|
||||
dao,
|
||||
record,
|
||||
|dao, _| dao.put_global_config(&SuggestGlobalConfig::from(&config)),
|
||||
)?;
|
||||
dao.put_global_config(&SuggestGlobalConfig::from(&config))?
|
||||
}
|
||||
SuggestRecord::Fakespot => {
|
||||
self.ingest_attachment(dao, record, |dao, record_id, suggestions| {
|
||||
dao.insert_fakespot_suggestions(record_id, suggestions)
|
||||
})?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn ingest_record(
|
||||
&self,
|
||||
last_ingest_key: &str,
|
||||
dao: &mut SuggestDao,
|
||||
record: &Record,
|
||||
ingestion_handler: impl FnOnce(&mut SuggestDao<'_>, &SuggestRecordId) -> Result<()>,
|
||||
) -> Result<()> {
|
||||
let record_id = SuggestRecordId::from(&record.id);
|
||||
|
||||
// Drop any data that we previously ingested from this record.
|
||||
// Suggestions in particular don't have a stable identifier, and
|
||||
// determining which suggestions in the record actually changed is
|
||||
// more complicated than dropping and re-ingesting all of them.
|
||||
dao.drop_suggestions(&record_id)?;
|
||||
|
||||
// Ingest (or re-ingest) all data in the record.
|
||||
ingestion_handler(dao, &record_id)?;
|
||||
|
||||
dao.handle_ingested_record(last_ingest_key, record)
|
||||
}
|
||||
|
||||
fn ingest_attachment<T>(
|
||||
&self,
|
||||
last_ingest_key: &str,
|
||||
dao: &mut SuggestDao,
|
||||
record: &Record,
|
||||
ingestion_handler: impl FnOnce(&mut SuggestDao<'_>, &SuggestRecordId, &[T]) -> Result<()>,
|
||||
|
@ -529,18 +504,16 @@ where
|
|||
T: DeserializeOwned,
|
||||
{
|
||||
if record.attachment.is_none() {
|
||||
// This method should be called only when a record is expected to
|
||||
// have an attachment. If it doesn't have one, it's malformed, so
|
||||
// skip to the next record.
|
||||
dao.put_last_ingest_if_newer(last_ingest_key, record.last_modified)?;
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
let attachment_data = record.require_attachment_data()?;
|
||||
match serde_json::from_slice::<SuggestAttachment<T>>(attachment_data) {
|
||||
Ok(attachment) => self.ingest_record(last_ingest_key, dao, record, |dao, record_id| {
|
||||
ingestion_handler(dao, record_id, attachment.suggestions())
|
||||
}),
|
||||
Ok(attachment) => ingestion_handler(
|
||||
dao,
|
||||
&SuggestRecordId::from(&record.id),
|
||||
attachment.suggestions(),
|
||||
),
|
||||
// If the attachment doesn't match our expected schema, just skip it. It's possible
|
||||
// that we're using an older version. If so, we'll get the data when we re-ingest
|
||||
// after updating the schema.
|
||||
|
@ -580,7 +553,7 @@ where
|
|||
self.ingest_records_by_type(
|
||||
ingest_record_type,
|
||||
dao,
|
||||
&SuggestIngestionConstraints::default(),
|
||||
&SuggestIngestionConstraints::all_providers(),
|
||||
)
|
||||
})
|
||||
.unwrap()
|
||||
|
@ -631,11 +604,11 @@ struct SuggestStoreDbs {
|
|||
}
|
||||
|
||||
impl SuggestStoreDbs {
|
||||
fn open(path: &Path) -> Result<Self> {
|
||||
fn open(path: &Path, extensions_to_load: &[Sqlite3Extension]) -> Result<Self> {
|
||||
// Order is important here: the writer must be opened first, so that it
|
||||
// can set up the database and run any migrations.
|
||||
let writer = SuggestDb::open(path, ConnectionType::ReadWrite)?;
|
||||
let reader = SuggestDb::open(path, ConnectionType::ReadOnly)?;
|
||||
let writer = SuggestDb::open(path, extensions_to_load, ConnectionType::ReadWrite)?;
|
||||
let reader = SuggestDb::open(path, extensions_to_load, ConnectionType::ReadOnly)?;
|
||||
Ok(Self { writer, reader })
|
||||
}
|
||||
}
|
||||
|
@ -665,7 +638,7 @@ mod tests {
|
|||
COUNTER.fetch_add(1, Ordering::Relaxed),
|
||||
);
|
||||
Self {
|
||||
inner: SuggestStoreInner::new(db_path, client),
|
||||
inner: SuggestStoreInner::new(db_path, vec![], client),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -747,7 +720,7 @@ mod tests {
|
|||
.with_record("data", "1234", json![los_pollos_amp()])
|
||||
.with_icon(los_pollos_icon()),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::amp("lo")),
|
||||
vec![los_pollos_suggestion("los")],
|
||||
|
@ -770,7 +743,7 @@ mod tests {
|
|||
// This ingestion should run, since the DB is empty
|
||||
store.ingest(SuggestIngestionConstraints {
|
||||
empty_only: true,
|
||||
..SuggestIngestionConstraints::default()
|
||||
..SuggestIngestionConstraints::all_providers()
|
||||
});
|
||||
// suggestions_table_empty returns false after the ingestion is complete
|
||||
assert!(!store.read(|dao| dao.suggestions_table_empty())?);
|
||||
|
@ -783,7 +756,7 @@ mod tests {
|
|||
));
|
||||
store.ingest(SuggestIngestionConstraints {
|
||||
empty_only: true,
|
||||
..SuggestIngestionConstraints::default()
|
||||
..SuggestIngestionConstraints::all_providers()
|
||||
});
|
||||
// "la" should not match the good place eats suggestion, since that should not have been
|
||||
// ingested.
|
||||
|
@ -808,7 +781,7 @@ mod tests {
|
|||
.with_icon(good_place_eats_icon()),
|
||||
);
|
||||
// This ingestion should run, since the DB is empty
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::amp("lo")),
|
||||
|
@ -862,7 +835,7 @@ mod tests {
|
|||
.with_icon(good_place_eats_icon())
|
||||
.with_icon(california_icon())
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::amp("lo")),
|
||||
|
@ -905,7 +878,7 @@ mod tests {
|
|||
.with_record("data", "1234", los_pollos_amp())
|
||||
.with_icon(los_pollos_icon()),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::amp("lo")),
|
||||
vec![los_pollos_suggestion("los")],
|
||||
|
@ -925,7 +898,7 @@ mod tests {
|
|||
json!([los_pollos_amp(), good_place_eats_amp()]),
|
||||
));
|
||||
// Ingest once
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
// Update the snapshot with new suggestions: Los pollos has a new name and Good place eats
|
||||
// is now serving Penne
|
||||
store.replace_client(MockRemoteSettingsClient::default().with_record(
|
||||
|
@ -942,7 +915,7 @@ mod tests {
|
|||
}))
|
||||
]),
|
||||
));
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
assert!(matches!(
|
||||
store.fetch_suggestions(SuggestionQuery::amp("lo")).as_slice(),
|
||||
|
@ -974,7 +947,7 @@ mod tests {
|
|||
.with_icon(good_place_eats_icon()),
|
||||
);
|
||||
// This ingestion should run, since the DB is empty
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
// Reingest with updated icon data
|
||||
// - Los pollos gets new data and a new id
|
||||
|
@ -999,7 +972,7 @@ mod tests {
|
|||
..good_place_eats_icon()
|
||||
}),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
assert!(matches!(
|
||||
store.fetch_suggestions(SuggestionQuery::amp("lo")).as_slice(),
|
||||
|
@ -1029,7 +1002,7 @@ mod tests {
|
|||
),
|
||||
);
|
||||
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::amo("masking e")),
|
||||
|
@ -1058,7 +1031,7 @@ mod tests {
|
|||
]),
|
||||
),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::amo("masking e")),
|
||||
|
@ -1093,7 +1066,7 @@ mod tests {
|
|||
.with_icon(los_pollos_icon())
|
||||
.with_icon(good_place_eats_icon()),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::amp("lo")),
|
||||
vec![los_pollos_suggestion("los")],
|
||||
|
@ -1112,7 +1085,7 @@ mod tests {
|
|||
.with_icon_tombstone(los_pollos_icon())
|
||||
.with_icon_tombstone(good_place_eats_icon()),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
assert_eq!(store.fetch_suggestions(SuggestionQuery::amp("lo")), vec![]);
|
||||
assert!(matches!(
|
||||
|
@ -1136,7 +1109,7 @@ mod tests {
|
|||
.with_icon(los_pollos_icon())
|
||||
.with_icon(good_place_eats_icon()),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
assert!(store.count_rows("suggestions") > 0);
|
||||
assert!(store.count_rows("keywords") > 0);
|
||||
assert!(store.count_rows("icons") > 0);
|
||||
|
@ -1186,7 +1159,7 @@ mod tests {
|
|||
.with_icon(multimatch_wiki_icon()),
|
||||
);
|
||||
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::all_providers("")),
|
||||
|
@ -1610,7 +1583,7 @@ mod tests {
|
|||
.with_icon(california_icon()),
|
||||
);
|
||||
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::all_providers("amp wiki match")),
|
||||
vec![
|
||||
|
@ -1669,7 +1642,7 @@ mod tests {
|
|||
// things would work in practice, but it's okay for the tests.
|
||||
.with_icon(good_place_eats_icon()),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
// The query results should be exactly the same for both the Amp and AmpMobile data
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::amp_mobile("las")),
|
||||
|
@ -1699,7 +1672,7 @@ mod tests {
|
|||
.with_record("icon", "bad-icon-id", json!("i-am-an-icon")),
|
||||
);
|
||||
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
store.read(|dao| {
|
||||
assert_eq!(
|
||||
|
@ -1746,7 +1719,7 @@ mod tests {
|
|||
let constraints = SuggestIngestionConstraints {
|
||||
max_suggestions: Some(100),
|
||||
providers: Some(vec![SuggestionProvider::Amp, SuggestionProvider::Pocket]),
|
||||
..SuggestIngestionConstraints::default()
|
||||
..SuggestIngestionConstraints::all_providers()
|
||||
};
|
||||
store.ingest(constraints);
|
||||
|
||||
|
@ -1843,7 +1816,7 @@ mod tests {
|
|||
.with_icon(good_place_eats_icon()),
|
||||
);
|
||||
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
// Test that the valid record was read
|
||||
assert_eq!(
|
||||
|
@ -1865,7 +1838,7 @@ mod tests {
|
|||
"mdn-1",
|
||||
json!([array_mdn()]),
|
||||
));
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
// prefix
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::mdn("array")),
|
||||
|
@ -1905,7 +1878,7 @@ mod tests {
|
|||
json!([ramen_yelp()]),
|
||||
), // Note: yelp_favicon() is missing
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
assert!(matches!(
|
||||
store.fetch_suggestions(SuggestionQuery::yelp("ramen")).as_slice(),
|
||||
[Suggestion::Yelp { icon, icon_mimetype, .. }] if icon.is_none() && icon_mimetype.is_none()
|
||||
|
@ -1927,7 +1900,7 @@ mod tests {
|
|||
"score": "0.24"
|
||||
}),
|
||||
));
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
// No match since the query doesn't match any keyword
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::weather("xab")),
|
||||
|
@ -2029,7 +2002,7 @@ mod tests {
|
|||
"show_less_frequently_cap": 3,
|
||||
}),
|
||||
));
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
assert_eq!(
|
||||
store.fetch_global_config(),
|
||||
SuggestGlobalConfig {
|
||||
|
@ -2045,7 +2018,7 @@ mod tests {
|
|||
before_each();
|
||||
|
||||
let store = TestStore::new(MockRemoteSettingsClient::default());
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
assert_eq!(
|
||||
store.fetch_global_config(),
|
||||
SuggestGlobalConfig {
|
||||
|
@ -2061,7 +2034,7 @@ mod tests {
|
|||
before_each();
|
||||
|
||||
let store = TestStore::new(MockRemoteSettingsClient::default());
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
assert_eq!(store.fetch_provider_config(SuggestionProvider::Amp), None);
|
||||
assert_eq!(
|
||||
store.fetch_provider_config(SuggestionProvider::Weather),
|
||||
|
@ -2084,7 +2057,7 @@ mod tests {
|
|||
"score": "0.24"
|
||||
}),
|
||||
));
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
// Getting the config for a different provider should return None.
|
||||
assert_eq!(store.fetch_provider_config(SuggestionProvider::Amp), None);
|
||||
Ok(())
|
||||
|
@ -2129,7 +2102,7 @@ mod tests {
|
|||
.with_icon(good_place_eats_icon())
|
||||
.with_icon(caltech_icon()),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::default());
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
// A query for cats should return all suggestions
|
||||
let query = SuggestionQuery::all_providers("cats");
|
||||
|
@ -2151,4 +2124,124 @@ mod tests {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn query_fakespot() -> anyhow::Result<()> {
|
||||
before_each();
|
||||
|
||||
let store = TestStore::new(
|
||||
MockRemoteSettingsClient::default()
|
||||
.with_record(
|
||||
"fakespot-suggestions",
|
||||
"fakespot-1",
|
||||
json!([snowglobe_fakespot(), simpsons_fakespot()]),
|
||||
)
|
||||
.with_icon(fakespot_amazon_icon()),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::fakespot("globe")),
|
||||
vec![snowglobe_suggestion()],
|
||||
);
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::fakespot("simpsons")),
|
||||
vec![simpsons_suggestion()],
|
||||
);
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::fakespot("snow")),
|
||||
vec![simpsons_suggestion(), snowglobe_suggestion()],
|
||||
);
|
||||
// Test FTS by using a query where the keywords are separated in the source text
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::fakespot("simpsons snow")),
|
||||
vec![simpsons_suggestion()],
|
||||
);
|
||||
// Special characters should be stripped out
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::fakespot("simpsons + snow")),
|
||||
vec![simpsons_suggestion()],
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fakespot_prefix_matching() -> anyhow::Result<()> {
|
||||
before_each();
|
||||
|
||||
let store = TestStore::new(
|
||||
MockRemoteSettingsClient::default()
|
||||
.with_record(
|
||||
"fakespot-suggestions",
|
||||
"fakespot-1",
|
||||
json!([snowglobe_fakespot(), simpsons_fakespot()]),
|
||||
)
|
||||
.with_icon(fakespot_amazon_icon()),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::fakespot("simp")),
|
||||
vec![simpsons_suggestion()],
|
||||
);
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::fakespot("simps")),
|
||||
vec![simpsons_suggestion()],
|
||||
);
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::fakespot("simpson")),
|
||||
vec![simpsons_suggestion()],
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fakespot_updates_and_deletes() -> anyhow::Result<()> {
|
||||
before_each();
|
||||
|
||||
let mut store = TestStore::new(
|
||||
MockRemoteSettingsClient::default()
|
||||
.with_record(
|
||||
"fakespot-suggestions",
|
||||
"fakespot-1",
|
||||
json!([snowglobe_fakespot(), simpsons_fakespot()]),
|
||||
)
|
||||
.with_icon(fakespot_amazon_icon()),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
// Update the snapshot so that:
|
||||
// - The Simpsons entry is deleted
|
||||
// - Snow globes now use sea glass instead of glitter
|
||||
store.replace_client(
|
||||
MockRemoteSettingsClient::default()
|
||||
.with_record(
|
||||
"fakespot-suggestions",
|
||||
"fakespot-1",
|
||||
json!([snowglobe_fakespot()
|
||||
.merge(json!({"title": "Make Your Own Sea Glass Snow Globes"}))]),
|
||||
)
|
||||
.with_icon(fakespot_amazon_icon()),
|
||||
);
|
||||
store.ingest(SuggestIngestionConstraints::all_providers());
|
||||
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::fakespot("glitter")),
|
||||
vec![],
|
||||
);
|
||||
assert!(matches!(
|
||||
store.fetch_suggestions(SuggestionQuery::fakespot("sea glass")).as_slice(),
|
||||
[
|
||||
Suggestion::Fakespot { title, .. }
|
||||
]
|
||||
if title == "Make Your Own Sea Glass Snow Globes"
|
||||
));
|
||||
|
||||
assert_eq!(
|
||||
store.fetch_suggestions(SuggestionQuery::fakespot("simpsons")),
|
||||
vec![],
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ enum SuggestionProvider {
|
|||
"Mdn",
|
||||
"Weather",
|
||||
"AmpMobile",
|
||||
"Fakespot",
|
||||
};
|
||||
|
||||
[Enum]
|
||||
|
@ -95,6 +96,17 @@ interface Suggestion {
|
|||
Weather(
|
||||
f64 score
|
||||
);
|
||||
Fakespot(
|
||||
string fakespot_grade,
|
||||
string product_id,
|
||||
f64 rating,
|
||||
string title,
|
||||
i64 total_reviews,
|
||||
string url,
|
||||
sequence<u8>? icon,
|
||||
string? icon_mimetype,
|
||||
f64 score
|
||||
);
|
||||
};
|
||||
|
||||
dictionary SuggestionQuery {
|
||||
|
@ -181,6 +193,14 @@ interface SuggestStoreBuilder {
|
|||
[Self=ByArc]
|
||||
SuggestStoreBuilder remote_settings_bucket_name(string bucket_name);
|
||||
|
||||
// Add an sqlite3 extension to load
|
||||
//
|
||||
// library_name should be the name of the library without any extension, for example `libmozsqlite3`.
|
||||
// entrypoint should be the entry point, for example `sqlite3_fts5_init`. If `null` (the default)
|
||||
// entry point will be used (see https://sqlite.org/loadext.html for details).
|
||||
[Self=ByArc]
|
||||
SuggestStoreBuilder load_extension(string library_name, string? entrypoint);
|
||||
|
||||
[Throws=SuggestApiError]
|
||||
SuggestStore build();
|
||||
};
|
||||
|
|
|
@ -81,6 +81,17 @@ pub enum Suggestion {
|
|||
Weather {
|
||||
score: f64,
|
||||
},
|
||||
Fakespot {
|
||||
fakespot_grade: String,
|
||||
product_id: String,
|
||||
rating: f64,
|
||||
title: String,
|
||||
total_reviews: i64,
|
||||
url: String,
|
||||
icon: Option<Vec<u8>>,
|
||||
icon_mimetype: Option<String>,
|
||||
score: f64,
|
||||
},
|
||||
}
|
||||
|
||||
impl PartialOrd for Suggestion {
|
||||
|
@ -118,7 +129,8 @@ impl Suggestion {
|
|||
| Self::Wikipedia { url, .. }
|
||||
| Self::Amo { url, .. }
|
||||
| Self::Yelp { url, .. }
|
||||
| Self::Mdn { url, .. } => Some(url),
|
||||
| Self::Mdn { url, .. }
|
||||
| Self::Fakespot { url, .. } => Some(url),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
@ -138,6 +150,29 @@ impl Suggestion {
|
|||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn title(&self) -> &str {
|
||||
match self {
|
||||
Self::Amp { title, .. }
|
||||
| Self::Pocket { title, .. }
|
||||
| Self::Wikipedia { title, .. }
|
||||
| Self::Amo { title, .. }
|
||||
| Self::Yelp { title, .. }
|
||||
| Self::Mdn { title, .. } => title,
|
||||
Self::Weather { .. } => "weather",
|
||||
Self::Fakespot { title, .. } => title,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn icon_data(&self) -> Option<&[u8]> {
|
||||
match self {
|
||||
Self::Amp { icon, .. }
|
||||
| Self::Wikipedia { icon, .. }
|
||||
| Self::Yelp { icon, .. }
|
||||
| Self::Fakespot { icon, .. } => icon.as_deref(),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Suggestion {}
|
||||
|
|
|
@ -152,11 +152,8 @@ pub struct MockIcon {
|
|||
|
||||
impl Client for MockRemoteSettingsClient {
|
||||
fn get_records(&self, request: RecordRequest) -> Result<Vec<Record>> {
|
||||
let record_type = request.record_type.unwrap_or_else(|| {
|
||||
panic!("MockRemoteSettingsClient.get_records: record_type required ")
|
||||
});
|
||||
// Note: limit and modified time are ignored
|
||||
Ok(match self.records.get(&record_type) {
|
||||
Ok(match self.records.get(&request.record_type) {
|
||||
Some(records) => records.clone(),
|
||||
None => vec![],
|
||||
})
|
||||
|
|
|
@ -449,3 +449,67 @@ pub fn multimatch_wiki_suggestion() -> Suggestion {
|
|||
full_keyword: "multimatch".into(),
|
||||
}
|
||||
}
|
||||
|
||||
// Fakespot test data
|
||||
|
||||
pub fn snowglobe_fakespot() -> JsonValue {
|
||||
json!({
|
||||
"fakespot_grade": "B",
|
||||
"product_id": "amazon-ABC",
|
||||
"rating": 4.7,
|
||||
"score": 0.7,
|
||||
"title": "Make Your Own Glitter Snow Globes",
|
||||
"total_reviews": 152,
|
||||
"url": "http://amazon.com/dp/ABC"
|
||||
})
|
||||
}
|
||||
|
||||
pub fn snowglobe_suggestion() -> Suggestion {
|
||||
Suggestion::Fakespot {
|
||||
fakespot_grade: "B".into(),
|
||||
product_id: "amazon-ABC".into(),
|
||||
rating: 4.7,
|
||||
title: "Make Your Own Glitter Snow Globes".into(),
|
||||
total_reviews: 152,
|
||||
url: "http://amazon.com/dp/ABC".into(),
|
||||
score: 0.7,
|
||||
icon: Some("fakespot-icon-amazon-data".as_bytes().to_vec()),
|
||||
icon_mimetype: Some("image/png".into()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn simpsons_fakespot() -> JsonValue {
|
||||
json!({
|
||||
"fakespot_grade": "A",
|
||||
// Use a product ID that doesn't match the ingested icons to test what happens. In this
|
||||
// case, icon and icon_mimetype for the returned Suggestion should both be None.
|
||||
"product_id": "vendorwithouticon-XYZ",
|
||||
"rating": 4.9,
|
||||
"score": 0.9,
|
||||
"title": "The Simpsons: Skinner's Sense of Snow (DVD)",
|
||||
"total_reviews": 14000,
|
||||
"url": "http://vendorwithouticon.com/dp/XYZ"
|
||||
})
|
||||
}
|
||||
|
||||
pub fn simpsons_suggestion() -> Suggestion {
|
||||
Suggestion::Fakespot {
|
||||
fakespot_grade: "A".into(),
|
||||
product_id: "vendorwithouticon-XYZ".into(),
|
||||
rating: 4.9,
|
||||
title: "The Simpsons: Skinner's Sense of Snow (DVD)".into(),
|
||||
total_reviews: 14000,
|
||||
url: "http://vendorwithouticon.com/dp/XYZ".into(),
|
||||
score: 0.9,
|
||||
icon: None,
|
||||
icon_mimetype: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fakespot_amazon_icon() -> MockIcon {
|
||||
MockIcon {
|
||||
id: "fakespot-amazon",
|
||||
data: "fakespot-icon-amazon-data",
|
||||
mimetype: "image/png",
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ impl Suggestion {
|
|||
Self::Mdn { score, .. } => score,
|
||||
Self::Weather { score, .. } => score,
|
||||
Self::Wikipedia { .. } => panic!("with_score not valid for wikipedia suggestions"),
|
||||
Self::Fakespot { score, .. } => score,
|
||||
};
|
||||
*current_score = score;
|
||||
self
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"f64f49761ff16c3504292455d4a94f34456ce1605a545a7e8d53bddb12f581e4","src/lib.rs":"a112b66270feba587d0b09e64b4197af01f981675a23f76649a7d948f85c2bd9","src/rusqlite_support.rs":"827d314605d8c741efdf238a0780a891c88bc56026a3e6dcfa534772a4852fb3","src/serde_support.rs":"519b5eb59ca7be555d522f2186909db969069dc9586a5fe4047d4ec176b2368a"},"package":null}
|
||||
{"files":{"Cargo.toml":"f64f49761ff16c3504292455d4a94f34456ce1605a545a7e8d53bddb12f581e4","src/lib.rs":"a112b66270feba587d0b09e64b4197af01f981675a23f76649a7d948f85c2bd9","src/rusqlite_support.rs":"c6791f103c286858a1a6e2c7e106b177ed8d9196b73ed100a8bb0aec1b1f957f","src/serde_support.rs":"99668580adb3c28ee7d3ae00ad4cf52e297aec3eeeaed11b200fa8c7e17319f1"},"package":null}
|
|
@ -2,8 +2,6 @@
|
|||
* 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/. */
|
||||
|
||||
#![cfg(feature = "rusqlite_support")]
|
||||
|
||||
use crate::Guid;
|
||||
use rusqlite::{
|
||||
self,
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
* 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/. */
|
||||
|
||||
#![cfg(feature = "serde_support")]
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use serde::{
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"6827fe696bd5e7ef806389493be837c7fa87f3301a7b243890259c5304fda21f","README.md":"6d4ff5b079ac5340d18fa127f583e7ad793c5a2328b8ecd12c3fc723939804f2","build.rs":"aa971160d67ce8626b26e15c04c34b730f594c45c817aae34cfc9f3ea14ae284","src/bso/content.rs":"92935258745bdf0c3915a555cb6884a7fa69faa1290ec2c1815f6e2f3c0f0562","src/bso/crypto.rs":"27602dcccb37d3a55620ee4e16b705da455d49af575de115c7c79c0178eb1d6d","src/bso/mod.rs":"09e723dc7e99295ecafdcadffaf604d66ea27cf2b7f1fd9ab3cac4f4698ff6a7","src/bso/test_utils.rs":"4ec5a2df5e1c0ec14dc770681e959bdcef6ef04f6fde435999197f46a8ae4831","src/client/coll_state.rs":"13e6ef55273baf5536acc369be522e34a803a32cabf19cce43e426aea9b6223e","src/client/coll_update.rs":"dac04a90c29dd969f8b4250414609c9b6d61daf2dfa4ae77d1c4a165ba970b05","src/client/collection_keys.rs":"c27b2277a3a52033b58ab01490fc2ea7007494195dd5e6dc2c6931a4ca96795a","src/client/mod.rs":"8f588d4a035cf79d96f2500f06d5651c1a7c566127c456ffa5429811ddce3fd6","src/client/request.rs":"e4fc6abfb5a3fe887c28831c73ef7d31c5bbc1499a3a1f279d8449b0ca034a38","src/client/state.rs":"4e31193ef2471c1dfabf1c6a391bcb95e14ddb45855786a4194ff187d5c9347c","src/client/status.rs":"f445a8765dac9789444e23b5145148413407bb1d18a15ef56682243997f591bf","src/client/storage_client.rs":"8de72d4ba3ca4f68c8e1898466de83a2b543545a18679800cb4f7fbda2dc3183","src/client/sync.rs":"b29abb512ec9d163f7883b71f78c9202802dcb17cad1fc5dc08087fb0bb66704","src/client/sync_multiple.rs":"6e92571132f89744b553190c596be8aff9b2d031d8f79d82c94cdf78b1683f4a","src/client/token.rs":"13729c693c8be72bcafc816c97e2a35932d008b4f2ccda6a5f8cdb8b2c99a293","src/client/util.rs":"71cc70ee41f821f53078675e636e9fad9c6046fa1a989e37f5487e340a2277d6","src/client_types.rs":"3c3cac1540b92482f43660d9e43bdde8481c4cc1a98253a68c80e791231f5976","src/clients_engine/engine.rs":"9e11b47be81fc63214f31879af74075674aa50a8f8989afe20fefa7990fa99b9","src/clients_engine/mod.rs":"461729e6f89b66b2cbd89b041a03d4d6a8ba582284ed4f3015cb13e1a0c6da97","src/clients_engine/record.rs":"b0d84bf420743d7638a45e4836633a45e50257d5548fe7ecd04bff4d724439b8","src/clients_engine/ser.rs":"ef12daeb11faf618fe3cafe91f20a031fe5bb6751369b6ee5aee03f196efe88c","src/device_type.rs":"dc2d4296d25e31471c8e68488f1043ff239b902036cd6aea8a686cf79b4ed335","src/enc_payload.rs":"aa3eea7df49b24cd59831680a47c417b73a3e36e6b0f3f4baf14ca66bd68be6b","src/engine/bridged_engine.rs":"b4e3071a0259ac55303364e57f9cd685916b80dc302030bba07790e55ceecb66","src/engine/mod.rs":"90f1f9760f5f712a337aebb04e59c736e4b6fbd89d6a188d969210c7f3f321ae","src/engine/request.rs":"5923025fb9550178339f880a1bf8526d8e853e7a0b2bce6d9d687cc808ac0085","src/engine/sync_engine.rs":"531b35d72ce9e04c3e543c0468c1e450fba2c0dc3d33d68d9b1c0a5c1ad7dd34","src/error.rs":"a45cfe02e6301f473c34678b694943c1a04308b8c292c6e0448bf495194c3b5e","src/key_bundle.rs":"abd0781f3be8c8e7c691f18bb71f3433b633803c48da9794e15ac6301ed60d6c","src/lib.rs":"f59f8817978d943518dfa03ab31fc0f6b1fc72ee9943a97aef1537e2769649f5","src/record_types.rs":"02bb3d352fb808131d298f9b90d9c95b7e9e0138b97c5401f3b9fdacc5562f44","src/server_timestamp.rs":"6272299c92b05b9ec9dc2e18402ebe927b07ccf1dcab5082301a09e0ee56ce24","src/sync15.udl":"005b2b056b93c959a04670f6f489afecb8e17093d8e4be34765a3a4cc0faeb8c","src/telemetry.rs":"e3a7e13e85f5e336526ebf07db04c81b8f1ba89ae1db4159a3a570826cb8cfd2","uniffi.toml":"34488f947497a9b05007445dd816024ef02e6b1696f1056ee868f039722828ee"},"package":null}
|
||||
{"files":{"Cargo.toml":"a80fd7eab7dfcb3767d8f959fa6e10cdb109d3bfa9634902617e783ca02b02ef","README.md":"6d4ff5b079ac5340d18fa127f583e7ad793c5a2328b8ecd12c3fc723939804f2","build.rs":"aa971160d67ce8626b26e15c04c34b730f594c45c817aae34cfc9f3ea14ae284","src/bso/content.rs":"92935258745bdf0c3915a555cb6884a7fa69faa1290ec2c1815f6e2f3c0f0562","src/bso/crypto.rs":"27602dcccb37d3a55620ee4e16b705da455d49af575de115c7c79c0178eb1d6d","src/bso/mod.rs":"09e723dc7e99295ecafdcadffaf604d66ea27cf2b7f1fd9ab3cac4f4698ff6a7","src/bso/test_utils.rs":"4ec5a2df5e1c0ec14dc770681e959bdcef6ef04f6fde435999197f46a8ae4831","src/client/coll_state.rs":"13e6ef55273baf5536acc369be522e34a803a32cabf19cce43e426aea9b6223e","src/client/coll_update.rs":"dac04a90c29dd969f8b4250414609c9b6d61daf2dfa4ae77d1c4a165ba970b05","src/client/collection_keys.rs":"c27b2277a3a52033b58ab01490fc2ea7007494195dd5e6dc2c6931a4ca96795a","src/client/mod.rs":"8f588d4a035cf79d96f2500f06d5651c1a7c566127c456ffa5429811ddce3fd6","src/client/request.rs":"e878c5b43298b6eb682748474963f9fb8d053b4dc690bbb27107f5fa0ee74e01","src/client/state.rs":"4e31193ef2471c1dfabf1c6a391bcb95e14ddb45855786a4194ff187d5c9347c","src/client/status.rs":"f445a8765dac9789444e23b5145148413407bb1d18a15ef56682243997f591bf","src/client/storage_client.rs":"cc4a3219f342f8665399734902f68a2ddf12ed7e3726033ed10084bcefb66ffd","src/client/sync.rs":"b29abb512ec9d163f7883b71f78c9202802dcb17cad1fc5dc08087fb0bb66704","src/client/sync_multiple.rs":"6e92571132f89744b553190c596be8aff9b2d031d8f79d82c94cdf78b1683f4a","src/client/token.rs":"13729c693c8be72bcafc816c97e2a35932d008b4f2ccda6a5f8cdb8b2c99a293","src/client/util.rs":"71cc70ee41f821f53078675e636e9fad9c6046fa1a989e37f5487e340a2277d6","src/client_types.rs":"3c3cac1540b92482f43660d9e43bdde8481c4cc1a98253a68c80e791231f5976","src/clients_engine/engine.rs":"9e11b47be81fc63214f31879af74075674aa50a8f8989afe20fefa7990fa99b9","src/clients_engine/mod.rs":"461729e6f89b66b2cbd89b041a03d4d6a8ba582284ed4f3015cb13e1a0c6da97","src/clients_engine/record.rs":"b0d84bf420743d7638a45e4836633a45e50257d5548fe7ecd04bff4d724439b8","src/clients_engine/ser.rs":"be6a19c45eb8002ff8e7cf746d2f97d9cecd1740f9817a8f1d624825475fd777","src/device_type.rs":"dc2d4296d25e31471c8e68488f1043ff239b902036cd6aea8a686cf79b4ed335","src/enc_payload.rs":"aa3eea7df49b24cd59831680a47c417b73a3e36e6b0f3f4baf14ca66bd68be6b","src/engine/bridged_engine.rs":"b4e3071a0259ac55303364e57f9cd685916b80dc302030bba07790e55ceecb66","src/engine/mod.rs":"90f1f9760f5f712a337aebb04e59c736e4b6fbd89d6a188d969210c7f3f321ae","src/engine/request.rs":"5923025fb9550178339f880a1bf8526d8e853e7a0b2bce6d9d687cc808ac0085","src/engine/sync_engine.rs":"531b35d72ce9e04c3e543c0468c1e450fba2c0dc3d33d68d9b1c0a5c1ad7dd34","src/error.rs":"a45cfe02e6301f473c34678b694943c1a04308b8c292c6e0448bf495194c3b5e","src/key_bundle.rs":"abd0781f3be8c8e7c691f18bb71f3433b633803c48da9794e15ac6301ed60d6c","src/lib.rs":"f59f8817978d943518dfa03ab31fc0f6b1fc72ee9943a97aef1537e2769649f5","src/record_types.rs":"02bb3d352fb808131d298f9b90d9c95b7e9e0138b97c5401f3b9fdacc5562f44","src/server_timestamp.rs":"63916817796e83fe31fbd598bac025dfa71ec9e1808d09073db258c78a3331cd","src/sync15.udl":"005b2b056b93c959a04670f6f489afecb8e17093d8e4be34765a3a4cc0faeb8c","src/telemetry.rs":"1d06433aafe05b8d0c403ff6cb3bb35eec292f2cd6273d321eaa196fb6584dd6","uniffi.toml":"34488f947497a9b05007445dd816024ef02e6b1696f1056ee868f039722828ee"},"package":null}
|
|
@ -46,6 +46,9 @@ path = "../support/error"
|
|||
[dependencies.interrupt-support]
|
||||
path = "../support/interrupt"
|
||||
|
||||
[dependencies.payload-support]
|
||||
path = "../support/payload"
|
||||
|
||||
[dependencies.rc_crypto]
|
||||
path = "../support/rc_crypto"
|
||||
features = ["hawk"]
|
||||
|
|
|
@ -103,10 +103,10 @@ impl Default for InfoConfiguration {
|
|||
InfoConfiguration {
|
||||
max_request_bytes: default_max_request_bytes(),
|
||||
max_record_payload_bytes: default_max_record_payload_bytes(),
|
||||
max_post_records: usize::max_value(),
|
||||
max_post_bytes: usize::max_value(),
|
||||
max_total_records: usize::max_value(),
|
||||
max_total_bytes: usize::max_value(),
|
||||
max_post_records: usize::MAX,
|
||||
max_post_bytes: usize::MAX,
|
||||
max_total_records: usize::MAX,
|
||||
max_total_bytes: usize::MAX,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ pub enum Sync15ClientResponse<T> {
|
|||
fn parse_seconds(seconds_str: &str) -> Option<u32> {
|
||||
let secs = seconds_str.parse::<f64>().ok()?.ceil();
|
||||
// Note: u32 doesn't impl TryFrom<f64> :(
|
||||
if !secs.is_finite() || secs < 0.0 || secs > f64::from(u32::max_value()) {
|
||||
if !secs.is_finite() || secs < 0.0 || secs > f64::from(u32::MAX) {
|
||||
log::warn!("invalid backoff value: {}", secs);
|
||||
None
|
||||
} else {
|
||||
|
|
|
@ -3,66 +3,19 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::error::Result;
|
||||
use payload_support::Fit;
|
||||
use serde::Serialize;
|
||||
use std::io::{self, Write};
|
||||
|
||||
/// A writer that counts the number of bytes it's asked to write, and discards
|
||||
/// the data. Used to calculate the serialized size of the commands list.
|
||||
#[derive(Clone, Copy, Default)]
|
||||
pub struct WriteCount(usize);
|
||||
|
||||
impl WriteCount {
|
||||
#[inline]
|
||||
pub fn len(self) -> usize {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Write for WriteCount {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
self.0 += buf.len();
|
||||
Ok(buf.len())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the size of the given value, in bytes, when serialized to JSON.
|
||||
fn compute_serialized_size<T: Serialize>(value: &T) -> Result<usize> {
|
||||
let mut w = WriteCount::default();
|
||||
serde_json::to_writer(&mut w, value)?;
|
||||
Ok(w.len())
|
||||
}
|
||||
|
||||
/// Truncates `list` to fit within `payload_size_max_bytes` when serialized to
|
||||
/// JSON.
|
||||
pub fn shrink_to_fit<T: Serialize>(list: &mut Vec<T>, payload_size_max_bytes: usize) -> Result<()> {
|
||||
let size = compute_serialized_size(&list)?;
|
||||
// See bug 535326 comment 8 for an explanation of the estimation
|
||||
match ((payload_size_max_bytes / 4) * 3).checked_sub(1500) {
|
||||
Some(max_serialized_size) => {
|
||||
if size > max_serialized_size {
|
||||
// Estimate a little more than the direct fraction to maximize packing
|
||||
let cutoff = (list.len() * max_serialized_size - 1) / size + 1;
|
||||
list.truncate(cutoff + 1);
|
||||
// Keep dropping off the last entry until the data fits.
|
||||
while compute_serialized_size(&list)? > max_serialized_size {
|
||||
if list.pop().is_none() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
None => {
|
||||
list.clear();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
match payload_support::try_fit_items(list, payload_size_max_bytes) {
|
||||
Fit::All => {}
|
||||
Fit::Some(count) => list.truncate(count.get()),
|
||||
Fit::None => list.clear(),
|
||||
Fit::Err(e) => Err(e)?,
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -70,16 +23,6 @@ mod tests {
|
|||
use super::super::record::CommandRecord;
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_compute_serialized_size() {
|
||||
assert_eq!(compute_serialized_size(&1).unwrap(), 1);
|
||||
assert_eq!(compute_serialized_size(&"hi").unwrap(), 4);
|
||||
assert_eq!(
|
||||
compute_serialized_size(&["hi", "hello", "bye"]).unwrap(),
|
||||
20
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_shrink_to_fit() {
|
||||
let mut commands = vec![
|
||||
|
@ -104,12 +47,6 @@ mod tests {
|
|||
shrink_to_fit(&mut commands, 4096).unwrap();
|
||||
assert_eq!(commands.len(), 3);
|
||||
|
||||
let sizes = commands
|
||||
.iter()
|
||||
.map(|c| compute_serialized_size(c).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(sizes, &[61, 60, 30]);
|
||||
|
||||
// `logout` won't fit within 2168 bytes.
|
||||
shrink_to_fit(&mut commands, 2168).unwrap();
|
||||
assert_eq!(commands.len(), 2);
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
|
||||
/// The maximum number of whole milliseconds that can be represented in
|
||||
/// an `f64` without loss of precision.
|
||||
const MAX_FLOAT_MILLISECONDS: f64 = ((1u64 << f64::MANTISSA_DIGITS) - 1) as f64;
|
||||
|
||||
/// Typesafe way to manage server timestamps without accidentally mixing them up with
|
||||
/// local ones.
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Default)]
|
||||
|
@ -11,7 +15,7 @@ pub struct ServerTimestamp(pub i64);
|
|||
impl ServerTimestamp {
|
||||
pub fn from_float_seconds(ts: f64) -> Self {
|
||||
let rf = (ts * 1000.0).round();
|
||||
if !rf.is_finite() || rf < 0.0 || rf >= i64::max_value() as f64 {
|
||||
if !(0.0..=MAX_FLOAT_MILLISECONDS).contains(&rf) {
|
||||
error_support::report_error!("sync15-illegal-timestamp", "Illegal timestamp: {}", ts);
|
||||
ServerTimestamp(0)
|
||||
} else {
|
||||
|
|
|
@ -16,9 +16,9 @@ use serde::{ser, Serialize, Serializer};
|
|||
|
||||
// A test helper, used by the many test modules below.
|
||||
#[cfg(test)]
|
||||
fn assert_json<T: ?Sized>(v: &T, expected: serde_json::Value)
|
||||
fn assert_json<T>(v: &T, expected: serde_json::Value)
|
||||
where
|
||||
T: serde::Serialize,
|
||||
T: serde::Serialize + ?Sized,
|
||||
{
|
||||
assert_eq!(
|
||||
serde_json::to_value(v).expect("should get a value"),
|
||||
|
@ -36,6 +36,7 @@ struct WhenTook {
|
|||
|
||||
/// What we track while recording 'when' and 'took. It serializes as a WhenTook,
|
||||
/// except when .finished() hasn't been called, in which case it panics.
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug)]
|
||||
enum Stopwatch {
|
||||
Started(time::SystemTime, time::Instant),
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"a3efcca6f5de8ea2b6cda1a99e3aa8782362acbd13866503c9a70750292585f4","README.md":"c48b8f391ef822c4f3971b5f453a1e7b43bea232752d520460d2f04803aead1a","build.rs":"33e61b811b19ed2b58e319cc65d5988bed258d2c4fea2d706301184c59847a0f","src/error.rs":"2694657aeb12f99c4b2fe102ad2b08b79955d209201831b3e071129f0b7d7eda","src/lib.rs":"5789fc7107c76168c331c175aff4f0b2ac2ba3d65cfa0df0e1d4f8ef0c6eb80c","src/schema.rs":"510218d465c7d26d6b9f342cc33c14ab83044a67561ef924c33dadb060761972","src/storage.rs":"c5620d81cfafebc899b34d331ab249359c297745e977ae1416253008ff3ff8d3","src/store.rs":"7e93486b55af9b8e30f9dea9ea166e92993eeaa8bb15860edf25f034ab4c84d5","src/sync/bridge.rs":"18d3a7913a030b598d4b6cbd5b7e2ab4cef4cc7ea964f5bc84d7fb2f28787529","src/sync/engine.rs":"73007423f2a22314a034ac660aa65bd9c50e8aa850c445a66604486280067843","src/sync/mod.rs":"09ba3c87f1174a243bf5aaa481effd18929d54359ceb9b23ccb2c32ee3482f34","src/sync/record.rs":"eef6751c209d039958afbe245ddb006cfdf6b8b6b47f925f69c552b832b87922","src/tabs.udl":"b2918b26c982c3420346bad4c8de83fa039afcee5ab838c71048eae27240af8f","uniffi.toml":"f9125e8d55b109e86076ee88bfd640372f06b142b7db557e41816c7227dd445c"},"package":null}
|
||||
{"files":{"Cargo.toml":"a613b43ebf9e388395b51cc026dd08f0b6fdf04404eeaf3d8efcc1f59c9072bc","README.md":"c48b8f391ef822c4f3971b5f453a1e7b43bea232752d520460d2f04803aead1a","build.rs":"33e61b811b19ed2b58e319cc65d5988bed258d2c4fea2d706301184c59847a0f","src/error.rs":"2694657aeb12f99c4b2fe102ad2b08b79955d209201831b3e071129f0b7d7eda","src/lib.rs":"5789fc7107c76168c331c175aff4f0b2ac2ba3d65cfa0df0e1d4f8ef0c6eb80c","src/schema.rs":"510218d465c7d26d6b9f342cc33c14ab83044a67561ef924c33dadb060761972","src/storage.rs":"c9c970b7c040df96b37689d5e754a0f067979941677e55e8e02f5d64fcef4bdb","src/store.rs":"95ed09a93bc72327811f9c5826779ef4fe96d7f2c04a2382a96557746bf7b2f9","src/sync/bridge.rs":"18d3a7913a030b598d4b6cbd5b7e2ab4cef4cc7ea964f5bc84d7fb2f28787529","src/sync/engine.rs":"73007423f2a22314a034ac660aa65bd9c50e8aa850c445a66604486280067843","src/sync/mod.rs":"09ba3c87f1174a243bf5aaa481effd18929d54359ceb9b23ccb2c32ee3482f34","src/sync/record.rs":"eef6751c209d039958afbe245ddb006cfdf6b8b6b47f925f69c552b832b87922","src/tabs.udl":"b2918b26c982c3420346bad4c8de83fa039afcee5ab838c71048eae27240af8f","uniffi.toml":"f9125e8d55b109e86076ee88bfd640372f06b142b7db557e41816c7227dd445c"},"package":null}
|
|
@ -38,6 +38,9 @@ path = "../support/error"
|
|||
[dependencies.interrupt-support]
|
||||
path = "../support/interrupt"
|
||||
|
||||
[dependencies.payload-support]
|
||||
path = "../support/payload"
|
||||
|
||||
[dependencies.rusqlite]
|
||||
version = "0.31.0"
|
||||
features = [
|
||||
|
|
|
@ -169,7 +169,6 @@ impl TabsStorage {
|
|||
.collect();
|
||||
// Sort the tabs so when we trim tabs it's the oldest tabs
|
||||
sanitized_tabs.sort_by(|a, b| b.last_used.cmp(&a.last_used));
|
||||
// If trimming the tab length failed for some reason, just return the untrimmed tabs
|
||||
trim_tabs_length(&mut sanitized_tabs, MAX_PAYLOAD_SIZE);
|
||||
return Some(sanitized_tabs);
|
||||
}
|
||||
|
@ -270,8 +269,10 @@ impl TabsStorage {
|
|||
Ok(Some(conn)) => conn,
|
||||
};
|
||||
let pending_tabs_result: Result<Vec<(String, String)>> = conn.query_rows_and_then_cached(
|
||||
"SELECT device_id, url FROM remote_tab_commands",
|
||||
[],
|
||||
"SELECT device_id, url
|
||||
FROM remote_tab_commands
|
||||
WHERE command = :command_close_tab",
|
||||
rusqlite::named_params! { ":command_close_tab": CommandKind::CloseTab },
|
||||
|row| {
|
||||
Ok((
|
||||
row.get::<_, String>(0)?, // device_id
|
||||
|
@ -493,7 +494,7 @@ impl TabsStorage {
|
|||
let Some(conn) = self.open_if_exists()? else {
|
||||
return Ok(Vec::new());
|
||||
};
|
||||
let records: Vec<Option<PendingCommand>> = match conn.query_rows_and_then_cached(
|
||||
let result = conn.query_rows_and_then_cached(
|
||||
&format!(
|
||||
"SELECT device_id, command, url, time_requested, time_sent
|
||||
FROM remote_tab_commands
|
||||
|
@ -524,15 +525,14 @@ impl TabsStorage {
|
|||
},
|
||||
}))
|
||||
},
|
||||
) {
|
||||
Ok(records) => records,
|
||||
);
|
||||
Ok(match result {
|
||||
Ok(records) => records.into_iter().flatten().collect(),
|
||||
Err(e) => {
|
||||
error_support::report_error!("tabs-get_unsent", "Failed to read database: {}", e);
|
||||
return Ok(Vec::new());
|
||||
Vec::new()
|
||||
}
|
||||
};
|
||||
|
||||
Ok(records.into_iter().flatten().collect())
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_pending_command_sent(&mut self, command: &PendingCommand) -> Result<bool> {
|
||||
|
@ -589,11 +589,13 @@ impl TabsStorage {
|
|||
.get(&record.id)
|
||||
.and_then(|r| r.fxa_device_id.as_ref())
|
||||
.unwrap_or(&record.id);
|
||||
if let Some(url) = record.tabs.first().and_then(|tab| tab.url_history.first()) {
|
||||
conn.execute(
|
||||
"INSERT INTO new_remote_tabs (device_id, url) VALUES (?, ?)",
|
||||
rusqlite::params![fxa_id, url],
|
||||
)?;
|
||||
for tab in &record.tabs {
|
||||
if let Some(url) = tab.url_history.first() {
|
||||
conn.execute(
|
||||
"INSERT INTO new_remote_tabs (device_id, url) VALUES (?, ?)",
|
||||
rusqlite::params![fxa_id, url],
|
||||
)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -618,7 +620,7 @@ impl TabsStorage {
|
|||
conn.changes()
|
||||
);
|
||||
|
||||
// Anything that couldn't be removed above and is older than 24 hours
|
||||
// Anything that couldn't be removed above and is older than REMOTE_COMMAND_TTL_MS
|
||||
// is assumed not closeable and we can remove it from the list
|
||||
let sql = format!("
|
||||
DELETE FROM remote_tab_commands
|
||||
|
@ -667,28 +669,14 @@ impl ToSql for CommandKind {
|
|||
}
|
||||
}
|
||||
|
||||
// Trim the amount of tabs in a list to fit the specified memory size
|
||||
/// Trim the amount of tabs in a list to fit the specified memory size.
|
||||
/// If trimming the tab length fails for some reason, just return the untrimmed tabs.
|
||||
fn trim_tabs_length(tabs: &mut Vec<RemoteTab>, payload_size_max_bytes: usize) {
|
||||
// Ported from https://searchfox.org/mozilla-central/rev/84fb1c4511312a0b9187f647d90059e3a6dd27f8/services/sync/modules/util.sys.mjs#422
|
||||
// See bug 535326 comment 8 for an explanation of the estimation
|
||||
let max_serialized_size = (payload_size_max_bytes / 4) * 3 - 1500;
|
||||
let size = compute_serialized_size(tabs);
|
||||
if size > max_serialized_size {
|
||||
// Estimate a little more than the direct fraction to maximize packing
|
||||
let cutoff = (tabs.len() * max_serialized_size) / size;
|
||||
tabs.truncate(cutoff);
|
||||
|
||||
// Keep dropping off the last entry until the data fits.
|
||||
while compute_serialized_size(tabs) > max_serialized_size {
|
||||
tabs.pop();
|
||||
}
|
||||
if let Some(count) = payload_support::try_fit_items(tabs, payload_size_max_bytes).as_some() {
|
||||
tabs.truncate(count.get());
|
||||
}
|
||||
}
|
||||
|
||||
fn compute_serialized_size(v: &Vec<RemoteTab>) -> usize {
|
||||
serde_json::to_string(v).unwrap_or_default().len()
|
||||
}
|
||||
|
||||
// Similar to places/utils.js
|
||||
// This method ensures we safely truncate a string up to a certain max_len while
|
||||
// respecting char bounds to prevent rust panics. If we do end up truncating, we
|
||||
|
@ -724,6 +712,7 @@ fn is_url_syncable(url: &str) -> bool {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use payload_support::compute_serialized_size;
|
||||
use std::time::Duration;
|
||||
|
||||
use super::*;
|
||||
|
@ -938,14 +927,14 @@ mod tests {
|
|||
..Default::default()
|
||||
});
|
||||
}
|
||||
let tabs_mem_size = compute_serialized_size(&too_many_tabs);
|
||||
let tabs_mem_size = compute_serialized_size(&too_many_tabs).unwrap();
|
||||
// ensure we are definitely over the payload limit
|
||||
assert!(tabs_mem_size > MAX_PAYLOAD_SIZE);
|
||||
// Add our over-the-limit tabs to the local state
|
||||
storage.update_local_state(too_many_tabs.clone());
|
||||
// prepare_local_tabs_for_upload did the trimming we needed to get under payload size
|
||||
let tabs_to_upload = &storage.prepare_local_tabs_for_upload().unwrap();
|
||||
assert!(compute_serialized_size(tabs_to_upload) <= MAX_PAYLOAD_SIZE);
|
||||
assert!(compute_serialized_size(tabs_to_upload).unwrap() <= MAX_PAYLOAD_SIZE);
|
||||
}
|
||||
// Helper struct to model what's stored in the DB
|
||||
struct TabsSQLRecord {
|
||||
|
@ -1356,10 +1345,16 @@ mod tests {
|
|||
TabsRecord {
|
||||
id: "device-recent".to_string(),
|
||||
client_name: "".to_string(),
|
||||
tabs: vec![TabsRecordTab {
|
||||
url_history: vec!["https://example.com".to_string()],
|
||||
..Default::default()
|
||||
}],
|
||||
tabs: vec![
|
||||
TabsRecordTab {
|
||||
url_history: vec!["https://example99.com".to_string()],
|
||||
..Default::default()
|
||||
},
|
||||
TabsRecordTab {
|
||||
url_history: vec!["https://example.com".to_string()],
|
||||
..Default::default()
|
||||
},
|
||||
],
|
||||
},
|
||||
ServerTimestamp::default(),
|
||||
)];
|
||||
|
|
|
@ -30,10 +30,7 @@ impl TabsStore {
|
|||
|
||||
// like remote_tabs, but serves the uniffi layer
|
||||
pub fn get_all(&self) -> Vec<ClientRemoteTabs> {
|
||||
match self.remote_tabs() {
|
||||
Some(list) => list,
|
||||
None => vec![],
|
||||
}
|
||||
self.remote_tabs().unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn remote_tabs(&self) -> Option<Vec<ClientRemoteTabs>> {
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"f82da27595f8b63e143ea2a7dab3215d0084b16177c69a0664ea195b63990ab5","README.md":"7507842687c0a9f7146318fe1541183a2fdca65ec86aafb12207c994012ab15a","src/backend.rs":"22c313dd0ecbe92803219d3770bb97b3f876ed2fdc4ac8b5ac8dbea92b563e9f","src/backend/ffi.rs":"9ce49be773b2eb51aeef00a15e1d33f34e48e916c5e8b628fdc0ee7cc6d40e15","src/error.rs":"98ca92b58bd8b4f3c9d4c6d03ed235609d486fe8121277004283b9cfda6e3260","src/fetch_msg_types.proto":"de8a46a4947a140783a4d714364f18ccf02c4759d6ab5ace9da0b1c058efa6c3","src/headers.rs":"bf3cd6b717dfb337c64ce0bc6d275364181884378fc47afed7c80c435ce0733f","src/headers/name.rs":"dcfd4d42326724f822893cf6ac90f1e14734dba178150dcb606f4b19de5e66d7","src/lib.rs":"abddea31021b5743e4cc6d20c0bd89dc59b248a15405bf9717c79ed732950a35","src/mozilla.appservices.httpconfig.protobuf.rs":"9ede762489a0c07bc08a5b852b33013a410cb41b44b92a44555f85bb2db91412","src/settings.rs":"f62d0779d7b86af5daad0c23fb61a5982c11520e6fa528ebe2e2d6ad76e70afd"},"package":null}
|
||||
{"files":{"Cargo.toml":"f82da27595f8b63e143ea2a7dab3215d0084b16177c69a0664ea195b63990ab5","README.md":"7507842687c0a9f7146318fe1541183a2fdca65ec86aafb12207c994012ab15a","src/backend.rs":"22c313dd0ecbe92803219d3770bb97b3f876ed2fdc4ac8b5ac8dbea92b563e9f","src/backend/ffi.rs":"a1ccc25c3f52cc94718624d39c082c9c7e34082804bb12f0b96f5d3a064e0c54","src/error.rs":"98ca92b58bd8b4f3c9d4c6d03ed235609d486fe8121277004283b9cfda6e3260","src/fetch_msg_types.proto":"de8a46a4947a140783a4d714364f18ccf02c4759d6ab5ace9da0b1c058efa6c3","src/headers.rs":"bf3cd6b717dfb337c64ce0bc6d275364181884378fc47afed7c80c435ce0733f","src/headers/name.rs":"dcfd4d42326724f822893cf6ac90f1e14734dba178150dcb606f4b19de5e66d7","src/lib.rs":"abddea31021b5743e4cc6d20c0bd89dc59b248a15405bf9717c79ed732950a35","src/mozilla.appservices.httpconfig.protobuf.rs":"9ede762489a0c07bc08a5b852b33013a410cb41b44b92a44555f85bb2db91412","src/settings.rs":"f62d0779d7b86af5daad0c23fb61a5982c11520e6fa528ebe2e2d6ad76e70afd"},"package":null}
|
|
@ -67,7 +67,7 @@ impl Backend for FfiBackend {
|
|||
.status
|
||||
.ok_or_else(|| backend_error!("Missing HTTP status"))?;
|
||||
|
||||
if status < 0 || status > i32::from(u16::max_value()) {
|
||||
if status < 0 || status > i32::from(u16::MAX) {
|
||||
return Err(backend_error!("Illegal HTTP status: {}", status));
|
||||
}
|
||||
|
||||
|
|
|
@ -777,6 +777,40 @@ export class SuggestStoreBuilder {
|
|||
return handleRustResult(functionCall(), liftResult, liftError);
|
||||
}
|
||||
|
||||
loadExtension(libraryName,entrypoint) {
|
||||
const liftResult = (result) => FfiConverterTypeSuggestStoreBuilder.lift(result);
|
||||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
try {
|
||||
FfiConverterString.checkType(libraryName)
|
||||
} catch (e) {
|
||||
if (e instanceof UniFFITypeError) {
|
||||
e.addItemDescriptionPart("libraryName");
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
try {
|
||||
FfiConverterOptionalstring.checkType(entrypoint)
|
||||
} catch (e) {
|
||||
if (e instanceof UniFFITypeError) {
|
||||
e.addItemDescriptionPart("entrypoint");
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
27, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_load_extension
|
||||
FfiConverterTypeSuggestStoreBuilder.lower(this),
|
||||
FfiConverterString.lower(libraryName),
|
||||
FfiConverterOptionalstring.lower(entrypoint),
|
||||
)
|
||||
}
|
||||
try {
|
||||
return functionCall().then((result) => handleRustResult(result, liftResult, liftError));
|
||||
} catch (error) {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
}
|
||||
|
||||
remoteSettingsBucketName(bucketName) {
|
||||
const liftResult = (result) => FfiConverterTypeSuggestStoreBuilder.lift(result);
|
||||
const liftError = null;
|
||||
|
@ -790,7 +824,7 @@ export class SuggestStoreBuilder {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callSync(
|
||||
27, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name
|
||||
28, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name
|
||||
FfiConverterTypeSuggestStoreBuilder.lower(this),
|
||||
FfiConverterString.lower(bucketName),
|
||||
)
|
||||
|
@ -811,7 +845,7 @@ export class SuggestStoreBuilder {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callSync(
|
||||
28, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server
|
||||
29, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server
|
||||
FfiConverterTypeSuggestStoreBuilder.lower(this),
|
||||
FfiConverterTypeRemoteSettingsServer.lower(server),
|
||||
)
|
||||
|
@ -1451,6 +1485,30 @@ Suggestion.Weather = class extends Suggestion{
|
|||
this.score = score;
|
||||
}
|
||||
}
|
||||
Suggestion.Fakespot = class extends Suggestion{
|
||||
constructor(
|
||||
fakespotGrade,
|
||||
productId,
|
||||
rating,
|
||||
title,
|
||||
totalReviews,
|
||||
url,
|
||||
icon,
|
||||
iconMimetype,
|
||||
score
|
||||
) {
|
||||
super();
|
||||
this.fakespotGrade = fakespotGrade;
|
||||
this.productId = productId;
|
||||
this.rating = rating;
|
||||
this.title = title;
|
||||
this.totalReviews = totalReviews;
|
||||
this.url = url;
|
||||
this.icon = icon;
|
||||
this.iconMimetype = iconMimetype;
|
||||
this.score = score;
|
||||
}
|
||||
}
|
||||
|
||||
// Export the FFIConverter object to make external types work.
|
||||
export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
|
||||
|
@ -1520,6 +1578,18 @@ export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
|
|||
return new Suggestion.Weather(
|
||||
FfiConverterF64.read(dataStream)
|
||||
);
|
||||
case 8:
|
||||
return new Suggestion.Fakespot(
|
||||
FfiConverterString.read(dataStream),
|
||||
FfiConverterString.read(dataStream),
|
||||
FfiConverterF64.read(dataStream),
|
||||
FfiConverterString.read(dataStream),
|
||||
FfiConverterI64.read(dataStream),
|
||||
FfiConverterString.read(dataStream),
|
||||
FfiConverterOptionalSequenceu8.read(dataStream),
|
||||
FfiConverterOptionalstring.read(dataStream),
|
||||
FfiConverterF64.read(dataStream)
|
||||
);
|
||||
default:
|
||||
throw new UniFFITypeError("Unknown Suggestion variant");
|
||||
}
|
||||
|
@ -1597,6 +1667,19 @@ export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
|
|||
FfiConverterF64.write(dataStream, value.score);
|
||||
return;
|
||||
}
|
||||
if (value instanceof Suggestion.Fakespot) {
|
||||
dataStream.writeInt32(8);
|
||||
FfiConverterString.write(dataStream, value.fakespotGrade);
|
||||
FfiConverterString.write(dataStream, value.productId);
|
||||
FfiConverterF64.write(dataStream, value.rating);
|
||||
FfiConverterString.write(dataStream, value.title);
|
||||
FfiConverterI64.write(dataStream, value.totalReviews);
|
||||
FfiConverterString.write(dataStream, value.url);
|
||||
FfiConverterOptionalSequenceu8.write(dataStream, value.icon);
|
||||
FfiConverterOptionalstring.write(dataStream, value.iconMimetype);
|
||||
FfiConverterF64.write(dataStream, value.score);
|
||||
return;
|
||||
}
|
||||
throw new UniFFITypeError("Unknown Suggestion variant");
|
||||
}
|
||||
|
||||
|
@ -1667,6 +1750,18 @@ export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
|
|||
totalSize += FfiConverterF64.computeSize(value.score);
|
||||
return totalSize;
|
||||
}
|
||||
if (value instanceof Suggestion.Fakespot) {
|
||||
totalSize += FfiConverterString.computeSize(value.fakespotGrade);
|
||||
totalSize += FfiConverterString.computeSize(value.productId);
|
||||
totalSize += FfiConverterF64.computeSize(value.rating);
|
||||
totalSize += FfiConverterString.computeSize(value.title);
|
||||
totalSize += FfiConverterI64.computeSize(value.totalReviews);
|
||||
totalSize += FfiConverterString.computeSize(value.url);
|
||||
totalSize += FfiConverterOptionalSequenceu8.computeSize(value.icon);
|
||||
totalSize += FfiConverterOptionalstring.computeSize(value.iconMimetype);
|
||||
totalSize += FfiConverterF64.computeSize(value.score);
|
||||
return totalSize;
|
||||
}
|
||||
throw new UniFFITypeError("Unknown Suggestion variant");
|
||||
}
|
||||
|
||||
|
@ -1688,6 +1783,7 @@ export const SuggestionProvider = {
|
|||
MDN: 6,
|
||||
WEATHER: 7,
|
||||
AMP_MOBILE: 8,
|
||||
FAKESPOT: 9,
|
||||
};
|
||||
|
||||
Object.freeze(SuggestionProvider);
|
||||
|
@ -1711,6 +1807,8 @@ export class FfiConverterTypeSuggestionProvider extends FfiConverterArrayBuffer
|
|||
return SuggestionProvider.WEATHER
|
||||
case 8:
|
||||
return SuggestionProvider.AMP_MOBILE
|
||||
case 9:
|
||||
return SuggestionProvider.FAKESPOT
|
||||
default:
|
||||
throw new UniFFITypeError("Unknown SuggestionProvider variant");
|
||||
}
|
||||
|
@ -1749,6 +1847,10 @@ export class FfiConverterTypeSuggestionProvider extends FfiConverterArrayBuffer
|
|||
dataStream.writeInt32(8);
|
||||
return;
|
||||
}
|
||||
if (value === SuggestionProvider.FAKESPOT) {
|
||||
dataStream.writeInt32(9);
|
||||
return;
|
||||
}
|
||||
throw new UniFFITypeError("Unknown SuggestionProvider variant");
|
||||
}
|
||||
|
||||
|
@ -1757,7 +1859,7 @@ export class FfiConverterTypeSuggestionProvider extends FfiConverterArrayBuffer
|
|||
}
|
||||
|
||||
static checkType(value) {
|
||||
if (!Number.isInteger(value) || value < 1 || value > 8) {
|
||||
if (!Number.isInteger(value) || value < 1 || value > 9) {
|
||||
throw new UniFFITypeError(`${value} is not a valid value for SuggestionProvider`);
|
||||
}
|
||||
}
|
||||
|
@ -2234,7 +2336,7 @@ export function rawSuggestionUrlMatches(rawUrl,url) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callSync(
|
||||
29, // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
|
||||
30, // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
|
||||
FfiConverterString.lower(rawUrl),
|
||||
FfiConverterString.lower(url),
|
||||
)
|
||||
|
|
|
@ -397,7 +397,7 @@ export class RemoteCommandStore {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
31, // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command
|
||||
32, // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command
|
||||
FfiConverterTypeRemoteCommandStore.lower(this),
|
||||
FfiConverterString.lower(deviceId),
|
||||
FfiConverterTypeRemoteCommand.lower(command),
|
||||
|
@ -439,7 +439,7 @@ export class RemoteCommandStore {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
32, // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at
|
||||
33, // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at
|
||||
FfiConverterTypeRemoteCommandStore.lower(this),
|
||||
FfiConverterString.lower(deviceId),
|
||||
FfiConverterTypeRemoteCommand.lower(command),
|
||||
|
@ -458,7 +458,7 @@ export class RemoteCommandStore {
|
|||
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
33, // tabs:uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands
|
||||
34, // tabs:uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands
|
||||
FfiConverterTypeRemoteCommandStore.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ export class RemoteCommandStore {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
34, // tabs:uniffi_tabs_fn_method_remotecommandstore_remove_remote_command
|
||||
35, // tabs:uniffi_tabs_fn_method_remotecommandstore_remove_remote_command
|
||||
FfiConverterTypeRemoteCommandStore.lower(this),
|
||||
FfiConverterString.lower(deviceId),
|
||||
FfiConverterTypeRemoteCommand.lower(command),
|
||||
|
@ -516,7 +516,7 @@ export class RemoteCommandStore {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
35, // tabs:uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent
|
||||
36, // tabs:uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent
|
||||
FfiConverterTypeRemoteCommandStore.lower(this),
|
||||
FfiConverterTypePendingCommand.lower(command),
|
||||
)
|
||||
|
@ -578,7 +578,7 @@ export class TabsBridgedEngine {
|
|||
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
37, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
|
||||
38, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -602,7 +602,7 @@ export class TabsBridgedEngine {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
38, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
|
||||
39, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
FfiConverterString.lower(newSyncId),
|
||||
)
|
||||
|
@ -619,7 +619,7 @@ export class TabsBridgedEngine {
|
|||
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
39, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
|
||||
40, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -643,7 +643,7 @@ export class TabsBridgedEngine {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
40, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
|
||||
41, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
FfiConverterString.lower(clientData),
|
||||
)
|
||||
|
@ -660,7 +660,7 @@ export class TabsBridgedEngine {
|
|||
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
41, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
|
||||
42, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ export class TabsBridgedEngine {
|
|||
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
42, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
|
||||
43, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -700,7 +700,7 @@ export class TabsBridgedEngine {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
43, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
|
||||
44, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
FfiConverterI64.lower(lastSync),
|
||||
)
|
||||
|
@ -733,7 +733,7 @@ export class TabsBridgedEngine {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
44, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
|
||||
45, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
FfiConverterI64.lower(newTimestamp),
|
||||
FfiConverterSequenceTypeTabsGuid.lower(uploadedIds),
|
||||
|
@ -759,7 +759,7 @@ export class TabsBridgedEngine {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
45, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
|
||||
46, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
FfiConverterSequencestring.lower(incomingEnvelopesAsJson),
|
||||
)
|
||||
|
@ -776,7 +776,7 @@ export class TabsBridgedEngine {
|
|||
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
46, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
|
||||
47, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -792,7 +792,7 @@ export class TabsBridgedEngine {
|
|||
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
47, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
|
||||
48, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -808,7 +808,7 @@ export class TabsBridgedEngine {
|
|||
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
48, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
|
||||
49, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -824,7 +824,7 @@ export class TabsBridgedEngine {
|
|||
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
49, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
|
||||
50, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
|
||||
FfiConverterTypeTabsBridgedEngine.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -898,7 +898,7 @@ export class TabsStore {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
51, // tabs:uniffi_tabs_fn_constructor_tabsstore_new
|
||||
52, // tabs:uniffi_tabs_fn_constructor_tabsstore_new
|
||||
FfiConverterString.lower(path),
|
||||
)
|
||||
}
|
||||
|
@ -913,7 +913,7 @@ export class TabsStore {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
52, // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
|
||||
53, // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
|
||||
FfiConverterTypeTabsStore.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -929,7 +929,7 @@ export class TabsStore {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
53, // tabs:uniffi_tabs_fn_method_tabsstore_get_all
|
||||
54, // tabs:uniffi_tabs_fn_method_tabsstore_get_all
|
||||
FfiConverterTypeTabsStore.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -945,7 +945,7 @@ export class TabsStore {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
54, // tabs:uniffi_tabs_fn_method_tabsstore_new_remote_command_store
|
||||
55, // tabs:uniffi_tabs_fn_method_tabsstore_new_remote_command_store
|
||||
FfiConverterTypeTabsStore.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -961,7 +961,7 @@ export class TabsStore {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
55, // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
|
||||
56, // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
|
||||
FfiConverterTypeTabsStore.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ export class TabsStore {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
56, // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
|
||||
57, // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
|
||||
FfiConverterTypeTabsStore.lower(this),
|
||||
FfiConverterSequenceTypeRemoteTabRecord.lower(remoteTabs),
|
||||
)
|
||||
|
|
|
@ -377,7 +377,7 @@ export function add(a,b) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
57, // arithmetic:uniffi_arithmetical_fn_func_add
|
||||
58, // arithmetic:uniffi_arithmetical_fn_func_add
|
||||
FfiConverterU64.lower(a),
|
||||
FfiConverterU64.lower(b),
|
||||
)
|
||||
|
@ -411,7 +411,7 @@ export function div(dividend,divisor) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
58, // arithmetic:uniffi_arithmetical_fn_func_div
|
||||
59, // arithmetic:uniffi_arithmetical_fn_func_div
|
||||
FfiConverterU64.lower(dividend),
|
||||
FfiConverterU64.lower(divisor),
|
||||
)
|
||||
|
@ -445,7 +445,7 @@ export function equal(a,b) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
59, // arithmetic:uniffi_arithmetical_fn_func_equal
|
||||
60, // arithmetic:uniffi_arithmetical_fn_func_equal
|
||||
FfiConverterU64.lower(a),
|
||||
FfiConverterU64.lower(b),
|
||||
)
|
||||
|
@ -479,7 +479,7 @@ export function sub(a,b) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
60, // arithmetic:uniffi_arithmetical_fn_func_sub
|
||||
61, // arithmetic:uniffi_arithmetical_fn_func_sub
|
||||
FfiConverterU64.lower(a),
|
||||
FfiConverterU64.lower(b),
|
||||
)
|
||||
|
|
|
@ -455,7 +455,7 @@ export function getCustomTypesDemo(demo) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
61, // custom_types:uniffi_uniffi_custom_types_fn_func_get_custom_types_demo
|
||||
62, // custom_types:uniffi_uniffi_custom_types_fn_func_get_custom_types_demo
|
||||
FfiConverterOptionalTypeCustomTypesDemo.lower(demo),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -381,7 +381,7 @@ export function gradient(value) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
62, // external_types:uniffi_uniffi_fixture_external_types_fn_func_gradient
|
||||
63, // external_types:uniffi_uniffi_fixture_external_types_fn_func_gradient
|
||||
FfiConverterOptionalTypeLine.lower(value),
|
||||
)
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ export function intersection(ln1,ln2) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
63, // external_types:uniffi_uniffi_fixture_external_types_fn_func_intersection
|
||||
64, // external_types:uniffi_uniffi_fixture_external_types_fn_func_intersection
|
||||
FfiConverterTypeLine.lower(ln1),
|
||||
FfiConverterTypeLine.lower(ln2),
|
||||
)
|
||||
|
|
|
@ -474,7 +474,7 @@ export function gradient(ln) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
68, // geometry:uniffi_uniffi_geometry_fn_func_gradient
|
||||
69, // geometry:uniffi_uniffi_geometry_fn_func_gradient
|
||||
FfiConverterTypeLine.lower(ln),
|
||||
)
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ export function intersection(ln1,ln2) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
69, // geometry:uniffi_uniffi_geometry_fn_func_intersection
|
||||
70, // geometry:uniffi_uniffi_geometry_fn_func_intersection
|
||||
FfiConverterTypeLine.lower(ln1),
|
||||
FfiConverterTypeLine.lower(ln2),
|
||||
)
|
||||
|
|
|
@ -321,7 +321,7 @@ export class SingletonObject {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callSync(
|
||||
65, // refcounts:uniffi_uniffi_fixture_refcounts_fn_method_singletonobject_method
|
||||
66, // refcounts:uniffi_uniffi_fixture_refcounts_fn_method_singletonobject_method
|
||||
FfiConverterTypeSingletonObject.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ export function getJsRefcount() {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callSync(
|
||||
66, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_js_refcount
|
||||
67, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_js_refcount
|
||||
)
|
||||
}
|
||||
return handleRustResult(functionCall(), liftResult, liftError);
|
||||
|
@ -381,7 +381,7 @@ export function getSingleton() {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callSync(
|
||||
67, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_singleton
|
||||
68, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_singleton
|
||||
)
|
||||
}
|
||||
return handleRustResult(functionCall(), liftResult, liftError);
|
||||
|
|
|
@ -620,7 +620,7 @@ export class Optionneur {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
71, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_optionneur_new
|
||||
72, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_optionneur_new
|
||||
)
|
||||
}
|
||||
try {
|
||||
|
@ -642,7 +642,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
72, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_boolean
|
||||
73, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_boolean
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterBool.lower(value),
|
||||
)
|
||||
|
@ -667,7 +667,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
73, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_enum
|
||||
74, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_enum
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterTypeEnumeration.lower(value),
|
||||
)
|
||||
|
@ -692,7 +692,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
74, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f32
|
||||
75, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f32
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterF32.lower(value),
|
||||
)
|
||||
|
@ -717,7 +717,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
75, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f64
|
||||
76, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f64
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterF64.lower(value),
|
||||
)
|
||||
|
@ -742,7 +742,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
76, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec
|
||||
77, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterI16.lower(value),
|
||||
)
|
||||
|
@ -767,7 +767,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
77, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex
|
||||
78, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterI16.lower(value),
|
||||
)
|
||||
|
@ -792,7 +792,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
78, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec
|
||||
79, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterI32.lower(value),
|
||||
)
|
||||
|
@ -817,7 +817,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
79, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex
|
||||
80, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterI32.lower(value),
|
||||
)
|
||||
|
@ -842,7 +842,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
80, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec
|
||||
81, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterI64.lower(value),
|
||||
)
|
||||
|
@ -867,7 +867,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
81, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex
|
||||
82, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterI64.lower(value),
|
||||
)
|
||||
|
@ -892,7 +892,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
82, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec
|
||||
83, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterI8.lower(value),
|
||||
)
|
||||
|
@ -917,7 +917,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
83, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex
|
||||
84, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterI8.lower(value),
|
||||
)
|
||||
|
@ -942,7 +942,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
84, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_null
|
||||
85, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_null
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterOptionalstring.lower(value),
|
||||
)
|
||||
|
@ -967,7 +967,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
85, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_sequence
|
||||
86, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_sequence
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterSequencestring.lower(value),
|
||||
)
|
||||
|
@ -992,7 +992,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
86, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_string
|
||||
87, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_string
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterString.lower(value),
|
||||
)
|
||||
|
@ -1017,7 +1017,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
87, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec
|
||||
88, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterU16.lower(value),
|
||||
)
|
||||
|
@ -1042,7 +1042,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
88, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex
|
||||
89, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterU16.lower(value),
|
||||
)
|
||||
|
@ -1067,7 +1067,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
89, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec
|
||||
90, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterU32.lower(value),
|
||||
)
|
||||
|
@ -1092,7 +1092,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
90, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex
|
||||
91, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterU32.lower(value),
|
||||
)
|
||||
|
@ -1117,7 +1117,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
91, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct
|
||||
92, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterU32.lower(value),
|
||||
)
|
||||
|
@ -1142,7 +1142,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
92, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec
|
||||
93, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterU64.lower(value),
|
||||
)
|
||||
|
@ -1167,7 +1167,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
93, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex
|
||||
94, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterU64.lower(value),
|
||||
)
|
||||
|
@ -1192,7 +1192,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
94, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec
|
||||
95, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterU8.lower(value),
|
||||
)
|
||||
|
@ -1217,7 +1217,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
95, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex
|
||||
96, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterU8.lower(value),
|
||||
)
|
||||
|
@ -1242,7 +1242,7 @@ export class Optionneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
96, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_zero
|
||||
97, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_zero
|
||||
FfiConverterTypeOptionneur.lower(this),
|
||||
FfiConverterOptionali32.lower(value),
|
||||
)
|
||||
|
@ -1309,7 +1309,7 @@ export class Retourneur {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
98, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_retourneur_new
|
||||
99, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_retourneur_new
|
||||
)
|
||||
}
|
||||
try {
|
||||
|
@ -1331,7 +1331,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
99, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_boolean
|
||||
100, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_boolean
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterBool.lower(value),
|
||||
)
|
||||
|
@ -1356,7 +1356,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
100, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_double
|
||||
101, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_double
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterF64.lower(value),
|
||||
)
|
||||
|
@ -1381,7 +1381,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
101, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_float
|
||||
102, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_float
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterF32.lower(value),
|
||||
)
|
||||
|
@ -1406,7 +1406,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
102, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i16
|
||||
103, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i16
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterI16.lower(value),
|
||||
)
|
||||
|
@ -1431,7 +1431,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
103, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i32
|
||||
104, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i32
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterI32.lower(value),
|
||||
)
|
||||
|
@ -1456,7 +1456,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
104, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i64
|
||||
105, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i64
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterI64.lower(value),
|
||||
)
|
||||
|
@ -1481,7 +1481,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
105, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i8
|
||||
106, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i8
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterI8.lower(value),
|
||||
)
|
||||
|
@ -1506,7 +1506,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
106, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres
|
||||
107, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterTypeDictionnaireNombres.lower(value),
|
||||
)
|
||||
|
@ -1531,7 +1531,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
107, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes
|
||||
108, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterTypeDictionnaireNombresSignes.lower(value),
|
||||
)
|
||||
|
@ -1556,7 +1556,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
108, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire
|
||||
109, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterTypeOptionneurDictionnaire.lower(value),
|
||||
)
|
||||
|
@ -1581,7 +1581,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
109, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_string
|
||||
110, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_string
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterString.lower(value),
|
||||
)
|
||||
|
@ -1606,7 +1606,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
110, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u16
|
||||
111, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u16
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterU16.lower(value),
|
||||
)
|
||||
|
@ -1631,7 +1631,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
111, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u32
|
||||
112, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u32
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterU32.lower(value),
|
||||
)
|
||||
|
@ -1656,7 +1656,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
112, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u64
|
||||
113, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u64
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterU64.lower(value),
|
||||
)
|
||||
|
@ -1681,7 +1681,7 @@ export class Retourneur {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
113, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u8
|
||||
114, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u8
|
||||
FfiConverterTypeRetourneur.lower(this),
|
||||
FfiConverterU8.lower(value),
|
||||
)
|
||||
|
@ -1748,7 +1748,7 @@ export class Stringifier {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
115, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_stringifier_new
|
||||
116, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_stringifier_new
|
||||
)
|
||||
}
|
||||
try {
|
||||
|
@ -1770,7 +1770,7 @@ export class Stringifier {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
116, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_boolean
|
||||
117, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_boolean
|
||||
FfiConverterTypeStringifier.lower(this),
|
||||
FfiConverterBool.lower(value),
|
||||
)
|
||||
|
@ -1795,7 +1795,7 @@ export class Stringifier {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
117, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_double
|
||||
118, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_double
|
||||
FfiConverterTypeStringifier.lower(this),
|
||||
FfiConverterF64.lower(value),
|
||||
)
|
||||
|
@ -1820,7 +1820,7 @@ export class Stringifier {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
118, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_float
|
||||
119, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_float
|
||||
FfiConverterTypeStringifier.lower(this),
|
||||
FfiConverterF32.lower(value),
|
||||
)
|
||||
|
@ -1845,7 +1845,7 @@ export class Stringifier {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
119, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i16
|
||||
120, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i16
|
||||
FfiConverterTypeStringifier.lower(this),
|
||||
FfiConverterI16.lower(value),
|
||||
)
|
||||
|
@ -1870,7 +1870,7 @@ export class Stringifier {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
120, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i32
|
||||
121, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i32
|
||||
FfiConverterTypeStringifier.lower(this),
|
||||
FfiConverterI32.lower(value),
|
||||
)
|
||||
|
@ -1895,7 +1895,7 @@ export class Stringifier {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
121, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i64
|
||||
122, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i64
|
||||
FfiConverterTypeStringifier.lower(this),
|
||||
FfiConverterI64.lower(value),
|
||||
)
|
||||
|
@ -1920,7 +1920,7 @@ export class Stringifier {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
122, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i8
|
||||
123, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i8
|
||||
FfiConverterTypeStringifier.lower(this),
|
||||
FfiConverterI8.lower(value),
|
||||
)
|
||||
|
@ -1945,7 +1945,7 @@ export class Stringifier {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
123, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u16
|
||||
124, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u16
|
||||
FfiConverterTypeStringifier.lower(this),
|
||||
FfiConverterU16.lower(value),
|
||||
)
|
||||
|
@ -1970,7 +1970,7 @@ export class Stringifier {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
124, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u32
|
||||
125, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u32
|
||||
FfiConverterTypeStringifier.lower(this),
|
||||
FfiConverterU32.lower(value),
|
||||
)
|
||||
|
@ -1995,7 +1995,7 @@ export class Stringifier {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
125, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u64
|
||||
126, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u64
|
||||
FfiConverterTypeStringifier.lower(this),
|
||||
FfiConverterU64.lower(value),
|
||||
)
|
||||
|
@ -2020,7 +2020,7 @@ export class Stringifier {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
126, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u8
|
||||
127, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u8
|
||||
FfiConverterTypeStringifier.lower(this),
|
||||
FfiConverterU8.lower(value),
|
||||
)
|
||||
|
@ -2045,7 +2045,7 @@ export class Stringifier {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
127, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_well_known_string
|
||||
128, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_well_known_string
|
||||
FfiConverterTypeStringifier.lower(this),
|
||||
FfiConverterString.lower(value),
|
||||
)
|
||||
|
@ -3284,7 +3284,7 @@ export function copieCarte(c) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
128, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_carte
|
||||
129, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_carte
|
||||
FfiConverterMapStringTypeEnumerationAvecDonnees.lower(c),
|
||||
)
|
||||
}
|
||||
|
@ -3309,7 +3309,7 @@ export function copieDictionnaire(d) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
129, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_dictionnaire
|
||||
130, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_dictionnaire
|
||||
FfiConverterTypeDictionnaire.lower(d),
|
||||
)
|
||||
}
|
||||
|
@ -3334,7 +3334,7 @@ export function copieEnumeration(e) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
130, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumeration
|
||||
131, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumeration
|
||||
FfiConverterTypeEnumeration.lower(e),
|
||||
)
|
||||
}
|
||||
|
@ -3359,7 +3359,7 @@ export function copieEnumerations(e) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
131, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumerations
|
||||
132, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumerations
|
||||
FfiConverterSequenceTypeEnumeration.lower(e),
|
||||
)
|
||||
}
|
||||
|
@ -3384,7 +3384,7 @@ export function switcheroo(b) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
132, // rondpoint:uniffi_uniffi_rondpoint_fn_func_switcheroo
|
||||
133, // rondpoint:uniffi_uniffi_rondpoint_fn_func_switcheroo
|
||||
FfiConverterBool.lower(b),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -325,7 +325,7 @@ export class Sprite {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
134, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new
|
||||
135, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new
|
||||
FfiConverterOptionalTypePoint.lower(initialPosition),
|
||||
)
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ export class Sprite {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
135, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new_relative_to
|
||||
136, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new_relative_to
|
||||
FfiConverterTypePoint.lower(reference),
|
||||
FfiConverterTypeVector.lower(direction),
|
||||
)
|
||||
|
@ -377,7 +377,7 @@ export class Sprite {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
136, // sprites:uniffi_uniffi_sprites_fn_method_sprite_get_position
|
||||
137, // sprites:uniffi_uniffi_sprites_fn_method_sprite_get_position
|
||||
FfiConverterTypeSprite.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ export class Sprite {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
137, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_by
|
||||
138, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_by
|
||||
FfiConverterTypeSprite.lower(this),
|
||||
FfiConverterTypeVector.lower(direction),
|
||||
)
|
||||
|
@ -426,7 +426,7 @@ export class Sprite {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
138, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_to
|
||||
139, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_to
|
||||
FfiConverterTypeSprite.lower(this),
|
||||
FfiConverterTypePoint.lower(position),
|
||||
)
|
||||
|
@ -678,7 +678,7 @@ export function translate(position,direction) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
139, // sprites:uniffi_uniffi_sprites_fn_func_translate
|
||||
140, // sprites:uniffi_uniffi_sprites_fn_func_translate
|
||||
FfiConverterTypePoint.lower(position),
|
||||
FfiConverterTypeVector.lower(direction),
|
||||
)
|
||||
|
|
|
@ -298,7 +298,7 @@ export class TodoList {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
141, // todolist:uniffi_uniffi_todolist_fn_constructor_todolist_new
|
||||
142, // todolist:uniffi_uniffi_todolist_fn_constructor_todolist_new
|
||||
)
|
||||
}
|
||||
try {
|
||||
|
@ -320,7 +320,7 @@ export class TodoList {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
142, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entries
|
||||
143, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entries
|
||||
FfiConverterTypeTodoList.lower(this),
|
||||
FfiConverterSequenceTypeTodoEntry.lower(entries),
|
||||
)
|
||||
|
@ -345,7 +345,7 @@ export class TodoList {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
143, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entry
|
||||
144, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entry
|
||||
FfiConverterTypeTodoList.lower(this),
|
||||
FfiConverterTypeTodoEntry.lower(entry),
|
||||
)
|
||||
|
@ -370,7 +370,7 @@ export class TodoList {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
144, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_item
|
||||
145, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_item
|
||||
FfiConverterTypeTodoList.lower(this),
|
||||
FfiConverterString.lower(todo),
|
||||
)
|
||||
|
@ -395,7 +395,7 @@ export class TodoList {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
145, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_items
|
||||
146, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_items
|
||||
FfiConverterTypeTodoList.lower(this),
|
||||
FfiConverterSequencestring.lower(items),
|
||||
)
|
||||
|
@ -420,7 +420,7 @@ export class TodoList {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
146, // todolist:uniffi_uniffi_todolist_fn_method_todolist_clear_item
|
||||
147, // todolist:uniffi_uniffi_todolist_fn_method_todolist_clear_item
|
||||
FfiConverterTypeTodoList.lower(this),
|
||||
FfiConverterString.lower(todo),
|
||||
)
|
||||
|
@ -437,7 +437,7 @@ export class TodoList {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
147, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_entries
|
||||
148, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_entries
|
||||
FfiConverterTypeTodoList.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ export class TodoList {
|
|||
const liftError = (data) => FfiConverterTypeTodoError.lift(data);
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
148, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_first
|
||||
149, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_first
|
||||
FfiConverterTypeTodoList.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ export class TodoList {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
149, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_items
|
||||
150, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_items
|
||||
FfiConverterTypeTodoList.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ export class TodoList {
|
|||
const liftError = (data) => FfiConverterTypeTodoError.lift(data);
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
150, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last
|
||||
151, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last
|
||||
FfiConverterTypeTodoList.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ export class TodoList {
|
|||
const liftError = (data) => FfiConverterTypeTodoError.lift(data);
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
151, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last_entry
|
||||
152, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last_entry
|
||||
FfiConverterTypeTodoList.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ export class TodoList {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
152, // todolist:uniffi_uniffi_todolist_fn_method_todolist_make_default
|
||||
153, // todolist:uniffi_uniffi_todolist_fn_method_todolist_make_default
|
||||
FfiConverterTypeTodoList.lower(this),
|
||||
)
|
||||
}
|
||||
|
@ -880,7 +880,7 @@ export function createEntryWith(todo) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
153, // todolist:uniffi_uniffi_todolist_fn_func_create_entry_with
|
||||
154, // todolist:uniffi_uniffi_todolist_fn_func_create_entry_with
|
||||
FfiConverterString.lower(todo),
|
||||
)
|
||||
}
|
||||
|
@ -897,7 +897,7 @@ export function getDefaultList() {
|
|||
const liftError = null;
|
||||
const functionCall = () => {
|
||||
return UniFFIScaffolding.callAsync(
|
||||
154, // todolist:uniffi_uniffi_todolist_fn_func_get_default_list
|
||||
155, // todolist:uniffi_uniffi_todolist_fn_func_get_default_list
|
||||
)
|
||||
}
|
||||
try {
|
||||
|
@ -921,7 +921,7 @@ export function setDefaultList(list) {
|
|||
throw e;
|
||||
}
|
||||
return UniFFIScaffolding.callAsync(
|
||||
155, // todolist:uniffi_uniffi_todolist_fn_func_set_default_list
|
||||
156, // todolist:uniffi_uniffi_todolist_fn_func_set_default_list
|
||||
FfiConverterTypeTodoList.lower(list),
|
||||
)
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -55,6 +55,7 @@ extern "C" {
|
|||
void * uniffi_suggest_fn_method_suggeststorebuilder_build(void *, RustCallStatus*);
|
||||
void * uniffi_suggest_fn_method_suggeststorebuilder_cache_path(void *, RustBuffer, RustCallStatus*);
|
||||
void * uniffi_suggest_fn_method_suggeststorebuilder_data_path(void *, RustBuffer, RustCallStatus*);
|
||||
void * uniffi_suggest_fn_method_suggeststorebuilder_load_extension(void *, RustBuffer, RustBuffer, RustCallStatus*);
|
||||
void * uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name(void *, RustBuffer, RustCallStatus*);
|
||||
void * uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server(void *, RustBuffer, RustCallStatus*);
|
||||
int8_t uniffi_suggest_fn_func_raw_suggestion_url_matches(RustBuffer, RustBuffer, RustCallStatus*);
|
||||
|
@ -248,123 +249,127 @@ Maybe<already_AddRefed<Promise>> UniFFICallAsync(const GlobalObject& aGlobal, ui
|
|||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststorebuilder_data_path, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststorebuilder_data_path: "_ns, aError));
|
||||
}
|
||||
case 27: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name
|
||||
case 27: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_load_extension
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststorebuilder_load_extension, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststorebuilder_load_extension: "_ns, aError));
|
||||
}
|
||||
case 28: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name: "_ns, aError));
|
||||
}
|
||||
case 28: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server
|
||||
case 29: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server: "_ns, aError));
|
||||
}
|
||||
case 29: { // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
|
||||
case 30: { // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int8_t>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_suggest_fn_func_raw_suggestion_url_matches, aGlobal, aArgs, "uniffi_suggest_fn_func_raw_suggestion_url_matches: "_ns, aError));
|
||||
}
|
||||
case 30: { // tabs:uniffi_tabs_fn_clone_remotecommandstore
|
||||
case 31: { // tabs:uniffi_tabs_fn_clone_remotecommandstore
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>, ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_clone_remotecommandstore, aGlobal, aArgs, "uniffi_tabs_fn_clone_remotecommandstore: "_ns, aError));
|
||||
}
|
||||
case 31: { // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command
|
||||
case 32: { // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int8_t>, ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_remotecommandstore_add_remote_command, aGlobal, aArgs, "uniffi_tabs_fn_method_remotecommandstore_add_remote_command: "_ns, aError));
|
||||
}
|
||||
case 32: { // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at
|
||||
case 33: { // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int8_t>, ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<int64_t>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at, aGlobal, aArgs, "uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at: "_ns, aError));
|
||||
}
|
||||
case 33: { // tabs:uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands
|
||||
case 34: { // tabs:uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands, aGlobal, aArgs, "uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands: "_ns, aError));
|
||||
}
|
||||
case 34: { // tabs:uniffi_tabs_fn_method_remotecommandstore_remove_remote_command
|
||||
case 35: { // tabs:uniffi_tabs_fn_method_remotecommandstore_remove_remote_command
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int8_t>, ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_remotecommandstore_remove_remote_command, aGlobal, aArgs, "uniffi_tabs_fn_method_remotecommandstore_remove_remote_command: "_ns, aError));
|
||||
}
|
||||
case 35: { // tabs:uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent
|
||||
case 36: { // tabs:uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int8_t>, ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent, aGlobal, aArgs, "uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent: "_ns, aError));
|
||||
}
|
||||
case 36: { // tabs:uniffi_tabs_fn_clone_tabsbridgedengine
|
||||
case 37: { // tabs:uniffi_tabs_fn_clone_tabsbridgedengine
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_clone_tabsbridgedengine, aGlobal, aArgs, "uniffi_tabs_fn_clone_tabsbridgedengine: "_ns, aError));
|
||||
}
|
||||
case 37: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
|
||||
case 38: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_apply, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_apply: "_ns, aError));
|
||||
}
|
||||
case 38: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
|
||||
case 39: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id: "_ns, aError));
|
||||
}
|
||||
case 39: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
|
||||
case 40: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int64_t>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_last_sync, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_last_sync: "_ns, aError));
|
||||
}
|
||||
case 40: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
|
||||
case 41: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync: "_ns, aError));
|
||||
}
|
||||
case 41: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
|
||||
case 42: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_reset, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_reset: "_ns, aError));
|
||||
}
|
||||
case 42: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
|
||||
case 43: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id: "_ns, aError));
|
||||
}
|
||||
case 43: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
|
||||
case 44: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<int64_t>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync: "_ns, aError));
|
||||
}
|
||||
case 44: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
|
||||
case 45: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<int64_t>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded: "_ns, aError));
|
||||
}
|
||||
case 45: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
|
||||
case 46: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_store_incoming, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_store_incoming: "_ns, aError));
|
||||
}
|
||||
case 46: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
|
||||
case 47: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_sync_finished, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_sync_finished: "_ns, aError));
|
||||
}
|
||||
case 47: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
|
||||
case 48: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_sync_id, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_sync_id: "_ns, aError));
|
||||
}
|
||||
case 48: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
|
||||
case 49: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_sync_started, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_sync_started: "_ns, aError));
|
||||
}
|
||||
case 49: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
|
||||
case 50: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_wipe, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_wipe: "_ns, aError));
|
||||
}
|
||||
case 50: { // tabs:uniffi_tabs_fn_clone_tabsstore
|
||||
case 51: { // tabs:uniffi_tabs_fn_clone_tabsstore
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsTabsStorePointerType>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_clone_tabsstore, aGlobal, aArgs, "uniffi_tabs_fn_clone_tabsstore: "_ns, aError));
|
||||
}
|
||||
case 51: { // tabs:uniffi_tabs_fn_constructor_tabsstore_new
|
||||
case 52: { // tabs:uniffi_tabs_fn_constructor_tabsstore_new
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsTabsStorePointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_constructor_tabsstore_new, aGlobal, aArgs, "uniffi_tabs_fn_constructor_tabsstore_new: "_ns, aError));
|
||||
}
|
||||
case 52: { // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
|
||||
case 53: { // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsstore_bridged_engine, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsstore_bridged_engine: "_ns, aError));
|
||||
}
|
||||
case 53: { // tabs:uniffi_tabs_fn_method_tabsstore_get_all
|
||||
case 54: { // tabs:uniffi_tabs_fn_method_tabsstore_get_all
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsstore_get_all, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsstore_get_all: "_ns, aError));
|
||||
}
|
||||
case 54: { // tabs:uniffi_tabs_fn_method_tabsstore_new_remote_command_store
|
||||
case 55: { // tabs:uniffi_tabs_fn_method_tabsstore_new_remote_command_store
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsstore_new_remote_command_store, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsstore_new_remote_command_store: "_ns, aError));
|
||||
}
|
||||
case 55: { // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
|
||||
case 56: { // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsstore_register_with_sync_manager, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsstore_register_with_sync_manager: "_ns, aError));
|
||||
}
|
||||
case 56: { // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
|
||||
case 57: { // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsstore_set_local_tabs, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsstore_set_local_tabs: "_ns, aError));
|
||||
}
|
||||
|
@ -509,152 +514,157 @@ bool UniFFICallSync(const GlobalObject& aGlobal, uint64_t aId, const Sequence<Un
|
|||
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststorebuilder_data_path, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststorebuilder_data_path: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 27: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name
|
||||
case 27: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_load_extension
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststorebuilder_load_extension, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststorebuilder_load_extension: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 28: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 28: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server
|
||||
case 29: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 29: { // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
|
||||
case 30: { // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int8_t>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_suggest_fn_func_raw_suggestion_url_matches, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_func_raw_suggestion_url_matches: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 30: { // tabs:uniffi_tabs_fn_clone_remotecommandstore
|
||||
case 31: { // tabs:uniffi_tabs_fn_clone_remotecommandstore
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>, ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_clone_remotecommandstore, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_clone_remotecommandstore: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 31: { // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command
|
||||
case 32: { // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int8_t>, ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_remotecommandstore_add_remote_command, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_remotecommandstore_add_remote_command: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 32: { // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at
|
||||
case 33: { // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int8_t>, ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<int64_t>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 33: { // tabs:uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands
|
||||
case 34: { // tabs:uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 34: { // tabs:uniffi_tabs_fn_method_remotecommandstore_remove_remote_command
|
||||
case 35: { // tabs:uniffi_tabs_fn_method_remotecommandstore_remove_remote_command
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int8_t>, ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_remotecommandstore_remove_remote_command, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_remotecommandstore_remove_remote_command: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 35: { // tabs:uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent
|
||||
case 36: { // tabs:uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int8_t>, ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 36: { // tabs:uniffi_tabs_fn_clone_tabsbridgedengine
|
||||
case 37: { // tabs:uniffi_tabs_fn_clone_tabsbridgedengine
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_clone_tabsbridgedengine, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_clone_tabsbridgedengine: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 37: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
|
||||
case 38: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_apply, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_apply: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 38: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
|
||||
case 39: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 39: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
|
||||
case 40: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int64_t>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_last_sync, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_last_sync: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 40: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
|
||||
case 41: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 41: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
|
||||
case 42: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_reset, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_reset: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 42: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
|
||||
case 43: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 43: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
|
||||
case 44: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<int64_t>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 44: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
|
||||
case 45: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<int64_t>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 45: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
|
||||
case 46: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_store_incoming, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_store_incoming: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 46: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
|
||||
case 47: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_sync_finished, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_sync_finished: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 47: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
|
||||
case 48: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_sync_id, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_sync_id: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 48: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
|
||||
case 49: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_sync_started, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_sync_started: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 49: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
|
||||
case 50: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_wipe, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_wipe: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 50: { // tabs:uniffi_tabs_fn_clone_tabsstore
|
||||
case 51: { // tabs:uniffi_tabs_fn_clone_tabsstore
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsTabsStorePointerType>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_clone_tabsstore, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_clone_tabsstore: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 51: { // tabs:uniffi_tabs_fn_constructor_tabsstore_new
|
||||
case 52: { // tabs:uniffi_tabs_fn_constructor_tabsstore_new
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsTabsStorePointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_constructor_tabsstore_new, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_constructor_tabsstore_new: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 52: { // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
|
||||
case 53: { // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsstore_bridged_engine, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsstore_bridged_engine: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 53: { // tabs:uniffi_tabs_fn_method_tabsstore_get_all
|
||||
case 54: { // tabs:uniffi_tabs_fn_method_tabsstore_get_all
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsstore_get_all, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsstore_get_all: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 54: { // tabs:uniffi_tabs_fn_method_tabsstore_new_remote_command_store
|
||||
case 55: { // tabs:uniffi_tabs_fn_method_tabsstore_new_remote_command_store
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsRemoteCommandStorePointerType>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsstore_new_remote_command_store, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsstore_new_remote_command_store: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 55: { // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
|
||||
case 56: { // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsstore_register_with_sync_manager, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsstore_register_with_sync_manager: "_ns, aError);
|
||||
return true;
|
||||
}
|
||||
case 56: { // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
|
||||
case 57: { // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
|
||||
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>, ScaffoldingConverter<RustBuffer>>;
|
||||
CallHandler::CallSync(uniffi_tabs_fn_method_tabsstore_set_local_tabs, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsstore_set_local_tabs: "_ns, aError);
|
||||
return true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче