Skip to content

Commit e390ef0

Browse files
committed
Removed old config struct, renamed new config struct
1 parent e060981 commit e390ef0

File tree

3 files changed

+7
-28
lines changed

3 files changed

+7
-28
lines changed

components/remote_settings/src/config.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ use crate::error::warn;
1414
use crate::{ApiResult, Error, RemoteSettingsContext, Result};
1515

1616
/// Remote settings configuration
17-
///
18-
/// This is the version used in the new API, hence the `2` at the end. The plan is to move
19-
/// consumers to the new API, remove the RemoteSettingsConfig struct, then remove the `2` from this
20-
/// name.
2117
#[derive(Debug, Default, Clone, uniffi::Record)]
22-
pub struct RemoteSettingsConfig2 {
18+
pub struct RemoteSettingsConfig {
2319
/// The Remote Settings server to use. Defaults to [RemoteSettingsServer::Prod],
2420
#[uniffi(default = None)]
2521
pub server: Option<RemoteSettingsServer>,
@@ -31,23 +27,6 @@ pub struct RemoteSettingsConfig2 {
3127
pub app_context: Option<RemoteSettingsContext>,
3228
}
3329

34-
/// Custom configuration for the client.
35-
/// Currently includes the following:
36-
/// - `server`: The Remote Settings server to use. If not specified, defaults to the production server (`RemoteSettingsServer::Prod`).
37-
/// - `server_url`: An optional custom Remote Settings server URL. Deprecated; please use `server` instead.
38-
/// - `bucket_name`: The optional name of the bucket containing the collection on the server. If not specified, the standard bucket will be used.
39-
/// - `collection_name`: The name of the collection for the settings server.
40-
#[derive(Debug, Clone, uniffi::Record)]
41-
pub struct RemoteSettingsConfig {
42-
pub collection_name: String,
43-
#[uniffi(default = None)]
44-
pub bucket_name: Option<String>,
45-
#[uniffi(default = None)]
46-
pub server_url: Option<String>,
47-
#[uniffi(default = None)]
48-
pub server: Option<RemoteSettingsServer>,
49-
}
50-
5130
/// The Remote Settings server that the client should use.
5231
#[derive(Debug, Clone, uniffi::Enum)]
5332
pub enum RemoteSettingsServer {

components/remote_settings/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(crate) mod jexl_filter;
2020
mod macros;
2121

2222
pub use client::{Attachment, RemoteSettingsRecord, RsJsonObject};
23-
pub use config::{BaseUrl, RemoteSettingsConfig2, RemoteSettingsServer};
23+
pub use config::{BaseUrl, RemoteSettingsConfig, RemoteSettingsServer};
2424
pub use context::RemoteSettingsContext;
2525
pub use error::{trace, ApiResult, RemoteSettingsError, Result};
2626

@@ -52,7 +52,7 @@ impl RemoteSettingsService {
5252
/// directory does not exist, it will be created when the storage is first used. Only the
5353
/// directory and the SQLite files will be created, any parent directories must already exist.
5454
#[uniffi::constructor]
55-
pub fn new(storage_dir: String, config: RemoteSettingsConfig2) -> Self {
55+
pub fn new(storage_dir: String, config: RemoteSettingsConfig) -> Self {
5656
Self {
5757
internal: service::RemoteSettingsService::new(storage_dir, config),
5858
}
@@ -79,7 +79,7 @@ impl RemoteSettingsService {
7979
/// Only intended for QA/debugging. Swapping the remote settings server in the middle of
8080
/// execution can cause weird effects.
8181
#[handle_error(Error)]
82-
pub fn update_config(&self, config: RemoteSettingsConfig2) -> ApiResult<()> {
82+
pub fn update_config(&self, config: RemoteSettingsConfig) -> ApiResult<()> {
8383
self.internal.update_config(config)
8484
}
8585

components/remote_settings/src/service.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use viaduct::Request;
1616

1717
use crate::{
1818
client::RemoteState, config::BaseUrl, error::Error, storage::Storage, RemoteSettingsClient,
19-
RemoteSettingsConfig2, RemoteSettingsContext, RemoteSettingsServer, Result,
19+
RemoteSettingsConfig, RemoteSettingsContext, RemoteSettingsServer, Result,
2020
};
2121

2222
/// Internal Remote settings service API
@@ -42,7 +42,7 @@ impl RemoteSettingsService {
4242
/// Construct a [RemoteSettingsService]
4343
///
4444
/// This is typically done early in the application-startup process
45-
pub fn new(storage_dir: String, config: RemoteSettingsConfig2) -> Self {
45+
pub fn new(storage_dir: String, config: RemoteSettingsConfig) -> Self {
4646
let storage_dir = storage_dir.into();
4747
let base_url = config
4848
.server
@@ -120,7 +120,7 @@ impl RemoteSettingsService {
120120
///
121121
/// This will cause all current and future clients to use new config and will delete any stored
122122
/// records causing the clients to return new results from the new config.
123-
pub fn update_config(&self, config: RemoteSettingsConfig2) -> Result<()> {
123+
pub fn update_config(&self, config: RemoteSettingsConfig) -> Result<()> {
124124
let base_url = config
125125
.server
126126
.unwrap_or(RemoteSettingsServer::Prod)

0 commit comments

Comments
 (0)