fluxus_source_gharchive/
lib.rs

1//! Fluxus Source Gharchive
2//!
3//! A Rust library for processing and analyzing GitHub Archive data streams, providing
4//! efficient access to historical GitHub event data. This library enables seamless
5//! integration with GitHub Archive data through both HTTP streaming and local file
6//! processing capabilities.
7//!
8//! ## Features
9//!
10//! ### Flexible Data Source Support
11//! - HTTP streaming from gharchive.org
12//! - Local file processing for offline analysis
13//! - Automatic handling of gzip compression
14//!
15//! ### Advanced Time Range Control
16//! - Date-based data retrieval (YYYY-MM-DD format)
17//! - Hour-specific data access (0-23 hour range)
18//! - Configurable date ranges with start and end dates
19//!
20//! ### Comprehensive Event Data
21//! Process full GitHub event information including:
22//! - Event type and ID
23//! - Repository details
24//! - Actor information
25//! - Organization data
26//! - Event payload
27//! - Timestamps
28//!
29//! ### Robust Error Handling
30//! - Configurable I/O timeouts
31//! - Detailed error reporting
32//! - Stream-based error handling
33//!
34//! ## Usage Examples
35//!
36//! ### Basic HTTP Source
37//! ```rust,no_run
38//! use fluxus_source_gharchive::GithubArchiveSource;
39//! use fluxus::sources::Source;
40//!
41//! #[tokio::main]
42//! async fn main() {
43//!     // Create a source for a specific hour
44//!     let uri = "https://data.gharchive.org/2015-01-01-15.json.gz";
45//!     let mut source = GithubArchiveSource::new(uri).unwrap();
46//!     
47//!     // Configure timeout
48//!     source.set_io_timeout(std::time::Duration::from_secs(20));
49//!     
50//!     // Initialize the source
51//!     source.init().await.unwrap();
52//!     
53//!     // Process events
54//!     while let Ok(Some(event)) = source.next().await {
55//!         println!("Event: {:?}", event);
56//!     }
57//! }
58//! ```
59//!
60//! ### Date Range Processing
61//! ```rust,no_run
62//! use fluxus_source_gharchive::GithubArchiveSource;
63//! use fluxus::sources::Source;
64//!
65//! #[tokio::main]
66//! async fn main() {
67//!     // Create a source starting from a specific date
68//!     let mut source = GithubArchiveSource::from_date("2021-01-01").unwrap();
69//!     
70//!     // Set end date (optional)
71//!     source.set_end_date("2021-01-02").unwrap();
72//!     
73//!     // Initialize and process
74//!     source.init().await.unwrap();
75//!     while let Ok(Some(event)) = source.next().await {
76//!         println!("Event: {:?}", event);
77//!     }
78//! }
79//! ```
80//!
81//! ### Local File Processing
82//! ```rust,no_run
83//! use fluxus_source_gharchive::GithubArchiveSource;
84//! use fluxus::sources::Source;
85//! use std::path::Path;
86//!
87//! #[tokio::main]
88//! async fn main() {
89//!     // Create a source from a local file
90//!     let path = Path::new("path/to/your/archive.json.gz");
91//!     let mut source = GithubArchiveSource::from_file(path).unwrap();
92//!     
93//!     // Initialize and process
94//!     source.init().await.unwrap();
95//!     while let Ok(Some(event)) = source.next().await {
96//!         println!("Event: {:?}", event);
97//!     }
98//! }
99//! ```
100
101mod gharchive;
102pub use gharchive::*;