@@ -49,6 +49,10 @@ pub struct File {
49
49
/// happen -- or not.
50
50
read_only : bool ,
51
51
52
+ /// The peer of this file, the next in line in rotation. So, if this file is
53
+ /// foo.log the peer will be foo.log.1 and its peer foo.log.2 etc.
54
+ peer : Option < Inode > ,
55
+
52
56
/// The ordinal number of this File. If the file is foo.log the ordinal
53
57
/// number is 0, if foo.log.1 then 1 etc.
54
58
ordinal : u8 ,
@@ -177,6 +181,7 @@ pub struct State {
177
181
now : Tick ,
178
182
block_cache : block:: Cache ,
179
183
max_bytes_per_file : u64 ,
184
+ max_rotations : u8 ,
180
185
// [GroupID, [Names]]. The interior Vec have size `max_rotations`.
181
186
group_names : Vec < Vec < String > > ,
182
187
next_inode : Inode ,
@@ -193,7 +198,7 @@ impl std::fmt::Debug for State {
193
198
. field ( "max_bytes_per_file" , & self . max_bytes_per_file )
194
199
. field ( "group_names" , & self . group_names )
195
200
. field ( "next_inode" , & self . next_inode )
196
- . finish ( )
201
+ . finish_non_exhaustive ( )
197
202
}
198
203
}
199
204
@@ -290,6 +295,8 @@ impl State {
290
295
read_only : false ,
291
296
ordinal : 0 ,
292
297
group_id : 0 ,
298
+
299
+ peer : None ,
293
300
} ;
294
301
nodes. insert ( foo_log_inode, Node :: File { file : foo_log } ) ;
295
302
@@ -304,6 +311,7 @@ impl State {
304
311
now : 0 ,
305
312
block_cache,
306
313
max_bytes_per_file,
314
+ max_rotations,
307
315
group_names,
308
316
next_inode : 4 ,
309
317
}
@@ -331,7 +339,6 @@ impl State {
331
339
332
340
for inode in inodes. drain ( ..) {
333
341
let rotation_data = {
334
- println ! ( "{nodes:?}" , nodes = self . nodes) ;
335
342
if let Some ( node) = self . nodes . get_mut ( & inode) {
336
343
match node {
337
344
Node :: File { file } => {
0 commit comments