Skip to content

Commit

Permalink
add HowPack
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxiujia committed Jul 27, 2024
1 parent dd630ef commit 11edd02
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/plugin/file_split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub struct FileSplitAppender {
packer: Arc<Box<dyn Packer>>,
dir_path: String,
sender: Sender<LogPack>,
is_pack: Box<dyn CanPack>,
can_pack: Box<dyn CanPack>,
//cache data
temp_bytes: AtomicUsize,
temp_name: String,
Expand Down Expand Up @@ -329,7 +329,7 @@ impl FileSplitAppender {
dir_path: dir_path.to_string(),
file: Box::new(file) as Box<dyn SplitFile>,
sender,
is_pack: how_to_pack,
can_pack: how_to_pack,
temp_name,
packer: arc_packer,
})
Expand Down Expand Up @@ -470,7 +470,7 @@ impl LogAppender for FileSplitAppender {
let current_temp_size = self.temp_bytes.load(Ordering::Relaxed)
+ temp.as_bytes().len()
+ x.formated.as_bytes().len();
if let Some(new_log_name) = self.is_pack.is_pack(self.packer.deref(), &self.temp_name, current_temp_size, x) {
if let Some(new_log_name) = self.can_pack.is_pack(self.packer.deref(), &self.temp_name, current_temp_size, x) {
self.temp_bytes.fetch_add(
{
let w = self.file.write(temp.as_bytes());
Expand All @@ -490,7 +490,7 @@ impl LogAppender for FileSplitAppender {
Command::CommandExit => {}
Command::CommandFlush(ref w) => {
let current_temp_size = self.temp_bytes.load(Ordering::Relaxed);
if let Some(new_log_name) = self.is_pack.is_pack(self.packer.deref(), &self.temp_name, current_temp_size, x) {
if let Some(new_log_name) = self.can_pack.is_pack(self.packer.deref(), &self.temp_name, current_temp_size, x) {
self.temp_bytes.fetch_add(
{
let w = self.file.write(temp.as_bytes());
Expand Down

0 comments on commit 11edd02

Please sign in to comment.