pijul nest
guest [sign in]

Cleanup, comments, renaming

[?]
Feb 14, 2021, 2:22 PM
CCNPHVQCIGINWTLXCHOASGVWUPBZXFOLM2F7HTKMEA2DMFTOX7TAC

Dependencies

  • [2] QYDGYIZR Split trait Representable into its mandatory part and an optional part
  • [3] H3FVSQIQ Unsized pages
  • [4] OFINGD26 implementing prev() on cursors (+ some cleanup)
  • [5] RV2L6CZW A few comments
  • [6] T73WR2BX Cleaner RC increments for keys and values containing references + more comments in `del`
  • [7] W26CFMAQ Improving safety of cursors
  • [8] G4JEQLLX Debugging synchronisation
  • [9] HN6Z5DU4 Cleanup
  • [10] 6DMPXOAT More debugging
  • [11] UUUVNC4D Debugging/cleanup around cursors
  • [12] NXMFNPZ7 Comments + debugging drop
  • [13] XEU2QVLC Debugging after plugging this into Pijul
  • [14] OP6SVMOD Resetting history
  • [15] OTWDDJE7 Trait/type cleanup
  • [16] WS4ZQM4R Debugging, tests, etc.
  • [17] QEUTVAZ4 Splitting btree::page
  • [18] ESUI5EUZ Making as_page() unsafe
  • [19] LSQ6V7M6 Cleanup + docs
  • [20] WAKPPBKO Fixing a double-free of roots after deletions (the root was freed both by handle_merge and by update_root)
  • [21] 6UVFCERM Formatting, debugging, etc.
  • [22] APPY2E7M Unsized deletions + custom sizes back
  • [23] KMT3MF5N Drop a database

Change contents

  • replacement in sanakirja-core/src/lib.rs at line 15
    [3.632][3.632:720]()
    //! At the moment, only B trees are implemented, as well as three
    //! important traits:
    [3.632]
    [3.720]
    //! At the moment, only B trees are implemented, as well as the
    //! following general traits:
  • edit in sanakirja-core/src/lib.rs at line 18
    [3.724][3.724:826]()
    //! - [`Representable`] is the trait of types that can be written to
    //! disk and read from the disk.
  • edit in sanakirja-core/src/lib.rs at line 26
    [3.1317]
    [3.134]
    //!
    //! Moreover, two other traits can be used to store things on pages:
    //! [`Storable`] is a simple trait that all `Sized + Ord` types
    //! without references can readily implement (the [`direct_repr!`]
    //! macro does that). For types containing references to pages
    //! allocated in the database, the comparison function can be
    //! customised. Moreover, these types must supply an iterator over
    //! these references, in order for reference-counting to work properly
    //! when the datastructures referencing these types are forked.
    //!
    //! Dynamically-sized types, or types that need to be represented in a
    //! dynamically-sized way, can use the [`UnsizedStorable`] format.
  • replacement in sanakirja-core/src/lib.rs at line 45
    [3.119][3.265:303]()
    /// Types that can be stored on disk.
    [3.119]
    [2.0]
    /// Types that can be stored on disk. This trait may be used in
    /// conjunction with `Sized` in order to determine the on-disk size,
    /// or with [`UnsizedStorable`] when special arrangements are needed.
  • replacement in sanakirja-core/src/lib.rs at line 57
    [2.162][2.162:211]()
    fn page_offsets(&self) -> Self::PageOffsets;
    [2.162]
    [2.211]
    fn page_references(&self) -> Self::PageReferences;
  • replacement in sanakirja-core/src/lib.rs at line 63
    [3.1614][3.1614:1658]()
    type PageOffsets: Iterator<Item = u64>;
    [3.1614]
    [3.761]
    type PageReferences: Iterator<Item = u64>;
  • replacement in sanakirja-core/src/lib.rs at line 66
    [3.764][3.1318:1379]()
    /// A macro to implement [`Representable`] on "plain" types,
    [3.764]
    [3.1379]
    /// A macro to implement [`Storable`] on "plain" types,
  • replacement in sanakirja-core/src/lib.rs at line 73
    [2.244][3.851:964](),[3.203][3.851:964](),[3.851][3.851:964]()
    type PageOffsets = core::iter::Empty<u64>;
    fn page_offsets(&self) -> Self::PageOffsets {
    [2.244]
    [3.964]
    type PageReferences = core::iter::Empty<u64>;
    fn page_references(&self) -> Self::PageReferences {
  • replacement in sanakirja-core/src/lib.rs at line 139
    [2.1715][3.392:489](),[3.392][3.392:489]()
    type PageOffsets = core::iter::Empty<u64>;
    fn page_offsets(&self) -> Self::PageOffsets {
    [2.1715]
    [3.489]
    type PageReferences = core::iter::Empty<u64>;
    fn page_references(&self) -> Self::PageReferences {
  • replacement in sanakirja-core/src/lib.rs at line 201
    [3.2399][3.1706:1754]()
    /// Representation of a mutable or shared page.
    [3.2399]
    [3.1754]
    /// Representation of a mutable or shared page. This is an owned page
    /// (like `Vec` in Rust's std), but we do not know whether we can
    /// mutate it or not.
    ///
    /// The least-significant bit of the first byte of each page is 1 if
    /// and only if the page was allocated by the current transaction (and
    /// hence isn't visible to any other transaction, meaning we can write
    /// on it).
  • edit in sanakirja-core/src/lib.rs at line 216
    [3.2494]
    [3.2494]
    /// Representation of a borrowed, or immutable page, like a slice in
    /// Rust.
  • edit in sanakirja-core/src/lib.rs at line 226
    [3.412]
    [3.1795]
    /// Borrows the page.
  • edit in sanakirja-core/src/lib.rs at line 231
    [3.1627][3.1627:1637](),[3.1637][3.0:116](),[3.495][3.0:116]()
    }
    }
    pub fn null() -> Self {
    CowPage {
    data: core::ptr::null_mut(),
    offset: 0,
  • replacement in sanakirja-core/src/lib.rs at line 235
    [3.2555][3.281:362]()
    /// The layout of pages is as follows: the LSB of the first byte is
    /// "dirty".
    [3.2555]
    [3.504]
    /// An owned page on which we can write. This is just a wrapper around
    /// `CowPage` to avoid checking the "dirty" bit at running time.
  • edit in sanakirja-core/src/lib.rs at line 247
    [3.1662]
    [3.1662]
    /// Checks the dirty bit of a page.
  • replacement in sanakirja-core/src/lib.rs at line 253
    [3.2732][3.2732:2836]()
    /// Trait for loading a page and a root. Base trait to implement
    /// "storage engines" under Sanakirja.
    [3.2732]
    [3.2836]
    /// Trait for loading a page.
  • replacement in sanakirja-core/src/lib.rs at line 258
    [3.623][3.2961:3028](),[3.2961][3.2961:3028]()
    /// RC
    fn rc(&self, off: u64) -> Result<u64, Self::Error>;
    [3.623]
    [3.3028]
    /// Reference-counting. Since reference-counts are designed to be
    /// storable into B trees by external allocators, pages referenced
    /// once aren't stored, and hence are indistinguishable from pages
    /// that are never referenced. The default implementation returns
    /// 0.
    ///
    /// This has the extra benefit of requiring less disk space, and
    /// isn't more unsafe than storing the reference count, since we
    /// aren't supposed to hold a reference to a page with "logical
    /// RC" 0, so storing "1" for that page would be redundant anyway.
    fn rc(&self, _off: u64) -> Result<u64, Self::Error> {
    Ok(0)
    }
  • replacement in sanakirja-core/src/lib.rs at line 274
    [3.3031][3.3031:3135]()
    /// Trait for loading a page and a root. Base trait to implement
    /// "storage engines" under Sanakirja.
    [3.3031]
    [3.3135]
    /// Trait for allocating and freeing pages.
  • edit in sanakirja-core/src/lib.rs at line 276
    [3.3167]
    [3.3167]
    /// Allocate a new page.
  • replacement in sanakirja-core/src/lib.rs at line 278
    [3.3229][3.0:27]()
    // Returns the new RC.
    [3.3229]
    [3.27]
    /// Increment the page's reference count.
  • replacement in sanakirja-core/src/lib.rs at line 280
    [3.94][3.94:134]()
    // Returns the new RC (0 if freed).
    [3.94]
    [3.134]
    /// Decrement the page's reference count, assuming the page was
    /// first allocated by another transaction. If the RC reaches 0,
    /// free the page. Must return the new RC (0 if freed).
  • replacement in sanakirja-core/src/lib.rs at line 284
    [3.201][3.201:241]()
    // Returns the new RC (0 if freed).
    [3.201]
    [3.241]
    /// Same as [`decr_rc`], but for pages allocated by the current
    /// transaction. This is an important distinction, as pages
    /// allocated by the current transaction can be reused immediately
    /// after being freed.
  • replacement in sanakirja-core/src/btree/put.rs at line 221
    [3.3297][3.8397:8461](),[3.1200][3.8397:8461](),[3.264][3.8397:8461](),[3.1215][3.8397:8461](),[3.8397][3.8397:8461]()
    for o in k.page_offsets().chain(v.page_offsets()) {
    [3.3297]
    [3.8461]
    for o in k.page_references().chain(v.page_references()) {
  • replacement in sanakirja-core/src/btree/mod.rs at line 443
    [3.13429][3.2319:2387](),[3.6934][3.2319:2387](),[3.2319][3.2319:2387]()
    for o in k.page_offsets().chain(v.page_offsets()) {
    [3.13429]
    [3.2387]
    for o in k.page_references().chain(v.page_references()) {
  • replacement in sanakirja-core/src/btree/del.rs at line 58
    [3.1194][3.1194:1260]()
    for o in delk.page_offsets().chain(delv.page_offsets()) {
    [3.1194]
    [3.450]
    for o in delk.page_references().chain(delv.page_references()) {
  • replacement in sanakirja-core/src/btree/del.rs at line 173
    [3.1825][3.1913:1977]()
    for o in k.page_offsets().chain(v.page_offsets()) {
    [3.1825]
    [3.1897]
    for o in k.page_references().chain(v.page_references()) {
  • replacement in sanakirja-core/src/btree/del.rs at line 351
    [3.5226][3.5226:5294]()
    for o in k.page_offsets().chain(v.page_offsets()) {
    [3.5226]
    [3.5294]
    for o in k.page_references().chain(v.page_references()) {
  • replacement in sanakirja-core/src/btree/del.rs at line 421
    [3.2310][3.37710:37796](),[3.16957][3.37710:37796](),[3.10492][3.37710:37796](),[3.37710][3.37710:37796]()
    for o in split_key.page_offsets().chain(split_value.page_offsets()) {
    [3.16957]
    [3.37796]
    for o in split_key
    .page_references()
    .chain(split_value.page_references())
    {
  • replacement in sanakirja-core/src/btree/del.rs at line 457
    [3.17243][3.9970:10030](),[3.8090][3.9970:10030](),[3.9970][3.9970:10030]()
    for o in k.page_offsets().chain(v.page_offsets()) {
    [3.17243]
    [3.10030]
    for o in k.page_references().chain(v.page_references()) {
  • replacement in sanakirja-core/src/btree/del.rs at line 482
    [3.17315][3.10710:10770](),[3.8173][3.10710:10770](),[3.10710][3.10710:10770]()
    for o in k.page_offsets().chain(v.page_offsets()) {
    [3.17315]
    [3.10770]
    for o in k.page_references().chain(v.page_references()) {
  • replacement in sanakirja-core/src/btree/del.rs at line 491
    [3.17390][3.11016:11076](),[3.8259][3.11016:11076](),[3.11016][3.11016:11076]()
    for o in k.page_offsets().chain(v.page_offsets()) {
    [3.17390]
    [3.11076]
    for o in k.page_references().chain(v.page_references()) {
  • replacement in sanakirja-core/src/btree/del.rs at line 581
    [3.24321][3.7767:7835]()
    for o in k.page_offsets().chain(v.page_offsets()) {
    [3.24321]
    [3.39482]
    for o in k.page_references().chain(v.page_references()) {