Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonhkr/rust-file-seq
https://github.com/jonhkr/rust-file-seq
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jonhkr/rust-file-seq
- Owner: jonhkr
- Created: 2020-05-24T16:30:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-19T13:15:14.000Z (11 months ago)
- Last Synced: 2024-04-26T04:03:08.366Z (7 months ago)
- Language: Rust
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fail-safe file sequence
Implemented in Rust.
Inspired by this [Java implementation](https://commons.apache.org/proper/commons-transaction/apidocs/org/apache/commons/transaction/file/FileSequence.html)[![Crates.io](https://img.shields.io/crates/v/file-seq)](https://crates.io/crates/file-seq)
[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/jonhkr/rust-file-seq/rust.yml)](https://github.com/jonhkr/rust-file-seq/actions)## Usage
```rust
let initial_value = 1;
let seq = FileSeq::new(store_dir, initial_value).unwrap();// Get current value
seq.value().unwrap();// Increment by 1 and get
seq.increment_and_get(1).unwrap();// Get, then increment by 1
seq.get_and_increment(1).unwrap();
```## Changelog
### 0.2.0 (2020-09-07)
- Ignore errors on `FileSeq::delete` function [\#1](https://github.com/jonhkr/rust-file-seq/pull/1)