1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! Document table implementation for Portable PDB format
//!
//! This module provides access to Document table data, which stores information about
//! source documents referenced in debug information. It includes raw table access,
//! resolved data structures, document name parsing, and integration with the broader
//! metadata system.
//!
//! The Document table follows the dual-representation pattern used throughout
//! the dotscope library:
//! - [`crate::metadata::tables::document::DocumentRaw`] for raw binary data with unresolved heap indices
//! - [`crate::metadata::tables::document::Document`] for processed data with resolved string and blob values
//!
//! # Architecture
//!
//! The Document table is part of the Portable PDB format and provides essential information
//! for mapping debug information back to source code locations. Each document entry contains
//! the document name/path, hash information for integrity verification, and language
//! identification for proper syntax highlighting and debugging support.
//!
//! # Key Components
//!
//! - [`crate::metadata::tables::document::DocumentRaw`] - Raw table structure with unresolved heap indices
//! - [`crate::metadata::tables::document::Document`] - Owned variant with resolved references and parsed document data
//! - [`crate::metadata::tables::document::DocumentLoader`] - Internal loader for processing Document table data
//! - [`crate::metadata::tables::document::DocumentMap`] - Thread-safe concurrent map for caching document entries
//! - [`crate::metadata::tables::document::DocumentList`] - Thread-safe append-only vector for document collections
//! - [`crate::metadata::tables::document::DocumentRc`] - Reference-counted pointer for shared ownership
//!
//! # Document Table Structure
//!
//! Each Document table row contains these fields:
//! - **Name**: Document name/path stored as blob (typically a file path)
//! - **`HashAlgorithm`**: Hash algorithm identifier stored as GUID
//! - **Hash**: Document content hash stored as blob
//! - **Language**: Source language identifier stored as GUID
//!
//! # Usage Examples
//!
//! ```rust,no_run
//! use dotscope::metadata::tables::{Document, DocumentMap};
//! use dotscope::metadata::token::Token;
//!
//! # fn example(documents: &DocumentMap) -> dotscope::Result<()> {
//! // Get a specific document by token
//! let token = Token::new(0x30000001); // Document table token
//! if let Some(document) = documents.get(&token) {
//! println!("Document name: {:?}", document.value().name);
//! println!("Hash algorithm: {:?}", document.value().hash_algorithm);
//! println!("Language: {:?}", document.value().language);
//! }
//! # Ok(())
//! # }
//! ```
//!
//!
//! # Error Handling
//!
//! This module handles error conditions during document processing:
//! - Document name parsing errors when blob data is malformed (returns [`crate::Error`])
//! - Hash validation errors for invalid hash algorithms or data (returns [`crate::Error`])
//! - Language identifier resolution errors for unsupported GUIDs (returns [`crate::Error`])
//!
//! # Thread Safety
//!
//! All types in this module are [`Send`] and [`Sync`]. The [`crate::metadata::tables::document::DocumentMap`] and [`crate::metadata::tables::document::DocumentList`]
//! use lock-free concurrent data structures for efficient multi-threaded access.
//!
//! # Integration
//!
//! This module integrates with:
//! - [`crate::metadata::tables`] - Core metadata table infrastructure
//! - [`crate::metadata::token`] - Token-based metadata references
//! - [`crate::metadata::loader`] - Metadata loading system
//! - [`crate::metadata::streams::Blob`] - Blob heap for document names and hashes
//! - [`crate::metadata::streams::Guid`] - GUID heap for algorithms and languages
//!
//! # References
//!
//! - [Portable PDB Format - Document Table](https://github.com/dotnet/core/blob/main/Documentation/diagnostics/portable_pdb.md#document-table-0x30)
use SkipMap;
use Arc;
use crateToken;
pub use *;
pub use *;
pub use *;
pub use *;
/// Thread-safe map that holds the mapping of [`crate::metadata::token::Token`] to parsed [`crate::metadata::tables::document::Document`] instances
///
/// Concurrent skip list-based map providing efficient lookups and insertions for
/// `Document` entries indexed by their metadata tokens.
pub type DocumentMap = ;
/// Thread-safe vector that holds a list of [`crate::metadata::tables::document::Document`] references for efficient access
///
/// Append-only vector using atomic operations for lock-free concurrent access,
/// optimized for scenarios with frequent reads of `Document` collections.
pub type DocumentList = ;
/// Reference-counted smart pointer to a [`crate::metadata::tables::document::Document`] instance for shared ownership
///
/// Provides shared ownership and automatic memory management for `Document` instances,
/// enabling safe sharing across multiple threads and contexts.
pub type DocumentRc = ;