Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: stepchowfun/docuum
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.22.4
Choose a base ref
...
head repository: stepchowfun/docuum
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.23.0
Choose a head ref
  • 11 commits
  • 7 files changed
  • 2 contributors

Commits on Jun 18, 2023

  1. Copy the full SHA
    7f7d822 View commit details
  2. Merge pull request #253 from stepchowfun/install-v0.22.4

    Install v0.22.4 by default
    stepchowfun authored Jun 18, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    36ca3c5 View commit details

Commits on Jul 1, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c39ff4b View commit details
  2. Merge pull request #254 from stepchowfun/integration-test

    Rename a file for consistency
    stepchowfun authored Jul 1, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d0a360a View commit details

Commits on Aug 11, 2023

  1. Copy the full SHA
    a499e89 View commit details
  2. Merge pull request #255 from stepchowfun/non-mut

    Change a mutable borrow to an immutable borrow
    stepchowfun authored Aug 11, 2023
    Copy the full SHA
    a971ca0 View commit details

Commits on Aug 17, 2023

  1. Only run vacuum when a new image is added to the cache.

    Otherwise there should be no need to start evicting. This reduces the load on moby (docker-daemon) via less `docker system df` calls as well as improving the performance of docuum.
    sdab committed Aug 17, 2023
    Copy the full SHA
    6b06857 View commit details
  2. Copy the full SHA
    25c503b View commit details
  3. Merge pull request #256 from sdab/vacuum_optimization

    Only run vacuum when a new image is added to the cache.
    stepchowfun authored Aug 17, 2023
    Copy the full SHA
    1858d86 View commit details
  4. Release v0.23.0

    stepchowfun committed Aug 17, 2023
    Copy the full SHA
    72ff459 View commit details
  5. Merge pull request #257 from stepchowfun/v0.23.0

    Release v0.23.0
    stepchowfun authored Aug 17, 2023
    Copy the full SHA
    c99386d View commit details
Showing with 34 additions and 26 deletions.
  1. +5 −0 CHANGELOG.md
  2. +1 −1 Cargo.lock
  3. +1 −1 Cargo.toml
  4. +1 −1 install.sh
  5. 0 integration_test.sh → integration-test.sh
  6. +23 −20 src/run.rs
  7. +3 −3 toast.yml
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.23.0] - 2023-08-17

### Changed
- Docuum now only runs its vacuuming logic when it learns about a new image for the first time.

## [0.22.4] - 2023-06-18

### Added
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "docuum"
version = "0.22.4"
version = "0.23.0"
authors = ["Stephan Boyer <stephan@stephanboyer.com>"]
edition = "2021"
description = "LRU eviction of Docker images."
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
DESTINATION="${PREFIX:-/usr/local/bin}/docuum"

# Which version to download
RELEASE="v${VERSION:-0.22.3}"
RELEASE="v${VERSION:-0.22.4}"

# Determine which binary to download.
FILENAME=''
File renamed without changes.
43 changes: 23 additions & 20 deletions src/run.rs
Original file line number Diff line number Diff line change
@@ -158,7 +158,7 @@ fn parent_id(state: &State, image_id: &str) -> io::Result<Option<String>> {
}

// Query Docker for all the images.
fn list_image_records(state: &mut State) -> io::Result<HashMap<String, ImageRecord>> {
fn list_image_records(state: &State) -> io::Result<HashMap<String, ImageRecord>> {
// Get the IDs and creation timestamps of all the images.
let output = Command::new("docker")
.args([
@@ -432,7 +432,8 @@ fn delete_image(image: &str) -> io::Result<()> {
}

// Update the timestamp for an image.
fn touch_image(state: &mut State, image_id: &str, verbose: bool) -> io::Result<()> {
// Returns a boolean indicating if a new entry was created for the image.
fn touch_image(state: &mut State, image_id: &str, verbose: bool) -> io::Result<bool> {
if verbose {
debug!(
"Updating last-used timestamp for image {}\u{2026}",
@@ -449,14 +450,16 @@ fn touch_image(state: &mut State, image_id: &str, verbose: bool) -> io::Result<(
match SystemTime::now().duration_since(UNIX_EPOCH) {
Ok(duration) => {
// Store the image metadata in the state.
state.images.insert(
image_id.to_owned(),
state::Image {
parent_id: parent_id(state, image_id)?,
last_used_since_epoch: duration,
},
);
Ok(())
Ok(state
.images
.insert(
image_id.to_owned(),
state::Image {
parent_id: parent_id(state, image_id)?,
last_used_since_epoch: duration,
},
)
.is_none())
}
Err(error) => Err(io::Error::new(
io::ErrorKind::Other,
@@ -830,16 +833,16 @@ pub fn run(settings: &Settings, state: &mut State, first_run: &mut bool) -> io::
debug!("Waking up\u{2026}");

// Update the timestamp for this image.
touch_image(state, &image_id, true)?;

// Run the main vacuum logic.
vacuum(
state,
*first_run,
threshold,
&settings.keep,
settings.deletion_chunk_size,
)?;
if touch_image(state, &image_id, true)? {
// Run the main vacuum logic only if a new image came in.
vacuum(
state,
*first_run,
threshold,
&settings.keep,
settings.deletion_chunk_size,
)?;
}

// Persist the state.
state::save(state)?;
6 changes: 3 additions & 3 deletions toast.yml
Original file line number Diff line number Diff line change
@@ -260,7 +260,7 @@ tasks:
dependencies:
- release
input_paths:
- integration_test.sh
- integration-test.sh
cache: false
mount_paths:
- /var/run/docker.sock
@@ -283,8 +283,8 @@ tasks:
docker:dind
docker exec dind apk add bash
docker cp "artifacts/docuum-x86_64-unknown-linux-musl" dind:/
docker cp integration_test.sh dind:/
docker exec dind ./integration_test.sh
docker cp integration-test.sh dind:/
docker exec dind ./integration-test.sh
publish:
description: Publish the crate to crates.io.