Commit Graph

114 Commits

Author SHA1 Message Date
Mohammed Alotaibi 761d71558a
fix(remove_fully): Remove the key content when set `remove_fully` to `true` (#63)
Fixes: https://github.com/zkat/cacache-rs/issues/61

BREAKING CHANGE: this is technically a fix, but maybe people didn't expect this.
2024-02-14 22:28:58 -08:00
Iker Nieto ffa1ab7254
fix(sync): Added the feature flags for compilation without the async runtime. Fixes #64. (#65)
BREAKING CHANGE: this bumps the MSRV to 1.70.0

---------

Co-authored-by: Kat Marchán <kzm@zkat.tech>
2024-02-12 09:55:58 -08:00
Kat Marchán cfdf4eed4d
feat(reflink): Separate reflink behavior into their own functions (#58)
BREAKING CHANGE: some signatures for copy have changed, and copy no longer automatically reflinks
2023-10-07 12:39:39 -07:00
Qing Lei 34ee679816
feat(remove_fully): add option for remove cache entry (#54)
Fixes: https://github.com/zkat/cacache-rs/issues/53
2023-10-07 12:39:30 -07:00
Christian Haynes 6624d66c16
fix(deps): moved to reflink-copy (#55)
Fixes: https://github.com/zkat/cacache-rs/issues/46
2023-09-11 15:19:26 -07:00
Kat Marchán c735d83a31
fix(mmap): fix unused method warning 2023-09-11 15:19:26 -07:00
Kat Marchán 6062226789
feat(sync-only): add support for removing async runtime dependency altogether (#56) 2023-09-11 12:15:16 -07:00
Michal Trybus 2c98f08a98
feat(deps) re-exported ssri::Integrity (#52) 2023-07-03 08:51:28 -07:00
Kat Marchán 41392e7469
feat(xxhash): Add xxhash support and some utilities for making it easier to use (#51)
Fixes: https://github.com/zkat/cacache-rs/issues/47
2023-05-20 19:06:08 -07:00
Michal Trybus 1ac1d647e0
fix(mmap): pre-allocate temp file before mmapping (#50)
Fixes: https://github.com/zkat/cacache-rs/issues/48

This avoids SIGBUS on memory write in case the temp file is sparse.
Implemented for linux only; other target_os cfg values unchanged.
2023-05-19 09:55:16 -07:00
Michal Trybus 58de0b2d10
feat(mmap): new feature for mmap-based optimization (#49)
Ref: https://github.com/zkat/cacache-rs/issues/48
2023-05-17 15:45:46 -07:00
Kat Marchán b88217cc54
feat(link): implement hard_link_hash_sync too 2023-03-09 18:25:26 -08:00
Kat Marchán 89eee6c1ae
feat(links): add support for hard linking from the cache (#43) 2023-03-04 17:10:46 -08:00
Kat Marchán d39e83801d
feat(copy): add support for reflink-copy and unsafe-copy (#42) 2023-02-27 19:09:02 -08:00
Scott Haug ac56fd9ce6
feat(link_to): Add support for linking to existing files from the cache (#41) 2023-02-27 14:08:01 -08:00
Kat Marchán 9991f56b4c
feat(index): Add support for raw index metadata and expose index functions 2023-02-19 01:18:29 -08:00
Redmar Kerkhoff 53c289523f
fix(ls): make sure `ls` sees entry deletions (#40) 2023-02-18 21:36:44 -08:00
Kat Marchán c2d5390a84
feat(errors): integrate miette and generally improve error reporting (#38)
BREAKING CHANGE: This bumps the MSRV to 1.67.0 and documents it in the README.
2023-01-28 19:17:53 -08:00
Kat Marchán da259ae432
fix(perf): do the inner fn trick to reduce generic compilation load 2023-01-28 16:49:31 -08:00
Kat Marchán 2767a6a671
misc: clippy fixes 2023-01-28 15:55:01 -08:00
Kat Marchán 7104df66dd
misc: update warning name 2023-01-28 15:55:00 -08:00
C J Silverio e34dcfdc25
feature(async): Add tokio as an executor option (#36)
This PR is based on the work @alexschrod did in PR #29. All
I did was carry it over the finish line.

This PR adds a feature to the crate named `tokio-runtime`. If
you disable default features and enable this new one, cacache
uses tokio as its async executor. This makes integrating cacache
with tokio-using projects easier, because the file types leak out
if you use anything more than the top-level convenience functions.

The PR implements the feature using shims in a new submodule named
`async_lib`. This module conditionally uses either async-std
or tokio based on feature selection, and hides some differences with
convenience functions.

This change should not be a breaking change, because the default is
still async-std.

There are a few other small changes in this PR worth noting.

- The README shows how to switch runtimes.
- There's a justfile to run common tasks, including those in makefile.toml.
  The default shell is `sh`, so this might not work out of the box for
  Windows users.
- The tests can now run under either runtime. The justfile has a recipe
  that runs them both.
- The benchmarks can also run under either runtime. The justfile has two
  recipe for this, one using bench and the other using criterion's runner.
- The dependencies now pull in async-attributes by default along with
  async-std. This made it easier to swap runtimes in the tests.
- All dependency versions have been bumped.

Co-authored-by: @alexschrod
2023-01-28 13:01:59 -08:00
C J Silverio 6d84ff0aed
fix(write): set tmpfile length in async writer (#35)
Fixes: https://github.com/zkat/cacache-rs/issues/34

The async `poll_write()` implementation was creating a tempfile as
a backing for its inner mmap, but it was failing to set the length
on the file to match the incoming data. Compare with the sync
implementation!

This bug was exposed when the `memmap2` crate was swapped in
for `memmap`. The older crate was likely more lax about this.

Wrote a pair of new tests for `cacache::write_hash_sync` and
`cacache::write_hash`. The async test fails without this change, as
does any benchmarks run. Everything passes with it.

BREAKING CHANGE: This commit also bumps the MSRV for cacache to 1.66.1.
2023-01-23 17:37:34 -08:00
Kat Marchán 684a3e8a68
fix(mmap): mmap needs equal buffer lengths (#33)
Fixes: https://github.com/zkat/cacache-rs/issues/32
2022-02-25 09:04:28 -08:00
Christian Haynes 03d4596baa
fix(security): replaced memmap with memmap2 (#30) 2022-01-23 10:04:07 -08:00
Kat Marchán 9c3cf994ec
misc: cargo fmt 2021-09-15 20:32:18 -07:00
Kat Marchán 9163a58481
fix(cleanup): general house cleaning, bumping deps, etc 2021-09-15 20:23:00 -07:00
Kat Marchán 8d08e45298
fix(clippy): appease the paperclip 2021-09-15 19:57:58 -07:00
Kat Marchán 803d0c3ede
feat(write): Use mmap for small writes (#26)
BREAKING CHANGE: This bumps the minimum Rust version from 1.39 to 1.43. Thanks, remove_dir_all! >:(
2020-07-18 10:43:38 -07:00
Florian Albertz bb815f5f22 feat(errors): remove anyhow and use custom error types (#24)
Co-authored-by: Florian Albertz <git@albertz.io>

BREAKING CHANGE: This changes the exported error type(s) for cacache, making it way easier to do error handling when something goes kaput.
2020-04-29 19:34:43 -07:00
Andreas Rammhold 88a76189fc
fix(list_sync): make sure the public interface allows using the Item type (#25)
Before this change the public interface wouldn't allow downstream users
to use the actual items since it wasn't communicated on the function
signature.

Previously a user would run into errors like this:
> no field `key` on type `<impl std::iter::Iterator as std::iter::Iterator>::Item`
2020-04-21 13:42:19 -07:00
Kat Marchán a9f8e4e6f4
cleanup: some reorganizing and reformatting of stuff 2019-11-06 23:03:14 -08:00
Kat Marchán d5bb0dffb6
feat(chown): stop changing owner/group on unix platforms
Fixes: #16

BREAKING CHANGE: If you were relying on the chown functionality for the index (which you probably weren't), then your index will no longer be updated that way.
2019-11-06 20:59:24 -08:00
Kat Marchán 743476b274
feat(api): rewrite entire API to be like std::fs (#21)
Fixes: #13

BREAKING CHANGE: The entire API surface has been rewritten and overhauled. Instead of breaking up the package into get/put/rm/ls modules, everything is now available mostly through the toplevel module, following the same conventions as std:fs for its operations. Associated structs and other types have also been renamed. Please refer to the documentation for the new API, and I hope you find it more ergonomic!
2019-10-23 21:17:57 -07:00
Kat Marchán ccdd8c7578
docs: improve examples 2019-10-21 18:28:00 -04:00
Kat Marchán 62298cdf35
feat(errors): improved errors messaging and context (#20)
Fixes: #19

BREAKING CHANGE: Error values have changed. If you were inspecting or
matching against actual return values, you'll need to change your code
to use the new enums.
2019-10-20 23:47:56 -04:00
Kat Marchán 649398512f
feat(rm): Accept AsRef<str> for keys 2019-10-20 23:08:26 -04:00
Kat Marchán ee149a70ca
feat(errors): Replace failure with anyhow crate (#17)
Fixes: #14

BREAKING CHANGE: Result functions now return anyhow::Error
2019-10-20 00:25:28 -04:00
Kat Marchán 38115599ca
fix(fmt): cargo fmt --all 2019-10-18 22:41:58 -04:00
Kat Marchán fde3521cce
deps: bump async_std 2019-10-18 22:24:42 -04:00
Kat Marchán 086cbfe379
docs: add a couple of examples to Put 2019-10-18 21:49:47 -04:00
Kat Marchán ef8d3ad0e7
docs: improve root examples a bit 2019-10-18 21:49:32 -04:00
Kat Marchán 57bc0f04ff
test(rm): add tests and examples for cacache::rm 2019-10-18 16:28:52 -04:00
Kat Marchán dafc79f481
feat(get): get::info -> get::entry
BREAKING CHANGE: This renames get::info to get::entry for better symmetry with rm
2019-10-18 16:28:15 -04:00
Kat Marchán 7123ffa44b
test(copy): add tests and doc examples for copy APIs 2019-10-18 12:44:48 -04:00
Kat Marchán c430016744
feat(ls): cacache::ls::all -> ls::all_sync
BREAKING CHANGE: In order to match up with the other APIs, the ls::all() has been renamed to ls::all_sync().
2019-10-17 23:16:51 -04:00
Kat Marchán a040a743a8
test(get): add examples and tests for get::data* family 2019-10-17 23:05:43 -04:00
Kat Marchán d08629cf55
fix(check): {Async}Get::check wasn't working correctly 2019-10-17 22:50:39 -04:00
Kat Marchán 03ff19709a
fix(open): use actual file paths instead of just cache for open APIs
Also taking the chance to write docs and tests for them.
2019-10-17 19:04:21 -04:00
Kat Marchán 662aea9b5a feat(async): reorganize async APIs to be the primary APIs
BREAKING CHANGE: the async_* namespaces are gone, and all the previously-sync APIs (get::data, put::data, etc), are all suffixed with _sync now. You'll need to adjust your usage accordingly.
2019-10-17 18:25:20 -04:00