sqlsrv

Check-in Differences
Login

Check-in Differences

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Difference From sqlsrv-0.0.3 To sqlsrv-0.0.4

2024-01-21
16:37
Make internal thread pool optional. check-in: 822036d2f6 user: jan tags: trunk
2024-01-19
16:01
Release maintenance. check-in: 2a13622830 user: jan tags: sqlsrv-0.0.4, trunk
15:58
Allow dirt to be optionally returned from read/write threaded wrappers. check-in: 03fc406b35 user: jan tags: trunk
2024-01-18
15:51
Add date. check-in: 9882cb4f86 user: jan tags: sqlsrv-0.0.3, trunk
15:50
Release maintenance. check-in: ceaf99c794 user: jan tags: trunk

Changes to Cargo.toml.

1
2
3
4
5
6
7
8
9
10
[package]
name = "sqlsrv"
version = "0.0.3"
edition = "2021"
license = "0BSD"
categories = [ "database" ]
keywords = [ "sqlite", "server" ]
repository = "https://repos.qrnch.tech/pub/sqlsrv"
description = "Utility functions for managing SQLite connections in a server application."
rust-version = "1.56"


|







1
2
3
4
5
6
7
8
9
10
[package]
name = "sqlsrv"
version = "0.0.4"
edition = "2021"
license = "0BSD"
categories = [ "database" ]
keywords = [ "sqlite", "server" ]
repository = "https://repos.qrnch.tech/pub/sqlsrv"
description = "Utility functions for managing SQLite connections in a server application."
rust-version = "1.56"

Changes to src/lib.rs.

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

    Ok(wctx)
  }

  /// Run a closure with read/write connection
  pub fn rw_run<F>(&self, f: F)
  where
    F: FnOnce(&mut Connection) + Send + 'static
  {
    let mut rwconn = self.writer();

    self.tpool.execute(move || f(&mut rwconn));



  }




  /// Run a closure with read/write connection, returning a channel end-point
  /// for retreiving result.
  pub fn rw_run_result<F, T, E>(&self, f: F) -> swctx::WaitCtx<T, (), E>
  where
    F: FnOnce(&mut Connection, swctx::SetCtx<T, (), E>) + Send + 'static,


    T: Send + 'static,
    E: Send + 'static
  {
    let mut rwconn = self.writer();

    let (sctx, wctx) = swctx::mkpair();

    self.tpool.execute(move || f(&mut rwconn, sctx));






    wctx
  }

  /// Perform an incremental vacuum.
  ///
  /// `n` is the number of freelist nodes to reclaim.  If `None` all nodes will







|



|
>
>
>
|
>
>
>





|
>
>







|
>
>
>
>
>







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

    Ok(wctx)
  }

  /// Run a closure with read/write connection
  pub fn rw_run<F>(&self, f: F)
  where
    F: FnOnce(&mut Connection) -> Option<usize> + Send + 'static
  {
    let mut rwconn = self.writer();

    self.tpool.execute(move || {
      let dirt = f(&mut rwconn);
      if let Some(dirt) = dirt {
        rwconn.add_dirt(dirt);
      }
    });
  }


  /// Run a closure with read/write connection, returning a channel end-point
  /// for retreiving result.
  pub fn rw_run_result<F, T, E>(&self, f: F) -> swctx::WaitCtx<T, (), E>
  where
    F: FnOnce(&mut Connection, swctx::SetCtx<T, (), E>) -> Option<usize>
      + Send
      + 'static,
    T: Send + 'static,
    E: Send + 'static
  {
    let mut rwconn = self.writer();

    let (sctx, wctx) = swctx::mkpair();

    self.tpool.execute(move || {
      let dirt = f(&mut rwconn, sctx);
      if let Some(dirt) = dirt {
        rwconn.add_dirt(dirt);
      }
    });

    wctx
  }

  /// Perform an incremental vacuum.
  ///
  /// `n` is the number of freelist nodes to reclaim.  If `None` all nodes will
557
558
559
560
561
562
563


564
565
566
567
568
569
570
571
572
573
      } else {
        wconn.execute("PRAGMA incremental_vacuum;", params![])
      };
      match res {
        Ok(_) => sctx.set(()),
        Err(e) => sctx.fail(e)
      }


    })
  }

  /// Consume self and wait for all threads in thread pool to complete.
  pub fn shutdown(self) {
    self.tpool.join();
  }
}

// vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 :







>
>










570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
      } else {
        wconn.execute("PRAGMA incremental_vacuum;", params![])
      };
      match res {
        Ok(_) => sctx.set(()),
        Err(e) => sctx.fail(e)
      }

      None
    })
  }

  /// Consume self and wait for all threads in thread pool to complete.
  pub fn shutdown(self) {
    self.tpool.join();
  }
}

// vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 :

Changes to www/changelog.md.

1
2
3
4
5
6
7
8
9
10
11
12










13
14
15
16
17
18
19
# Change Log

## [Unreleased]

[Details](/vdiff?from=sqlsrv-0.0.3&to=trunk)

### Added

### Changed

### Removed











---

## [0.0.3] - 2024-01-18

[Details](/vdiff?from=sqlsrv-0.0.2&to=sqlsrv-0.0.3)

### Added




|







>
>
>
>
>
>
>
>
>
>







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
# Change Log

## [Unreleased]

[Details](/vdiff?from=sqlsrv-0.0.4&to=trunk)

### Added

### Changed

### Removed

---

## [0.0.4]

[Details](/vdiff?from=sqlsrv-0.0.3&to=sqlsrv-0.0.4)

### Changed

- Allow `dirt` to be returned from read/write thread wrappers.

---

## [0.0.3] - 2024-01-18

[Details](/vdiff?from=sqlsrv-0.0.2&to=sqlsrv-0.0.3)

### Added