Struct exar::Scanner [] [src]

pub struct Scanner {
    // some fields omitted
}

Exar DB's log file scanner.

It manages event stream subscriptions and continuously scans portions of the log file depending on the subscriptions query parameters.

Examples

extern crate exar;

use exar::*;
use std::sync::mpsc::channel;
use std::time::Duration;

let log = Log::new("/path/to/logs", "test", 100);
let event = Event::new("data", vec!["tag1", "tag2"]);

let line_reader = log.open_line_reader().unwrap();
let mut scanner = Scanner::new(line_reader, Duration::from_millis(10));

let (sender, _) = channel();
let subscription = Subscription::new(sender, Query::live());
scanner.handle_subscription(subscription).unwrap();

drop(scanner);

Methods

impl Scanner
[src]

fn new(reader: IndexedLineReader<BufReader<File>>, sleep_duration: Duration) -> Scanner

Creates a new log scanner using the given IndexedLineReader and sleep duration.

fn handle_subscription(&self, subscription: Subscription) -> Result<()DatabaseError>

Handles the given Subscription or returns a DatabaseError if a failure occurs.

fn add_line_index(&self, line: u64, byte_count: u64) -> Result<()DatabaseError>

Adds the given line to the LinesIndex or returns a DatabaseError if a failure occurs.

fn set_tail_scanner_sender(&mut self, sender: Sender<ScannerAction>) -> Result<()DatabaseError>

Adds a reference to a tail scanner that is responsible of handling live subscriptions or returns a DatabaseError if a failure occurs.

fn clone_action_sender(&self) -> Sender<ScannerAction>

Clones the channel sender responsible to send ScannerActions to the scanner thread.

Trait Implementations

impl Debug for Scanner
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Clone for Scanner
[src]

fn clone(&self) -> Scanner

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Drop for Scanner
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more