barrel_att_s3
S3-compatible attachment storage backend for barrel_docdb. Stores
attachment bytes in an S3 bucket (AWS S3, MinIO, Garage) instead of the
embedded RocksDB instance barrel_docdb uses by default.
Documentation | HexDocs | Repository
Kept out of the default (embeddable) barrel_docdb build -- it pulls
livery_s3 (and livery), so it opts in via its own s3 rebar3 profile.
Use
{ok, _} = barrel_docdb:create_db(<<"mydb">>, #{
att_opts => #{
backend => s3,
s3 => #{
bucket => <<"my-bucket">>,
endpoint => <<"https://s3.eu-west-1.amazonaws.com">>,
region => <<"eu-west-1">>,
access_key_id => <<"...">>,
secret_access_key => <<"...">>
}
}
}),
{ok, _Info} = barrel_docdb:put_attachment(<<"mydb">>, <<"doc1">>,
<<"greeting.txt">>, <<"Hello, World!">>).
Everything else -- get_attachment/4, delete_attachment/4, streaming --
works exactly as it does with the default backend; the backend choice is
entirely in att_opts.
Encryption
An encrypted database (encryption at open) encrypts its attachments in
the bucket too: AES-256 per object under a key derived from the database
key, with the digest in the metadata sealed. Sizes are unchanged, so
streaming, multipart and range reads work as for a plaintext database.
Object keys still show the document id and attachment name. Objects
written in plaintext before 0.2.0 are rewritten encrypted in the
background when the database opens. See the
encryption guide.
Documentation
- Getting started -- config shape, credentials,
part_size. - Limitations -- current limitations, and the store-compatibility table.