Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: add windows support #108

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-12 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-12 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
profile: [ release, debug ]
steps:
- uses: actions/checkout@v3
Expand Down
76 changes: 42 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ members = [
[workspace.dependencies]
ahash = "0.8.3"
arrayvec = "0.7.4"
awaken = "0.1.0"
awaken = "0.2.0"
backtrace = "0.3.69"
bitvec = "1.0.1"
blake3 = "1.5.0"
Expand All @@ -49,7 +49,7 @@ boring-sys = "3.1.0"
bstr = "1.7.0"
bytes = "1.5.0"
clap = "4.4.6"
clocksource = "0.6.0"
clocksource = "0.8.0"
crossbeam-channel = "0.5.8"
foreign-types-shared = "0.3.1"
httparse = "1.8.0"
Expand All @@ -67,12 +67,12 @@ quote = "1.0.33"
rand = "0.8.5"
rand_chacha = "0.3.1"
rand_xoshiro = "0.6.0"
ringlog = "0.3.2"
ringlog = "0.4.0"
serde = "1.0.189"
serde_json = "1.0.107"
signal-hook = "0.3.17"
slab = "0.4.9"
switchboard = "0.2.1"
switchboard = "0.3.0"
syn = "2.0.38"
thiserror = "1.0.49"
tiny_http = "0.12.0"
Expand Down
10 changes: 5 additions & 5 deletions src/common/src/expiry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0

use crate::time::*;
use clocksource::{coarse, precise};
use serde::{Deserialize, Serialize};

use std::time::SystemTime;
Expand Down Expand Up @@ -70,11 +70,11 @@
}
}

pub fn as_duration(&self) -> Duration<Nanoseconds<u64>> {
Duration::<Nanoseconds<u64>>::from_secs(self.as_secs().into())
pub fn as_duration(&self) -> precise::Duration {
precise::Duration::from_secs(self.as_secs().into())
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
}

pub fn as_coarse_duration(&self) -> Duration<Seconds<u32>> {
Duration::<Seconds<u32>>::from_secs(self.as_secs())
pub fn as_coarse_duration(&self) -> coarse::Duration {
coarse::Duration::from_secs(self.as_secs())
}
}
1 change: 0 additions & 1 deletion src/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ pub mod expiry;
pub mod metrics;
pub mod signal;
pub mod ssl;
pub mod time;
pub mod traits;
3 changes: 0 additions & 3 deletions src/common/src/time.rs

This file was deleted.

3 changes: 1 addition & 2 deletions src/core/proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ extern crate metriken;
use ::net::event::{Event, Source};
use ::net::*;
use admin::AdminBuilder;
use clocksource::precise::Instant;
use common::signal::Signal;
use common::ssl::tls_acceptor;
use config::proxy::*;
Expand All @@ -31,8 +32,6 @@ use std::io::{Error, ErrorKind, Result};
use std::sync::Arc;
use switchboard::{Queues, Waker};

type Instant = clocksource::Instant<clocksource::Nanoseconds<u64>>;

mod backend;
mod frontend;
mod listener;
Expand Down
1 change: 1 addition & 0 deletions src/protocol/memcache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ path = "benches/request_parsing.rs"
harness = false

[dependencies]
clocksource = { workspace = true }
common = { path = "../../common" }
logger = { path = "../../logger" }
metriken = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions src/protocol/memcache/src/request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// http://www.apache.org/licenses/LICENSE-2.0

use crate::*;
use common::time::{Seconds, UnixInstant};
use clocksource::coarse::{Duration, UnixInstant};
use core::fmt::{Display, Formatter};
use core::num::NonZeroI32;
use protocol_common::{BufMut, Parse, ParseOk};
Expand Down Expand Up @@ -427,8 +427,8 @@ impl Ttl {
};

// calculate the ttl in seconds
let seconds = UnixInstant::from_secs(exptime)
.checked_duration_since(UnixInstant::<Seconds<u32>>::recent())
let seconds = (UnixInstant::EPOCH + Duration::from_secs(exptime))
.checked_duration_since(UnixInstant::now())
.map(|v| v.as_secs())
.unwrap_or(0);

Expand Down
1 change: 0 additions & 1 deletion src/proxy/momento/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub static ADMIN_CONN_CLOSE: Counter = Counter::new();

pub(crate) async fn admin(mut log_drain: Box<dyn logger::Drain>, admin_listener: TcpListener) {
loop {
clocksource::refresh_clock();
let _ = log_drain.flush();

// accept a new client
Expand Down
1 change: 1 addition & 0 deletions src/session/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ license = { workspace = true }

[dependencies]
bytes = { workspace = true }
clocksource = { workspace = true }
common = { path = "../common" }
log = { workspace = true }
metriken = { workspace = true }
Expand Down
4 changes: 1 addition & 3 deletions src/session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub use server::ServerSession;
use std::os::unix::prelude::AsRawFd;

use ::net::*;
use common::time::Nanoseconds;
use clocksource::precise::Instant;
use core::borrow::{Borrow, BorrowMut};
use core::fmt::Debug;
use core::marker::PhantomData;
Expand Down Expand Up @@ -79,8 +79,6 @@ pub static SESSION_SEND_BYTE: Counter = Counter::new();
)]
pub static REQUEST_LATENCY: AtomicHistogram = AtomicHistogram::new(7, 32);

type Instant = common::time::Instant<Nanoseconds<u64>>;

// The size of one kilobyte, in bytes
const KB: usize = 1024;

Expand Down
Loading
Loading