Module: OllamaAgent::Runtime::FileAtomicSwap

Defined in:
lib/ollama_agent/runtime/file_atomic_swap.rb

Overview

Internal helper: binary temp write → fsync → rename → parent fsync (no WAL / ownership).

Class Method Summary collapse

Class Method Details

.write_bytes!(absolute_path, content) ⇒ Object



11
12
13
14
15
16
# File 'lib/ollama_agent/runtime/file_atomic_swap.rb', line 11

def write_bytes!(absolute_path, content)
  bytes = content.b
  parent = File.dirname(absolute_path)
  FileUtils.mkdir_p(parent)
  swap_bytes_into_path!(absolute_path, parent, File.basename(absolute_path), bytes)
end