Skip to content

Commit ccea285

Browse files
committed
Revert "stop using NativeDateTime"
This reverts commit 42a296e.
1 parent b03db2d commit ccea285

File tree

8 files changed

+28
-24
lines changed

8 files changed

+28
-24
lines changed

libsql-server/src/http/admin/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use axum::extract::{FromRef, Path, State};
44
use axum::middleware::Next;
55
use axum::routing::delete;
66
use axum::Json;
7-
use chrono::{DateTime, Utc};
7+
use chrono::NaiveDateTime;
88
use futures::{SinkExt, StreamExt, TryStreamExt};
99
use hyper::{Body, Request, StatusCode};
1010
use metrics_exporter_prometheus::{PrometheusBuilder, PrometheusHandle};
@@ -427,7 +427,7 @@ async fn handle_create_namespace<C: Connector>(
427427

428428
#[derive(Debug, Deserialize)]
429429
struct ForkNamespaceReq {
430-
timestamp: DateTime<Utc>,
430+
timestamp: NaiveDateTime,
431431
}
432432

433433
async fn handle_fork_namespace<C>(

libsql-server/src/namespace/configurator/libsql_primary.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::pin::Pin;
33
use std::sync::atomic::{AtomicBool, Ordering};
44
use std::sync::Arc;
55

6-
use chrono::{DateTime, Utc};
76
use futures::prelude::Future;
87
use libsql_sys::name::NamespaceResolver;
98
use libsql_sys::wal::either::Either;
@@ -270,7 +269,7 @@ impl ConfigureNamespace for LibsqlPrimaryConfigurator {
270269
_from_config: MetaStoreHandle,
271270
_to_ns: NamespaceName,
272271
_to_config: MetaStoreHandle,
273-
timestamp: Option<DateTime<Utc>>,
272+
_timestamp: Option<chrono::prelude::NaiveDateTime>,
274273
_store: NamespaceStore,
275274
) -> Pin<Box<dyn Future<Output = crate::Result<Namespace>> + Send + 'a>> {
276275
Box::pin(async move {

libsql-server/src/namespace/configurator/libsql_replica.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::future::Future;
22
use std::pin::Pin;
33
use std::sync::Arc;
44

5-
use chrono::{DateTime, Utc};
65
use hyper::Uri;
76
use libsql_replication::injector::LibsqlInjector;
87
use libsql_replication::replicator::Replicator;
@@ -266,7 +265,7 @@ impl ConfigureNamespace for LibsqlReplicaConfigurator {
266265
_from_config: MetaStoreHandle,
267266
_to_ns: NamespaceName,
268267
_to_config: MetaStoreHandle,
269-
_timestamp: Option<DateTime<Utc>>,
268+
_timestamp: Option<chrono::prelude::NaiveDateTime>,
270269
_store: NamespaceStore,
271270
) -> Pin<Box<dyn Future<Output = crate::Result<Namespace>> + Send + 'a>> {
272271
Box::pin(std::future::ready(Err(crate::Error::Fork(

libsql-server/src/namespace/configurator/libsql_schema.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::path::Path;
22
use std::sync::Arc;
33

4-
use chrono::{DateTime, Utc};
54
use futures::prelude::Future;
65
use libsql_sys::name::NamespaceResolver;
76
use libsql_wal::io::StdIO;
@@ -160,13 +159,22 @@ impl ConfigureNamespace for LibsqlSchemaConfigurator {
160159

161160
fn fork<'a>(
162161
&'a self,
163-
_from_ns: &'a Namespace,
164-
_from_config: MetaStoreHandle,
165-
_to_ns: NamespaceName,
166-
_to_config: MetaStoreHandle,
167-
_timestamp: Option<DateTime<Utc>>,
168-
_store: NamespaceStore,
162+
from_ns: &'a Namespace,
163+
from_config: MetaStoreHandle,
164+
to_ns: NamespaceName,
165+
to_config: MetaStoreHandle,
166+
timestamp: Option<chrono::prelude::NaiveDateTime>,
167+
store: NamespaceStore,
169168
) -> std::pin::Pin<Box<dyn Future<Output = crate::Result<Namespace>> + Send + 'a>> {
170-
todo!()
169+
Box::pin(super::fork::fork(
170+
from_ns,
171+
from_config,
172+
to_ns,
173+
to_config,
174+
timestamp,
175+
store,
176+
&self.primary_config,
177+
self.base.base_path.clone(),
178+
))
171179
}
172180
}

libsql-server/src/namespace/configurator/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::pin::Pin;
33
use std::sync::Arc;
44
use std::time::Duration;
55

6-
use chrono::{DateTime, Utc};
6+
use chrono::NaiveDateTime;
77
use futures::Future;
88
use libsql_sys::EncryptionConfig;
99
use tokio::sync::Semaphore;
@@ -139,7 +139,7 @@ pub trait ConfigureNamespace {
139139
from_config: MetaStoreHandle,
140140
to_ns: NamespaceName,
141141
to_config: MetaStoreHandle,
142-
timestamp: Option<DateTime<Utc>>,
142+
timestamp: Option<NaiveDateTime>,
143143
store: NamespaceStore,
144144
) -> Pin<Box<dyn Future<Output = crate::Result<Namespace>> + Send + 'a>>;
145145
}

libsql-server/src/namespace/configurator/primary.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::pin::Pin;
33
use std::sync::atomic::{AtomicBool, Ordering};
44
use std::sync::Arc;
55

6-
use chrono::{DateTime, Utc};
76
use futures::prelude::Future;
87
use libsql_sys::EncryptionConfig;
98
use tokio::task::JoinSet;
@@ -185,15 +184,15 @@ impl ConfigureNamespace for PrimaryConfigurator {
185184
from_config: MetaStoreHandle,
186185
to_ns: NamespaceName,
187186
to_config: MetaStoreHandle,
188-
timestamp: Option<DateTime<Utc>>,
187+
timestamp: Option<chrono::prelude::NaiveDateTime>,
189188
store: NamespaceStore,
190189
) -> Pin<Box<dyn Future<Output = crate::Result<Namespace>> + Send + 'a>> {
191190
Box::pin(super::fork::fork(
192191
from_ns,
193192
from_config,
194193
to_ns,
195194
to_config,
196-
timestamp.map(|d| d.naive_utc()),
195+
timestamp,
197196
store,
198197
&self.primary_config,
199198
self.base.base_path.clone(),

libsql-server/src/namespace/configurator/schema.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::sync::{atomic::AtomicBool, Arc};
22

3-
use chrono::{DateTime, Utc};
43
use futures::prelude::Future;
54
use tokio::task::JoinSet;
65

@@ -121,15 +120,15 @@ impl ConfigureNamespace for SchemaConfigurator {
121120
from_config: MetaStoreHandle,
122121
to_ns: NamespaceName,
123122
to_config: MetaStoreHandle,
124-
timestamp: Option<DateTime<Utc>>,
123+
timestamp: Option<chrono::prelude::NaiveDateTime>,
125124
store: NamespaceStore,
126125
) -> std::pin::Pin<Box<dyn Future<Output = crate::Result<Namespace>> + Send + 'a>> {
127126
Box::pin(super::fork::fork(
128127
from_ns,
129128
from_config,
130129
to_ns,
131130
to_config,
132-
timestamp.map(|ts| ts.naive_utc()),
131+
timestamp,
133132
store,
134133
&self.primary_config,
135134
self.base.base_path.clone(),

libsql-server/src/namespace/store.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
22
use std::sync::Arc;
33

44
use async_lock::RwLock;
5-
use chrono::{DateTime, Utc};
5+
use chrono::NaiveDateTime;
66
use futures::TryFutureExt;
77
use moka::future::Cache;
88
use once_cell::sync::OnceCell;
@@ -219,7 +219,7 @@ impl NamespaceStore {
219219
from: NamespaceName,
220220
to: NamespaceName,
221221
to_config: DatabaseConfig,
222-
timestamp: Option<DateTime<Utc>>,
222+
timestamp: Option<NaiveDateTime>,
223223
) -> crate::Result<()> {
224224
if self.inner.has_shutdown.load(Ordering::Relaxed) {
225225
return Err(Error::NamespaceStoreShutdown);

0 commit comments

Comments
 (0)