Skip to content

Commit c4d716f

Browse files
committed
another attempt for windows
1 parent 11c22ae commit c4d716f

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
//! The main library to support building Vector.
2323
24-
#[cfg(feature = "sinks-socket")]
24+
#[cfg(all(unix, feature = "sinks-socket"))]
2525
#[macro_use]
2626
extern crate cfg_if;
2727
#[macro_use]

src/sinks/socket.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
use std::path::PathBuf;
12
use vector_lib::codecs::{
23
encoding::{Framer, FramingConfig},
34
TextSerializerConfig,
45
};
56
use vector_lib::configurable::configurable_component;
67

7-
#[cfg(unix)]
8-
use crate::sinks::util::unix::UnixSinkConfig;
98
use crate::{
109
codecs::{Encoder, EncodingConfig, EncodingConfigWithFraming, SinkType},
1110
config::{AcknowledgementsConfig, GenerateConfig, Input, SinkConfig, SinkContext},
@@ -83,6 +82,17 @@ pub struct UnixMode {
8382
encoding: EncodingConfigWithFraming,
8483
}
8584

85+
/// A Unix Domain Socket sink.
86+
#[configurable_component]
87+
#[derive(Clone, Debug)]
88+
pub struct UnixSinkConfig {
89+
/// The Unix socket path.
90+
///
91+
/// This should be an absolute path.
92+
#[configurable(metadata(docs::examples = "/path/to/socket"))]
93+
pub path: PathBuf,
94+
}
95+
8696
impl GenerateConfig for SocketSinkConfig {
8797
fn generate_config() -> toml::Value {
8898
toml::from_str(

src/sinks/util/unix.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ use tokio::{
1616
time::sleep,
1717
};
1818
use tokio_util::codec::Encoder;
19+
use vector_lib::internal_event::{BytesSent, Protocol};
1920
use vector_lib::json_size::JsonSize;
20-
use vector_lib::{
21-
configurable::configurable_component,
22-
internal_event::{BytesSent, Protocol},
23-
};
2421
use vector_lib::{ByteSizeOf, EstimatedJsonEncodedSizeOf};
2522

23+
use super::datagram::{send_datagrams, DatagramSocket};
24+
use crate::sinks::socket::UnixSinkConfig;
2625
use crate::{
2726
codecs::Transformer,
2827
event::{Event, Finalizable},
@@ -42,8 +41,6 @@ use crate::{
4241
},
4342
};
4443

45-
use super::datagram::{send_datagrams, DatagramSocket};
46-
4744
#[derive(Debug, Snafu)]
4845
pub enum UnixError {
4946
#[snafu(display("Failed connecting to socket at path {}: {}", path.display(), source))]
@@ -56,17 +53,6 @@ pub enum UnixError {
5653
FailedToBind { source: std::io::Error },
5754
}
5855

59-
/// A Unix Domain Socket sink.
60-
#[configurable_component]
61-
#[derive(Clone, Debug)]
62-
pub struct UnixSinkConfig {
63-
/// The Unix socket path.
64-
///
65-
/// This should be an absolute path.
66-
#[configurable(metadata(docs::examples = "/path/to/socket"))]
67-
pub path: PathBuf,
68-
}
69-
7056
impl UnixSinkConfig {
7157
pub const fn new(path: PathBuf) -> Self {
7258
Self { path }

0 commit comments

Comments
 (0)