{"id":49850211,"url":"https://github.com/markosski/pwal","last_synced_at":"2026-05-14T15:06:38.140Z","repository":{"id":339311938,"uuid":"1160537392","full_name":"markosski/pwal","owner":"markosski","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-19T03:46:00.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-19T08:50:54.916Z","etag":null,"topics":["rust-lang","wal","write-ahead-log"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markosski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-18T04:06:52.000Z","updated_at":"2026-02-19T03:46:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/markosski/pwal","commit_stats":null,"previous_names":["markosski/pwal"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/markosski/pwal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markosski%2Fpwal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markosski%2Fpwal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markosski%2Fpwal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markosski%2Fpwal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markosski","download_url":"https://codeload.github.com/markosski/pwal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markosski%2Fpwal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33030406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust-lang","wal","write-ahead-log"],"created_at":"2026-05-14T15:06:34.694Z","updated_at":"2026-05-14T15:06:38.118Z","avatar_url":"https://github.com/markosski.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gossipgrid-wal\n\nWrite-Ahead Log (WAL) implementation for GossipGrid.\n\nThis crate provides a structured WAL for recording state changes (Puts and Deletes) in a distributed database. It supports multiple partitions, LSN (Log Sequence Number) tracking, and asynchronous IO with `tokio`.\n\n## Features\n\n- **Partitioned Logs**: Each partition has its own WAL file for better concurrency and recovery.\n- **Asynchronous IO**: Built on `tokio` for high-performance non-blocking disk operations.\n- **LSN Tracking**: Every record is assigned an LSN for synchronization.\n- **Watchers**: Subscribe to LSN updates for real-time replication.\n\n## Usage\n\n```rust\nuse pwal::wal::WalLocalFile;\nuse pwal::{WalWriter, WalPartitionId, WalCommon};\nuse serde::{Serialize, Deserialize};\nuse bincode::{Encode, Decode};\nuse std::path::PathBuf;\n\n#[derive(Serialize, Deserialize, Encode, Decode, Clone, Debug, PartialEq)]\npub enum MyRecord {\n    Put {\n        key: Vec\u003cu8\u003e,\n        value: Vec\u003cu8\u003e,\n    },\n    Delete {\n        key: Vec\u003cu8\u003e,\n    },\n}\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    // Initialize WAL with base directory, truncate=false, and max segment size (e.g., 1MB)\n    let wal = WalLocalFile::new(PathBuf::from(\"./wal_data\"), false, 1024 * 1024).await?;\n    \n    let record = MyRecord::Put {\n        key: b\"my-key\".to_vec(),\n        value: b\"my-value\".to_vec(),\n    };\n    \n    let partition = WalPartitionId(1);\n    let (lsn, pos) = wal.append(partition, record).await?;\n    println!(\"Appended record with LSN {} at segment {} offset {}\", \n        lsn, pos.segment_index, pos.local_offset);\n    wal.io_sync().await?;\n    Ok(())\n}\n```\n\n## Benchmarks\n\nThe following benchmarks were performed on a **MacBook Pro** with an **Apple M4** CPU.\n\n### System Specifications\n- **CPU**: Apple M4 (10 cores)\n- **RAM**: 16 GB\n- **OS**: macOS\n\n### Results\n| Benchmark | Average Time |\n|-----------|--------------|\n| `append_single_record` | 6.8 µs |\n| `append_1000_records` | 6.79 ms |\n| `append_single_record_and_io_sync` | 3.9 ms |\n| `append_1000_records_and_io_sync` | 9.5 ms |\n| `stream_1000_records_linear` | 75.75 µs |\n\nRun benchmarks yourself with:\n```bash\ncargo bench --bench wal_bench\n```\n\n## License\n\nMIT OR Apache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkosski%2Fpwal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkosski%2Fpwal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkosski%2Fpwal/lists"}