@@ -20,8 +20,8 @@
Loading
20 20
pub const FLAG_EXISTS: u8 = 0b000_0001;
21 21
pub const FLAG_DELETED: u8 = 0b000_0010;
22 22
pub const SEGMENT_HASH_OFFSET: u32 = 16;
23 -
pub const SEGMENT_PAGE_DELETE_COUNT_OFFSET: u32 = 20;
24 -
pub const SEGMENT_DATA_OFFSET: u32 = 22;
23 +
pub const SEGMENT_PAGE_DELETE_COUNT_OFFSET: u32 = 24;
24 +
pub const SEGMENT_DATA_OFFSET: u32 = 26;
25 25
pub const ADDRESS_ENTRY_SIZE: u32 = 8 + 1 + 2; // Pointer to data page + flags + version management (not yet used)
26 26
27 27
pub struct OldRecordInfo {
@@ -455,7 +455,7 @@
Loading
455 455
                .segment_by_id(segment_id)
456 456
                .unwrap()
457 457
                .alloc_pos,
458 -
            22
458 +
            26
459 459
        );
460 460
    }
461 461

@@ -345,13 +345,13 @@
Loading
345 345
    pub temp_segments_id: HashMap<String, SegmentId>,
346 346
}
347 347
348 -
pub fn segment_hash(segment: &str) -> u32 {
349 -
    let mut val: u32;
348 +
pub fn segment_hash(segment: &str) -> u64 {
349 +
    let mut val: u64;
350 350
    let hasher = &mut DefaultHasher::new();
351 351
    segment.hash(hasher);
352 -
    val = hasher.finish() as u32;
353 -
    val <<= 16;
354 -
    val |= u32::from(rand::random::<u16>());
352 +
    val = hasher.finish();
353 +
    val <<= 32;
354 +
    val |= u64::from(rand::random::<u32>());
355 355
    val
356 356
}
357 357
@@ -386,7 +386,7 @@
Loading
386 386
                    let first_page = page.read_u64();
387 387
                    let persistent_page = page.read_u64();
388 388
                    let persistent_pos = page.read_u32();
389 -
                    let pers_hash = SegmentId::new(page.read_u32());
389 +
                    let pers_hash = SegmentId::read(&mut page);
390 390
                    let name_size = page.read_u16() as usize;
391 391
392 392
                    let mut slice: Vec<u8> = vec![0; name_size];

@@ -19,16 +19,16 @@
Loading
19 19
    encode::{u32 as u32_venc, u32_buffer, u64 as u64_venc, u64_buffer},
20 20
};
21 21
22 -
fn write_id(f: &mut fmt::Formatter, id: u32) -> fmt::Result {
22 +
fn write_id(f: &mut fmt::Formatter, id: u64) -> fmt::Result {
23 23
    let mut buffer = Vec::new();
24 -
    buffer.write_all(u32_venc(id, &mut u32_buffer()));
24 +
    buffer.write_all(u64_venc(id, &mut u64_buffer()));
25 25
    buffer.push(0b0101_0101);
26 26
    write!(f, "{}", BASE32_DNSSEC.encode(&buffer))
27 27
}
28 28
29 -
fn read_id(s: &str) -> PRes<u32> {
29 +
fn read_id(s: &str) -> PRes<u64> {
30 30
    let bytes = BASE32_DNSSEC.decode(s.as_bytes())?;
31 -
    Ok(u32_vdec(&bytes).map_err(|_| PersyError::InvalidId(String::from(s)))?.0)
31 +
    Ok(u64_vdec(&bytes).map_err(|_| PersyError::InvalidId(String::from(s)))?.0)
32 32
}
33 33
34 34
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Debug, Default)]
@@ -102,30 +102,30 @@
Loading
102 102
/// It does NOT serialize to the segment name.
103 103
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Default)]
104 104
pub struct SegmentId {
105 -
    pub(crate) id: u32,
105 +
    pub(crate) id: u64,
106 106
}
107 107
108 108
impl SegmentId {
109 109
    #[inline]
110 -
    pub(crate) fn new(id: u32) -> Self {
110 +
    pub(crate) fn new(id: u64) -> Self {
111 111
        SegmentId { id }
112 112
    }
113 113
114 114
    pub(crate) fn write_varint(&self, write: &mut dyn InfallibleWrite) {
115 -
        write.write_varint_u32(self.id);
115 +
        write.write_varint_u64(self.id);
116 116
    }
117 117
118 118
    pub(crate) fn read_varint(read: &mut dyn InfallibleRead) -> SegmentId {
119 -
        let id = read.read_varint_u32();
119 +
        let id = read.read_varint_u64();
120 120
        Self::new(id)
121 121
    }
122 122
123 123
    pub(crate) fn write(&self, write: &mut dyn InfallibleWrite) {
124 -
        write.write_u32(self.id);
124 +
        write.write_u64(self.id);
125 125
    }
126 126
127 127
    pub(crate) fn read(read: &mut dyn InfallibleRead) -> SegmentId {
128 -
        let id = read.read_u32();
128 +
        let id = read.read_u64();
129 129
        Self::new(id)
130 130
    }
131 131
}
@@ -328,8 +328,8 @@
Loading
328 328
impl fmt::Display for IndexId {
329 329
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
330 330
        let mut buffer = Vec::new();
331 -
        buffer.write_all(u32_venc(self.meta.id, &mut u32_buffer()));
332 -
        buffer.write_all(u32_venc(self.data.id, &mut u32_buffer()));
331 +
        buffer.write_all(u64_venc(self.meta.id, &mut u64_buffer()));
332 +
        buffer.write_all(u64_venc(self.data.id, &mut u64_buffer()));
333 333
        buffer.push(0b0101_0101);
334 334
        write!(f, "{}", BASE32_DNSSEC.encode(&buffer))
335 335
    }
@@ -340,9 +340,9 @@
Loading
340 340
341 341
    fn from_str(s: &str) -> Result<Self, Self::Err> {
342 342
        let bytes = BASE32_DNSSEC.decode(s.as_bytes())?;
343 -
        let (meta, bytes) = u32_vdec(&bytes).map_err(|_| PersyError::InvalidId(String::from(s)))?;
343 +
        let (meta, bytes) = u64_vdec(&bytes).map_err(|_| PersyError::InvalidId(String::from(s)))?;
344 344
        let data = if bytes.len() > 1 {
345 -
            let (d, _) = u32_vdec(&bytes).map_err(|_| PersyError::InvalidId(String::from(s)))?;
345 +
            let (d, _) = u64_vdec(&bytes).map_err(|_| PersyError::InvalidId(String::from(s)))?;
346 346
            d
347 347
        } else {
348 348
            0
Files Coverage
src 92.81%
tests 98.56%
Project Totals (29 files) 93.84%
1
coverage:
2
  status:
3
    project:
4
      default:
5
        target: 80%
6
        threshold: 1.0%
7
    patch: off
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading