Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elliotekj/atomic_writes
LWW, FWW & serialized atomic file writes in Elixir
https://github.com/elliotekj/atomic_writes
atomic elixir serializer
Last synced: about 2 months ago
JSON representation
LWW, FWW & serialized atomic file writes in Elixir
- Host: GitHub
- URL: https://github.com/elliotekj/atomic_writes
- Owner: elliotekj
- License: apache-2.0
- Created: 2023-10-13T16:03:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-18T11:10:44.000Z (over 1 year ago)
- Last Synced: 2024-10-29T02:39:28.067Z (3 months ago)
- Topics: atomic, elixir, serializer
- Language: Elixir
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AtomicWrites: LWW, FWW & Serialized Atomic File Writes in Elixir
Perform last-write-wins, first-write-wins or serialized atomic file writes in
Elixir with **AtomicWrites**. The basic idea is that writes are made to a
temporary file and then moved when the write is complete. By default, the
temporary write is made to the same file system (so that the move is also
atomic) and the move will overwrite any existing file (LWW). Both of these
options are configurable.## LWW Atomic Writes
```elixir
AtomicWrites.write("Atomically written content.", path: "example.txt")
```## FWW Atomic Writes
```elixir
AtomicWrites.write("Atomically written content.", path: "example.txt", overwrite?: false)
```## Serialized Atomic Writes
``` elixir
alias AtomicWrites.AtomicFile{:ok, pid} = AtomicFile.start_link(path: "example.txt")
AtomicFile.write(pid, "Serialized, atomically written content.")
```## Installation
The package can be installed by adding `atomic_writes` to your list of
dependencies in `mix.exs`:```elixir
def deps do
[
{:atomic_writes, "~> 1.1"}
]
end
```## Documentation
The documentation is published at .
## License
AtomicWrites is released under the [`Apache License
2.0`](https://github.com/elliotekj/atomic_writes/blob/main/LICENSE).## About
This package was written by [Elliot Jackson](https://elliotekj.com).
- Blog: [https://elliotekj.com](https://elliotekj.com)
- Email: [email protected]