barrel_server_http (barrel_server v1.5.0)

View Source

REST/JSON HTTP surface for the barrel edge database.

One livery router served over HTTP/1.1 and HTTP/2. Every handler reads path bindings and the request body, calls the barrel module through barrel_server_dbs, and renders JSON. Documents, attachments, vectors, search, and the changes feed (JSON or SSE) are exposed.

Summary

Functions

Body is optional (an empty body is #{}, not an error, same as with_json everywhere else) -- a plain PUT /db/:name keeps behaving exactly as before. att_opts picks a non-default attachment backend (e.g. S3); see att_opts_from_json/1.

If-None-Match: * / If-Match: <etag> opt into S3 conditional writes (create_only/expected_etag -- see barrel_att_s3_store); a backend that can't evaluate them (Garage) or doesn't understand them at all (the default RocksDB backend) is handled by the callee, not here.

Functions

bulk_docs(Req)

bulk_get(Req)

changes(Req)

create_db(Req)

Body is optional (an empty body is #{}, not an error, same as with_json everywhere else) -- a plain PUT /db/:name keeps behaving exactly as before. att_opts picks a non-default attachment backend (e.g. S3); see att_opts_from_json/1.

db_info(Req)

delete_att(Req)

delete_doc(Req)

doc_versions(Req)

drop_db(Req)

encode_db_info(Map)

error_resp(Reason)

find(Req)

get_att(Req)

get_doc(Req)

health(Req)

history(Req)

json_resp(Status, Term)

merge_report(Report)

param(Key, Req)

put_att(Req)

If-None-Match: * / If-Match: <etag> opt into S3 conditional writes (create_only/expected_etag -- see barrel_att_s3_store); a backend that can't evaluate them (Garage) or doesn't understand them at all (the default RocksDB backend) is handled by the callee, not here.

put_doc(Req)

query(Req)

root(Req)

search_bm25(Req)

search_hybrid(Req)

search_vector(Req)

start_link()

-spec start_link() -> {ok, pid()} | {error, term()}.

timeline_branch(Req)

timeline_info(Req)

timeline_merge(Req)

vector_add(Req)

version_body(Req)

with_json(Req, Fun)