File tree Expand file tree Collapse file tree 3 files changed +50
-2
lines changed Expand file tree Collapse file tree 3 files changed +50
-2
lines changed Original file line number Diff line number Diff line change @@ -137,4 +137,6 @@ database:
137137 url: "postgresql://postgres:[email protected] :5432/meta" 138138` ` `
139139
140- 目前,本地数据库模式下,在挂载后的文件夹中,可以正常操作文件夹,包括重命名,删除,读写文件之类的操作。
140+ 目前,本地数据库模式下,在挂载后的文件夹中,可以正常操作文件夹,包括重命名,删除,读写文件之类的操作。
141+
142+ 运行script/cache_demo.sh 后可以在log中看到关于缓存命中、加入、移除等信息
Original file line number Diff line number Diff line change @@ -69,7 +69,8 @@ fn process_config_for_backend(
6969
7070#[ tokio:: main]
7171async fn main ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
72- env_logger:: init ( ) ;
72+ let format = tracing_subscriber:: fmt:: format ( ) . with_ansi ( false ) ;
73+ tracing_subscriber:: fmt ( ) . event_format ( format) . init ( ) ;
7374
7475 #[ cfg( not( target_os = "linux" ) ) ]
7576 {
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Simple script to demonstrate SlayerFS cache hits
3+ set -e
4+
5+ CONFIG_FILE=" sqlite.yml"
6+ LOG_FILE=" cache_hits.log"
7+
8+ echo " === SlayerFS Cache Hit Demo ==="
9+
10+
11+ echo " Starting SlayerFS..."
12+ cargo run --example persistence_demo -- --config " $CONFIG_FILE " --mount " /tmp/mount" --storage " /tmp/sqlite" > " $LOG_FILE " 2>&1 &
13+ DEMO_PID=$!
14+
15+ # Wait for mount
16+ sleep 3
17+
18+ if ! mountpoint -q " /tmp/mount" ; then
19+ echo " Error: Mount failed"
20+ exit 1
21+ fi
22+
23+ echo " Filesystem mounted successfully!"
24+
25+ # Create test files
26+ echo " Creating test files..."
27+ for i in {1..3}; do
28+ echo " Content of file $i - $( date) " > " /tmp/mount/test$i .txt"
29+ done
30+
31+ echo " Reading files multiple times to trigger cache hits..."
32+ for round in {1..3}; do
33+ echo " Round $round :"
34+ for i in {1..3}; do
35+ cat " /tmp/mount/test$i .txt" > /dev/null
36+ done
37+ sleep 1
38+ done
39+
40+ echo " Checking logs for cache messages..."
41+ echo " === Cache-related messages ==="
42+ grep -i " cache\|hit\|remove\|chunks" " $LOG_FILE " | head -20
43+
44+ echo " "
45+ echo " Demo completed. Full log saved to: $LOG_FILE "
You can’t perform that action at this time.
0 commit comments