Commit Graph

37 Commits

Author SHA1 Message Date
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
Kat Marchán 6062226789
feat(sync-only): add support for removing async runtime dependency altogether (#56) 2023-09-11 12:15:16 -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
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 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 9c3cf994ec
misc: cargo fmt 2021-09-15 20:32:18 -07:00
Kat Marchán 8d08e45298
fix(clippy): appease the paperclip 2021-09-15 19:57:58 -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
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 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 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 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
Kat Marchán b02f41e07f feat(api): get::read -> get::data
This should improve the ergonomics a bit by being more symmetrical with put

BREAKING CHANGE: The `get` API now uses "data" instead of "read" as the "verb". You will need to change anything that used get::read/hash/etc to use "data" now.
2019-10-17 18:25:20 -04:00
Kat Marchán 4d9404b9a6
feat(license): relicense to Parity+Apache 2019-10-15 12:15:34 -04:00
Kat Marchán 473473e6b2
feat(license): relicense under MPL-2.0 (#8)
BREAKING CHANGE: The license terms have changed. Please refer to LICENSE in the root of this repository for details. Future use of this library may require release of source code for any changes applied to it.
2019-09-06 21:39:36 -07:00
Kat Marchán d7af45d4f1
doc(get): document get module 2019-06-30 20:53:50 -07:00
Kat Marchán aee271186a
refactor(get): reuse open_hash 2019-06-30 20:12:31 -07:00
Kat Marchán 0349d115f4
fix(fmt): cargo fmt 2019-06-27 22:48:58 -07:00
Kat Marchán a5e9966624
refactor(get): move trait bounds into where clauses 2019-06-27 22:41:56 -07:00
Kat Marchán 6e9a2f9f87
feat(get): add get::open() and get::open_hash() 2019-06-27 22:41:32 -07:00
Kat Marchán abc0246da6
refactor: remove unneeded Ok() 2019-06-26 22:03:29 -07:00
Kat Marchán 5af622eb30
feat(api): AsRef all the things! 2019-06-09 10:59:36 -07:00
Kat Marchán cf0fbe233f
fix(api): use &str keys 2019-06-05 14:46:49 +02:00
Kat Marchán 261f190e4e
doc: added some basic top-level documentation. 2019-06-05 14:00:25 +02:00
Kat Marchán d91d214176
feat(get): add external cacache::get api 2019-06-04 22:06:38 +02:00