A content-addressed cache that hands out only bytes that hash to the hash they are asked for.
More...
#include <service_client.hpp>
|
| | VerifiedCache (std::shared_ptr< IBundleStore > store) |
| | A cache over store.
|
| std::optional< std::string > | get (std::string const &hash) |
| | Reads a file, verified. A stored file that does not hash to hash is dropped and reads as a miss.
|
| std::string | put (std::string bytes) |
| | Keeps a file under its content hash.
|
| IBundleStore & | store () noexcept |
| | The store.
|
A content-addressed cache that hands out only bytes that hash to the hash they are asked for.
Definition at line 150 of file service_client.hpp.
◆ VerifiedCache()
| morph::ui::VerifiedCache::VerifiedCache |
( |
std::shared_ptr< IBundleStore > | store | ) |
|
|
inlineexplicit |
A cache over store.
- Parameters
-
| store | The store; shared with the caller. |
- Exceptions
-
| std::invalid_argument | if store is null. |
Definition at line 155 of file service_client.hpp.
◆ get()
| std::optional< std::string > morph::ui::VerifiedCache::get |
( |
std::string const & | hash | ) |
|
|
inlinenodiscard |
Reads a file, verified. A stored file that does not hash to hash is dropped and reads as a miss.
- Parameters
-
- Returns
- The bytes, or nothing.
Definition at line 164 of file service_client.hpp.
◆ put()
| std::string morph::ui::VerifiedCache::put |
( |
std::string | bytes | ) |
|
|
inline |
Keeps a file under its content hash.
- Parameters
-
- Returns
- The hash they are kept under.
Definition at line 177 of file service_client.hpp.
◆ store()
The documentation for this class was generated from the following file: