Skip to content

Commit

Permalink
feat(puffin): implement MokaCacheManager
Browse files Browse the repository at this point in the history
Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
  • Loading branch information
zhongzc committed Jun 25, 2024
1 parent 1204477 commit b14b85d
Show file tree
Hide file tree
Showing 5 changed files with 519 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Cargo.lock

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

7 changes: 7 additions & 0 deletions src/puffin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@ workspace = true
async-compression = "0.4.11"
async-trait.workspace = true
async-walkdir = "2.0.0"
base64.workspace = true
bitflags.workspace = true
common-error.workspace = true
common-macro.workspace = true
common-telemetry.workspace = true
derive_builder.workspace = true
futures.workspace = true
lz4_flex = "0.11"
moka.workspace = true
pin-project.workspace = true
serde.workspace = true
serde_json.workspace = true
sha2 = "0.10.8"
snafu.workspace = true
tokio.workspace = true
tokio-util.workspace = true
uuid.workspace = true

[dev-dependencies]
common-test-util.workspace = true
27 changes: 27 additions & 0 deletions src/puffin/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,30 @@ pub enum Error {
location: Location,
},

#[snafu(display("Failed to create"))]
Create {
#[snafu(source)]
error: IoError,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Failed to rename"))]
Rename {
#[snafu(source)]
error: IoError,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Failed to remove"))]
Remove {
#[snafu(source)]
error: IoError,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Error while walking directory"))]
WalkDirError {
#[snafu(source)]
Expand Down Expand Up @@ -212,6 +236,9 @@ impl ErrorExt for Error {
| Close { .. }
| Open { .. }
| Metadata { .. }
| Create { .. }
| Remove { .. }
| Rename { .. }
| SerializeJson { .. }
| BytesToInteger { .. }
| ParseStageNotMatch { .. }
Expand Down
2 changes: 2 additions & 0 deletions src/puffin/src/puffin_manager/cache_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

mod moka_cache_manager;

use std::path::PathBuf;
use std::sync::Arc;

Expand Down
Loading

0 comments on commit b14b85d

Please sign in to comment.