Skip to content

Commit e701d9f

Browse files
guvencMalteJ
authored andcommitted
Non functional clean up
Signed-off-by: Guvenc Gulce <[email protected]>
1 parent 566062a commit e701d9f

File tree

3 files changed

+2
-37
lines changed

3 files changed

+2
-37
lines changed

feos/services/image-service/src/worker.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ use feos_proto::image_service::{
55
};
66
use log::{error, info, warn};
77
use oci_distribution::{
8-
client::{ClientConfig, ClientProtocol},
9-
errors::OciDistributionError,
10-
secrets, Client, ParseError, Reference,
8+
client::ClientConfig, errors::OciDistributionError, secrets, Client, ParseError, Reference,
119
};
1210
use std::collections::HashMap;
1311
use tokio::sync::{broadcast, mpsc, oneshot};
@@ -218,10 +216,7 @@ async fn download_layer_data(image_ref: &str) -> Result<Vec<u8>, PullError> {
218216
VMLINUZ_MEDIA_TYPE,
219217
];
220218

221-
let insecure_registries = vec!["ghcr.io:5000".to_string()];
222-
223219
let config = ClientConfig {
224-
protocol: ClientProtocol::HttpsExcept(insecure_registries),
225220
..Default::default()
226221
};
227222

feos/utils/src/feos_logger/mod.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ use std::io::Write;
66
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
77
use tokio::sync::{broadcast, mpsc, oneshot};
88

9-
// --- Public API ---
10-
11-
/// A single log entry, containing all relevant information.
12-
/// It must be `Clone` to be sent over a broadcast channel.
139
#[derive(Clone, Debug)]
1410
pub struct LogEntry {
1511
pub seq: u64,
@@ -32,22 +28,17 @@ impl fmt::Display for LogEntry {
3228
}
3329
}
3430

35-
/// A clonable handle that allows creating new log readers.
36-
/// This is the primary object you'll interact with after initialization.
3731
#[derive(Clone)]
3832
pub struct LogHandle {
3933
history_requester: mpsc::Sender<HistoryRequest>,
4034
broadcast_sender: broadcast::Sender<LogEntry>,
4135
}
4236

43-
/// A reader that provides access to the log history and the live stream.
4437
pub struct LogReader {
4538
history_snapshot: VecDeque<LogEntry>,
4639
receiver: broadcast::Receiver<LogEntry>,
4740
}
4841

49-
/// A builder for creating and initializing the logger.
50-
/// This is the main entry point for setting up the logging system.
5142
pub struct Builder {
5243
filter: LevelFilter,
5344
max_history: usize,
@@ -59,7 +50,7 @@ pub struct Builder {
5950
impl Default for Builder {
6051
fn default() -> Self {
6152
Self {
62-
filter: LevelFilter::Info, // Default log level
53+
filter: LevelFilter::Info,
6354
max_history: 1000,
6455
broadcast_capacity: 1024,
6556
mpsc_capacity: 4096,
@@ -89,7 +80,6 @@ impl Builder {
8980
}
9081

9182
pub fn init(self) -> Result<LogHandle, SetLoggerError> {
92-
// FIX: The channel now sends our new, simple `LogMessage` struct.
9383
let (log_tx, log_rx) = mpsc::channel::<LogMessage>(self.mpsc_capacity);
9484
let (history_tx, history_rx) = mpsc::channel(32);
9585
let (broadcast_tx, _) = broadcast::channel(self.broadcast_capacity);
@@ -172,9 +162,7 @@ struct LogMessage {
172162
message: String,
173163
}
174164

175-
/// The frontend that implements the `log::Log` trait.
176165
struct FeosLogger {
177-
// FIX: The sender now sends the safe `LogMessage` struct.
178166
sender: mpsc::Sender<LogMessage>,
179167
filter: LevelFilter,
180168
}
@@ -189,8 +177,6 @@ impl Log for FeosLogger {
189177
return;
190178
}
191179

192-
// FIX: Create the safe `LogMessage` here, on the calling thread.
193-
// `format!` turns the `Arguments` into a `String`, which is `Send`.
194180
let msg = LogMessage {
195181
level: record.level(),
196182
target: record.target().to_string(),
@@ -205,9 +191,7 @@ impl Log for FeosLogger {
205191
fn flush(&self) {}
206192
}
207193

208-
/// The central actor task that owns and manages all logger state.
209194
struct LoggerActor {
210-
// FIX: The receiver now gets the safe `LogMessage` struct.
211195
log_receiver: mpsc::Receiver<LogMessage>,
212196
history_requester: mpsc::Receiver<HistoryRequest>,
213197
broadcast_sender: broadcast::Sender<LogEntry>,
@@ -222,11 +206,9 @@ impl LoggerActor {
222206
async fn run(mut self) {
223207
loop {
224208
tokio::select! {
225-
// FIX: Receive the `LogMessage` instead of a `Record`.
226209
Some(msg) = self.log_receiver.recv() => {
227210
self.seq_counter += 1;
228211

229-
// FIX: Construct the final `LogEntry` from the `LogMessage`.
230212
let entry = LogEntry {
231213
seq: self.seq_counter,
232214
timestamp: Utc::now(),
@@ -236,8 +218,6 @@ impl LoggerActor {
236218
};
237219

238220
if self.log_to_stdout {
239-
// We ignore the result of the write operation. In a more
240-
// critical application, you might handle I/O errors here.
241221
let _ = self.write_log_entry_to_stdout(&entry);
242222
}
243223

@@ -260,7 +240,6 @@ impl LoggerActor {
260240

261241
fn write_log_entry_to_stdout(&mut self, entry: &LogEntry) -> std::io::Result<()> {
262242
let mut level_spec = ColorSpec::new();
263-
// Set color and boldness based on log level
264243
match entry.level {
265244
Level::Error => level_spec.set_fg(Some(Color::Red)).set_bold(true),
266245
Level::Warn => level_spec.set_fg(Some(Color::Yellow)).set_bold(true),
@@ -269,18 +248,15 @@ impl LoggerActor {
269248
Level::Trace => level_spec.set_fg(Some(Color::Magenta)).set_bold(true),
270249
};
271250

272-
// Write the timestamp (no color)
273251
write!(
274252
&mut self.stdout_writer,
275253
"[{} ",
276254
entry.timestamp.format("%Y-%m-%dT%H:%M:%SZ")
277255
)?;
278256

279-
// Set the color for the level and write it
280257
self.stdout_writer.set_color(&level_spec)?;
281258
write!(&mut self.stdout_writer, "{:<5}", entry.level.to_string())?;
282259

283-
// Reset color for the rest of the line
284260
self.stdout_writer.reset()?;
285261
writeln!(
286262
&mut self.stdout_writer,

proto/v1/image.proto

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ syntax = "proto3";
22

33
package feos.image.vmm.api.v1;
44

5-
// ===================================================================
65
// Image Service
7-
// ===================================================================
86

97
// ImageService handles the lifecycle of OCI images used for booting VMs.
108
service ImageService {
@@ -25,10 +23,6 @@ service ImageService {
2523
rpc DeleteImage(DeleteImageRequest) returns (DeleteImageResponse);
2624
}
2725

28-
// ===================================================================
29-
// Image Manager Messages
30-
// ===================================================================
31-
3226
enum ImageState {
3327
IMAGE_STATE_UNSPECIFIED = 0;
3428
// The requested image UUID is not known to the service.

0 commit comments

Comments
 (0)