pub struct FileFingerprint {
pub byte_digest: Option<ByteDigest>,
pub content_digest: Option<ContentDigest>,
pub meta_digest: Option<MetaDigest>,
pub size: u64,
pub modified_at: Option<DateTime<Utc>>,
}Expand description
ファイル同一性判定に使用するフィンガープリント。
matches_within_location() が同一location内で
利用可能な最高精度の情報で比較を行う。
cross-location比較には CrossLocationIdentity を使用。
§精度の優先順位(情報量順)
content_digest(Semantic) — フォーマット固有の意味的ハッシュ(ピクセルデータ等)meta_digest(MetaLevel) — 埋め込みメタデータのハッシュ(PNG tEXt, EXIF等)byte_digest(ByteLevel) — ファイル全体のバイト列ハッシュ(一致=バイト同一)size+modified_at(Metadata) — メタデータ比較sizeのみ (SizeOnly) — 最低精度
§matches_within_location()の比較信頼性順
byte_digest— バイト完全一致(最も確実、同一アルゴリズムのみ)content_digest— ピクセル同一性meta_digest— メタデータ同一性size+modified_atsizeのみ
Fields§
§byte_digest: Option<ByteDigest>ファイル全体のハッシュ。location固有アルゴリズム(DJB2/SHA-256)。 Cloud Storageではダウンロードなしに取得不可のためNone。
PartialEq未実装 — cross-location比較はコンパイルエラー。
content_digest: Option<ContentDigest>フォーマット固有セマンティックハッシュ (PNG IHDR+IDAT 等のピクセルデータ)。 location非依存。PartialEq実装済み。
meta_digest: Option<MetaDigest>埋め込みメタデータのハッシュ (PNG tEXt, EXIF等)。 content_digestと合わせて「何が変わったか」を区別する:
- content_digest一致 + meta_digest不一致 → メタデータだけ変更
- content_digest不一致 → コンテンツ自体が変更
size: u64ファイルサイズ (bytes)。
modified_at: Option<DateTime<Utc>>最終更新日時 (ストレージ報告値)。
Implementations§
Source§impl FileFingerprint
impl FileFingerprint
Sourcepub fn matches_within_location(&self, other: &FileFingerprint) -> bool
pub fn matches_within_location(&self, other: &FileFingerprint) -> bool
同一location内でのファイル同一性判定。
cross-location比較には使用不可 — ByteDigest はlocation固有アルゴリズムのため、
異location間で比較するとアルゴリズム不一致エラーになる。
cross-location比較には CrossLocationIdentity を使用。
§画像ファイル = Entity モデル
Content(ピクセルデータ)がEntityのIdentity。メタデータやファイルサイズは 副次的属性であり、メタ変更でsizeが変わっても同一Entityである。 そのため content_digest / meta_digest 比較は size gateより前 に実行し、 hash一致時にsize不一致でも同一と判定する。
§信頼性フォールバック順
- 双方に
byte_digest→ 同一アルゴリズム比較(最も確実) - 双方に
content_digest→ ピクセル同一性(size無関係で判定) - 双方に
meta_digest→ メタデータ同一性(size無関係で判定) sizegate → 上記digestが全て比較不可能な場合のみフォールバック- 双方に
modified_at→ mtime比較(size一致済み) - size一致のみ → 最低精度(false positiveリスクあり)
Sourcepub fn precision(&self) -> FingerprintPrecision
pub fn precision(&self) -> FingerprintPrecision
このフィンガープリントが保持する最高精度レベル。
content_digest(Semantic)を最上位とする情報量の序列。
matches_within_location() の比較信頼性順(byte_digest最優先)とは独立した軸である。
Sourcepub fn effective_precision(
&self,
other: &FileFingerprint,
) -> FingerprintPrecision
pub fn effective_precision( &self, other: &FileFingerprint, ) -> FingerprintPrecision
2つのフィンガープリントの比較で使われる実効精度。
双方の精度の低い方が実効精度となる。
Trait Implementations§
Source§impl Clone for FileFingerprint
impl Clone for FileFingerprint
Source§fn clone(&self) -> FileFingerprint
fn clone(&self) -> FileFingerprint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more