lcpfs 2026.1.102

LCP File System - A ZFS-inspired copy-on-write filesystem for Rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
// Copyright 2025 LunaOS Contributors
// SPDX-License-Identifier: Apache-2.0

//! Commit tracking with BLAKE3 hashes.
//!
//! This module implements git-style commits with cryptographic hashing.
//! Each commit hash is computed as: BLAKE3(parent_hash || txg || message || author || changes).

use alloc::collections::BTreeMap;
use alloc::string::{String, ToString};
use alloc::vec;
use alloc::vec::Vec;

use super::types::{BranchError, Commit, FileChange};

// ═══════════════════════════════════════════════════════════════════════════════
// COMMIT BUILDER
// ═══════════════════════════════════════════════════════════════════════════════

/// Builder for creating commits.
pub struct CommitBuilder {
    parent: Option<[u8; 32]>,
    txg: u64,
    message: String,
    author: String,
    timestamp: u64,
    changes: Vec<FileChange>,
}

impl CommitBuilder {
    /// Create a new commit builder.
    pub fn new(txg: u64) -> Self {
        Self {
            parent: None,
            txg,
            message: String::new(),
            author: String::new(),
            timestamp: 0,
            changes: Vec::new(),
        }
    }

    /// Set the parent commit hash.
    pub fn parent(mut self, hash: [u8; 32]) -> Self {
        self.parent = Some(hash);
        self
    }

    /// Set the commit message.
    pub fn message(mut self, msg: impl Into<String>) -> Self {
        self.message = msg.into();
        self
    }

    /// Set the author.
    pub fn author(mut self, author: impl Into<String>) -> Self {
        self.author = author.into();
        self
    }

    /// Set the timestamp.
    pub fn timestamp(mut self, ts: u64) -> Self {
        self.timestamp = ts;
        self
    }

    /// Add a file change.
    pub fn change(mut self, change: FileChange) -> Self {
        self.changes.push(change);
        self
    }

    /// Add multiple file changes.
    pub fn changes(mut self, changes: Vec<FileChange>) -> Self {
        self.changes.extend(changes);
        self
    }

    /// Build the commit.
    pub fn build(self) -> Commit {
        // Compute hash
        let hash = compute_commit_hash(
            self.parent.as_ref(),
            self.txg,
            &self.message,
            &self.author,
            &self.changes,
        );

        Commit {
            hash,
            parent: self.parent,
            txg: self.txg,
            message: self.message,
            author: self.author,
            timestamp: self.timestamp,
            changes: self.changes,
        }
    }
}

/// Compute commit hash using BLAKE3.
fn compute_commit_hash(
    parent: Option<&[u8; 32]>,
    txg: u64,
    message: &str,
    author: &str,
    changes: &[FileChange],
) -> [u8; 32] {
    // Build the data to hash
    let mut data = Vec::new();

    // Parent hash (or zeros if no parent)
    match parent {
        Some(p) => data.extend_from_slice(p),
        None => data.extend_from_slice(&[0u8; 32]),
    }

    // TXG
    data.extend_from_slice(&txg.to_le_bytes());

    // Message length + message
    let msg_bytes = message.as_bytes();
    data.extend_from_slice(&(msg_bytes.len() as u32).to_le_bytes());
    data.extend_from_slice(msg_bytes);

    // Author length + author
    let author_bytes = author.as_bytes();
    data.extend_from_slice(&(author_bytes.len() as u32).to_le_bytes());
    data.extend_from_slice(author_bytes);

    // Number of changes
    data.extend_from_slice(&(changes.len() as u32).to_le_bytes());

    // Each change
    for change in changes {
        // Path
        let path_bytes = change.path.as_bytes();
        data.extend_from_slice(&(path_bytes.len() as u32).to_le_bytes());
        data.extend_from_slice(path_bytes);

        // Change type (as u8)
        let change_type_byte = match &change.change_type {
            super::types::ChangeType::Created => 0u8,
            super::types::ChangeType::Modified => 1u8,
            super::types::ChangeType::Deleted => 2u8,
            super::types::ChangeType::Renamed { .. } => 3u8,
        };
        data.push(change_type_byte);

        // Checksums (optional)
        if let Some(cksum) = change.old_checksum {
            data.push(1);
            for v in cksum {
                data.extend_from_slice(&v.to_le_bytes());
            }
        } else {
            data.push(0);
        }

        if let Some(cksum) = change.new_checksum {
            data.push(1);
            for v in cksum {
                data.extend_from_slice(&v.to_le_bytes());
            }
        } else {
            data.push(0);
        }
    }

    // Compute BLAKE3 hash
    blake3_hash(&data)
}

/// BLAKE3 hash function.
///
/// Uses a simple implementation suitable for no_std.
fn blake3_hash(data: &[u8]) -> [u8; 32] {
    // Use the blake3 crate if available, otherwise use a fallback
    #[cfg(feature = "blake3")]
    {
        let hash = blake3::hash(data);
        *hash.as_bytes()
    }

    #[cfg(not(feature = "blake3"))]
    {
        // Fallback: simple hash mixing (NOT cryptographically secure!)
        // In production, we'd use the actual blake3 crate
        let mut state = [0u8; 32];

        // Initialize with a fixed pattern
        for (i, byte) in state.iter_mut().enumerate() {
            *byte = (i as u8).wrapping_mul(0x9E).wrapping_add(0x3B);
        }

        // Mix in data
        for (i, &byte) in data.iter().enumerate() {
            let idx = i % 32;
            state[idx] = state[idx]
                .wrapping_add(byte)
                .wrapping_mul(0x9E)
                .rotate_left(5);

            // Cross-mixing
            let next_idx = (idx + 1) % 32;
            state[next_idx] ^= state[idx];
        }

        // Final mixing rounds
        for _ in 0..4 {
            for i in 0..32 {
                let prev = state[(i + 31) % 32];
                let next = state[(i + 1) % 32];
                state[i] = state[i].wrapping_add(prev ^ next).rotate_left(3);
            }
        }

        state
    }
}

// ═══════════════════════════════════════════════════════════════════════════════
// COMMIT STORE
// ═══════════════════════════════════════════════════════════════════════════════

/// In-memory commit storage.
///
/// Maps commit hashes to commits, with branch head tracking.
#[derive(Debug, Clone)]
pub struct CommitStore {
    /// All commits indexed by hash.
    commits: BTreeMap<[u8; 32], Commit>,
    /// Branch heads (branch name -> commit hash).
    heads: BTreeMap<String, [u8; 32]>,
    /// TXG to commit mapping.
    txg_commits: BTreeMap<u64, [u8; 32]>,
}

impl CommitStore {
    /// Create a new empty commit store.
    pub fn new() -> Self {
        Self {
            commits: BTreeMap::new(),
            heads: BTreeMap::new(),
            txg_commits: BTreeMap::new(),
        }
    }

    /// Get the number of commits.
    pub fn len(&self) -> usize {
        self.commits.len()
    }

    /// Check if the store is empty.
    pub fn is_empty(&self) -> bool {
        self.commits.is_empty()
    }

    /// Add a commit to the store.
    pub fn add_commit(&mut self, commit: Commit) {
        let hash = commit.hash;
        let txg = commit.txg;
        self.txg_commits.insert(txg, hash);
        self.commits.insert(hash, commit);
    }

    /// Add a commit and update branch head.
    pub fn add_commit_to_branch(&mut self, commit: Commit, branch: &str) {
        let hash = commit.hash;
        self.add_commit(commit);
        self.heads.insert(branch.to_string(), hash);
    }

    /// Get a commit by hash.
    pub fn get(&self, hash: &[u8; 32]) -> Option<&Commit> {
        self.commits.get(hash)
    }

    /// Get a commit by short hash (first N hex chars).
    pub fn get_by_short_hash(&self, short: &str) -> Option<&Commit> {
        // Convert short hash to bytes for comparison
        let short_lower = short.to_lowercase();

        for (hash, commit) in &self.commits {
            let hash_hex = commit.hash_hex();
            if hash_hex.starts_with(&short_lower) {
                return Some(commit);
            }
        }
        None
    }

    /// Get a commit by TXG.
    pub fn get_by_txg(&self, txg: u64) -> Option<&Commit> {
        self.txg_commits.get(&txg).and_then(|h| self.commits.get(h))
    }

    /// Get the head commit for a branch.
    pub fn get_head(&self, branch: &str) -> Option<&Commit> {
        self.heads.get(branch).and_then(|h| self.commits.get(h))
    }

    /// Get the head hash for a branch.
    pub fn get_head_hash(&self, branch: &str) -> Option<[u8; 32]> {
        self.heads.get(branch).copied()
    }

    /// Set the head for a branch.
    pub fn set_head(&mut self, branch: &str, hash: [u8; 32]) {
        self.heads.insert(branch.to_string(), hash);
    }

    /// Check if a commit exists.
    pub fn contains(&self, hash: &[u8; 32]) -> bool {
        self.commits.contains_key(hash)
    }

    /// Get the parent commit.
    pub fn get_parent(&self, commit: &Commit) -> Option<&Commit> {
        commit.parent.as_ref().and_then(|h| self.commits.get(h))
    }

    /// Get the ancestry chain for a commit.
    pub fn ancestry(&self, hash: &[u8; 32], max_depth: Option<usize>) -> Vec<&Commit> {
        let mut result = Vec::new();
        let mut current = hash;
        let max = max_depth.unwrap_or(usize::MAX);

        while let Some(commit) = self.commits.get(current) {
            result.push(commit);
            if result.len() >= max {
                break;
            }
            match &commit.parent {
                Some(parent) => current = parent,
                None => break,
            }
        }

        result
    }

    /// Find the common ancestor of two commits.
    pub fn common_ancestor(&self, hash_a: &[u8; 32], hash_b: &[u8; 32]) -> Option<&Commit> {
        let ancestry_a: Vec<[u8; 32]> =
            self.ancestry(hash_a, None).iter().map(|c| c.hash).collect();

        let mut current = hash_b;
        while let Some(commit) = self.commits.get(current) {
            if ancestry_a.contains(&commit.hash) {
                return Some(commit);
            }
            match &commit.parent {
                Some(parent) => current = parent,
                None => break,
            }
        }

        None
    }

    /// Get commits in a range (exclusive start, inclusive end).
    pub fn range(&self, start: Option<&[u8; 32]>, end: &[u8; 32]) -> Vec<&Commit> {
        let mut result = Vec::new();
        let mut current = end;

        while let Some(commit) = self.commits.get(current) {
            if start.is_some() && start == Some(current) {
                break;
            }
            result.push(commit);
            match &commit.parent {
                Some(parent) => current = parent,
                None => break,
            }
        }

        result.reverse();
        result
    }

    /// Iterate over all commits.
    pub fn iter(&self) -> impl Iterator<Item = &Commit> {
        self.commits.values()
    }

    /// Get commits for a branch (from head back).
    pub fn branch_commits(&self, branch: &str, limit: Option<usize>) -> Vec<&Commit> {
        match self.heads.get(branch) {
            Some(head) => self.ancestry(head, limit),
            None => Vec::new(),
        }
    }
}

impl Default for CommitStore {
    fn default() -> Self {
        Self::new()
    }
}

// ═══════════════════════════════════════════════════════════════════════════════
// COMMIT VALIDATOR
// ═══════════════════════════════════════════════════════════════════════════════

/// Validates commit integrity.
pub struct CommitValidator;

impl CommitValidator {
    /// Verify a commit's hash is correct.
    pub fn verify_hash(commit: &Commit) -> bool {
        let computed = compute_commit_hash(
            commit.parent.as_ref(),
            commit.txg,
            &commit.message,
            &commit.author,
            &commit.changes,
        );
        computed == commit.hash
    }

    /// Validate commit data.
    pub fn validate(commit: &Commit) -> Result<(), BranchError> {
        // Check hash
        if !Self::verify_hash(commit) {
            return Err(BranchError::Internal("commit hash mismatch".into()));
        }

        // Check message is not empty
        if commit.message.is_empty() {
            return Err(BranchError::Internal(
                "commit message cannot be empty".into(),
            ));
        }

        // Check author is not empty
        if commit.author.is_empty() {
            return Err(BranchError::Internal(
                "commit author cannot be empty".into(),
            ));
        }

        Ok(())
    }

    /// Validate a chain of commits.
    pub fn validate_chain(commits: &[&Commit]) -> Result<(), BranchError> {
        for (i, commit) in commits.iter().enumerate() {
            // Validate individual commit
            Self::validate(commit)?;

            // Check parent linkage (if not the last/oldest commit)
            if i + 1 < commits.len() {
                let expected_parent = commits[i + 1].hash;
                match commit.parent {
                    Some(parent) if parent == expected_parent => {}
                    Some(_) => {
                        return Err(BranchError::Internal("broken commit chain".into()));
                    }
                    None => {
                        return Err(BranchError::Internal("missing parent reference".into()));
                    }
                }
            }
        }

        Ok(())
    }
}

// ═══════════════════════════════════════════════════════════════════════════════
// TESTS
// ═══════════════════════════════════════════════════════════════════════════════

#[cfg(test)]
mod tests {
    use super::*;
    use crate::branch::types::ChangeType;

    #[test]
    fn test_commit_builder() {
        let commit = CommitBuilder::new(100)
            .message("Initial commit")
            .author("test@example.com")
            .timestamp(1704067200)
            .change(FileChange::created("/file.txt".into(), [1; 4], 100))
            .build();

        assert_eq!(commit.txg, 100);
        assert_eq!(commit.message, "Initial commit");
        assert_eq!(commit.author, "test@example.com");
        assert!(commit.parent.is_none());
        assert_eq!(commit.changes.len(), 1);
    }

    #[test]
    fn test_commit_hash_deterministic() {
        let commit1 = CommitBuilder::new(100)
            .message("Test")
            .author("test")
            .timestamp(1000)
            .build();

        let commit2 = CommitBuilder::new(100)
            .message("Test")
            .author("test")
            .timestamp(1000)
            .build();

        // Same input should produce same hash
        assert_eq!(commit1.hash, commit2.hash);
    }

    #[test]
    fn test_commit_hash_changes_with_input() {
        let commit1 = CommitBuilder::new(100)
            .message("Test A")
            .author("test")
            .timestamp(1000)
            .build();

        let commit2 = CommitBuilder::new(100)
            .message("Test B")
            .author("test")
            .timestamp(1000)
            .build();

        // Different message should produce different hash
        assert_ne!(commit1.hash, commit2.hash);
    }

    #[test]
    fn test_commit_with_parent() {
        let parent = CommitBuilder::new(100)
            .message("Parent")
            .author("test")
            .timestamp(1000)
            .build();

        let child = CommitBuilder::new(101)
            .parent(parent.hash)
            .message("Child")
            .author("test")
            .timestamp(2000)
            .build();

        assert_eq!(child.parent, Some(parent.hash));
    }

    #[test]
    fn test_commit_store() {
        let mut store = CommitStore::new();

        let commit = CommitBuilder::new(100)
            .message("Test")
            .author("test")
            .timestamp(1000)
            .build();

        let hash = commit.hash;
        store.add_commit_to_branch(commit, "main");

        assert!(store.contains(&hash));
        assert_eq!(store.len(), 1);
        assert_eq!(store.get_head("main").unwrap().hash, hash);
    }

    #[test]
    fn test_ancestry() {
        let mut store = CommitStore::new();

        // Create chain: c1 <- c2 <- c3
        let c1 = CommitBuilder::new(100)
            .message("First")
            .author("test")
            .timestamp(1000)
            .build();

        let c2 = CommitBuilder::new(101)
            .parent(c1.hash)
            .message("Second")
            .author("test")
            .timestamp(2000)
            .build();

        let c3 = CommitBuilder::new(102)
            .parent(c2.hash)
            .message("Third")
            .author("test")
            .timestamp(3000)
            .build();

        let c3_hash = c3.hash;
        store.add_commit(c1);
        store.add_commit(c2);
        store.add_commit_to_branch(c3, "main");

        let ancestry = store.ancestry(&c3_hash, None);
        assert_eq!(ancestry.len(), 3);
        assert_eq!(ancestry[0].message, "Third");
        assert_eq!(ancestry[1].message, "Second");
        assert_eq!(ancestry[2].message, "First");
    }

    #[test]
    fn test_common_ancestor() {
        let mut store = CommitStore::new();

        // Create:
        //   c1 <- c2 <- c3 (main)
        //          \<- c4 (feature)

        let c1 = CommitBuilder::new(100)
            .message("First")
            .author("test")
            .timestamp(1000)
            .build();

        let c2 = CommitBuilder::new(101)
            .parent(c1.hash)
            .message("Second")
            .author("test")
            .timestamp(2000)
            .build();

        let c2_hash = c2.hash;

        let c3 = CommitBuilder::new(102)
            .parent(c2.hash)
            .message("Third on main")
            .author("test")
            .timestamp(3000)
            .build();

        let c4 = CommitBuilder::new(103)
            .parent(c2.hash)
            .message("Fourth on feature")
            .author("test")
            .timestamp(3000)
            .build();

        let c3_hash = c3.hash;
        let c4_hash = c4.hash;

        store.add_commit(c1);
        store.add_commit(c2);
        store.add_commit_to_branch(c3, "main");
        store.add_commit_to_branch(c4, "feature");

        let ancestor = store.common_ancestor(&c3_hash, &c4_hash);
        assert!(ancestor.is_some());
        assert_eq!(ancestor.unwrap().hash, c2_hash);
    }

    #[test]
    fn test_get_by_short_hash() {
        let mut store = CommitStore::new();

        let commit = CommitBuilder::new(100)
            .message("Test")
            .author("test")
            .timestamp(1000)
            .build();

        let short = commit.short_hash();
        store.add_commit(commit);

        let found = store.get_by_short_hash(&short);
        assert!(found.is_some());
        assert_eq!(found.unwrap().message, "Test");
    }

    #[test]
    fn test_get_by_txg() {
        let mut store = CommitStore::new();

        let commit = CommitBuilder::new(42)
            .message("Test")
            .author("test")
            .timestamp(1000)
            .build();

        store.add_commit(commit);

        let found = store.get_by_txg(42);
        assert!(found.is_some());
        assert_eq!(found.unwrap().message, "Test");

        // Non-existent TXG
        assert!(store.get_by_txg(999).is_none());
    }

    #[test]
    fn test_range() {
        let mut store = CommitStore::new();

        // Create chain: c1 <- c2 <- c3 <- c4
        let c1 = CommitBuilder::new(100)
            .message("First")
            .author("test")
            .timestamp(1000)
            .build();

        let c2 = CommitBuilder::new(101)
            .parent(c1.hash)
            .message("Second")
            .author("test")
            .timestamp(2000)
            .build();

        let c1_hash = c1.hash;
        let c2_hash = c2.hash;

        let c3 = CommitBuilder::new(102)
            .parent(c2.hash)
            .message("Third")
            .author("test")
            .timestamp(3000)
            .build();

        let c4 = CommitBuilder::new(103)
            .parent(c3.hash)
            .message("Fourth")
            .author("test")
            .timestamp(4000)
            .build();

        let c4_hash = c4.hash;

        store.add_commit(c1);
        store.add_commit(c2);
        store.add_commit(c3);
        store.add_commit(c4);

        // Range from c2 (exclusive) to c4 (inclusive) should give c3, c4
        let range = store.range(Some(&c2_hash), &c4_hash);
        assert_eq!(range.len(), 2);
        assert_eq!(range[0].message, "Third");
        assert_eq!(range[1].message, "Fourth");
    }

    #[test]
    fn test_validator_verify_hash() {
        let commit = CommitBuilder::new(100)
            .message("Test")
            .author("test")
            .timestamp(1000)
            .build();

        assert!(CommitValidator::verify_hash(&commit));
    }

    #[test]
    fn test_validator_validate() {
        let commit = CommitBuilder::new(100)
            .message("Test")
            .author("test")
            .timestamp(1000)
            .build();

        assert!(CommitValidator::validate(&commit).is_ok());
    }

    #[test]
    fn test_validator_empty_message() {
        let commit = CommitBuilder::new(100)
            .message("")
            .author("test")
            .timestamp(1000)
            .build();

        assert!(CommitValidator::validate(&commit).is_err());
    }

    #[test]
    fn test_validator_empty_author() {
        let commit = CommitBuilder::new(100)
            .message("Test")
            .author("")
            .timestamp(1000)
            .build();

        assert!(CommitValidator::validate(&commit).is_err());
    }

    #[test]
    fn test_branch_commits() {
        let mut store = CommitStore::new();

        let c1 = CommitBuilder::new(100)
            .message("First")
            .author("test")
            .timestamp(1000)
            .build();

        let c2 = CommitBuilder::new(101)
            .parent(c1.hash)
            .message("Second")
            .author("test")
            .timestamp(2000)
            .build();

        store.add_commit(c1);
        store.add_commit_to_branch(c2, "main");

        let commits = store.branch_commits("main", None);
        assert_eq!(commits.len(), 2);

        // With limit
        let limited = store.branch_commits("main", Some(1));
        assert_eq!(limited.len(), 1);
    }
}