class Capsium::Reactor::ContentApi
Content writes over the mountโs overlay (ARCHITECTURE.md section 5a): PUT creates/overwrites a content file (creating its route on demand), DELETE records a tombstone so the path 404s even when a lower layer holds the file. The immutable package never changes on disk. Text bodies only for v1.
Constants
- CONTENT_PREFIX
- WRITE_METHODS
Public Class Methods
(Mount mount) → void
Source
# File lib/capsium/reactor/content_api.rb, line 22 def initialize(mount) @mount = mount end
(String method) → bool
Source
# File lib/capsium/reactor/content_api.rb, line 18 def self.write_method?(method) WRITE_METHODS.include?(method) end
Public Instance Methods
(String inner_path, untyped request, untyped response) → untyped
Source
# File lib/capsium/reactor/content_api.rb, line 26 def handle(inner_path, request, response) return read_only(response) unless @mount.writable? route = @mount.routes.resolve(inner_path) return guard_route(route, inner_path, response) if route && !writable_route?(route) case request.request_method when "PUT" then put_content(inner_path, route, request, response) when "DELETE" then delete_content(inner_path, route, response) else respond_method_not_allowed(response) end end