Add robust myfsio_core staleness detection with Python fallback; document Rust extension build in README
This commit is contained in:
@@ -72,6 +72,11 @@ source .venv/bin/activate
|
|||||||
# Install dependencies
|
# Install dependencies
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
# (Optional) Build Rust native extension for better performance
|
||||||
|
# Requires Rust toolchain: https://rustup.rs
|
||||||
|
pip install maturin
|
||||||
|
cd myfsio_core && maturin develop --release && cd ..
|
||||||
|
|
||||||
# Start both servers
|
# Start both servers
|
||||||
python run.py
|
python run.py
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ if sys.platform != "win32":
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import myfsio_core as _rc
|
import myfsio_core as _rc
|
||||||
|
if not all(hasattr(_rc, f) for f in (
|
||||||
|
"encrypt_stream_chunked", "decrypt_stream_chunked",
|
||||||
|
)):
|
||||||
|
raise ImportError("myfsio_core is outdated, rebuild with: cd myfsio_core && maturin develop --release")
|
||||||
_HAS_RUST = True
|
_HAS_RUST = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_rc = None
|
_rc = None
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ from typing import Any, Dict, List, Optional
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import myfsio_core as _rc
|
import myfsio_core as _rc
|
||||||
|
if not hasattr(_rc, "md5_file"):
|
||||||
|
raise ImportError("myfsio_core is outdated, rebuild with: cd myfsio_core && maturin develop --release")
|
||||||
_HAS_RUST = True
|
_HAS_RUST = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_HAS_RUST = False
|
_HAS_RUST = False
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ from defusedxml.ElementTree import fromstring
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import myfsio_core as _rc
|
import myfsio_core as _rc
|
||||||
|
if not all(hasattr(_rc, f) for f in (
|
||||||
|
"verify_sigv4_signature", "derive_signing_key", "clear_signing_key_cache",
|
||||||
|
)):
|
||||||
|
raise ImportError("myfsio_core is outdated, rebuild with: cd myfsio_core && maturin develop --release")
|
||||||
_HAS_RUST = True
|
_HAS_RUST = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_rc = None
|
_rc = None
|
||||||
|
|||||||
@@ -20,6 +20,14 @@ from typing import Any, BinaryIO, Dict, Generator, List, Optional
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import myfsio_core as _rc
|
import myfsio_core as _rc
|
||||||
|
if not all(hasattr(_rc, f) for f in (
|
||||||
|
"validate_bucket_name", "validate_object_key", "md5_file",
|
||||||
|
"shallow_scan", "bucket_stats_scan", "search_objects_scan",
|
||||||
|
"stream_to_file_with_md5", "assemble_parts_with_md5",
|
||||||
|
"build_object_cache", "read_index_entry", "write_index_entry",
|
||||||
|
"delete_index_entry", "check_bucket_contents",
|
||||||
|
)):
|
||||||
|
raise ImportError("myfsio_core is outdated, rebuild with: cd myfsio_core && maturin develop --release")
|
||||||
_HAS_RUST = True
|
_HAS_RUST = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_rc = None
|
_rc = None
|
||||||
|
|||||||
Reference in New Issue
Block a user