pub(crate) struct ContainerLog {
drivers: Vec<Driver>,
lines: LineBuffer,
buffers_lines: bool,
}Expand description
The log drivers of a container.
Fields§
§drivers: Vec<Driver>§lines: LineBufferCollects whole lines for the journald drivers, the only ones which take them.
buffers_lines: boolWhether any driver takes whole lines.
Implementations§
Source§impl ContainerLog
impl ContainerLog
Sourcepub(crate) fn new() -> Arc<Mutex<ContainerLog>> ⓘ
pub(crate) fn new() -> Arc<Mutex<ContainerLog>> ⓘ
Create a new default SharedContainerLog.
Sourcepub(crate) fn has_drivers(&self) -> bool
pub(crate) fn has_drivers(&self) -> bool
Check if this logger has any drivers configured.
Sourcepub(crate) fn from_request(
id: &str,
reader: Reader<'_, Owned>,
) -> Result<Arc<Mutex<ContainerLog>>>
pub(crate) fn from_request( id: &str, reader: Reader<'_, Owned>, ) -> Result<Arc<Mutex<ContainerLog>>>
Create a new SharedContainerLog for the container id from the
requested drivers.
Sourcefn path<'a>(driver: &Reader<'a>) -> Result<&'a Path>
fn path<'a>(driver: &Reader<'a>) -> Result<&'a Path>
The path of a requested driver, which has to be absolute.
Sourcefn max_size(driver: &Reader<'_>) -> Option<usize>
fn max_size(driver: &Reader<'_>) -> Option<usize>
The maximum log size of a requested driver, zero means unlimited.
Sourcepub(crate) async fn reopen(&mut self) -> Result<()>
pub(crate) async fn reopen(&mut self) -> Result<()>
Reopen the container logs. All drivers get reopened even if one fails, the first error is returned.
Sourcepub(crate) async fn write(&mut self, pipe: Pipe, bytes: &[u8]) -> Result<()>
pub(crate) async fn write(&mut self, pipe: Pipe, bytes: &[u8]) -> Result<()>
Write the contents of the provided bytes into all loggers. All of them get the chunk even if one fails, the first error is returned.
Sourcepub(crate) fn has_pending(&self, pipe: Pipe) -> bool
pub(crate) fn has_pending(&self, pipe: Pipe) -> bool
Whether a line of the pipe waits for its ending.
Sourcepub(crate) async fn flush(&mut self, pipe: Pipe) -> Result<()>
pub(crate) async fn flush(&mut self, pipe: Pipe) -> Result<()>
Write the line of the pipe which waits for its ending as a partial one, because the output paused.
Sourcepub(crate) async fn finish(&mut self, pipe: Pipe) -> Result<()>
pub(crate) async fn finish(&mut self, pipe: Pipe) -> Result<()>
The output of the pipe ended, write the line which still waits for its ending.
Sourcepub(crate) async fn sync(log: &Arc<Mutex<ContainerLog>>) -> Result<()>
pub(crate) async fn sync(log: &Arc<Mutex<ContainerLog>>) -> Result<()>
Sync the data of the log files to disk, like conmon does once the
container exited. The log is not locked while the files sync, they
get synced even if one fails, the first error is returned. A file
which cannot be synced, like a device, has nothing to sync. Only a
few logs sync at a time, syncs which hang on a stuck disk keep a
quarter of the threads of the blocking pool at most, see
Server::MAX_BLOCKING_THREADS. Tests, which share the static, do
not wait for each other.
Trait Implementations§
Source§impl Debug for ContainerLog
impl Debug for ContainerLog
Auto Trait Implementations§
impl Freeze for ContainerLog
impl RefUnwindSafe for ContainerLog
impl Send for ContainerLog
impl Sync for ContainerLog
impl Unpin for ContainerLog
impl UnsafeUnpin for ContainerLog
impl UnwindSafe for ContainerLog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].