Class: Textus::Infra::Storage::FileStore
- Inherits:
-
Object
- Object
- Textus::Infra::Storage::FileStore
- Defined in:
- lib/textus/infra/storage/file_store.rb
Overview
Pure filesystem I/O port. Wraps File/FileUtils/Etag with no knowledge of envelopes, entries, schemas, or audit.
Instance Method Summary collapse
-
#delete(path) ⇒ Object
Raises Errno::ENOENT if absent — mirrors File.delete and matches the semantics used by Store::Writer (which guards with File.exist? first).
- #etag(path) ⇒ Object
- #exists?(path) ⇒ Boolean
- #read(path) ⇒ Object
- #write(path, bytes) ⇒ Object
Instance Method Details
#delete(path) ⇒ Object
Raises Errno::ENOENT if absent — mirrors File.delete and matches the semantics used by Store::Writer (which guards with File.exist? first).
18 |
# File 'lib/textus/infra/storage/file_store.rb', line 18 def delete(path) = File.delete(path) |
#etag(path) ⇒ Object
22 |
# File 'lib/textus/infra/storage/file_store.rb', line 22 def etag(path) = Etag.for_file(path) |
#exists?(path) ⇒ Boolean
20 |
# File 'lib/textus/infra/storage/file_store.rb', line 20 def exists?(path) = File.exist?(path) |
#read(path) ⇒ Object
9 |
# File 'lib/textus/infra/storage/file_store.rb', line 9 def read(path) = File.binread(path) |
#write(path, bytes) ⇒ Object
11 12 13 14 |
# File 'lib/textus/infra/storage/file_store.rb', line 11 def write(path, bytes) FileUtils.mkdir_p(File.dirname(path)) File.binwrite(path, bytes) end |